35#ifndef _BLAZE_MATH_DYNAMICMATRIX_H_
36#define _BLAZE_MATH_DYNAMICMATRIX_H_
72template<
typename Type
75class Rand< DynamicMatrix<Type,SO,Tag> >
85 inline const DynamicMatrix<Type,SO,Tag>
88 DynamicMatrix<Type,SO,Tag> matrix( m, n );
103 template<
typename Arg >
104 inline const DynamicMatrix<Type,SO,Tag>
105 generate(
size_t m,
size_t n,
const Arg&
min,
const Arg&
max )
const
107 DynamicMatrix<Type,SO,Tag> matrix( m, n );
119 inline void randomize( DynamicMatrix<Type,SO,Tag>& matrix )
const
123 const size_t m( matrix.rows() );
124 const size_t n( matrix.columns() );
126 for(
size_t i=0UL; i<m; ++i ) {
127 for(
size_t j=0UL; j<n; ++j ) {
142 template<
typename Arg >
143 inline void randomize( DynamicMatrix<Type,SO,Tag>& matrix,
144 const Arg&
min,
const Arg&
max )
const
148 const size_t m( matrix.rows() );
149 const size_t n( matrix.columns() );
151 for(
size_t i=0UL; i<m; ++i ) {
152 for(
size_t j=0UL; j<n; ++j ) {
179template<
typename Type
182void makeSymmetric( DynamicMatrix<Type,SO,Tag>& matrix )
190 const size_t n( matrix.rows() );
192 for(
size_t i=0UL; i<n; ++i ) {
193 for(
size_t j=0UL; j<i; ++j ) {
195 matrix(j,i) = matrix(i,j);
216template<
typename Type
220void makeSymmetric( DynamicMatrix<Type,SO,Tag>& matrix,
const Arg&
min,
const Arg&
max )
228 const size_t n( matrix.rows() );
230 for(
size_t i=0UL; i<n; ++i ) {
231 for(
size_t j=0UL; j<i; ++j ) {
233 matrix(j,i) = matrix(i,j);
252template<
typename Type
255void makeHermitian( DynamicMatrix<Type,SO,Tag>& matrix )
261 using BT = UnderlyingBuiltin_t<Type>;
267 const size_t n( matrix.rows() );
269 for(
size_t i=0UL; i<n; ++i ) {
270 for(
size_t j=0UL; j<i; ++j ) {
272 matrix(j,i) =
conj( matrix(i,j) );
274 matrix(i,i) = rand<BT>();
293template<
typename Type
297void makeHermitian( DynamicMatrix<Type,SO,Tag>& matrix,
const Arg&
min,
const Arg&
max )
303 using BT = UnderlyingBuiltin_t<Type>;
309 const size_t n( matrix.rows() );
311 for(
size_t i=0UL; i<n; ++i ) {
312 for(
size_t j=0UL; j<i; ++j ) {
314 matrix(j,i) =
conj( matrix(i,j) );
333template<
typename Type
336void makePositiveDefinite( DynamicMatrix<Type,SO,Tag>& matrix )
346 const size_t n( matrix.rows() );
349 matrix *=
ctrans( matrix );
351 for(
size_t i=0UL; i<n; ++i ) {
352 matrix(i,i) += Type(n);
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 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
decltype(auto) generate(size_t m, size_t n, OP op)
Generates a new dense matrix filled via the given custom binary operation.
Definition: DMatGenExpr.h:675
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
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.