35#ifndef _BLAZE_MATH_DENSE_DENSEMATRIX_H_
36#define _BLAZE_MATH_DENSE_DENSEMATRIX_H_
110template<
typename T1,
typename T2 >
111auto operator==(
const DenseMatrix<T1,false>& mat, T2 scalar )
112 -> EnableIf_t< IsScalar_v<T2>,
bool >;
114template<
typename T1,
typename T2 >
115auto operator==(
const DenseMatrix<T1,true>& mat, T2 scalar )
116 -> EnableIf_t< IsScalar_v<T2>,
bool >;
118template<
typename T1,
typename T2,
bool SO >
119auto operator==( T1 scalar,
const DenseMatrix<T2,SO>& mat )
120 -> EnableIf_t< IsScalar_v<T2>,
bool >;
122template<
typename T1,
typename T2,
bool SO >
123auto operator!=(
const DenseMatrix<T1,SO>& mat, T2 scalar )
124 -> EnableIf_t< IsScalar_v<T2>,
bool >;
126template<
typename T1,
typename T2,
bool SO >
127auto operator!=( T1 scalar,
const DenseMatrix<T2,SO>& mat )
128 -> EnableIf_t< IsScalar_v<T2>,
bool >;
130template<
typename MT,
bool SO,
typename ST >
131auto operator+=( DenseMatrix<MT,SO>& mat, ST scalar )
132 -> EnableIf_t< IsScalar_v<ST>, MT& >;
134template<
typename MT,
bool SO,
typename ST >
135auto operator+=( DenseMatrix<MT,SO>&& mat, ST scalar )
136 -> EnableIf_t< IsScalar_v<ST>, MT& >;
138template<
typename MT,
bool SO,
typename ST >
139auto operator-=( DenseMatrix<MT,SO>& mat, ST scalar )
140 -> EnableIf_t< IsScalar_v<ST>, MT& >;
142template<
typename MT,
bool SO,
typename ST >
143auto operator-=( DenseMatrix<MT,SO>&& mat, ST scalar )
144 -> EnableIf_t< IsScalar_v<ST>, MT& >;
146template<
typename MT,
bool SO,
typename ST >
147auto operator*=( DenseMatrix<MT,SO>& mat, ST scalar )
148 -> EnableIf_t< IsScalar_v<ST>, MT& >;
150template<
typename MT,
bool SO,
typename ST >
151auto operator*=( DenseMatrix<MT,SO>&& mat, ST scalar )
152 -> EnableIf_t< IsScalar_v<ST>, MT& >;
154template<
typename MT,
bool SO,
typename ST >
155auto operator/=( DenseMatrix<MT,SO>& mat, ST scalar )
156 -> EnableIf_t< IsScalar_v<ST>, MT& >;
158template<
typename MT,
bool SO,
typename ST >
159auto operator/=( DenseMatrix<MT,SO>&& mat, ST scalar )
160 -> EnableIf_t< IsScalar_v<ST>, MT& >;
162template<
typename MT,
bool SO >
163MT&
operator<<=( DenseMatrix<MT,SO>& mat,
int count );
165template<
typename MT,
bool SO >
166MT&
operator<<=( DenseMatrix<MT,SO>&& mat,
int count );
168template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
169MT1&
operator<<=( DenseMatrix<MT1,SO1>& lhs,
const DenseMatrix<MT2,SO2>& rhs );
171template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
172MT1&
operator<<=( DenseMatrix<MT1,SO1>&& lhs,
const DenseMatrix<MT2,SO2>& rhs );
174template<
typename MT,
bool SO >
175MT&
operator>>=( DenseMatrix<MT,SO>& mat,
int count );
177template<
typename MT,
bool SO >
178MT&
operator>>=( DenseMatrix<MT,SO>&& mat,
int count );
180template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
181MT1&
operator>>=( DenseMatrix<MT1,SO1>& lhs,
const DenseMatrix<MT2,SO2>& rhs );
183template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
184MT1&
operator>>=( DenseMatrix<MT1,SO1>&& lhs,
const DenseMatrix<MT2,SO2>& rhs );
186template<
typename MT,
bool SO,
typename ST >
187auto operator&=( DenseMatrix<MT,SO>& mat, ST scalar )
188 -> EnableIf_t< IsScalar_v<ST>, MT& >;
190template<
typename MT,
bool SO,
typename ST >
191auto operator&=( DenseMatrix<MT,SO>&& mat, ST scalar )
192 -> EnableIf_t< IsScalar_v<ST>, MT& >;
194template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
195MT1&
operator&=( DenseMatrix<MT1,SO1>& lhs,
const DenseMatrix<MT2,SO2>& rhs );
197template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
198MT1&
operator&=( DenseMatrix<MT1,SO1>&& lhs,
const DenseMatrix<MT2,SO2>& rhs );
200template<
typename MT,
bool SO,
typename ST >
201auto operator|=( DenseMatrix<MT,SO>& mat, ST scalar )
202 -> EnableIf_t< IsScalar_v<ST>, MT& >;
204template<
typename MT,
bool SO,
typename ST >
205auto operator|=( DenseMatrix<MT,SO>&& mat, ST scalar )
206 -> EnableIf_t< IsScalar_v<ST>, MT& >;
208template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
209MT1&
operator|=( DenseMatrix<MT1,SO1>& lhs,
const DenseMatrix<MT2,SO2>& rhs );
211template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
212MT1&
operator|=( DenseMatrix<MT1,SO1>&& lhs,
const DenseMatrix<MT2,SO2>& rhs );
214template<
typename MT,
bool SO,
typename ST >
215auto operator^=( DenseMatrix<MT,SO>& mat, ST scalar )
216 -> EnableIf_t< IsScalar_v<ST>, MT& >;
218template<
typename MT,
bool SO,
typename ST >
219auto operator^=( DenseMatrix<MT,SO>&& mat, ST scalar )
220 -> EnableIf_t< IsScalar_v<ST>, MT& >;
222template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
223MT1&
operator^=( DenseMatrix<MT1,SO1>& lhs,
const DenseMatrix<MT2,SO2>& rhs );
225template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
226MT1&
operator^=( DenseMatrix<MT1,SO1>&& lhs,
const DenseMatrix<MT2,SO2>& rhs );
255 for(
size_t i=0; i<A.rows(); ++i ) {
256 for(
size_t j=0; j<A.columns(); ++j ) {
257 if( !
equal( A(i,j), scalar ) )
return false;
290 for(
size_t j=0; j<A.columns(); ++j ) {
291 for(
size_t i=0; i<A.rows(); ++i ) {
292 if( !
equal( A(i,j), scalar ) )
return false;
319 return ( mat == scalar );
342 return !( mat == scalar );
365 return !( mat == scalar );
391 if( IsRestricted_v<MT> ) {
392 if( !tryAdd( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), scalar ) ) {
397 decltype(
auto) left( derestrict( *mat ) );
453 if( IsRestricted_v<MT> ) {
454 if( !trySub( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), scalar ) ) {
459 decltype(
auto) left( derestrict( *mat ) );
515 if( IsRestricted_v<MT> ) {
516 if( !tryMult( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), scalar ) ) {
521 decltype(
auto) left( derestrict( *mat ) );
581 if( IsRestricted_v<MT> ) {
582 if( !tryDiv( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), scalar ) ) {
587 decltype(
auto) left( derestrict( *mat ) );
642 if( IsRestricted_v<MT> ) {
643 if( !tryShift( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), count ) ) {
648 decltype(
auto) left( derestrict( *mat ) );
692template<
typename MT1
698 if( IsRestricted_v<MT1> ) {
699 if( !tryShiftAssign( *lhs, *rhs, 0UL, 0UL ) ) {
704 decltype(
auto) left( derestrict( *lhs ) );
727template<
typename MT1
756 if( IsRestricted_v<MT> ) {
757 if( !tryShift( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), count ) ) {
762 decltype(
auto) left( derestrict( *mat ) );
806template<
typename MT1
812 if( IsRestricted_v<MT1> ) {
813 if( !tryShiftAssign( *lhs, *rhs, 0UL, 0UL ) ) {
818 decltype(
auto) left( derestrict( *lhs ) );
841template<
typename MT1
872 if( IsRestricted_v<MT> ) {
873 if( !tryBitand( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), scalar ) ) {
878 decltype(
auto) left( derestrict( *mat ) );
925template<
typename MT1
931 if( IsRestricted_v<MT1> ) {
932 if( !tryBitandAssign( *lhs, *rhs, 0UL, 0UL ) ) {
937 decltype(
auto) left( derestrict( *lhs ) );
960template<
typename MT1
991 if( IsRestricted_v<MT> ) {
992 if( !tryBitor( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), scalar ) ) {
997 decltype(
auto) left( derestrict( *mat ) );
1021template<
typename MT
1044template<
typename MT1
1050 if( IsRestricted_v<MT1> ) {
1051 if( !tryBitorAssign( *lhs, *rhs, 0UL, 0UL ) ) {
1056 decltype(
auto) left( derestrict( *lhs ) );
1079template<
typename MT1
1102template<
typename MT
1110 if( IsRestricted_v<MT> ) {
1111 if( !tryBitxor( *mat, 0UL, 0UL, (*mat).rows(), (*mat).columns(), scalar ) ) {
1116 decltype(
auto) left( derestrict( *mat ) );
1140template<
typename MT
1163template<
typename MT1
1169 if( IsRestricted_v<MT1> ) {
1170 if( !tryBitxorAssign( *lhs, *rhs, 0UL, 0UL ) ) {
1175 decltype(
auto) left( derestrict( *lhs ) );
1198template<
typename MT1
1220template<
typename MT,
bool SO >
1221bool isnan(
const DenseMatrix<MT,SO>& dm );
1223template<
typename MT,
bool SO >
1224bool isinf(
const DenseMatrix<MT,SO>& dm );
1226template<
typename MT,
bool SO >
1227bool isfinite(
const DenseMatrix<MT,SO>& dm );
1229template< RelaxationFlag RF,
typename MT,
bool SO >
1232template< RelaxationFlag RF,
typename MT,
bool SO >
1235template< RelaxationFlag RF,
typename MT,
bool SO >
1236bool isUniform(
const DenseMatrix<MT,SO>& dm );
1238template< RelaxationFlag RF,
typename MT,
bool SO >
1239bool isZero(
const DenseMatrix<MT,SO>& dm );
1241template< RelaxationFlag RF,
typename MT,
bool SO >
1242bool isLower(
const DenseMatrix<MT,SO>& dm );
1244template< RelaxationFlag RF,
typename MT,
bool SO >
1245bool isUniLower(
const DenseMatrix<MT,SO>& dm );
1247template< RelaxationFlag RF,
typename MT,
bool SO >
1250template< RelaxationFlag RF,
typename MT,
bool SO >
1251bool isUpper(
const DenseMatrix<MT,SO>& dm );
1253template< RelaxationFlag RF,
typename MT,
bool SO >
1254bool isUniUpper(
const DenseMatrix<MT,SO>& dm );
1256template< RelaxationFlag RF,
typename MT,
bool SO >
1259template< RelaxationFlag RF,
typename MT,
bool SO >
1260bool isDiagonal(
const DenseMatrix<MT,SO>& dm );
1262template< RelaxationFlag RF,
typename MT,
bool SO >
1263bool isIdentity(
const DenseMatrix<MT,SO>& dm );
1265template<
typename MT,
bool SO >
1288template<
typename MT
1300 for(
size_t i=0UL; i<A.rows(); ++i ) {
1301 const size_t jbegin( IsUpper_v<MT> ? i : 0UL );
1302 const size_t jend ( IsLower_v<MT> ? i+1UL : A.columns() );
1303 for(
size_t j=jbegin; j<jend; ++j )
1304 if(
isnan( A(i,j) ) )
return true;
1308 for(
size_t j=0UL; j<A.columns(); ++j ) {
1309 const size_t ibegin( IsLower_v<MT> ? j : 0UL );
1310 const size_t iend ( IsUpper_v<MT> ? j+1UL : A.rows() );
1311 for(
size_t i=ibegin; i<iend; ++i )
1312 if(
isnan( A(i,j) ) )
return true;
1337template<
typename MT
1349 for(
size_t i=0UL; i<A.rows(); ++i ) {
1350 const size_t jbegin( IsUpper_v<MT> ? i : 0UL );
1351 const size_t jend ( IsLower_v<MT> ? i+1UL : A.columns() );
1352 for(
size_t j=jbegin; j<jend; ++j )
1353 if(
isinf( A(i,j) ) )
return true;
1357 for(
size_t j=0UL; j<A.columns(); ++j ) {
1358 const size_t ibegin( IsLower_v<MT> ? j : 0UL );
1359 const size_t iend ( IsUpper_v<MT> ? j+1UL : A.rows() );
1360 for(
size_t i=ibegin; i<iend; ++i )
1361 if(
isinf( A(i,j) ) )
return true;
1387template<
typename MT
1399 for(
size_t i=0UL; i<A.rows(); ++i ) {
1400 const size_t jbegin( IsUpper_v<MT> ? i : 0UL );
1401 const size_t jend ( IsLower_v<MT> ? i+1UL : A.columns() );
1402 for(
size_t j=jbegin; j<jend; ++j )
1403 if( !
isfinite( A(i,j) ) )
return false;
1407 for(
size_t j=0UL; j<A.columns(); ++j ) {
1408 const size_t ibegin( IsLower_v<MT> ? j : 0UL );
1409 const size_t iend ( IsUpper_v<MT> ? j+1UL : A.rows() );
1410 for(
size_t i=ibegin; i<iend; ++i )
1411 if( !
isfinite( A(i,j) ) )
return false;
1460 if( IsSymmetric_v<MT> )
1466 if( IsUniform_v<MT> || (*dm).rows() < 2UL )
1469 if( IsTriangular_v<MT> )
1475 for(
size_t i=1UL; i<A.rows(); ++i ) {
1476 for(
size_t j=0UL; j<i; ++j ) {
1477 if( !equal<RF>( A(i,j), A(j,i) ) )
1483 for(
size_t j=1UL; j<A.columns(); ++j ) {
1484 for(
size_t i=0UL; i<j; ++i ) {
1485 if( !equal<RF>( A(i,j), A(j,i) ) )
1539 if( IsHermitian_v<MT> )
1542 if( !IsScalar_v<ET> || !
isSquare( *dm ) )
1545 if( IsBuiltin_v<ET> && IsUniform_v<MT> )
1551 for(
size_t i=0UL; i<A.rows(); ++i ) {
1552 for(
size_t j=0UL; j<i; ++j ) {
1553 if( !equal<RF>( A(i,j),
conj( A(j,i) ) ) )
1556 if( !isReal<RF>( A(i,i) ) )
1561 for(
size_t j=0UL; j<A.columns(); ++j ) {
1562 for(
size_t i=0UL; i<j; ++i ) {
1563 if( !equal<RF>( A(i,j),
conj( A(j,i) ) ) )
1566 if( !isReal<RF>( A(j,j) ) )
1586bool isUniform_backend(
const DenseMatrix<MT,false>& dm,
TrueType )
1594 const size_t ibegin( ( IsStrictlyLower_v<MT> )?( 1UL ):( 0UL ) );
1595 const size_t iend ( ( IsStrictlyUpper_v<MT> )?( (*dm).rows()-1UL ):( (*dm).rows() ) );
1597 for(
size_t i=ibegin; i<iend; ++i ) {
1598 if( !IsUpper_v<MT> ) {
1599 for(
size_t j=0UL; j<i; ++j ) {
1600 if( !isDefault<RF>( (*dm)(i,j) ) )
1604 if( !isDefault<RF>( (*dm)(i,i) ) )
1606 if( !IsLower_v<MT> ) {
1607 for(
size_t j=i+1UL; j<(*dm).columns(); ++j ) {
1608 if( !isDefault<RF>( (*dm)(i,j) ) )
1630bool isUniform_backend(
const DenseMatrix<MT,true>& dm,
TrueType )
1638 const size_t jbegin( ( IsStrictlyUpper_v<MT> )?( 1UL ):( 0UL ) );
1639 const size_t jend ( ( IsStrictlyLower_v<MT> )?( (*dm).columns()-1UL ):( (*dm).columns() ) );
1641 for(
size_t j=jbegin; j<jend; ++j ) {
1642 if( !IsLower_v<MT> ) {
1643 for(
size_t i=0UL; i<j; ++i ) {
1644 if( !isDefault<RF>( (*dm)(i,j) ) )
1648 if( !isDefault<RF>( (*dm)(j,j) ) )
1650 if( !IsUpper_v<MT> ) {
1651 for(
size_t i=j+1UL; i<(*dm).rows(); ++i ) {
1652 if( !isDefault<RF>( (*dm)(i,j) ) )
1674bool isUniform_backend(
const DenseMatrix<MT,false>& dm,
FalseType )
1682 const auto& cmp( (*dm)(0UL,0UL) );
1684 for(
size_t i=0UL; i<(*dm).rows(); ++i ) {
1685 for(
size_t j=0UL; j<(*dm).columns(); ++j ) {
1686 if( !equal<RF>( (*dm)(i,j), cmp ) )
1707bool isUniform_backend(
const DenseMatrix<MT,true>& dm,
FalseType )
1715 const auto& cmp( (*dm)(0UL,0UL) );
1717 for(
size_t j=0UL; j<(*dm).columns(); ++j ) {
1718 for(
size_t i=0UL; i<(*dm).rows(); ++i ) {
1719 if( !equal<RF>( (*dm)(i,j), cmp ) )
1768 if( IsUniform_v<MT> ||
1769 (*dm).rows() == 0UL || (*dm).columns() == 0UL ||
1770 ( (*dm).rows() == 1UL && (*dm).columns() == 1UL ) )
1773 if( IsUniTriangular_v<MT> )
1821 const size_t M( (*dm).rows() );
1822 const size_t N( (*dm).columns() );
1824 if( IsZero_v<MT> || M == 0UL || N == 0UL )
1827 if( IsUniTriangular_v<MT> )
1830 if( IsUniform_v<MT> )
1831 return isZero<RF>( (*dm)(0UL,0UL) );
1837 for(
size_t i=0UL; i<M; ++i )
1839 const size_t jbegin( IsUpper_v<MT>
1840 ? ( IsStrictlyUpper_v<MT> ? i+1UL : i )
1842 const size_t jend ( IsLower_v<MT> || IsSymmetric_v<MT> || IsHermitian_v<MT>
1843 ? ( IsStrictlyLower_v<MT> ? i : i+1UL )
1846 for(
size_t j=jbegin; j<jend; ++j ) {
1847 if( !isZero<RF>( A(i,j) ) )
1854 for(
size_t j=0UL; j<N; ++j )
1856 const size_t ibegin( IsLower_v<MT>
1857 ? ( IsStrictlyLower_v<MT> ? j+1UL : j )
1859 const size_t iend ( IsUpper_v<MT> || IsSymmetric_v<MT> || IsHermitian_v<MT>
1860 ? ( IsStrictlyUpper_v<MT> ? j : j+1UL )
1863 for(
size_t i=ibegin; i<iend; ++i ) {
1864 if( !isZero<RF>( A(i,j) ) )
1934 if( IsZero_v<MT> || (*dm).rows() < 2UL )
1939 if( IsUniform_v<MT> )
1940 return isDefault<RF>( A(0UL,0UL) );
1943 for(
size_t i=0UL; i<A.rows()-1UL; ++i ) {
1944 for(
size_t j=i+1UL; j<A.columns(); ++j ) {
1945 if( !isDefault<RF>( A(i,j) ) )
1951 for(
size_t j=1UL; j<A.columns(); ++j ) {
1952 for(
size_t i=0UL; i<j; ++i ) {
1953 if( !isDefault<RF>( A(i,j) ) )
2016 if( IsUniLower_v<MT> )
2025 for(
size_t i=0UL; i<A.rows(); ++i ) {
2026 if( !isOne<RF>( A(i,i) ) )
2028 for(
size_t j=i+1UL; j<A.columns(); ++j ) {
2029 if( !isZero<RF>( A(i,j) ) )
2035 for(
size_t j=0UL; j<A.columns(); ++j ) {
2036 for(
size_t i=0UL; i<j; ++i ) {
2037 if( !isZero<RF>( A(i,j) ) )
2040 if( !isOne<RF>( A(j,j) ) )
2103 if( IsStrictlyLower_v<MT> )
2109 if( IsZero_v<MT> || (*dm).rows() < 2UL )
2112 if( IsUniLower_v<MT> || IsUniUpper_v<MT> )
2117 if( IsUniform_v<MT> )
2118 return isDefault<RF>( A(0UL,0UL) );
2121 for(
size_t i=0UL; i<A.rows(); ++i ) {
2122 for(
size_t j=i; j<A.columns(); ++j ) {
2123 if( !isDefault<RF>( A(i,j) ) )
2129 for(
size_t j=0UL; j<A.columns(); ++j ) {
2130 for(
size_t i=0UL; i<=j; ++i ) {
2131 if( !isDefault<RF>( A(i,j) ) )
2201 if( IsZero_v<MT> || (*dm).rows() < 2UL )
2206 if( IsUniform_v<MT> )
2207 return isDefault<RF>( A(0UL,0UL) );
2210 for(
size_t i=1UL; i<A.rows(); ++i ) {
2211 for(
size_t j=0UL; j<i; ++j ) {
2212 if( !isDefault<RF>( A(i,j) ) )
2218 for(
size_t j=0UL; j<A.columns()-1UL; ++j ) {
2219 for(
size_t i=j+1UL; i<A.rows(); ++i ) {
2220 if( !isDefault<RF>( A(i,j) ) )
2283 if( IsUniUpper_v<MT> )
2292 for(
size_t i=0UL; i<A.rows(); ++i ) {
2293 for(
size_t j=0UL; j<i; ++j ) {
2294 if( !isZero<RF>( A(i,j) ) )
2297 if( !isOne<RF>( A(i,i) ) )
2302 for(
size_t j=0UL; j<A.columns(); ++j ) {
2303 if( !isOne<RF>( A(j,j) ) )
2305 for(
size_t i=j+1UL; i<A.rows(); ++i ) {
2306 if( !isZero<RF>( A(i,j) ) )
2370 if( IsStrictlyUpper_v<MT> )
2376 if( IsZero_v<MT> || (*dm).rows() < 2UL )
2379 if( IsUniLower_v<MT> || IsUniUpper_v<MT> )
2384 if( IsUniform_v<MT> )
2385 return isDefault<RF>( A(0UL,0UL) );
2388 for(
size_t i=0UL; i<A.rows(); ++i ) {
2389 for(
size_t j=0UL; j<=i; ++j ) {
2390 if( !isDefault<RF>( A(i,j) ) )
2396 for(
size_t j=0UL; j<A.columns(); ++j ) {
2397 for(
size_t i=j; i<A.rows(); ++i ) {
2398 if( !isDefault<RF>( A(i,j) ) )
2463 if( IsDiagonal_v<MT> )
2469 if( IsZero_v<MT> || (*dm).rows() < 2UL )
2474 if( IsUniform_v<MT> )
2475 return isDefault<RF>( A(0UL,0UL) );
2478 for(
size_t i=0UL; i<A.rows(); ++i ) {
2479 if( !IsUpper_v<MT> ) {
2480 for(
size_t j=0UL; j<i; ++j ) {
2481 if( !isDefault<RF>( A(i,j) ) )
2485 if( !IsLower_v<MT> ) {
2486 for(
size_t j=i+1UL; j<A.columns(); ++j ) {
2487 if( !isDefault<RF>( A(i,j) ) )
2494 for(
size_t j=0UL; j<A.columns(); ++j ) {
2495 if( !IsLower_v<MT> ) {
2496 for(
size_t i=0UL; i<j; ++i ) {
2497 if( !isDefault<RF>( A(i,j) ) )
2501 if( !IsUpper_v<MT> ) {
2502 for(
size_t i=j+1UL; i<A.rows(); ++i ) {
2503 if( !isDefault<RF>( A(i,j) ) )
2568 if( IsIdentity_v<MT> )
2574 if( (*dm).rows() == 0UL )
2580 for(
size_t i=0UL; i<A.rows(); ++i ) {
2581 if( !IsUpper_v<MT> ) {
2582 for(
size_t j=0UL; j<i; ++j ) {
2583 if( !isZero<RF>( A(i,j) ) )
2587 if( !IsUniLower_v<MT> && !IsUniUpper_v<MT> && !isOne<RF>( A(i,i) ) ) {
2590 if( !IsLower_v<MT> ) {
2591 for(
size_t j=i+1UL; j<A.columns(); ++j ) {
2592 if( !isZero<RF>( A(i,j) ) )
2599 for(
size_t j=0UL; j<A.columns(); ++j ) {
2600 if( !IsLower_v<MT> ) {
2601 for(
size_t i=0UL; i<j; ++i ) {
2602 if( !isZero<RF>( A(i,j) ) )
2606 if( !IsUniLower_v<MT> && !IsUniUpper_v<MT> && !isOne<RF>( A(j,j) ) ) {
2609 if( !IsUpper_v<MT> ) {
2610 for(
size_t i=j+1UL; i<A.rows(); ++i ) {
2611 if( !isZero<RF>( A(i,j) ) )
2655template<
typename MT
2664 if( (*dm).rows() < 2UL )
2669 char uplo( IsRowMajorMatrix_v<MT> ?
'U' :
'L' );
2670 blas_int_t n ( numeric_cast<blas_int_t>( (*L).rows() ) );
2671 blas_int_t lda ( numeric_cast<blas_int_t>( (*L).spacing()) );
2674 potrf( uplo, n, (*L).data(), lda, &info );
2676 return ( info == 0 );
2713template<
typename MT
2725 return std::count_if(
begin(s),
end(s), [tolerance](
auto val ) {
return abs(val) > tolerance; } );
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
Header file for run time assertion macros.
Constraint on the data type.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the conjugate shim.
Header file for the EnableIf class template.
Numerical epsilon value for floating point data types.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the IsBuiltin type trait.
Header file for the isDefault shim.
Header file for the IsDiagonal type trait.
Header file for the isDivisor shim.
Header file for the IsExpression type trait class.
Header file for the isfinite shim.
Header file for the IsFloatingPoint type trait.
Header file for the IsHermitian type trait.
Header file for the IsIdentity type trait.
Header file for the isinf shim.
Header file for the IsLower type trait.
Header file for the isnan shim.
Header file for the isOne shim.
Header file for the isReal shim.
Header file for the IsRestricted type trait.
Header file for the IsRowMajorMatrix type trait.
Header file for the IsScalar type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the IsTriangular type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniTriangular type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUpper type trait.
Numerical limits of built-in data types.
Cast operators for numeric types.
Header file for the reduction flags.
Header file for the relaxation flag enumeration.
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the UnderlyingBuiltin type trait.
Constraint on the data type.
Header file for the CLAPACK potrf wrapper functions.
Base class for dense matrices.
Definition: DenseMatrix.h:82
Constraint on the data type.
Constraint on the data type.
Header file for the DenseMatrix base class.
auto operator+=(DenseMatrix< MT, SO > &&mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a temporary dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:424
auto operator*=(DenseMatrix< MT, SO > &&mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a temporary dense matrix and a scalar va...
Definition: DenseMatrix.h:548
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:2096
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
auto operator!=(T1 scalar, const DenseMatrix< T2, SO > &mat) -> EnableIf_t< IsScalar_v< T2 >, bool >
Inequality operator for the comparison of a scalar value and a dense matrix.
Definition: DenseMatrix.h:362
bool isinf(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for infinite elements.
Definition: DenseMatrix.h:1339
auto operator-=(DenseMatrix< MT, SO > &&mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a temporary dense matrix and a scalar value ( ...
Definition: DenseMatrix.h:486
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1464
MT1 & operator<<=(DenseMatrix< MT1, SO1 > &&lhs, const DenseMatrix< MT2, SO2 > &rhs)
Left-shift assignment operator for the elementwise left-shift of a temporary dense matrix.
Definition: DenseMatrix.h:731
MT1 & operator>>=(DenseMatrix< MT1, SO1 > &&lhs, const DenseMatrix< MT2, SO2 > &rhs)
Right-shift assignment operator for the elementwise right-shift of a temporary dense.
Definition: DenseMatrix.h:845
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1921
MT1 & operator|=(DenseMatrix< MT1, SO1 > &&lhs, const DenseMatrix< MT2, SO2 > &rhs)
Bitwise OR assignment operator for the bitwise OR of a temporary dense matrix.
Definition: DenseMatrix.h:1083
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1766
decltype(auto) abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1296
bool isPositiveDefinite(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a positive definite matrix.
Definition: DenseMatrix.h:2657
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition: DenseMatrix.h:1290
void svd(const DenseMatrix< MT, SO > &A, DenseVector< VT, TF > &s)
Singular value decomposition (SVD) of the given dense general matrix.
Definition: SVD.h:135
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:2009
auto operator/=(DenseMatrix< MT, SO > &&mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Division assignment operator for the division of a temporary dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:616
size_t rank(const DenseMatrix< MT, SO > &dm)
Computes the rank of the given dense matrix.
Definition: DenseMatrix.h:2715
bool isfinite(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for finite elements.
Definition: DenseMatrix.h:1389
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:2363
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:1534
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:1456
bool isUniUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper unitriangular matrix.
Definition: DenseMatrix.h:2276
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is diagonal.
Definition: DenseMatrix.h:2456
bool isZero(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a zero matrix.
Definition: DenseMatrix.h:1819
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:2188
MT1 & operator&=(DenseMatrix< MT1, SO1 > &&lhs, const DenseMatrix< MT2, SO2 > &rhs)
Bitwise AND assignment operator for the bitwise AND of a temporary dense matrix.
Definition: DenseMatrix.h:964
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an identity matrix.
Definition: DenseMatrix.h:2561
auto operator==(T1 scalar, const DenseMatrix< T2, SO > &mat) -> EnableIf_t< IsScalar_v< T2 >, bool >
Equality operator for the comparison of a scalar value and a dense matrix.
Definition: DenseMatrix.h:316
MT1 & operator^=(DenseMatrix< MT1, SO1 > &&lhs, const DenseMatrix< MT2, SO2 > &rhs)
Bitwise XOR assignment operator for the bitwise XOR of a temporary dense matrix.
Definition: DenseMatrix.h:1202
bool isDivisor(const DenseVector< VT, TF > &dv)
Returns whether the given dense vector is a valid divisor.
Definition: DenseVector.h:1261
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
void potrf(char uplo, blas_int_t n, float *A, blas_int_t lda, blas_int_t *info)
LAPACK kernel for the Cholesky decomposition of the given dense positive definite single precision co...
Definition: potrf.h:137
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.
Definition: BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Triangular.h:81
#define BLAZE_CONSTRAINT_MUST_BE_TRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Triangular.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: UniTriangular.h:81
typename UnderlyingBuiltin< T >::Type UnderlyingBuiltin_t
Auxiliary alias declaration for the UnderlyingBuiltin type trait.
Definition: UnderlyingBuiltin.h:117
typename RemoveAdaptor< T >::Type RemoveAdaptor_t
Auxiliary alias declaration for the RemoveAdaptor type trait.
Definition: RemoveAdaptor.h:153
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
int32_t blas_int_t
Signed integer type used in the BLAS/LAPACK wrapper functions.
Definition: Types.h:64
MT::ResultType evaluate(const Matrix< MT, SO > &matrix)
Evaluates the given matrix expression.
Definition: Matrix.h:1282
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:644
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:660
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:518
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
bool equal(const SharedValue< T1 > &lhs, const SharedValue< T2 > &rhs)
Equality check for a two shared values.
Definition: SharedValue.h:343
constexpr bool IsFloatingPoint_v
Auxiliary variable template for the IsFloatingPoint type trait.
Definition: IsFloatingPoint.h:95
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
BoolConstant< false > FalseType
Type/value traits base class.
Definition: IntegralConstant.h:121
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
Header file for the matrix storage order types.
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the equal shim.
Header file for the isZero shim.
Compile time check for triangular matrix types.
Definition: IsTriangular.h:88
Numerical limits of built-in data types.
Definition: Limits.h:108
Header file for the IsZero type trait.
Header file for basic type definitions.
Header file for the generic max algorithm.