35 #ifndef _BLAZE_MATH_DENSEMATRIX_H_
36 #define _BLAZE_MATH_DENSEMATRIX_H_
108 template<
typename T1,
typename T2 >
109 inline bool operator==(
const DenseMatrix<T1,false>& lhs,
const DenseMatrix<T2,false>& rhs );
111 template<
typename T1,
typename T2 >
112 inline bool operator==(
const DenseMatrix<T1,true>& lhs,
const DenseMatrix<T2,true>& rhs );
114 template<
typename T1,
typename T2,
bool SO >
115 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const DenseMatrix<T2,!SO>& rhs );
117 template<
typename T1,
typename T2,
bool SO >
118 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const SparseMatrix<T2,false>& rhs );
120 template<
typename T1,
typename T2,
bool SO >
121 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const SparseMatrix<T2,true>& rhs );
123 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
124 inline bool operator==(
const SparseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
126 template<
typename T1,
typename T2 >
127 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
128 operator==(
const DenseMatrix<T1,false>& mat, T2 scalar );
130 template<
typename T1,
typename T2 >
131 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
132 operator==(
const DenseMatrix<T1,true>& mat, T2 scalar );
134 template<
typename T1,
typename T2,
bool SO >
135 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
136 operator==( T1 scalar,
const DenseMatrix<T2,SO>& mat );
138 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
139 inline bool operator!=(
const DenseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
141 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
142 inline bool operator!=(
const DenseMatrix<T1,SO1>& lhs,
const SparseMatrix<T2,SO2>& rhs );
144 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
145 inline bool operator!=(
const SparseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
147 template<
typename T1,
typename T2,
bool SO >
148 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
149 operator!=(
const DenseMatrix<T1,SO>& mat, T2 scalar );
151 template<
typename T1,
typename T2,
bool SO >
152 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
153 operator!=( T1 scalar,
const DenseMatrix<T2,SO>& mat );
166 template<
typename T1
183 for(
size_t i=0; i<A.rows(); ++i ) {
184 for(
size_t j=0; j<A.columns(); ++j ) {
185 if( !
equal( A(i,j), B(i,j) ) )
return false;
202 template<
typename T1
219 for(
size_t j=0; j<A.columns(); ++j ) {
220 for(
size_t i=0; i<A.rows(); ++i ) {
221 if( !
equal( A(i,j), B(i,j) ) )
return false;
238 template<
typename T1
256 const size_t rows ( A.rows() );
257 const size_t columns( A.columns() );
258 const size_t block ( 16 );
260 for(
size_t ii=0; ii<
rows; ii+=block ) {
261 const size_t iend( ( rows < ii+block )?( rows ):( ii+block ) );
262 for(
size_t jj=0; jj<
columns; jj+=block ) {
263 const size_t jend( ( columns < jj+block )?( columns ):( jj+block ) );
264 for(
size_t i=ii; i<iend; ++i ) {
265 for(
size_t j=jj; j<jend; ++j ) {
266 if( !
equal( A(i,j), B(i,j) ) )
return false;
285 template<
typename T1
306 for(
size_t i=0; i<B.rows(); ++i ) {
308 for( ConstIterator element=B.begin(i); element!=B.end(i); ++element, ++j ) {
309 for( ; j<element->index(); ++j ) {
312 if( !
equal( element->value(), A(i,j) ) )
return false;
314 for( ; j<A.columns(); ++j ) {
332 template<
typename T1
353 for(
size_t j=0; j<B.columns(); ++j ) {
355 for( ConstIterator element=B.begin(j); element!=B.end(j); ++element, ++i ) {
356 for( ; i<element->index(); ++i ) {
359 if( !
equal( element->value(), A(i,j) ) )
return false;
361 for( ; i<A.rows(); ++i ) {
379 template<
typename T1
385 return ( rhs == lhs );
402 template<
typename T1
404 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
414 for(
size_t i=0; i<A.rows(); ++i ) {
415 for(
size_t j=0; j<A.columns(); ++j ) {
416 if( !
equal( A(i,j), scalar ) )
return false;
437 template<
typename T1
439 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
449 for(
size_t j=0; j<A.columns(); ++j ) {
450 for(
size_t i=0; i<A.rows(); ++i ) {
451 if( !
equal( A(i,j), scalar ) )
return false;
472 template<
typename T1
475 inline typename EnableIf< IsNumeric<T1>,
bool >::Type
478 return ( mat == scalar );
491 template<
typename T1
497 return !( lhs == rhs );
510 template<
typename T1
516 return !( lhs == rhs );
529 template<
typename T1
535 return !( rhs == lhs );
552 template<
typename T1
555 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
558 return !( mat == scalar );
575 template<
typename T1
578 inline typename EnableIf< IsNumeric<T1>,
bool >::Type
581 return !( mat == scalar );
597 template<
typename MT,
bool SO >
598 bool isnan(
const DenseMatrix<MT,SO>& dm );
600 template<
typename MT,
bool SO >
601 bool isDiagonal(
const DenseMatrix<MT,SO>& dm );
603 template<
typename MT,
bool SO >
606 template<
typename MT,
bool SO >
609 template<
typename MT,
bool SO >
635 template<
typename MT
644 for(
size_t i=0UL; i<A.rows(); ++i ) {
645 for(
size_t j=0UL; j<A.columns(); ++j )
646 if(
isnan( A(i,j) ) )
return true;
650 for(
size_t j=0UL; j<A.columns(); ++j ) {
651 for(
size_t i=0UL; i<A.rows(); ++i )
652 if(
isnan( A(i,j) ) )
return true;
680 template<
typename MT
687 if( rows != columns )
return false;
690 for(
size_t i=1UL; i<
rows; ++i ) {
691 for(
size_t j=0UL; j<i; ++j ) {
698 for(
size_t j=1UL; j<
columns; ++j ) {
699 for(
size_t i=0UL; i<j; ++i ) {
718 template<
typename MT
725 if( rows != columns )
return false;
728 for(
size_t i=1UL; i<
rows; ++i ) {
729 for(
size_t j=0UL; j<i; ++j ) {
730 if( !
equal( (~dm)(i,j), (~dm)(j,i) ) )
736 for(
size_t j=1UL; j<
columns; ++j ) {
737 for(
size_t i=0UL; i<j; ++i ) {
738 if( !
equal( (~dm)(i,j), (~dm)(j,i) ) )
761 template<
typename MT
772 if( A.rows() == 0UL || A.columns() == 0UL )
return ET();
774 ET minimum( A(0,0) );
777 for(
size_t j=1UL; j<A.columns(); ++j )
778 minimum = min( minimum, A(0UL,j) );
779 for(
size_t i=1UL; i<A.rows(); ++i )
780 for(
size_t j=0UL; j<A.columns(); ++j )
781 minimum = min( minimum, A(i,j) );
784 for(
size_t i=1UL; i<A.rows(); ++i )
785 minimum = min( minimum, A(i,0UL) );
786 for(
size_t j=1UL; j<A.columns(); ++j )
787 for(
size_t i=0UL; i<A.rows(); ++i )
788 minimum = min( minimum, A(i,j) );
808 template<
typename MT
819 if( A.rows() == 0UL || A.columns() == 0UL )
return ET();
821 ET maximum( A(0,0) );
824 for(
size_t j=1UL; j<A.columns(); ++j )
825 maximum = max( maximum, A(0UL,j) );
826 for(
size_t i=1UL; i<A.rows(); ++i )
827 for(
size_t j=0UL; j<A.columns(); ++j )
828 maximum = max( maximum, A(i,j) );
831 for(
size_t i=1UL; i<A.rows(); ++i )
832 maximum = max( maximum, A(i,0UL) );
833 for(
size_t j=1UL; j<A.columns(); ++j )
834 for(
size_t i=0UL; i<A.rows(); ++i )
835 maximum = max( maximum, A(i,j) );
Header file for the isnan shim.
Header file for the dense vector/dense vector outer product expression.
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:682
Header file for the transpose dense vector/dense matrix multiplication expression.
Header file for the dense matrix/dense vector multiplication expression.
Header file for the dense matrix/dense matrix addition expression.
Header file for the dense matrix/sparse vector multiplication expression.
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4555
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:720
Header file for the transpose sparse matrix/transpose dense matrix multiplication expression...
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2375
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition: DenseMatrix.h:637
Header file for the dense matrix/dense matrix subtraction expression.
Header file for the sparse matrix/transpose dense matrix multiplication expression.
Header file for the transpose dense matrix/dense matrix multiplication expression.
Header file for the transpose dense matrix/sparse matrix multiplication expression.
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:104
Header file for the dense matrix/transpose dense matrix addition expression.
Header file for the SparseMatrix base class.
Header file for the transpose sparse vector/dense matrix multiplication expression.
Header file for the matrix storage order types.
Header file for the transpose sparse matrix/dense matrix subtraction expression.
Header file for the dense matrix/transpose sparse matrix addition expression.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2379
Header file for the DenseMatrix base class.
Header file for the transpose sparse vector/transpose dense matrix multiplication expression...
Header file for the sparse matrix/dense matrix subtraction expression.
Header file for the transpose sparse matrix/dense matrix multiplication expression.
Header file for the dense matrix/scalar multiplication expression.
Header file for the transpose dense matrix/dense vector multiplication expression.
Header file for the dense matrix/sparse matrix addition expression.
Header file for the transpose dense matrix/sparse vector multiplication expression.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2373
Header file for the sparse matrix/transpose dense matrix subtraction expression.
Header file for the EnableIf class template.
Header file for the dense matrix/scalar division expression.
Header file for the equal shim.
Header file for the dense matrix evaluation expression.
Header file for the transpose dense matrix/transpose sparse matrix multiplication expression...
Header file for the transpose dense matrix/transpose dense matrix multiplication expression.
Header file for the dense matrix transposer.
Header file for the IsNumeric type trait.
Header file for all basic Matrix functionality.
Header file for the dense matrix/transpose sparse matrix subtraction expression.
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for run time assertion macros.
Header file for the dense matrix/dense matrix multiplication expression.
bool equal(const T1 &a, const T2 &b)
Generic equality check.
Definition: Equal.h:352
Header file for the dense matrix/sparse matrix subtraction expression.
Header file for the dense matrix/sparse matrix multiplication expression.
Header file for the dense matrix/transpose dense matrix multiplication expression.
Header file for the dense matrix/transpose sparse matrix multiplication expression.
const VT::ElementType max(const SparseVector< VT, TF > &sv)
Returns the largest element of the sparse vector.
Definition: SparseVector.h:405
Header file for the isDefault shim.
Header file for the transpose dense matrix/sparse matrix addition expression.
Header file for the RemoveReference type trait.
Header file for the dense matrix absolute value expression.
Header file for the dense matrix/transpose dense matrix subtraction expression.
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the transpose dense matrix/sparse matrix subtraction expression.
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:154
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
Header file for the sparse matrix/dense matrix multiplication expression.
Header file for the dense matrix transpose expression.
const VT::ElementType min(const SparseVector< VT, TF > &sv)
Returns the smallest element of the sparse vector.
Definition: SparseVector.h:348
Header file for the transpose dense vector/transpose dense matrix multiplication expression.
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:138