35 #ifndef _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_H_
98 template<
typename MT,
bool SO,
bool DF >
99 inline void reset( UniLowerMatrix<MT,SO,DF>& m );
101 template<
typename MT,
bool SO,
bool DF >
102 inline void reset( UniLowerMatrix<MT,SO,DF>& m,
size_t i );
104 template<
typename MT,
bool SO,
bool DF >
105 inline void clear( UniLowerMatrix<MT,SO,DF>& m );
107 template<
typename MT,
bool SO,
bool DF >
108 inline bool isDefault(
const UniLowerMatrix<MT,SO,DF>& m );
110 template<
typename MT,
bool SO,
bool DF >
111 inline bool isIntact(
const UniLowerMatrix<MT,SO,DF>& m );
113 template<
typename MT,
bool SO,
bool DF >
114 inline void swap( UniLowerMatrix<MT,SO,DF>& a, UniLowerMatrix<MT,SO,DF>& b ) ;
126 template<
typename MT
149 template<
typename MT
166 template<
typename MT
186 template<
typename MT
189 inline bool isDefault_backend(
const UniLowerMatrix<MT,SO,DF>& m,
TrueType )
191 return ( m.rows() == 0UL );
207 template<
typename MT
210 inline bool isDefault_backend(
const UniLowerMatrix<MT,SO,DF>& m,
FalseType )
237 template<
typename MT
268 template<
typename MT
287 template<
typename MT
311 template<
typename MT
313 inline void invert2x2( UniLowerMatrix<MT,SO,true>& m )
322 typename DerestrictTrait<MT>::Type A( derestrict( m ) );
346 template<
typename MT
348 inline void invert3x3( UniLowerMatrix<MT,SO,true>& m )
357 const StaticMatrix<ET,3UL,3UL,SO> A( m );
358 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
361 B(2,0) = A(1,0)*A(2,1) - A(2,0);
384 template<
typename MT
386 inline void invert4x4( UniLowerMatrix<MT,SO,true>& m )
395 const StaticMatrix<ET,4UL,4UL,SO> A( m );
396 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
398 const ET tmp( A(2,1)*A(3,2) - A(3,1) );
401 B(2,0) = A(1,0)*A(2,1) - A(2,0);
402 B(3,0) = A(2,0)*A(3,2) - A(3,0) - A(1,0)*tmp;
427 template<
typename MT
429 inline void invert5x5( UniLowerMatrix<MT,SO,true>& m )
438 const StaticMatrix<ET,5UL,5UL,SO> A( m );
439 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
441 const ET tmp1( A(3,2)*A(4,3) - A(4,2) );
442 const ET tmp2( A(2,1)*A(3,2) - A(3,1) );
443 const ET tmp3( A(2,1)*tmp1 - A(3,1)*A(4,3) + A(4,1) );
446 B(2,0) = A(1,0)*A(2,1) - A(2,0);
447 B(3,0) = - A(1,0)*tmp2 + A(2,0)*A(3,2) - A(3,0);
448 B(4,0) = A(1,0)*tmp3 - A(2,0)*tmp1 + A(3,0)*A(4,3) - A(4,0);
453 B(4,2) = A(4,3)*A(3,2) - A(4,2);
476 template<
typename MT
478 inline void invert6x6( UniLowerMatrix<MT,SO,true>& m )
487 const StaticMatrix<ET,6UL,6UL,SO> A( m );
488 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
490 const ET tmp1( A(4,3)*A(5,4) - A(5,3) );
491 const ET tmp2( A(3,2)*A(4,3) - A(4,2) );
492 const ET tmp3( A(3,2)*tmp1 - A(4,2)*A(5,4) + A(5,2) );
493 const ET tmp4( A(2,1)*A(3,2) - A(3,1) );
494 const ET tmp5( A(2,1)*tmp2 - A(3,1)*A(4,3) + A(4,1) );
495 const ET tmp6( A(2,1)*tmp3 - A(3,1)*tmp1 + A(4,1)*A(5,4) - A(5,1) );
498 B(2,0) = A(1,0)*A(2,1) - A(2,0);
499 B(3,0) = - A(1,0)*tmp4 + A(2,0)*A(3,2) - A(3,0);
500 B(4,0) = A(1,0)*tmp5 - A(2,0)*tmp2 + A(3,0)*A(4,3) - A(4,0);
501 B(5,0) = - A(1,0)*tmp6 + A(2,0)*tmp3 - A(3,0)*tmp1 + A(4,0)*A(5,4) - A(5,0);
509 B(4,3) = A(5,3)*A(4,5) - A(4,3);
510 B(5,3) = A(5,4)*A(4,3) - A(5,3);
511 B(5,4) = A(5,3)*A(3,4) - A(5,4);
540 template<
typename MT
542 inline void invertByDefault( UniLowerMatrix<MT,SO,true>& m )
570 template<
typename MT
572 inline void invertByLU( UniLowerMatrix<MT,SO,true>& m )
576 typename DerestrictTrait<MT>::Type A( derestrict( ~m ) );
578 trtri( A,
'L',
'U' );
603 template<
typename MT
605 inline void invertByLDLT( UniLowerMatrix<MT,SO,true>& m )
630 template<
typename MT
632 inline void invertByLDLH( UniLowerMatrix<MT,SO,true>& m )
654 template<
typename MT
656 inline void invertByLLH( UniLowerMatrix<MT,SO,true>& m )
687 template<
typename MT1,
bool SO1,
typename MT2,
typename MT3,
typename MT4,
bool SO2 >
688 inline void lu(
const UniLowerMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
689 DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
706 const size_t n( (~A).
rows() );
708 typename DerestrictTrait<MT3>::Type U2( derestrict( ~U ) );
718 for(
size_t i=0UL; i<n; ++i ) {
743 template<
typename MT
747 inline bool tryAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
748 const DenseVector<VT,false>& rhs,
size_t row,
size_t column )
761 const bool containsDiagonal( column < row + (~rhs).
size() );
762 const size_t iend(
min( column - row, (~rhs).
size() ) );
764 for(
size_t i=0UL; i<iend; ++i ) {
769 if( containsDiagonal && !
isOne( (~rhs)[iend] ) )
794 template<
typename MT
798 inline bool tryAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
799 const DenseVector<VT,true>& rhs,
size_t row,
size_t column )
809 if( row >= column + (~rhs).
size() )
812 const bool containsDiagonal( row >= column );
813 const size_t ibegin( ( !containsDiagonal )?( 0UL ):( row - column + 1UL ) );
815 if( containsDiagonal && !
isOne( (~rhs)[row-column] ) )
818 for(
size_t i=ibegin; i<(~rhs).
size(); ++i ) {
845 template<
typename MT
849 inline bool tryAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
850 const SparseVector<VT,false>& rhs,
size_t row,
size_t column )
865 const bool containsDiagonal( column < row + (~rhs).
size() );
866 const size_t index( column - row );
867 const RhsIterator last( (~rhs).lowerBound( index ) );
869 if( containsDiagonal ) {
870 if( last == (~rhs).
end() || last->index() != index || !
isOne( last->value() ) )
874 for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
901 template<
typename MT
905 inline bool tryAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
906 const SparseVector<VT,true>& rhs,
size_t row,
size_t column )
918 if( row >= column + (~rhs).
size() )
921 const bool containsDiagonal( row >= column );
922 const size_t index( ( containsDiagonal )?( row - column ):( 0UL ) );
923 const RhsIterator last( (~rhs).
end() );
924 RhsIterator element( (~rhs).lowerBound( index ) );
926 if( containsDiagonal ) {
927 if( element == last || element->index() != index || !
isOne( element->value() ) )
932 for( ; element!=last; ++element ) {
959 template<
typename MT1
963 inline bool tryAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
964 const DenseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
975 const size_t M( (~rhs).
rows() );
976 const size_t N( (~rhs).
columns() );
978 if( row + 1UL >= column + N )
981 const size_t iend(
min( column + N - row, M ) );
983 for(
size_t i=0UL; i<iend; ++i )
985 const bool containsDiagonal( row + i >= column );
987 if( containsDiagonal && !
isOne( (~rhs)(i,row+i-column) ) )
990 const size_t jbegin( ( containsDiagonal )?( row + i - column + 1UL ):( 0UL ) );
992 for(
size_t j=jbegin; j<N; ++j ) {
1020 template<
typename MT1
1024 inline bool tryAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
1025 const DenseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
1036 const size_t M( (~rhs).
rows() );
1037 const size_t N( (~rhs).
columns() );
1039 if( row + 1UL >= column + N )
1042 const size_t jbegin( ( row < column )?( 0UL ):( row - column ) );
1044 for(
size_t j=jbegin; j<N; ++j )
1046 const size_t iend(
min( column + j - row, M ) );
1048 for(
size_t i=0UL; i<iend; ++i ) {
1053 const bool containsDiagonal( column + j < row + M );
1055 if( containsDiagonal && !
isOne( (~rhs)(iend,j) ) )
1081 template<
typename MT1
1085 inline bool tryAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
1086 const SparseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
1099 const size_t M( (~rhs).
rows() );
1100 const size_t N( (~rhs).
columns() );
1102 if( row + 1UL >= column + N )
1105 const size_t iend(
min( column + N - row, M ) );
1107 for(
size_t i=0UL; i<iend; ++i )
1109 const bool containsDiagonal( row + i >= column );
1110 const size_t index( ( containsDiagonal )?( row + i - column ):( 0UL ) );
1112 const RhsIterator last( (~rhs).
end(i) );
1113 RhsIterator element( (~rhs).lowerBound( i, index ) );
1115 if( containsDiagonal ) {
1116 if( element == last || ( element->index() != index ) || !
isOne( element->value() ) )
1121 for( ; element!=last; ++element ) {
1149 template<
typename MT1
1153 inline bool tryAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
1154 const SparseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
1167 const size_t M( (~rhs).
rows() );
1168 const size_t N( (~rhs).
columns() );
1170 if( row + 1UL >= column + N )
1173 const size_t jbegin( ( row < column )?( 0UL ):( row - column ) );
1175 for(
size_t j=jbegin; j<N; ++j )
1177 const bool containsDiagonal( column + j < row + M );
1179 const size_t index( column + j - row );
1180 const RhsIterator last( (~rhs).lowerBound(
min( index, M ), j ) );
1182 if( containsDiagonal ) {
1183 if( last == (~rhs).
end(j) || ( last->index() != index ) || !
isOne( last->value() ) )
1187 for( RhsIterator element=(~rhs).begin(j); element!=last; ++element ) {
1216 template<
typename MT
1220 inline bool tryAddAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
1221 const DenseVector<VT,false>& rhs,
size_t row,
size_t column )
1234 const size_t iend(
min( column - row + 1UL, (~rhs).
size() ) );
1236 for(
size_t i=0UL; i<iend; ++i ) {
1264 template<
typename MT
1268 inline bool tryAddAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
1269 const DenseVector<VT,true>& rhs,
size_t row,
size_t column )
1279 const size_t ibegin( ( row <= column )?( 0UL ):( row - column ) );
1281 for(
size_t i=ibegin; i<(~rhs).
size(); ++i ) {
1309 template<
typename MT
1313 inline bool tryAddAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
1314 const SparseVector<VT,false>& rhs,
size_t row,
size_t column )
1329 const RhsIterator last( (~rhs).lowerBound( column - row + 1UL ) );
1331 for( RhsIterator element=(~rhs).
begin(); element!=last; ++element ) {
1359 template<
typename MT
1363 inline bool tryAddAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
1364 const SparseVector<VT,true>& rhs,
size_t row,
size_t column )
1376 const RhsIterator last( (~rhs).
end() );
1377 RhsIterator element( (~rhs).lowerBound( ( row <= column )?( 0UL ):( row - column ) ) );
1379 for( ; element!=last; ++element ) {
1407 template<
typename MT1
1411 inline bool tryAddAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
1412 const DenseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
1423 const size_t M( (~rhs).
rows() );
1424 const size_t N( (~rhs).
columns() );
1426 if( row + 1UL >= column + N )
1429 const size_t iend(
min( column + N - row, M ) );
1431 for(
size_t i=0UL; i<iend; ++i )
1433 const bool containsDiagonal( row + i >= column );
1434 const size_t jbegin( ( containsDiagonal )?( row + i - column ):( 0UL ) );
1436 for(
size_t j=jbegin; j<N; ++j ) {
1465 template<
typename MT1
1469 inline bool tryAddAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
1470 const DenseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
1481 const size_t M( (~rhs).
rows() );
1482 const size_t N( (~rhs).
columns() );
1484 if( row + 1UL >= column + N )
1487 const size_t jbegin( ( row <= column )?( 0UL ):( row - column ) );
1489 for(
size_t j=jbegin; j<N; ++j )
1491 const size_t iend(
min( column + j - row + 1UL, M ) );
1493 for(
size_t i=0UL; i<iend; ++i ) {
1522 template<
typename MT1
1526 inline bool tryAddAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
1527 const SparseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
1540 const size_t M( (~rhs).
rows() );
1541 const size_t N( (~rhs).
columns() );
1543 if( row + 1UL >= column + N )
1546 const size_t iend(
min( column + N - row, M ) );
1548 for(
size_t i=0UL; i<iend; ++i )
1550 const bool containsDiagonal( row + i >= column );
1551 const size_t index( ( containsDiagonal )?( row + i - column ):( 0UL ) );
1553 const RhsIterator last( (~rhs).
end(i) );
1554 RhsIterator element( (~rhs).lowerBound( i, index ) );
1556 for( ; element!=last; ++element ) {
1585 template<
typename MT1
1589 inline bool tryAddAssign(
const UniLowerMatrix<MT1,SO,DF>& lhs,
1590 const SparseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
1603 const size_t M( (~rhs).
rows() );
1604 const size_t N( (~rhs).
columns() );
1606 if( row + 1UL >= column + N )
1609 const size_t jbegin( ( row < column )?( 0UL ):( row - column ) );
1611 for(
size_t j=jbegin; j<N; ++j )
1613 const size_t index( column + j - row + 1UL );
1614 const RhsIterator last( (~rhs).lowerBound(
min( index, M ), j ) );
1616 for( RhsIterator element=(~rhs).
begin(j); element!=last; ++element ) {
1645 template<
typename MT
1650 inline bool trySubAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
1651 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1653 return tryAddAssign( lhs, ~rhs, row, column );
1676 template<
typename MT1
1681 inline bool trySubAssign(
const UniLowerMatrix<MT1,SO1,DF>& lhs,
1682 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1684 return tryAddAssign( lhs, ~rhs, row, column );
1707 template<
typename MT
1711 inline bool tryMultAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
1712 const Vector<VT,false>& rhs,
size_t row,
size_t column )
1722 return ( column < row || (~rhs).
size() <= column - row ||
isOne( (~rhs)[column-row] ) );
1745 template<
typename MT
1749 inline bool tryMultAssign(
const UniLowerMatrix<MT,SO,DF>& lhs,
1750 const Vector<VT,true>& rhs,
size_t row,
size_t column )
1760 return ( row < column || (~rhs).
size() <= row - column ||
isOne( (~rhs)[row-column] ) );
1780 template<
typename MT
1783 inline MT& derestrict( UniLowerMatrix<MT,SO,DF>& m )
1801 template<
typename MT,
bool SO,
bool DF >
1802 struct Rows< UniLowerMatrix<MT,SO,DF> > :
public Rows<MT>
1818 template<
typename MT,
bool SO,
bool DF >
1819 struct Columns< UniLowerMatrix<MT,SO,DF> > :
public Columns<MT>
1835 template<
typename MT,
bool SO,
bool DF >
1836 struct IsSquare< UniLowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1852 template<
typename MT,
bool SO,
bool DF >
1853 struct IsUniLower< UniLowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1869 template<
typename MT,
bool SO,
bool DF >
1870 struct IsAdaptor< UniLowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1886 template<
typename MT,
bool SO,
bool DF >
1887 struct IsRestricted< UniLowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1903 template<
typename MT,
bool SO >
1904 struct HasConstDataAccess< UniLowerMatrix<MT,SO,true> > :
public IsTrue<true>
1920 template<
typename MT,
bool SO,
bool DF >
1921 struct IsAligned< UniLowerMatrix<MT,SO,DF> > :
public IsTrue< IsAligned<MT>::value >
1937 template<
typename MT,
bool SO,
bool DF >
1938 struct IsPadded< UniLowerMatrix<MT,SO,DF> > :
public IsTrue< IsPadded<MT>::value >
1954 template<
typename MT,
bool SO,
bool DF >
1955 struct IsResizable< UniLowerMatrix<MT,SO,DF> > :
public IsTrue< IsResizable<MT>::value >
1971 template<
typename MT,
bool SO,
bool DF >
1972 struct RemoveAdaptor< UniLowerMatrix<MT,SO,DF> >
1990 template<
typename MT,
bool SO,
bool DF >
1991 struct DerestrictTrait< UniLowerMatrix<MT,SO,DF> >
2009 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
2010 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
2012 typedef typename AddTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
2015 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
2016 struct AddTrait< StaticMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2018 typedef typename AddTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
2021 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
2022 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
2024 typedef typename AddTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
2027 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
2028 struct AddTrait< HybridMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2030 typedef typename AddTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
2033 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
2034 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
2036 typedef typename AddTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
2039 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
2040 struct AddTrait< DynamicMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2042 typedef typename AddTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
2045 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool AF,
bool PF,
bool SO2 >
2046 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
2048 typedef typename AddTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
2051 template<
typename T,
bool AF,
bool PF,
bool SO1,
typename MT,
bool SO2,
bool DF >
2052 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, UniLowerMatrix<MT,SO2,DF> >
2054 typedef typename AddTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
2057 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
2058 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
2060 typedef typename AddTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
2063 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
2064 struct AddTrait< CompressedMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2066 typedef typename AddTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
2069 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2,
bool NF >
2070 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
2072 typedef typename AddTrait<MT1,MT2>::Type Type;
2075 template<
typename MT1,
bool SO1,
bool DF1,
bool NF,
typename MT2,
bool SO2,
bool DF2 >
2076 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniLowerMatrix<MT2,SO2,DF2> >
2078 typedef typename AddTrait<MT1,MT2>::Type Type;
2081 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2082 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
2084 typedef typename AddTrait<MT1,MT2>::Type Type;
2087 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2088 struct AddTrait< HermitianMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2090 typedef typename AddTrait<MT1,MT2>::Type Type;
2093 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2094 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2096 typedef LowerMatrix< typename AddTrait<MT1,MT2>::Type > Type;
2099 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2100 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2102 typedef LowerMatrix< typename AddTrait<MT1,MT2>::Type > Type;
2105 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2106 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2108 typedef LowerMatrix< typename AddTrait<MT1,MT2>::Type > Type;
2124 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
2125 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
2127 typedef typename SubTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
2130 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
2131 struct SubTrait< StaticMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2133 typedef typename SubTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
2136 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
2137 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
2139 typedef typename SubTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
2142 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
2143 struct SubTrait< HybridMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2145 typedef typename SubTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
2148 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
2149 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
2151 typedef typename SubTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
2154 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
2155 struct SubTrait< DynamicMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2157 typedef typename SubTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
2160 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool AF,
bool PF,
bool SO2 >
2161 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
2163 typedef typename SubTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
2166 template<
typename T,
bool AF,
bool PF,
bool SO1,
typename MT,
bool SO2,
bool DF >
2167 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, UniLowerMatrix<MT,SO2,DF> >
2169 typedef typename SubTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
2172 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
2173 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
2175 typedef typename SubTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
2178 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
2179 struct SubTrait< CompressedMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2181 typedef typename SubTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
2184 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2,
bool NF >
2185 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
2187 typedef typename SubTrait<MT1,MT2>::Type Type;
2190 template<
typename MT1,
bool SO1,
bool DF1,
bool NF,
typename MT2,
bool SO2,
bool DF2 >
2191 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniLowerMatrix<MT2,SO2,DF2> >
2193 typedef typename SubTrait<MT1,MT2>::Type Type;
2196 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2197 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
2199 typedef typename SubTrait<MT1,MT2>::Type Type;
2202 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2203 struct SubTrait< HermitianMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2205 typedef typename SubTrait<MT1,MT2>::Type Type;
2208 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2209 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2211 typedef LowerMatrix< typename SubTrait<MT1,MT2>::Type > Type;
2214 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2215 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2217 typedef LowerMatrix< typename SubTrait<MT1,MT2>::Type > Type;
2220 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2221 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2223 typedef LowerMatrix< typename SubTrait<MT1,MT2>::Type > Type;
2239 template<
typename MT,
bool SO,
bool DF,
typename T >
2240 struct MultTrait< UniLowerMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
2242 typedef LowerMatrix< typename MultTrait<MT,T>::Type > Type;
2245 template<
typename T,
typename MT,
bool SO,
bool DF >
2246 struct MultTrait< T, UniLowerMatrix<MT,SO,DF>, typename EnableIf< IsNumeric<T> >::Type >
2248 typedef LowerMatrix< typename MultTrait<T,MT>::Type > Type;
2251 template<
typename MT,
bool SO,
bool DF,
typename T,
size_t N >
2252 struct MultTrait< UniLowerMatrix<MT,SO,DF>, StaticVector<T,N,false> >
2254 typedef typename MultTrait< MT, StaticVector<T,N,false> >::Type Type;
2257 template<
typename T,
size_t N,
typename MT,
bool SO,
bool DF >
2258 struct MultTrait< StaticVector<T,N,true>, UniLowerMatrix<MT,SO,DF> >
2260 typedef typename MultTrait< StaticVector<T,N,true>, MT >::Type Type;
2263 template<
typename MT,
bool SO,
bool DF,
typename T,
size_t N >
2264 struct MultTrait< UniLowerMatrix<MT,SO,DF>, HybridVector<T,N,false> >
2266 typedef typename MultTrait< MT, HybridVector<T,N,false> >::Type Type;
2269 template<
typename T,
size_t N,
typename MT,
bool SO,
bool DF >
2270 struct MultTrait< HybridVector<T,N,true>, UniLowerMatrix<MT,SO,DF> >
2272 typedef typename MultTrait< HybridVector<T,N,true>, MT >::Type Type;
2275 template<
typename MT,
bool SO,
bool DF,
typename T >
2276 struct MultTrait< UniLowerMatrix<MT,SO,DF>, DynamicVector<T,false> >
2278 typedef typename MultTrait< MT, DynamicVector<T,false> >::Type Type;
2281 template<
typename T,
typename MT,
bool SO,
bool DF >
2282 struct MultTrait< DynamicVector<T,true>, UniLowerMatrix<MT,SO,DF> >
2284 typedef typename MultTrait< DynamicVector<T,true>, MT >::Type Type;
2287 template<
typename MT,
bool SO,
bool DF,
typename T,
bool AF,
bool PF >
2288 struct MultTrait< UniLowerMatrix<MT,SO,DF>, CustomVector<T,AF,PF,false> >
2290 typedef typename MultTrait< MT, CustomVector<T,AF,PF,false> >::Type Type;
2293 template<
typename T,
bool AF,
bool PF,
typename MT,
bool SO,
bool DF >
2294 struct MultTrait< CustomVector<T,AF,PF,true>, UniLowerMatrix<MT,SO,DF> >
2296 typedef typename MultTrait< CustomVector<T,AF,PF,true>, MT >::Type Type;
2299 template<
typename MT,
bool SO,
bool DF,
typename T >
2300 struct MultTrait< UniLowerMatrix<MT,SO,DF>, CompressedVector<T,false> >
2302 typedef typename MultTrait< MT, CompressedVector<T,false> >::Type Type;
2305 template<
typename T,
typename MT,
bool SO,
bool DF >
2306 struct MultTrait< CompressedVector<T,true>, UniLowerMatrix<MT,SO,DF> >
2308 typedef typename MultTrait< CompressedVector<T,true>, MT >::Type Type;
2311 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
2312 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
2314 typedef typename MultTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
2317 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
2318 struct MultTrait< StaticMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2320 typedef typename MultTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
2323 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
2324 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
2326 typedef typename MultTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
2329 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
2330 struct MultTrait< HybridMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2332 typedef typename MultTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
2335 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
2336 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
2338 typedef typename MultTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
2341 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
2342 struct MultTrait< DynamicMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2344 typedef typename MultTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
2347 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool AF,
bool PF,
bool SO2 >
2348 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
2350 typedef typename MultTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
2353 template<
typename T,
bool AF,
bool PF,
bool SO1,
typename MT,
bool SO2,
bool DF >
2354 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, UniLowerMatrix<MT,SO2,DF> >
2356 typedef typename MultTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
2359 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
2360 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
2362 typedef typename MultTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
2365 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
2366 struct MultTrait< CompressedMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2368 typedef typename MultTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
2371 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2,
bool NF >
2372 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
2374 typedef typename MultTrait<MT1,MT2>::Type Type;
2377 template<
typename MT1,
bool SO1,
bool DF1,
bool NF,
typename MT2,
bool SO2,
bool DF2 >
2378 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniLowerMatrix<MT2,SO2,DF2> >
2380 typedef typename MultTrait<MT1,MT2>::Type Type;
2383 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2384 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
2386 typedef typename MultTrait<MT1,MT2>::Type Type;
2389 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2390 struct MultTrait< HermitianMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2392 typedef typename MultTrait<MT1,MT2>::Type Type;
2395 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2396 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2398 typedef LowerMatrix< typename MultTrait<MT1,MT2>::Type > Type;
2401 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2402 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2404 typedef LowerMatrix< typename MultTrait<MT1,MT2>::Type > Type;
2407 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2408 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2410 typedef UniLowerMatrix< typename MultTrait<MT1,MT2>::Type > Type;
2426 template<
typename MT,
bool SO,
bool DF,
typename T >
2427 struct DivTrait< UniLowerMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
2429 typedef LowerMatrix< typename DivTrait<MT,T>::Type > Type;
2445 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2446 struct MathTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2448 typedef UniLowerMatrix< typename MathTrait<MT1,MT2>::HighType > HighType;
2449 typedef UniLowerMatrix< typename MathTrait<MT1,MT2>::LowType > LowType;
2465 template<
typename MT,
bool SO,
bool DF >
2466 struct SubmatrixTrait< UniLowerMatrix<MT,SO,DF> >
2468 typedef typename SubmatrixTrait<MT>::Type Type;
2484 template<
typename MT,
bool SO,
bool DF >
2485 struct RowTrait< UniLowerMatrix<MT,SO,DF> >
2487 typedef typename RowTrait<MT>::Type Type;
2503 template<
typename MT,
bool SO,
bool DF >
2504 struct ColumnTrait< UniLowerMatrix<MT,SO,DF> >
2506 typedef typename ColumnTrait<MT>::Type Type;
bool isOne(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 1.
Definition: DiagonalProxy.h:609
Header file for mathematical functions.
void trtri(char uplo, char diag, int n, float *A, int lda, int *info)
LAPACK kernel for the inversion of the given dense triangular single precision column-major matrix...
Definition: trtri.h:133
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
Header file for the row trait.
BLAZE_ALWAYS_INLINE 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:250
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:107
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:118
Constraint on the data type.
Header file for the IsUniLower type trait.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
Header file for the IsSquare type trait.
UniLowerMatrix specialization for sparse matrices.
Header file for the multiplication trait.
Header file for the implementation of the base template of the LowerMatrix.
Header file for the LAPACK triangular matrix inversion functions (trtri)
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
void lu(const DenseMatrix< MT1, SO1 > &A, DenseMatrix< MT2, SO1 > &L, DenseMatrix< MT3, SO1 > &U, Matrix< MT4, SO2 > &P)
LU decomposition of the given dense matrix.
Definition: LU.h:217
Header file for the Columns type trait.
Header file for the implementation of a fixed-size matrix.
Header file for the IsAligned type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:118
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:187
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
Header file for the isOne shim.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:107
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:118
Header file for the column trait.
Header file for the isDefault shim.
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BlasCompatible.h:79
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
Header file for the mathematical trait.
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
UniLowerMatrix specialization for dense matrices.
Header file for the IsTrue value trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
Matrix adapter for lower unitriangular matrices.
Definition: Forward.h:53
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:116
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
#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
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1605
Header file for the implementation of the base template of the UniLowerMatrix.