35 #ifndef _BLAZE_MATH_HYBRIDMATRIX_H_ 36 #define _BLAZE_MATH_HYBRIDMATRIX_H_ 72 template<
typename Type
76 class Rand< HybridMatrix<Type,M,N,SO> >
82 inline const HybridMatrix<Type,M,N,SO>
generate(
size_t m,
size_t n )
const;
84 template<
typename Arg >
85 inline const HybridMatrix<Type,M,N,SO>
generate(
size_t m,
size_t n,
const Arg&
min,
const Arg&
max )
const;
92 inline void randomize( HybridMatrix<Type,M,N,SO>& matrix )
const;
94 template<
typename Arg >
95 inline void randomize( HybridMatrix<Type,M,N,SO>& matrix,
const Arg&
min,
const Arg&
max )
const;
109 template<
typename Type
113 inline const HybridMatrix<Type,M,N,SO>
114 Rand< HybridMatrix<Type,M,N,SO> >
::generate(
size_t m,
size_t n )
const 116 HybridMatrix<Type,M,N,SO> matrix( m, n );
132 template<
typename Type
136 template<
typename Arg >
137 inline const HybridMatrix<Type,M,N,SO>
138 Rand< HybridMatrix<Type,M,N,SO> >
::generate(
size_t m,
size_t n,
const Arg&
min,
const Arg&
max )
const 140 HybridMatrix<Type,M,N,SO> matrix( m, n );
155 template<
typename Type
159 inline void Rand< HybridMatrix<Type,M,N,SO> >
::randomize( HybridMatrix<Type,M,N,SO>& matrix )
const 163 const size_t m( matrix.rows() );
164 const size_t n( matrix.columns() );
166 for(
size_t i=0UL; i<m; ++i ) {
167 for(
size_t j=0UL; j<n; ++j ) {
185 template<
typename Type
189 template<
typename Arg >
190 inline void Rand< HybridMatrix<Type,M,N,SO> >
::randomize( HybridMatrix<Type,M,N,SO>& matrix,
191 const Arg&
min,
const Arg&
max )
const 195 const size_t m( matrix.rows() );
196 const size_t n( matrix.columns() );
198 for(
size_t i=0UL; i<m; ++i ) {
199 for(
size_t j=0UL; j<n; ++j ) {
224 template<
typename Type
228 void makeSymmetric( HybridMatrix<Type,M,N,SO>& matrix )
236 const size_t n( matrix.rows() );
238 for(
size_t i=0UL; i<n; ++i ) {
239 for(
size_t j=0UL; j<i; ++j ) {
241 matrix(j,i) = matrix(i,j);
262 template<
typename Type
267 void makeSymmetric( HybridMatrix<Type,M,N,SO>& matrix,
const Arg& min,
const Arg& max )
275 const size_t n( matrix.rows() );
277 for(
size_t i=0UL; i<n; ++i ) {
278 for(
size_t j=0UL; j<i; ++j ) {
280 matrix(j,i) = matrix(i,j);
299 template<
typename Type
303 void makeHermitian( HybridMatrix<Type,M,N,SO>& matrix )
309 using BT = UnderlyingBuiltin_<Type>;
315 const size_t n( matrix.rows() );
317 for(
size_t i=0UL; i<n; ++i ) {
318 for(
size_t j=0UL; j<i; ++j ) {
320 matrix(j,i) =
conj( matrix(i,j) );
322 matrix(i,i) = rand<BT>();
341 template<
typename Type
346 void makeHermitian( HybridMatrix<Type,M,N,SO>& matrix,
const Arg& min,
const Arg& max )
352 using BT = UnderlyingBuiltin_<Type>;
358 const size_t n( matrix.rows() );
360 for(
size_t i=0UL; i<n; ++i ) {
361 for(
size_t j=0UL; j<i; ++j ) {
363 matrix(j,i) =
conj( matrix(i,j) );
365 matrix(i,i) = rand<BT>(
real( min ),
real( max ) );
382 template<
typename Type
386 void makePositiveDefinite( HybridMatrix<Type,M,N,SO>& matrix )
396 const size_t n( matrix.rows() );
399 matrix *=
ctrans( matrix );
401 for(
size_t i=0UL; i<n; ++i ) {
402 matrix(i,i) += Type(n);
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for the complete HybridVector implementation.
decltype(auto) real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatMapExpr.h:1387
void randomize(T &value)
Randomization of a given variable.
Definition: Random.h:927
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
Implementation of a random number generator.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:290
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1359
Header file for the UnderlyingBuiltin type trait.
Header file for the exception macros of the math module.
Header file for the conjugate shim.
Header file for run time assertion macros.
#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:61
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:778
Header file for the implementation of a fixed-size matrix.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:700
T generate() const
Generation of a random value in the range .
Definition: Random.h:250
Header file for all basic DenseMatrix functionality.
Header file for the complete StaticMatrix implementation.
Header file for the complete IdentityMatrix implementation.
Header file for the real shim.
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1321
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:742
#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