35 #ifndef _BLAZE_MATH_DENSE_DENSEMATRIX_H_
36 #define _BLAZE_MATH_DENSE_DENSEMATRIX_H_
74 template<
typename T1,
typename T2 >
75 inline bool operator==(
const DenseMatrix<T1,false>& lhs,
const DenseMatrix<T2,false>& rhs );
77 template<
typename T1,
typename T2 >
78 inline bool operator==(
const DenseMatrix<T1,true>& lhs,
const DenseMatrix<T2,true>& rhs );
80 template<
typename T1,
typename T2,
bool SO >
81 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const DenseMatrix<T2,!SO>& rhs );
83 template<
typename T1,
typename T2,
bool SO >
84 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const SparseMatrix<T2,false>& rhs );
86 template<
typename T1,
typename T2,
bool SO >
87 inline bool operator==(
const DenseMatrix<T1,SO>& lhs,
const SparseMatrix<T2,true>& rhs );
89 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
90 inline bool operator==(
const SparseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
92 template<
typename T1,
typename T2 >
93 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
94 operator==(
const DenseMatrix<T1,false>& mat, T2 scalar );
96 template<
typename T1,
typename T2 >
97 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
98 operator==(
const DenseMatrix<T1,true>& mat, T2 scalar );
100 template<
typename T1,
typename T2,
bool SO >
101 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
102 operator==( T1 scalar,
const DenseMatrix<T2,SO>& mat );
104 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
105 inline bool operator!=(
const DenseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
107 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
108 inline bool operator!=(
const DenseMatrix<T1,SO1>& lhs,
const SparseMatrix<T2,SO2>& rhs );
110 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
111 inline bool operator!=(
const SparseMatrix<T1,SO1>& lhs,
const DenseMatrix<T2,SO2>& rhs );
113 template<
typename T1,
typename T2,
bool SO >
114 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
115 operator!=(
const DenseMatrix<T1,SO>& mat, T2 scalar );
117 template<
typename T1,
typename T2,
bool SO >
118 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
119 operator!=( T1 scalar,
const DenseMatrix<T2,SO>& mat );
132 template<
typename T1
149 for(
size_t i=0; i<A.rows(); ++i ) {
150 for(
size_t j=0; j<A.columns(); ++j ) {
151 if( !
equal( A(i,j), B(i,j) ) )
return false;
168 template<
typename T1
185 for(
size_t j=0; j<A.columns(); ++j ) {
186 for(
size_t i=0; i<A.rows(); ++i ) {
187 if( !
equal( A(i,j), B(i,j) ) )
return false;
204 template<
typename T1
222 const size_t rows ( A.rows() );
223 const size_t columns( A.columns() );
224 const size_t block ( 16 );
226 for(
size_t ii=0; ii<
rows; ii+=block ) {
227 const size_t iend( ( rows < ii+block )?( rows ):( ii+block ) );
228 for(
size_t jj=0; jj<
columns; jj+=block ) {
229 const size_t jend( ( columns < jj+block )?( columns ):( jj+block ) );
230 for(
size_t i=ii; i<iend; ++i ) {
231 for(
size_t j=jj; j<jend; ++j ) {
232 if( !
equal( A(i,j), B(i,j) ) )
return false;
251 template<
typename T1
272 for(
size_t i=0; i<B.rows(); ++i ) {
274 for( ConstIterator element=B.begin(i); element!=B.end(i); ++element, ++j ) {
275 for( ; j<element->index(); ++j ) {
278 if( !
equal( element->value(), A(i,j) ) )
return false;
280 for( ; j<A.columns(); ++j ) {
298 template<
typename T1
319 for(
size_t j=0; j<B.columns(); ++j ) {
321 for( ConstIterator element=B.begin(j); element!=B.end(j); ++element, ++i ) {
322 for( ; i<element->index(); ++i ) {
325 if( !
equal( element->value(), A(i,j) ) )
return false;
327 for( ; i<A.rows(); ++i ) {
345 template<
typename T1
351 return ( rhs == lhs );
368 template<
typename T1
370 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
380 for(
size_t i=0; i<A.rows(); ++i ) {
381 for(
size_t j=0; j<A.columns(); ++j ) {
382 if( !
equal( A(i,j), scalar ) )
return false;
403 template<
typename T1
405 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
415 for(
size_t j=0; j<A.columns(); ++j ) {
416 for(
size_t i=0; i<A.rows(); ++i ) {
417 if( !
equal( A(i,j), scalar ) )
return false;
438 template<
typename T1
441 inline typename EnableIf< IsNumeric<T1>,
bool >::Type
444 return ( mat == scalar );
457 template<
typename T1
463 return !( lhs == rhs );
476 template<
typename T1
482 return !( lhs == rhs );
495 template<
typename T1
501 return !( rhs == lhs );
518 template<
typename T1
521 inline typename EnableIf< IsNumeric<T2>,
bool >::Type
524 return !( mat == scalar );
541 template<
typename T1
544 inline typename EnableIf< IsNumeric<T1>,
bool >::Type
547 return !( mat == scalar );
563 template<
typename MT,
bool SO >
564 bool isnan(
const DenseMatrix<MT,SO>& dm );
566 template<
typename MT,
bool SO >
567 bool isDiagonal(
const DenseMatrix<MT,SO>& dm );
569 template<
typename MT,
bool SO >
572 template<
typename MT,
bool SO >
573 bool isLower(
const DenseMatrix<MT,SO>& dm );
575 template<
typename MT,
bool SO >
576 bool isUpper(
const DenseMatrix<MT,SO>& dm );
578 template<
typename MT,
bool SO >
581 template<
typename MT,
bool SO >
607 template<
typename MT
616 for(
size_t i=0UL; i<A.rows(); ++i ) {
617 for(
size_t j=0UL; j<A.columns(); ++j )
618 if(
isnan( A(i,j) ) )
return true;
622 for(
size_t j=0UL; j<A.columns(); ++j ) {
623 for(
size_t i=0UL; i<A.rows(); ++i )
624 if(
isnan( A(i,j) ) )
return true;
669 template<
typename MT
682 for(
size_t i=1UL; i<A.rows(); ++i ) {
683 for(
size_t j=0UL; j<i; ++j ) {
690 for(
size_t j=1UL; j<A.columns(); ++j ) {
691 for(
size_t i=0UL; i<j; ++i ) {
729 template<
typename MT
741 if( (~dm).
rows() < 2UL )
750 for(
size_t i=1UL; i<A.rows(); ++i ) {
751 for(
size_t j=0UL; j<i; ++j ) {
752 if( !
equal( A(i,j), A(j,i) ) )
758 for(
size_t j=1UL; j<A.columns(); ++j ) {
759 for(
size_t i=0UL; i<j; ++i ) {
760 if( !
equal( A(i,j), A(j,i) ) )
807 template<
typename MT
822 if( (~dm).
rows() < 2UL )
831 for(
size_t i=0UL; i<A.rows()-1UL; ++i ) {
832 for(
size_t j=i+1UL; j<A.columns(); ++j ) {
839 for(
size_t j=1UL; j<A.columns(); ++j ) {
840 for(
size_t i=0UL; i<j; ++i ) {
888 template<
typename MT
903 if( (~dm).
rows() < 2UL )
912 for(
size_t i=1UL; i<A.rows(); ++i ) {
913 for(
size_t j=0UL; j<i; ++j ) {
920 for(
size_t j=0UL; j<A.columns()-1UL; ++j ) {
921 for(
size_t i=j+1UL; i<A.rows(); ++i ) {
945 template<
typename MT
956 if( A.rows() == 0UL || A.columns() == 0UL )
return ET();
958 ET minimum( A(0,0) );
961 for(
size_t j=1UL; j<A.columns(); ++j )
962 minimum =
min( minimum, A(0UL,j) );
963 for(
size_t i=1UL; i<A.rows(); ++i )
964 for(
size_t j=0UL; j<A.columns(); ++j )
965 minimum =
min( minimum, A(i,j) );
968 for(
size_t i=1UL; i<A.rows(); ++i )
969 minimum =
min( minimum, A(i,0UL) );
970 for(
size_t j=1UL; j<A.columns(); ++j )
971 for(
size_t i=0UL; i<A.rows(); ++i )
972 minimum =
min( minimum, A(i,j) );
992 template<
typename MT
1003 if( A.rows() == 0UL || A.columns() == 0UL )
return ET();
1005 ET maximum( A(0,0) );
1008 for(
size_t j=1UL; j<A.columns(); ++j )
1009 maximum =
max( maximum, A(0UL,j) );
1010 for(
size_t i=1UL; i<A.rows(); ++i )
1011 for(
size_t j=0UL; j<A.columns(); ++j )
1012 maximum =
max( maximum, A(i,j) );
1015 for(
size_t i=1UL; i<A.rows(); ++i )
1016 maximum =
max( maximum, A(i,0UL) );
1017 for(
size_t j=1UL; j<A.columns(); ++j )
1018 for(
size_t i=0UL; i<A.rows(); ++i )
1019 maximum =
max( maximum, A(i,j) );
Header file for the isnan shim.
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:994
Header file for mathematical functions.
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:671
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix)
Checks if the given matrix is a square matrix.
Definition: Matrix.h:902
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:731
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2478
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:85
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition: DenseMatrix.h:609
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:85
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:809
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 SparseMatrix base class.
Header file for the IsSquare type trait.
Header file for the matrix storage order types.
Header file for the IsSymmetric type trait.
Header file for the If class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:947
Header file for the DenseMatrix base class.
Header file for the IsLower type trait.
Header file for the equal shim.
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:890
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2476
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2477
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.
bool equal(const T1 &a, const T2 &b)
Generic equality check.
Definition: Equal.h:376
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Header file for the RemoveReference type trait.
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2473
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
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 IsUpper type trait.
Header file for the IsExpression type trait class.