35 #ifndef _BLAZE_MATH_ADAPTORS_LOWERMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_LOWERMATRIX_H_
98 template<
typename MT,
bool SO,
bool DF >
99 inline void reset( LowerMatrix<MT,SO,DF>& m );
101 template<
typename MT,
bool SO,
bool DF >
102 inline void reset( LowerMatrix<MT,SO,DF>& m,
size_t i );
104 template<
typename MT,
bool SO,
bool DF >
105 inline void clear( LowerMatrix<MT,SO,DF>& m );
107 template<
typename MT,
bool SO,
bool DF >
108 inline bool isDefault(
const LowerMatrix<MT,SO,DF>& m );
110 template<
typename MT,
bool SO,
bool DF >
111 inline bool isIntact(
const LowerMatrix<MT,SO,DF>& m );
113 template<
typename MT,
bool SO,
bool DF >
114 inline void swap( LowerMatrix<MT,SO,DF>& a, LowerMatrix<MT,SO,DF>& b ) ;
126 template<
typename MT
149 template<
typename MT
166 template<
typename MT
197 template<
typename MT
228 template<
typename MT
247 template<
typename MT
273 template<
typename MT
275 inline void invert2x2( LowerMatrix<MT,SO,true>& m )
284 typename DerestrictTrait<MT>::Type A( derestrict( m ) );
286 const ET
det( A(0,0) * A(1,1) );
292 const ET idet( ET(1) /
det );
293 const ET a11( A(0,0) * idet );
295 A(0,0) = A(1,1) * idet;
296 A(1,0) = -A(1,0) * idet;
321 template<
typename MT
323 inline void invert3x3( LowerMatrix<MT,SO,true>& m )
332 const StaticMatrix<ET,3UL,3UL,SO> A( m );
333 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
335 const ET tmp( A(1,1)*A(2,2) );
336 const ET
det( A(0,0)*tmp );
343 B(1,0) = - A(1,0)*A(2,2);
344 B(2,0) = A(1,0)*A(2,1) - A(1,1)*A(2,0);
345 B(1,1) = A(0,0)*A(2,2);
346 B(2,1) = - A(0,0)*A(2,1);
347 B(2,2) = A(0,0)*A(1,1);
373 template<
typename MT
375 inline void invert4x4( LowerMatrix<MT,SO,true>& m )
384 const StaticMatrix<ET,4UL,4UL,SO> A( m );
385 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
387 const ET tmp1( A(2,2)*A(3,3) );
388 const ET tmp2( A(2,1)*A(3,3) );
389 const ET tmp3( A(2,1)*A(3,2) - A(2,2)*A(3,1) );
390 const ET tmp4( A(0,0)*A(1,1) );
392 const ET
det( tmp4 * A(2,2) * A(3,3) );
398 B(0,0) = A(1,1)*tmp1;
399 B(1,0) = - A(1,0)*tmp1;
400 B(2,0) = A(1,0)*tmp2 - A(1,1)*A(2,0)*A(3,3);
401 B(3,0) = A(1,1)*( A(2,0)*A(3,2) - A(2,2)*A(3,0) ) - A(1,0)*tmp3;
402 B(1,1) = A(0,0)*tmp1;
403 B(2,1) = - A(0,0)*tmp2;
404 B(3,1) = A(0,0)*tmp3;
405 B(2,2) = A(3,3)*tmp4;
406 B(3,2) = - A(3,2)*tmp4;
407 B(3,3) = A(2,2)*tmp4;
433 template<
typename MT
435 inline void invert5x5( LowerMatrix<MT,SO,true>& m )
444 const StaticMatrix<ET,5UL,5UL,SO> A( m );
445 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
447 const ET tmp1( A(3,3)*A(4,4) );
448 const ET tmp2( A(3,2)*A(4,4) );
449 const ET tmp3( A(3,2)*A(4,3) - A(3,3)*A(4,2) );
450 const ET tmp4( A(0,0)*A(1,1) );
452 const ET tmp5 ( A(2,2)*tmp1 );
453 const ET tmp6 ( A(2,1)*tmp1 );
454 const ET tmp7 ( A(2,1)*tmp2 - A(2,2)*A(3,1)*A(4,4) );
455 const ET tmp8 ( A(2,1)*tmp3 - A(2,2)*( A(3,1)*A(4,3) - A(3,3)*A(4,1) ) );
456 const ET tmp9 ( A(3,2)*tmp4 );
457 const ET tmp10( A(2,2)*tmp4 );
459 B(0,0) = A(1,1)*tmp5;
460 B(1,0) = - A(1,0)*tmp5;
461 B(2,0) = A(1,0)*tmp6 - A(1,1)*A(2,0)*tmp1;
462 B(3,0) = A(1,1)*( A(2,0)*tmp2 - A(2,2)*A(3,0)*A(4,4) ) - A(1,0)*tmp7;
463 B(4,0) = A(1,0)*tmp8 - A(1,1)*( A(2,0)*tmp3 - A(2,2)*( A(3,0)*A(4,3) - A(3,3)*A(4,0) ) );
464 B(1,1) = A(0,0)*tmp5;
465 B(2,1) = - A(0,0)*tmp6;
466 B(3,1) = A(0,0)*tmp7;
467 B(4,1) = - A(0,0)*tmp8;
468 B(2,2) = A(0,0)*A(1,1)*tmp1;
469 B(3,2) = - A(4,4)*tmp9;
470 B(4,2) = A(4,3)*tmp9 - A(4,2)*A(3,3)*tmp4;
471 B(3,3) = A(4,4)*tmp10;
472 B(4,3) = - A(4,3)*tmp10;
473 B(4,4) = A(3,3)*tmp10;
475 const ET
det( B(4,4) * A(4,4) );
505 template<
typename MT
507 inline void invert6x6( LowerMatrix<MT,SO,true>& m )
516 const StaticMatrix<ET,6UL,6UL,SO> A( m );
517 typename DerestrictTrait<MT>::Type B( derestrict( m ) );
519 const ET tmp1( A(4,4)*A(5,5) );
520 const ET tmp2( A(4,3)*A(5,5) );
521 const ET tmp3( A(4,3)*A(5,4) - A(4,4)*A(5,3) );
523 const ET tmp4( A(3,3)*tmp1 );
524 const ET tmp5( A(3,2)*tmp1 );
525 const ET tmp6( A(3,2)*tmp2 - A(3,3)*A(4,2)*A(5,5) );
526 const ET tmp7( A(3,2)*tmp3 - A(3,3)*( A(4,2)*A(5,4) - A(4,4)*A(5,2) ) );
527 const ET tmp8( A(0,0)*A(1,1)*A(2,2) );
529 const ET tmp9 ( A(2,2)*tmp4 );
530 const ET tmp10( A(2,1)*tmp4 );
531 const ET tmp11( A(2,1)*tmp5 - A(2,2)*A(3,1)*tmp1 );
532 const ET tmp12( A(2,1)*tmp6 - A(2,2)*( A(3,1)*tmp2 - A(3,3)*A(4,1)*A(5,5) ) );
533 const ET tmp13( A(2,1)*tmp7 - A(2,2)*( A(3,1)*tmp3 - A(3,3)*( A(4,1)*A(5,4) - A(4,4)*A(5,1) ) ) );
534 const ET tmp14( A(4,4)*tmp8 );
535 const ET tmp15( A(4,3)*tmp8 );
536 const ET tmp16( A(3,3)*tmp8 );
538 B(0,0) = A(1,1)*tmp9;
539 B(1,0) = - A(1,0)*tmp9;
540 B(2,0) = A(1,0)*tmp10 - A(1,1)*A(2,0)*tmp4;
541 B(3,0) = - A(1,0)*tmp11 + A(1,1)*( A(2,0)*tmp5 - A(2,2)*A(3,0)*tmp1 );
542 B(4,0) = A(1,0)*tmp12 - A(1,1)*( A(2,0)*tmp6 - A(2,2)*( A(3,0)*tmp2 - A(3,3)*A(4,0)*A(5,5) ) );
543 B(5,0) = - A(1,0)*tmp13 + A(1,1)*( A(2,0)*tmp7 - A(2,2)*( A(3,0)*tmp3 - A(3,3)*( A(4,0)*A(5,4) - A(4,4)*A(5,0) ) ) );
544 B(1,1) = A(0,0)*tmp9;
545 B(2,1) = - A(0,0)*tmp10;
546 B(3,1) = A(0,0)*tmp11;
547 B(4,1) = - A(0,0)*tmp12;
548 B(5,1) = A(0,0)*tmp13;
549 B(2,2) = A(0,0)*A(1,1)*tmp4;
550 B(3,2) = - A(0,0)*A(1,1)*tmp5;
551 B(4,2) = A(0,0)*A(1,1)*tmp6;
552 B(5,2) = - A(0,0)*A(1,1)*tmp7;
553 B(3,3) = A(5,5)*tmp14;
554 B(4,3) = - A(5,5)*tmp15;
555 B(5,3) = A(5,4)*tmp15 - A(5,3)*tmp14;
556 B(4,4) = A(5,5)*tmp16 - A(5,3)*A(3,5)*tmp8;
557 B(5,4) = - A(5,4)*tmp16;
558 B(5,5) = A(4,4)*tmp16;
560 const ET
det( B(5,5)*A(5,5) );
597 template<
typename MT
599 inline void invertByDefault( LowerMatrix<MT,SO,true>& m )
630 template<
typename MT
632 inline void invertByLU( LowerMatrix<MT,SO,true>& m )
636 typename DerestrictTrait<MT>::Type A( derestrict( ~m ) );
638 trtri( A,
'L',
'N' );
669 template<
typename MT
671 inline void invertByLDLT( LowerMatrix<MT,SO,true>& m )
702 template<
typename MT
704 inline void invertByLDLH( LowerMatrix<MT,SO,true>& m )
732 template<
typename MT
734 inline void invertByLLH( LowerMatrix<MT,SO,true>& m )
740 typename DerestrictTrait<MT>::Type A( derestrict( ~m ) );
742 for(
size_t i=0UL; i<A.rows(); ++i )
776 template<
typename MT1,
bool SO1,
typename MT2,
typename MT3,
typename MT4,
bool SO2 >
777 inline void lu(
const LowerMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
778 DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
795 const size_t n( (~A).
rows() );
797 typename DerestrictTrait<MT3>::Type U2( derestrict( ~U ) );
807 for(
size_t i=0UL; i<n; ++i ) {
832 template<
typename MT
836 inline bool tryAssign(
const LowerMatrix<MT,SO,DF>& lhs,
837 const DenseVector<VT,false>& rhs,
size_t row,
size_t column )
850 const size_t iend(
min( column - row, (~rhs).
size() ) );
852 for(
size_t i=0UL; i<iend; ++i ) {
879 template<
typename MT
883 inline bool tryAssign(
const LowerMatrix<MT,SO,DF>& lhs,
884 const DenseVector<VT,true>& rhs,
size_t row,
size_t column )
894 const size_t ibegin( ( row < column )?( 0UL ):( row - column + 1UL ) );
896 for(
size_t i=ibegin; i<(~rhs).
size(); ++i ) {
923 template<
typename MT
927 inline bool tryAssign(
const LowerMatrix<MT,SO,DF>& lhs,
928 const SparseVector<VT,false>& rhs,
size_t row,
size_t column )
943 const RhsIterator last( (~rhs).lowerBound( column - row ) );
945 for( RhsIterator element=(~rhs).
begin(); element!=last; ++element ) {
972 template<
typename MT
976 inline bool tryAssign(
const LowerMatrix<MT,SO,DF>& lhs,
977 const SparseVector<VT,true>& rhs,
size_t row,
size_t column )
989 const RhsIterator last( (~rhs).
end() );
990 RhsIterator element( (~rhs).lowerBound( ( row < column )?( 0UL ):( row - column + 1UL ) ) );
992 for( ; element!=last; ++element ) {
1019 template<
typename MT1
1023 inline bool tryAssign(
const LowerMatrix<MT1,SO,DF>& lhs,
1024 const DenseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
1035 const size_t M( (~rhs).
rows() );
1036 const size_t N( (~rhs).
columns() );
1038 if( row + 1UL >= column + N )
1041 const size_t iend(
min( column + N - row - 1UL, M ) );
1043 for(
size_t i=0UL; i<iend; ++i )
1045 const bool containsDiagonal( row + i >= column );
1046 const size_t jbegin( ( containsDiagonal )?( row + i - column + 1UL ):( 0UL ) );
1048 for(
size_t j=jbegin; j<N; ++j ) {
1076 template<
typename MT1
1080 inline bool tryAssign(
const LowerMatrix<MT1,SO,DF>& lhs,
1081 const DenseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
1092 const size_t M( (~rhs).
rows() );
1093 const size_t N( (~rhs).
columns() );
1095 if( row + 1UL >= column + N )
1098 const size_t jbegin( ( row < column )?( 0UL ):( row - column + 1UL ) );
1100 for(
size_t j=jbegin; j<N; ++j )
1102 const size_t iend(
min( column + j - row, M ) );
1104 for(
size_t i=0UL; i<iend; ++i ) {
1132 template<
typename MT1
1136 inline bool tryAssign(
const LowerMatrix<MT1,SO,DF>& lhs,
1137 const SparseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
1150 const size_t M( (~rhs).
rows() );
1151 const size_t N( (~rhs).
columns() );
1153 if( row + 1UL >= column + N )
1156 const size_t iend(
min( column + N - row - 1UL, M ) );
1158 for(
size_t i=0UL; i<iend; ++i )
1160 const bool containsDiagonal( row + i >= column );
1161 const size_t index( ( containsDiagonal )?( row + i - column + 1UL ):( 0UL ) );
1163 const RhsIterator last( (~rhs).
end(i) );
1164 RhsIterator element( (~rhs).lowerBound( i, index ) );
1166 for( ; element!=last; ++element ) {
1194 template<
typename MT1
1198 inline bool tryAssign(
const LowerMatrix<MT1,SO,DF>& lhs,
1199 const SparseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
1212 const size_t M( (~rhs).
rows() );
1213 const size_t N( (~rhs).
columns() );
1215 if( row + 1UL >= column + N )
1218 const size_t jbegin( ( row < column )?( 0UL ):( row - column + 1UL ) );
1220 for(
size_t j=jbegin; j<N; ++j )
1222 const size_t index( column + j - row );
1223 const RhsIterator last( (~rhs).lowerBound(
min( index, M ), j ) );
1225 for( RhsIterator element=(~rhs).
begin(j); element!=last; ++element ) {
1253 template<
typename MT
1258 inline bool tryAddAssign(
const LowerMatrix<MT,SO,DF>& lhs,
1259 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1261 return tryAssign( lhs, ~rhs, row, column );
1283 template<
typename MT1
1288 inline bool tryAddAssign(
const LowerMatrix<MT1,SO1,DF>& lhs,
1289 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1291 return tryAssign( lhs, ~rhs, row, column );
1313 template<
typename MT
1318 inline bool trySubAssign(
const LowerMatrix<MT,SO,DF>& lhs,
1319 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1321 return tryAssign( lhs, ~rhs, row, column );
1343 template<
typename MT1
1348 inline bool trySubAssign(
const LowerMatrix<MT1,SO1,DF>& lhs,
1349 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1351 return tryAssign( lhs, ~rhs, row, column );
1371 template<
typename MT
1374 inline MT& derestrict( LowerMatrix<MT,SO,DF>& m )
1392 template<
typename MT,
bool SO,
bool DF >
1393 struct Rows< LowerMatrix<MT,SO,DF> > :
public Rows<MT>
1409 template<
typename MT,
bool SO,
bool DF >
1410 struct Columns< LowerMatrix<MT,SO,DF> > :
public Columns<MT>
1426 template<
typename MT,
bool SO,
bool DF >
1427 struct IsSquare< LowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1443 template<
typename MT,
bool SO,
bool DF >
1444 struct IsLower< LowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1460 template<
typename MT,
bool SO,
bool DF >
1461 struct IsAdaptor< LowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1477 template<
typename MT,
bool SO,
bool DF >
1478 struct IsRestricted< LowerMatrix<MT,SO,DF> > :
public IsTrue<true>
1494 template<
typename MT,
bool SO >
1495 struct HasConstDataAccess< LowerMatrix<MT,SO,true> > :
public IsTrue<true>
1511 template<
typename MT,
bool SO,
bool DF >
1512 struct IsAligned< LowerMatrix<MT,SO,DF> > :
public IsTrue< IsAligned<MT>::value >
1528 template<
typename MT,
bool SO,
bool DF >
1529 struct IsPadded< LowerMatrix<MT,SO,DF> > :
public IsTrue< IsPadded<MT>::value >
1545 template<
typename MT,
bool SO,
bool DF >
1546 struct IsResizable< LowerMatrix<MT,SO,DF> > :
public IsTrue< IsResizable<MT>::value >
1562 template<
typename MT,
bool SO,
bool DF >
1563 struct RemoveAdaptor< LowerMatrix<MT,SO,DF> >
1581 template<
typename MT,
bool SO,
bool DF >
1582 struct DerestrictTrait< LowerMatrix<MT,SO,DF> >
1600 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
1601 struct AddTrait< LowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1603 typedef typename AddTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
1606 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
1607 struct AddTrait< StaticMatrix<T,M,N,SO1>, LowerMatrix<MT,SO2,DF> >
1609 typedef typename AddTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
1612 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
1613 struct AddTrait< LowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1615 typedef typename AddTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
1618 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
1619 struct AddTrait< HybridMatrix<T,M,N,SO1>, LowerMatrix<MT,SO2,DF> >
1621 typedef typename AddTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
1624 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
1625 struct AddTrait< LowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1627 typedef typename AddTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
1630 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
1631 struct AddTrait< DynamicMatrix<T,SO1>, LowerMatrix<MT,SO2,DF> >
1633 typedef typename AddTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
1636 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool AF,
bool PF,
bool SO2 >
1637 struct AddTrait< LowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1639 typedef typename AddTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
1642 template<
typename T,
bool AF,
bool PF,
bool SO1,
typename MT,
bool SO2,
bool DF >
1643 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, LowerMatrix<MT,SO2,DF> >
1645 typedef typename AddTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
1648 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
1649 struct AddTrait< LowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1651 typedef typename AddTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
1654 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
1655 struct AddTrait< CompressedMatrix<T,SO1>, LowerMatrix<MT,SO2,DF> >
1657 typedef typename AddTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
1660 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2,
bool NF >
1661 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1663 typedef typename AddTrait<MT1,MT2>::Type Type;
1666 template<
typename MT1,
bool SO1,
bool DF1,
bool NF,
typename MT2,
bool SO2,
bool DF2 >
1667 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, LowerMatrix<MT2,SO2,DF2> >
1669 typedef typename AddTrait<MT1,MT2>::Type Type;
1672 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1673 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1675 typedef typename AddTrait<MT1,MT2>::Type Type;
1678 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1679 struct AddTrait< HermitianMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1681 typedef typename AddTrait<MT1,MT2>::Type Type;
1684 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1685 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1687 typedef LowerMatrix< typename AddTrait<MT1,MT2>::Type > Type;
1703 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
1704 struct SubTrait< LowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1706 typedef typename SubTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
1709 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
1710 struct SubTrait< StaticMatrix<T,M,N,SO1>, LowerMatrix<MT,SO2,DF> >
1712 typedef typename SubTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
1715 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
1716 struct SubTrait< LowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1718 typedef typename SubTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
1721 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
1722 struct SubTrait< HybridMatrix<T,M,N,SO1>, LowerMatrix<MT,SO2,DF> >
1724 typedef typename SubTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
1727 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
1728 struct SubTrait< LowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1730 typedef typename SubTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
1733 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
1734 struct SubTrait< DynamicMatrix<T,SO1>, LowerMatrix<MT,SO2,DF> >
1736 typedef typename SubTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
1739 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool AF,
bool PF,
bool SO2 >
1740 struct SubTrait< LowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1742 typedef typename SubTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
1745 template<
typename T,
bool AF,
bool PF,
bool SO1,
typename MT,
bool SO2,
bool DF >
1746 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, LowerMatrix<MT,SO2,DF> >
1748 typedef typename SubTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
1751 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
1752 struct SubTrait< LowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1754 typedef typename SubTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
1757 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
1758 struct SubTrait< CompressedMatrix<T,SO1>, LowerMatrix<MT,SO2,DF> >
1760 typedef typename SubTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
1763 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2,
bool NF >
1764 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1766 typedef typename SubTrait<MT1,MT2>::Type Type;
1769 template<
typename MT1,
bool SO1,
bool DF1,
bool NF,
typename MT2,
bool SO2,
bool DF2 >
1770 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, LowerMatrix<MT2,SO2,DF2> >
1772 typedef typename SubTrait<MT1,MT2>::Type Type;
1775 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1776 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1778 typedef typename SubTrait<MT1,MT2>::Type Type;
1781 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1782 struct SubTrait< HermitianMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1784 typedef typename SubTrait<MT1,MT2>::Type Type;
1787 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1788 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1790 typedef LowerMatrix< typename SubTrait<MT1,MT2>::Type > Type;
1806 template<
typename MT,
bool SO,
bool DF,
typename T >
1807 struct MultTrait< LowerMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
1809 typedef LowerMatrix< typename MultTrait<MT,T>::Type > Type;
1812 template<
typename T,
typename MT,
bool SO,
bool DF >
1813 struct MultTrait< T, LowerMatrix<MT,SO,DF>, typename EnableIf< IsNumeric<T> >::Type >
1815 typedef LowerMatrix< typename MultTrait<T,MT>::Type > Type;
1818 template<
typename MT,
bool SO,
bool DF,
typename T,
size_t N >
1819 struct MultTrait< LowerMatrix<MT,SO,DF>, StaticVector<T,N,false> >
1821 typedef typename MultTrait< MT, StaticVector<T,N,false> >::Type Type;
1824 template<
typename T,
size_t N,
typename MT,
bool SO,
bool DF >
1825 struct MultTrait< StaticVector<T,N,true>, LowerMatrix<MT,SO,DF> >
1827 typedef typename MultTrait< StaticVector<T,N,true>, MT >::Type Type;
1830 template<
typename MT,
bool SO,
bool DF,
typename T,
size_t N >
1831 struct MultTrait< LowerMatrix<MT,SO,DF>, HybridVector<T,N,false> >
1833 typedef typename MultTrait< MT, HybridVector<T,N,false> >::Type Type;
1836 template<
typename T,
size_t N,
typename MT,
bool SO,
bool DF >
1837 struct MultTrait< HybridVector<T,N,true>, LowerMatrix<MT,SO,DF> >
1839 typedef typename MultTrait< HybridVector<T,N,true>, MT >::Type Type;
1842 template<
typename MT,
bool SO,
bool DF,
typename T >
1843 struct MultTrait< LowerMatrix<MT,SO,DF>, DynamicVector<T,false> >
1845 typedef typename MultTrait< MT, DynamicVector<T,false> >::Type Type;
1848 template<
typename T,
typename MT,
bool SO,
bool DF >
1849 struct MultTrait< DynamicVector<T,true>, LowerMatrix<MT,SO,DF> >
1851 typedef typename MultTrait< DynamicVector<T,true>, MT >::Type Type;
1854 template<
typename MT,
bool SO,
bool DF,
typename T,
bool AF,
bool PF >
1855 struct MultTrait< LowerMatrix<MT,SO,DF>, CustomVector<T,AF,PF,false> >
1857 typedef typename MultTrait< MT, CustomVector<T,AF,PF,false> >::Type Type;
1860 template<
typename T,
bool AF,
bool PF,
typename MT,
bool SO,
bool DF >
1861 struct MultTrait< CustomVector<T,AF,PF,true>, LowerMatrix<MT,SO,DF> >
1863 typedef typename MultTrait< CustomVector<T,AF,PF,true>, MT >::Type Type;
1866 template<
typename MT,
bool SO,
bool DF,
typename T >
1867 struct MultTrait< LowerMatrix<MT,SO,DF>, CompressedVector<T,false> >
1869 typedef typename MultTrait< MT, CompressedVector<T,false> >::Type Type;
1872 template<
typename T,
typename MT,
bool SO,
bool DF >
1873 struct MultTrait< CompressedVector<T,true>, LowerMatrix<MT,SO,DF> >
1875 typedef typename MultTrait< CompressedVector<T,true>, MT >::Type Type;
1878 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
1879 struct MultTrait< LowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1881 typedef typename MultTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
1884 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
1885 struct MultTrait< StaticMatrix<T,M,N,SO1>, LowerMatrix<MT,SO2,DF> >
1887 typedef typename MultTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
1890 template<
typename MT,
bool SO1,
bool DF,
typename T,
size_t M,
size_t N,
bool SO2 >
1891 struct MultTrait< LowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1893 typedef typename MultTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
1896 template<
typename T,
size_t M,
size_t N,
bool SO1,
typename MT,
bool SO2,
bool DF >
1897 struct MultTrait< HybridMatrix<T,M,N,SO1>, LowerMatrix<MT,SO2,DF> >
1899 typedef typename MultTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
1902 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
1903 struct MultTrait< LowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1905 typedef typename MultTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
1908 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
1909 struct MultTrait< DynamicMatrix<T,SO1>, LowerMatrix<MT,SO2,DF> >
1911 typedef typename MultTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
1914 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool AF,
bool PF,
bool SO2 >
1915 struct MultTrait< LowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1917 typedef typename MultTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
1920 template<
typename T,
bool AF,
bool PF,
bool SO1,
typename MT,
bool SO2,
bool DF >
1921 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, LowerMatrix<MT,SO2,DF> >
1923 typedef typename MultTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
1926 template<
typename MT,
bool SO1,
bool DF,
typename T,
bool SO2 >
1927 struct MultTrait< LowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1929 typedef typename MultTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
1932 template<
typename T,
bool SO1,
typename MT,
bool SO2,
bool DF >
1933 struct MultTrait< CompressedMatrix<T,SO1>, LowerMatrix<MT,SO2,DF> >
1935 typedef typename MultTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
1938 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2,
bool NF >
1939 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1941 typedef typename MultTrait<MT1,MT2>::Type Type;
1944 template<
typename MT1,
bool SO1,
bool DF1,
bool NF,
typename MT2,
bool SO2,
bool DF2 >
1945 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, LowerMatrix<MT2,SO2,DF2> >
1947 typedef typename MultTrait<MT1,MT2>::Type Type;
1950 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1951 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1953 typedef typename MultTrait<MT1,MT2>::Type Type;
1956 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1957 struct MultTrait< HermitianMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1959 typedef typename MultTrait<MT1,MT2>::Type Type;
1962 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1963 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1965 typedef LowerMatrix< typename MultTrait<MT1,MT2>::Type > Type;
1981 template<
typename MT,
bool SO,
bool DF,
typename T >
1982 struct DivTrait< LowerMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
1984 typedef LowerMatrix< typename DivTrait<MT,T>::Type > Type;
2000 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2001 struct MathTrait< LowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2003 typedef LowerMatrix< typename MathTrait<MT1,MT2>::HighType > HighType;
2004 typedef LowerMatrix< typename MathTrait<MT1,MT2>::LowType > LowType;
2020 template<
typename MT,
bool SO,
bool DF >
2021 struct SubmatrixTrait< LowerMatrix<MT,SO,DF> >
2023 typedef typename SubmatrixTrait<MT>::Type Type;
2039 template<
typename MT,
bool SO,
bool DF >
2040 struct RowTrait< LowerMatrix<MT,SO,DF> >
2042 typedef typename RowTrait<MT>::Type Type;
2058 template<
typename MT,
bool SO,
bool DF >
2059 struct ColumnTrait< LowerMatrix<MT,SO,DF> >
2061 typedef typename ColumnTrait<MT>::Type Type;
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
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
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:1511
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
LowerMatrix specialization for dense matrices.
Matrix adapter for lower triangular matrices.
Definition: Forward.h:48
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
MT::ElementType det(const DenseMatrix< MT, SO > &dm)
Computation of the determinant of the given dense square matrix.
Definition: DMatDetExpr.h:382
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
Header file for the invert shim.
Constraint on the data type.
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.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:767
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 IsLower type trait.
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 DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
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.
LowerMatrix specialization for sparse 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
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
Header file for exception macros.
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