35 #ifndef _BLAZE_MATH_DENSEMATRIX_H_
36 #define _BLAZE_MATH_DENSEMATRIX_H_
111 template<
typename T1,
typename T2 >
112 inline bool operator==(
const DenseMatrix<T1,false>& lhs,
const DenseMatrix<T2,false>& rhs );
114 template<
typename T1,
typename T2 >
115 inline bool operator==(
const DenseMatrix<T1,true>& lhs,
const DenseMatrix<T2,true>& rhs );
117 template<
typename T1,
typename T2,
bool SO >
118 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const DenseMatrix<T2,!SO>& rhs );
120 template<
typename T1,
typename T2,
bool SO >
121 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const SparseMatrix<T2,false>& rhs );
123 template<
typename T1,
typename T2,
bool SO >
124 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const SparseMatrix<T2,true>& rhs );
126 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
127 inline bool operator==(
const SparseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
129 template<
typename T1,
typename T2 >
130 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
131 operator==(
const DenseMatrix<T1,false>& mat, T2 scalar );
133 template<
typename T1,
typename T2 >
134 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
135 operator==(
const DenseMatrix<T1,true>& mat, T2 scalar );
137 template<
typename T1,
typename T2,
bool SO >
138 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
139 operator==( T1 scalar,
const DenseMatrix<T2,SO>& mat );
141 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
142 inline bool operator!=(
const DenseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
144 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
145 inline bool operator!=(
const DenseMatrix<T1,SO1>& lhs,
const SparseMatrix<T2,SO2>& rhs );
147 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
148 inline bool operator!=(
const SparseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
150 template<
typename T1,
typename T2,
bool SO >
151 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
152 operator!=(
const DenseMatrix<T1,SO>& mat, T2 scalar );
154 template<
typename T1,
typename T2,
bool SO >
155 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
156 operator!=( T1 scalar,
const DenseMatrix<T2,SO>& mat );
169 template<
typename T1
186 for(
size_t i=0; i<A.rows(); ++i ) {
187 for(
size_t j=0; j<A.columns(); ++j ) {
188 if( !
equal( A(i,j), B(i,j) ) )
return false;
205 template<
typename T1
222 for(
size_t j=0; j<A.columns(); ++j ) {
223 for(
size_t i=0; i<A.rows(); ++i ) {
224 if( !
equal( A(i,j), B(i,j) ) )
return false;
241 template<
typename T1
259 const size_t rows ( A.rows() );
260 const size_t columns( A.columns() );
261 const size_t block ( 16 );
263 for(
size_t ii=0; ii<
rows; ii+=block ) {
264 const size_t iend( ( rows < ii+block )?( rows ):( ii+block ) );
265 for(
size_t jj=0; jj<
columns; jj+=block ) {
266 const size_t jend( ( columns < jj+block )?( columns ):( jj+block ) );
267 for(
size_t i=ii; i<iend; ++i ) {
268 for(
size_t j=jj; j<jend; ++j ) {
269 if( !
equal( A(i,j), B(i,j) ) )
return false;
288 template<
typename T1
309 for(
size_t i=0; i<B.rows(); ++i ) {
311 for( ConstIterator element=B.begin(i); element!=B.end(i); ++element, ++j ) {
312 for( ; j<element->index(); ++j ) {
315 if( !
equal( element->value(), A(i,j) ) )
return false;
317 for( ; j<A.columns(); ++j ) {
335 template<
typename T1
356 for(
size_t j=0; j<B.columns(); ++j ) {
358 for( ConstIterator element=B.begin(j); element!=B.end(j); ++element, ++i ) {
359 for( ; i<element->index(); ++i ) {
362 if( !
equal( element->value(), A(i,j) ) )
return false;
364 for( ; i<A.rows(); ++i ) {
382 template<
typename T1
388 return ( rhs == lhs );
405 template<
typename T1
407 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
417 for(
size_t i=0; i<A.rows(); ++i ) {
418 for(
size_t j=0; j<A.columns(); ++j ) {
419 if( !
equal( A(i,j), scalar ) )
return false;
440 template<
typename T1
442 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
452 for(
size_t j=0; j<A.columns(); ++j ) {
453 for(
size_t i=0; i<A.rows(); ++i ) {
454 if( !
equal( A(i,j), scalar ) )
return false;
475 template<
typename T1
478 inline typename EnableIf< IsNumeric<T1>,
bool >::Type
481 return ( mat == scalar );
494 template<
typename T1
500 return !( lhs == rhs );
513 template<
typename T1
519 return !( lhs == rhs );
532 template<
typename T1
538 return !( rhs == lhs );
555 template<
typename T1
558 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
561 return !( mat == scalar );
578 template<
typename T1
581 inline typename EnableIf< IsNumeric<T1>,
bool >::Type
584 return !( mat == scalar );
600 template<
typename MT,
bool SO >
601 bool isnan(
const DenseMatrix<MT,SO>& dm );
603 template<
typename MT,
bool SO >
604 bool isDiagonal(
const DenseMatrix<MT,SO>& dm );
606 template<
typename MT,
bool SO >
609 template<
typename MT,
bool SO >
612 template<
typename MT,
bool SO >
638 template<
typename MT
647 for(
size_t i=0UL; i<A.rows(); ++i ) {
648 for(
size_t j=0UL; j<A.columns(); ++j )
649 if(
isnan( A(i,j) ) )
return true;
653 for(
size_t j=0UL; j<A.columns(); ++j ) {
654 for(
size_t i=0UL; i<A.rows(); ++i )
655 if(
isnan( A(i,j) ) )
return true;
683 template<
typename MT
690 if( rows != columns )
return false;
693 for(
size_t i=1UL; i<
rows; ++i ) {
694 for(
size_t j=0UL; j<i; ++j ) {
701 for(
size_t j=1UL; j<
columns; ++j ) {
702 for(
size_t i=0UL; i<j; ++i ) {
721 template<
typename MT
728 if( rows != columns )
return false;
731 for(
size_t i=1UL; i<
rows; ++i ) {
732 for(
size_t j=0UL; j<i; ++j ) {
733 if( !
equal( (~dm)(i,j), (~dm)(j,i) ) )
739 for(
size_t j=1UL; j<
columns; ++j ) {
740 for(
size_t i=0UL; i<j; ++i ) {
741 if( !
equal( (~dm)(i,j), (~dm)(j,i) ) )
764 template<
typename MT
775 if( A.rows() == 0UL || A.columns() == 0UL )
return ET();
777 ET minimum( A(0,0) );
780 for(
size_t j=1UL; j<A.columns(); ++j )
781 minimum = min( minimum, A(0UL,j) );
782 for(
size_t i=1UL; i<A.rows(); ++i )
783 for(
size_t j=0UL; j<A.columns(); ++j )
784 minimum = min( minimum, A(i,j) );
787 for(
size_t i=1UL; i<A.rows(); ++i )
788 minimum = min( minimum, A(i,0UL) );
789 for(
size_t j=1UL; j<A.columns(); ++j )
790 for(
size_t i=0UL; i<A.rows(); ++i )
791 minimum = min( minimum, A(i,j) );
811 template<
typename MT
822 if( A.rows() == 0UL || A.columns() == 0UL )
return ET();
824 ET maximum( A(0,0) );
827 for(
size_t j=1UL; j<A.columns(); ++j )
828 maximum = max( maximum, A(0UL,j) );
829 for(
size_t i=1UL; i<A.rows(); ++i )
830 for(
size_t j=0UL; j<A.columns(); ++j )
831 maximum = max( maximum, A(i,j) );
834 for(
size_t i=1UL; i<A.rows(); ++i )
835 maximum = max( maximum, A(i,0UL) );
836 for(
size_t j=1UL; j<A.columns(); ++j )
837 for(
size_t i=0UL; i<A.rows(); ++i )
838 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:685
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:4642
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:723
Header file for the transpose sparse matrix/transpose dense matrix multiplication expression...
Header file for the sparse matrix SMP implementation.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition: DenseMatrix.h:640
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:107
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:2412
Header file for the dense matrix SMP implementation.
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:2406
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:408
Header file for the isDefault shim.
Header file for the dense matrix serial evaluation expression.
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:170
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:351
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:154