35 #ifndef _BLAZE_MATH_DYNAMICMATRIX_H_
36 #define _BLAZE_MATH_DYNAMICMATRIX_H_
71 template<
typename Type
73 class Rand< DynamicMatrix<Type,SO> >
79 inline const DynamicMatrix<Type,SO>
generate(
size_t m,
size_t n )
const;
81 template<
typename Arg >
82 inline const DynamicMatrix<Type,SO>
generate(
size_t m,
size_t n,
const Arg&
min,
const Arg&
max )
const;
89 inline void randomize( DynamicMatrix<Type,SO>& matrix )
const;
91 template<
typename Arg >
92 inline void randomize( DynamicMatrix<Type,SO>& matrix,
const Arg&
min,
const Arg&
max )
const;
108 template<
typename Type
110 inline const DynamicMatrix<Type,SO>
111 Rand< DynamicMatrix<Type,SO> >::generate(
size_t m,
size_t n )
const
113 DynamicMatrix<Type,SO> matrix( m, n );
131 template<
typename Type
133 template<
typename Arg >
134 inline const DynamicMatrix<Type,SO>
135 Rand< DynamicMatrix<Type,SO> >::generate(
size_t m,
size_t n,
const Arg&
min,
const Arg&
max )
const
137 DynamicMatrix<Type,SO> matrix( m, n );
152 template<
typename Type
154 inline void Rand< DynamicMatrix<Type,SO> >
::randomize( DynamicMatrix<Type,SO>& matrix )
const
158 const size_t m( matrix.rows() );
159 const size_t n( matrix.columns() );
161 for(
size_t i=0UL; i<m; ++i ) {
162 for(
size_t j=0UL; j<n; ++j ) {
180 template<
typename Type
182 template<
typename Arg >
183 inline void Rand< DynamicMatrix<Type,SO> >
::randomize( DynamicMatrix<Type,SO>& matrix,
184 const Arg&
min,
const Arg&
max )
const
188 const size_t m( matrix.rows() );
189 const size_t n( matrix.columns() );
191 for(
size_t i=0UL; i<m; ++i ) {
192 for(
size_t j=0UL; j<n; ++j ) {
217 template<
typename Type
219 void makeSymmetric( DynamicMatrix<Type,SO>& matrix )
227 const size_t n( matrix.rows() );
229 for(
size_t i=0UL; i<n; ++i ) {
230 for(
size_t j=0UL; j<i; ++j ) {
232 matrix(j,i) = matrix(i,j);
253 template<
typename Type
256 void makeSymmetric( DynamicMatrix<Type,SO>& matrix,
const Arg& min,
const Arg& max )
264 const size_t n( matrix.rows() );
266 for(
size_t i=0UL; i<n; ++i ) {
267 for(
size_t j=0UL; j<i; ++j ) {
269 matrix(j,i) = matrix(i,j);
288 template<
typename Type
290 void makeHermitian( DynamicMatrix<Type,SO>& matrix )
296 typedef typename UnderlyingBuiltin<Type>::Type BT;
302 const size_t n( matrix.rows() );
304 for(
size_t i=0UL; i<n; ++i ) {
305 for(
size_t j=0UL; j<i; ++j ) {
307 matrix(j,i) =
conj( matrix(i,j) );
309 matrix(i,i) = rand<BT>();
328 template<
typename Type
331 void makeHermitian( DynamicMatrix<Type,SO>& matrix,
const Arg& min,
const Arg& max )
337 typedef typename UnderlyingBuiltin<Type>::Type BT;
343 const size_t n( matrix.rows() );
345 for(
size_t i=0UL; i<n; ++i ) {
346 for(
size_t j=0UL; j<i; ++j ) {
348 matrix(j,i) =
conj( matrix(i,j) );
350 matrix(i,i) = rand<BT>(
real( min ),
real( max ) );
367 template<
typename Type
369 void makePositiveDefinite( DynamicMatrix<Type,SO>& matrix )
379 const size_t n( matrix.rows() );
382 matrix *=
ctrans( matrix );
384 for(
size_t i=0UL; i<n; ++i ) {
385 matrix(i,i) += Type(n);
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1729
Constraint on the data type.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix)
Checks if the given matrix is a square matrix.
Definition: Matrix.h:603
void randomize(T &value)
Randomization of a given variable.
Definition: Random.h:1041
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:697
Implementation of a random number generator.
Efficient implementation of a dynamic matrix.The DynamicMatrix class template is the representation ...
Definition: DynamicMatrix.h:195
DynamicMatrix< double, false > MatMxNd
MxN double precision matrix.
Definition: DynamicMatrix.h:414
ConjExprTrait< typename DiagonalProxy< MT >::RepresentedType >::Type conj(const DiagonalProxy< MT > &proxy)
Computing the complex conjugate of the represented element.
Definition: DiagonalProxy.h:487
Header file for the floating point precision of the Blaze library.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:260
Header file for the UnderlyingBuiltin type trait.
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
const CTransExprTrait< MT >::Type ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatConjExpr.h:974
const RealExprTrait< MT >::Type real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatRealExpr.h:920
DynamicMatrix< real_t, false > MatMxN
MxN matrix with system-specific precision.
Definition: DynamicMatrix.h:422
Header file for the real shim.
Header file for the implementation of a dynamic MxN matrix.
Header file for the complete DynamicVector implementation.
Header file for the conjugate shim.
Header file for run time assertion macros.
DynamicMatrix< float, false > MatMxNf
MxN single precision matrix.
Definition: DynamicMatrix.h:406
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
T generate() const
Generation of a random value in the range .
Definition: Random.h:220
Header file for all basic DenseMatrix functionality.
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:767
Header file for exception macros.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101