35#ifndef _BLAZE_MATH_CUSTOMMATRIX_H_
36#define _BLAZE_MATH_CUSTOMMATRIX_H_
74template<
typename Type
80class Rand< CustomMatrix<Type,AF,PF,SO,Tag,RT> >
89 inline void randomize( CustomMatrix<Type,AF,PF,SO,Tag,RT>& matrix )
const
93 const size_t m( matrix.rows() );
94 const size_t n( matrix.columns() );
96 for(
size_t i=0UL; i<m; ++i ) {
97 for(
size_t j=0UL; j<n; ++j ) {
112 template<
typename Arg >
113 inline void randomize( CustomMatrix<Type,AF,PF,SO,Tag,RT>& matrix,
114 const Arg&
min,
const Arg&
max )
const
118 const size_t m( matrix.rows() );
119 const size_t n( matrix.columns() );
121 for(
size_t i=0UL; i<m; ++i ) {
122 for(
size_t j=0UL; j<n; ++j ) {
149template<
typename Type
155void makeSymmetric( CustomMatrix<Type,AF,PF,SO,Tag,RT>& matrix )
163 const size_t n( matrix.rows() );
165 for(
size_t i=0UL; i<n; ++i ) {
166 for(
size_t j=0UL; j<i; ++j ) {
168 matrix(j,i) = matrix(i,j);
189template<
typename Type
196void makeSymmetric( CustomMatrix<Type,AF,PF,SO,Tag,RT>& matrix,
const Arg&
min,
const Arg&
max )
204 const size_t n( matrix.rows() );
206 for(
size_t i=0UL; i<n; ++i ) {
207 for(
size_t j=0UL; j<i; ++j ) {
209 matrix(j,i) = matrix(i,j);
228template<
typename Type
234void makeHermitian( CustomMatrix<Type,AF,PF,SO,Tag,RT>& matrix )
240 using BT = UnderlyingBuiltin_t<Type>;
246 const size_t n( matrix.rows() );
248 for(
size_t i=0UL; i<n; ++i ) {
249 for(
size_t j=0UL; j<i; ++j ) {
251 matrix(j,i) =
conj( matrix(i,j) );
253 matrix(i,i) = rand<BT>();
272template<
typename Type
279void makeHermitian( CustomMatrix<Type,AF,PF,SO,Tag,RT>& matrix,
const Arg&
min,
const Arg&
max )
285 using BT = UnderlyingBuiltin_t<Type>;
291 const size_t n( matrix.rows() );
293 for(
size_t i=0UL; i<n; ++i ) {
294 for(
size_t j=0UL; j<i; ++j ) {
296 matrix(j,i) =
conj( matrix(i,j) );
315template<
typename Type
321void makePositiveDefinite( CustomMatrix<Type,AF,PF,SO,Tag,RT>& matrix )
331 const size_t n( matrix.rows() );
334 matrix *=
ctrans( matrix );
336 for(
size_t i=0UL; i<n; ++i ) {
337 matrix(i,i) += Type(n);
Header file for the alignment flag enumeration.
Header file for run time assertion macros.
Header file for the conjugate shim.
Header file for all basic DenseMatrix functionality.
Header file for the complete DynamicVector implementation.
Header file for the complete IdentityMatrix implementation.
Constraint on the data type.
Header file for the UnderlyingBuiltin type trait.
Header file for the complete ZeroMatrix implementation.
Header file for the implementation of a customizable matrix.
Header file for the implementation of a dynamic MxN matrix.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatMapExpr.h:1529
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1464
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1501
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:1534
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:1456
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
PaddingFlag
Padding flag for (un-)padded vectors and matrices.
Definition: PaddingFlag.h:77
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.
Definition: AlignmentFlag.h:63
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:626
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
Header file for the exception macros of the math module.
Header file for the real shim.
Implementation of a random number generator.