35 #ifndef _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_H_ 36 #define _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_H_ 109 template<
typename MT,
bool SO,
bool DF >
110 void reset( StrictlyLowerMatrix<MT,SO,DF>& m );
112 template<
typename MT,
bool SO,
bool DF >
113 void reset( StrictlyLowerMatrix<MT,SO,DF>& m,
size_t i );
115 template<
typename MT,
bool SO,
bool DF >
116 void clear( StrictlyLowerMatrix<MT,SO,DF>& m );
118 template<
bool RF,
typename MT,
bool SO,
bool DF >
119 bool isDefault(
const StrictlyLowerMatrix<MT,SO,DF>& m );
121 template<
typename MT,
bool SO,
bool DF >
122 bool isIntact(
const StrictlyLowerMatrix<MT,SO,DF>& m );
124 template<
typename MT,
bool SO,
bool DF >
125 void swap( StrictlyLowerMatrix<MT,SO,DF>& a, StrictlyLowerMatrix<MT,SO,DF>& b ) noexcept;
137 template<
typename MT
160 template<
typename MT
177 template<
typename MT
202 inline bool isDefault_backend(
const StrictlyLowerMatrix<MT,SO,DF>& m,
TrueType )
204 return ( m.rows() == 0UL );
225 inline bool isDefault_backend(
const StrictlyLowerMatrix<MT,SO,DF>& m,
FalseType )
228 for(
size_t j=0UL; j<m.columns(); ++j ) {
229 for(
size_t i=j+1UL; i<m.rows(); ++i ) {
230 if( !isDefault<RF>( m(i,j) ) )
236 for(
size_t i=1UL; i<m.rows(); ++i ) {
237 for(
size_t j=0UL; j<i; ++j ) {
238 if( !isDefault<RF>( m(i,j) ) )
308 template<
typename MT
326 template<
typename MT
352 template<
typename MT
356 inline bool trySet(
const StrictlyLowerMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
385 template<
typename MT
389 inline bool tryAdd(
const StrictlyLowerMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
391 return trySet( mat, i, j, value );
413 template<
typename MT
417 inline bool trySub(
const StrictlyLowerMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
419 return trySet( mat, i, j, value );
442 template<
typename MT
446 inline bool tryAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
447 const DenseVector<VT,false>& rhs,
size_t row,
size_t column )
462 for(
size_t i=0UL; i<iend; ++i ) {
490 template<
typename MT
494 inline bool tryAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
495 const DenseVector<VT,true>& rhs,
size_t row,
size_t column )
507 for(
size_t i=ibegin; i<(~rhs).
size(); ++i ) {
536 template<
typename MT
541 inline bool tryAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
const DenseVector<VT,TF>& rhs,
554 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
583 template<
typename MT
587 inline bool tryAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
588 const SparseVector<VT,false>& rhs,
size_t row,
size_t column )
601 const auto last( (~rhs).lowerBound(
column -
row + 1UL ) );
603 for(
auto element=(~rhs).
begin(); element!=last; ++element ) {
631 template<
typename MT
635 inline bool tryAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
636 const SparseVector<VT,true>& rhs,
size_t row,
size_t column )
646 const auto last( (~rhs).
end() );
649 for( ; element!=last; ++element ) {
678 template<
typename MT
683 inline bool tryAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
const SparseVector<VT,TF>& rhs,
696 for(
const auto& element : ~rhs ) {
725 template<
typename MT1
729 inline bool tryAssign(
const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
730 const DenseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
741 const size_t M( (~rhs).
rows() );
742 const size_t N( (~rhs).
columns() );
749 for(
size_t i=0UL; i<iend; ++i )
751 const bool containsDiagonal(
row + i >=
column );
752 const size_t jbegin( ( containsDiagonal )?(
row + i -
column ):( 0UL ) );
754 for(
size_t j=jbegin; j<N; ++j ) {
783 template<
typename MT1
787 inline bool tryAssign(
const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
788 const DenseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
799 const size_t M( (~rhs).
rows() );
800 const size_t N( (~rhs).
columns() );
807 for(
size_t j=jbegin; j<N; ++j )
811 for(
size_t i=0UL; i<iend; ++i ) {
840 template<
typename MT1
844 inline bool tryAssign(
const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
845 const SparseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
856 const size_t M( (~rhs).
rows() );
857 const size_t N( (~rhs).
columns() );
864 for(
size_t i=0UL; i<iend; ++i )
866 const bool containsDiagonal(
row + i >=
column );
867 const size_t index( ( containsDiagonal )?(
row + i -
column ):( 0UL ) );
869 const auto last( (~rhs).
end(i) );
870 auto element( (~rhs).lowerBound( i, index ) );
872 for( ; element!=last; ++element ) {
901 template<
typename MT1
905 inline bool tryAssign(
const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
906 const SparseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
917 const size_t M( (~rhs).
rows() );
918 const size_t N( (~rhs).
columns() );
925 for(
size_t j=jbegin; j<N; ++j )
927 const size_t index(
column + j -
row + 1UL );
928 const auto last( (~rhs).lowerBound(
min( index, M ), j ) );
930 for(
auto element=(~rhs).
begin(j); element!=last; ++element ) {
959 template<
typename MT
964 inline bool tryAddAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
965 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
967 return tryAssign( lhs, ~rhs,
row,
column );
991 template<
typename MT
996 inline bool tryAddAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
const Vector<VT,TF>& rhs,
1022 template<
typename MT1
1027 inline bool tryAddAssign(
const StrictlyLowerMatrix<MT1,SO1,DF>& lhs,
1028 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1030 return tryAssign( lhs, ~rhs,
row,
column );
1053 template<
typename MT
1058 inline bool trySubAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
1059 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1061 return tryAssign( lhs, ~rhs,
row,
column );
1085 template<
typename MT
1090 inline bool trySubAssign(
const StrictlyLowerMatrix<MT,SO,DF>& lhs,
const Vector<VT,TF>& rhs,
1116 template<
typename MT1
1121 inline bool trySubAssign(
const StrictlyLowerMatrix<MT1,SO1,DF>& lhs,
1122 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1124 return tryAssign( lhs, ~rhs,
row,
column );
1144 template<
typename MT
1147 inline MT& derestrict( StrictlyLowerMatrix<MT,SO,DF>& m )
1165 template<
typename MT,
bool SO,
bool DF >
1166 struct Size< StrictlyLowerMatrix<MT,SO,DF>, 0UL >
1167 :
public Size<MT,0UL>
1170 template<
typename MT,
bool SO,
bool DF >
1171 struct Size< StrictlyLowerMatrix<MT,SO,DF>, 1UL >
1172 :
public Size<MT,1UL>
1188 template<
typename MT,
bool SO,
bool DF >
1189 struct MaxSize< StrictlyLowerMatrix<MT,SO,DF>, 0UL >
1190 :
public MaxSize<MT,0UL>
1193 template<
typename MT,
bool SO,
bool DF >
1194 struct MaxSize< StrictlyLowerMatrix<MT,SO,DF>, 1UL >
1195 :
public MaxSize<MT,1UL>
1211 template<
typename MT,
bool SO,
bool DF >
1212 struct IsSquare< StrictlyLowerMatrix<MT,SO,DF> >
1229 template<
typename MT,
bool SO,
bool DF >
1230 struct IsUniform< StrictlyLowerMatrix<MT,SO,DF> >
1231 :
public IsUniform<MT>
1247 template<
typename MT,
bool SO,
bool DF >
1248 struct IsSymmetric< StrictlyLowerMatrix<MT,SO,DF> >
1249 :
public IsUniform<MT>
1265 template<
typename MT,
bool SO,
bool DF >
1266 struct IsHermitian< StrictlyLowerMatrix<MT,SO,DF> >
1267 :
public IsUniform<MT>
1283 template<
typename MT,
bool SO,
bool DF >
1284 struct IsStrictlyLower< StrictlyLowerMatrix<MT,SO,DF> >
1301 template<
typename MT,
bool SO,
bool DF >
1302 struct IsStrictlyUpper< StrictlyLowerMatrix<MT,SO,DF> >
1303 :
public IsUniform<MT>
1319 template<
typename MT,
bool SO,
bool DF >
1320 struct IsAdaptor< StrictlyLowerMatrix<MT,SO,DF> >
1337 template<
typename MT,
bool SO,
bool DF >
1338 struct IsRestricted< StrictlyLowerMatrix<MT,SO,DF> >
1355 template<
typename MT,
bool SO >
1356 struct HasConstDataAccess< StrictlyLowerMatrix<MT,SO,true> >
1373 template<
typename MT,
bool SO,
bool DF >
1374 struct IsAligned< StrictlyLowerMatrix<MT,SO,DF> >
1375 :
public IsAligned<MT>
1391 template<
typename MT,
bool SO,
bool DF >
1392 struct IsContiguous< StrictlyLowerMatrix<MT,SO,DF> >
1393 :
public IsContiguous<MT>
1409 template<
typename MT,
bool SO,
bool DF >
1410 struct IsPadded< StrictlyLowerMatrix<MT,SO,DF> >
1411 :
public IsPadded<MT>
1427 template<
typename MT,
bool SO,
bool DF >
1428 struct IsResizable< StrictlyLowerMatrix<MT,SO,DF> >
1429 :
public IsResizable<MT>
1445 template<
typename MT,
bool SO,
bool DF >
1446 struct IsShrinkable< StrictlyLowerMatrix<MT,SO,DF> >
1447 :
public IsShrinkable<MT>
1463 template<
typename MT,
bool SO,
bool DF >
1464 struct RemoveAdaptor< StrictlyLowerMatrix<MT,SO,DF> >
1482 template<
typename T1,
typename T2 >
1483 struct AddTraitEval1< T1, T2
1486 ( IsStrictlyLower_v<T1> && IsStrictlyLower_v<T2> ) &&
1487 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1489 using Type = StrictlyLowerMatrix< typename AddTraitEval2<T1,T2>::Type >;
1505 template<
typename T1,
typename T2 >
1506 struct SubTraitEval1< T1, T2
1509 ( ( IsUniLower_v<T1> && IsUniLower_v<T2> ) ||
1510 ( IsStrictlyLower_v<T1> && IsStrictlyLower_v<T2> ) ) &&
1511 !( IsIdentity_v<T1> && IsIdentity_v<T2> ) &&
1512 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1514 using Type = StrictlyLowerMatrix< typename SubTraitEval2<T1,T2>::Type >;
1530 template<
typename T1,
typename T2 >
1531 struct SchurTraitEval1< T1, T2
1534 ( ( IsStrictlyLower_v<T1> && !IsUpper_v<T2> ) ||
1535 ( !IsUpper_v<T1> && IsStrictlyLower_v<T2> ) ) &&
1536 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1538 using Type = StrictlyLowerMatrix< typename SchurTraitEval2<T1,T2>::Type >;
1554 template<
typename T1,
typename T2 >
1555 struct MultTraitEval1< T1, T2
1558 ( IsStrictlyLower_v<T1> && !IsUniform_v<T1> ) > >
1560 using Type = StrictlyLowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
1563 template<
typename T1,
typename T2 >
1564 struct MultTraitEval1< T1, T2
1567 ( IsStrictlyLower_v<T2> && !IsUniform_v<T2> ) > >
1569 using Type = StrictlyLowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
1572 template<
typename T1,
typename T2 >
1573 struct MultTraitEval1< T1, T2
1576 ( ( IsStrictlyLower_v<T1> && IsLower_v<T2> ) ||
1577 ( IsLower_v<T1> && IsStrictlyLower_v<T2> ) ) &&
1578 !( IsIdentity_v<T1> || IsIdentity_v<T2> ) &&
1579 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1581 using Type = StrictlyLowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
1597 template<
typename T1,
typename T2 >
1598 struct DivTraitEval1< T1, T2
1601 using Type = StrictlyLowerMatrix< typename DivTraitEval2<T1,T2>::Type >;
1617 template<
typename T,
typename OP >
1618 struct UnaryMapTraitEval1< T, OP
1620 !YieldsZero_v<OP,T> > >
1622 using Type = StrictlyLowerMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
1630 template<
typename T1,
typename T2,
typename OP >
1631 struct BinaryMapTraitEval1< T1, T2, OP
1633 !YieldsDiagonal_v<OP,T1,T2> > >
1635 using Type = StrictlyLowerMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
1651 template<
typename MT,
bool SO,
bool DF >
1652 struct DeclSymTrait< StrictlyLowerMatrix<MT,SO,DF> >
1654 using Type = ZeroMatrix< typename MT::ElementType, SO >;
1670 template<
typename MT,
bool SO,
bool DF >
1671 struct DeclHermTrait< StrictlyLowerMatrix<MT,SO,DF> >
1673 using Type = ZeroMatrix< typename MT::ElementType, SO >;
1689 template<
typename MT,
bool SO,
bool DF >
1690 struct DeclLowTrait< StrictlyLowerMatrix<MT,SO,DF> >
1692 using Type = StrictlyLowerMatrix<MT,SO,DF>;
1708 template<
typename MT,
bool SO,
bool DF >
1709 struct DeclUppTrait< StrictlyLowerMatrix<MT,SO,DF> >
1711 using Type = ZeroMatrix< typename MT::ElementType, SO >;
1727 template<
typename MT,
bool SO,
bool DF >
1728 struct DeclDiagTrait< StrictlyLowerMatrix<MT,SO,DF> >
1730 using Type = ZeroMatrix< typename MT::ElementType, SO >;
1746 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1747 struct HighType< StrictlyLowerMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1749 using Type = StrictlyLowerMatrix< typename HighType<MT1,MT2>::Type >;
1765 template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
1766 struct LowType< StrictlyLowerMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1768 using Type = StrictlyLowerMatrix< typename LowType<MT1,MT2>::Type >;
1784 template<
typename MT,
size_t I,
size_t N >
1785 struct SubmatrixTraitEval1< MT, I, I, N, N
1788 using Type = StrictlyLowerMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the decldiag trait.
Header file for the Schur product trait.
Header file for the UNUSED_PARAMETER function template.
StrictlyLowerMatrix specialization for sparse matrices.
Header file for the subtraction trait.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Header file for the implementation of the base template of the StrictlyLowerMatrix.
Header file for the declherm trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsZero type trait.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
Header file for the IsIdentity type trait.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the IsUniLower type trait.
Header file for the MaxSize type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Header file for the IsMatrix type trait.
Header file for the IsSquare type trait.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the LowType type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the IsShrinkable type trait.
StrictlyLowerMatrix specialization for dense matrices.
Header file for all forward declarations of the math module.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
constexpr bool YieldsStrictlyLower_v
Auxiliary variable template for the YieldsStrictlyLower type trait.The YieldsStrictlyLower_v variable...
Definition: YieldsStrictlyLower.h:125
Header file for the decllow trait.
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.The IsStrictlyLower_v variable templat...
Definition: IsStrictlyLower.h:172
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:438
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:135
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
Header file for the declupp trait.
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.
Header file for the IsContiguous type trait.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
Header file for the IsZero type trait.
Header file for the declsym trait.
Matrix adapter for strictly lower triangular matrices.
Definition: BaseTemplate.h:558
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
#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:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Header file for the YieldsDiagonal type trait.
Header file for the StorageOrder type trait.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the IsUpper type trait.
Header file for the IsHermitian type trait.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
Header file for the Size 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
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.