35#ifndef _BLAZE_MATH_ADAPTORS_UNIUPPERMATRIX_H_
36#define _BLAZE_MATH_ADAPTORS_UNIUPPERMATRIX_H_
116template< RelaxationFlag RF,
typename MT,
bool SO,
bool DF >
119template<
typename MT,
bool SO,
bool DF >
122template<
typename MT,
bool SO,
bool DF >
162 return m.rows() == 0UL;
283template<
typename MT1,
bool SO1,
typename MT2,
typename MT3,
typename MT4,
bool SO2 >
302 const size_t n( (*A).rows() );
304 decltype(
auto) L2( derestrict( *L ) );
314 for(
size_t i=0UL; i<n; ++i ) {
351 ( i == j &&
isOne( value ) ) ||
390 return ( m == 0UL ) ||
465 return ( m == 0UL ) ||
496 return tryAdd( mat, i, j, value );
527 return tryAdd( mat,
row,
column, m, n, value );
560 return ( i != j ||
isOne( value ) );
598 return ( m == 0UL ) ||
630 return tryMult( mat, i, j, value );
737 return ( m == 0UL ) ||
812 return ( m == 0UL ) ||
844 return trySet( mat, i, j, value );
875 return trySet( mat,
row,
column, m, n, value );
903 return tryAdd( mat, i, j, value );
934 return tryAdd( mat,
row,
column, m, n, value );
974 const bool containsDiagonal(
column >=
row );
975 const size_t ibegin( ( !containsDiagonal )?( 0UL ):(
column -
row + 1UL ) );
980 for(
size_t i=ibegin; i<(*rhs).size(); ++i ) {
1007template<
typename MT
1025 const bool containsDiagonal(
row <
column + (*rhs).size() );
1026 const size_t iend(
min(
row -
column, (*rhs).size() ) );
1028 for(
size_t i=0UL; i<iend; ++i ) {
1033 if( containsDiagonal && !
isOne( (*rhs)[iend] ) )
1060template<
typename MT
1078 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
1079 if( !
isOne( (*rhs)[i] ) )
1083 else if(
band < 0L ) {
1084 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
1112template<
typename MT
1130 const bool containsDiagonal(
column >=
row );
1131 const size_t index( ( containsDiagonal )?(
column -
row ):( 0UL ) );
1132 const auto last( (*rhs).end() );
1133 auto element( (*rhs).lowerBound( index ) );
1135 if( containsDiagonal ) {
1136 if( element == last || element->index() != index || !
isOne( element->value() ) )
1141 for( ; element!=last; ++element ) {
1168template<
typename MT
1186 const bool containsDiagonal(
row <
column + (*rhs).size() );
1188 const auto last( (*rhs).lowerBound( index ) );
1190 if( containsDiagonal ) {
1191 if( last == (*rhs).end() || last->index() != index || !
isOne( last->value() ) )
1195 for(
auto element=(*rhs).begin(); element!=last; ++element ) {
1224template<
typename MT
1242 if( (*rhs).nonZeros() != (*rhs).size() )
1244 for(
const auto& element : *rhs ) {
1245 if( !
isOne( element.value() ) )
1249 else if(
band < 0L ) {
1250 for(
const auto& element : *rhs ) {
1278template<
typename MT1
1294 const size_t M( (*rhs).rows() );
1295 const size_t N( (*rhs).columns() );
1302 for(
size_t i=ibegin; i<M; ++i )
1306 for(
size_t j=0UL; j<jend; ++j ) {
1311 const bool containsDiagonal(
row + i <
column + N );
1313 if( containsDiagonal && !
isOne( (*rhs)(i,jend) ) )
1339template<
typename MT1
1355 const size_t M( (*rhs).rows() );
1356 const size_t N( (*rhs).columns() );
1363 for(
size_t j=0UL; j<jend; ++j )
1365 const bool containsDiagonal(
column + j >=
row );
1370 const size_t ibegin( ( containsDiagonal )?(
column + j -
row + 1UL ):( 0UL ) );
1372 for(
size_t i=ibegin; i<M; ++i ) {
1400template<
typename MT1
1416 const size_t M( (*rhs).rows() );
1417 const size_t N( (*rhs).columns() );
1424 for(
size_t i=ibegin; i<M; ++i )
1426 const bool containsDiagonal(
row + i <
column + N );
1429 const auto last( (*rhs).lowerBound( i,
min( index, N ) ) );
1431 if( containsDiagonal ) {
1432 if( last == (*rhs).end(i) || ( last->index() != index ) || !
isOne( last->value() ) )
1436 for(
auto element=(*rhs).begin(i); element!=last; ++element ) {
1464template<
typename MT1
1480 const size_t M( (*rhs).rows() );
1481 const size_t N( (*rhs).columns() );
1488 for(
size_t j=0UL; j<jend; ++j )
1490 const bool containsDiagonal(
column + j >=
row );
1491 const size_t index( ( containsDiagonal )?(
column + j -
row ):( 0UL ) );
1493 const auto last( (*rhs).end(j) );
1494 auto element( (*rhs).lowerBound( index, j ) );
1496 if( containsDiagonal ) {
1497 if( element == last || ( element->index() != index ) || !
isOne( element->value() ) )
1502 for( ; element!=last; ++element ) {
1531template<
typename MT
1548 for(
size_t i=ibegin; i<(*rhs).size(); ++i ) {
1576template<
typename MT
1594 const size_t iend(
min(
row -
column + 1UL, (*rhs).size() ) );
1596 for(
size_t i=0UL; i<iend; ++i ) {
1624template<
typename MT
1642 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
1671template<
typename MT
1686 const auto last( (*rhs).end() );
1689 for( ; element!=last; ++element ) {
1717template<
typename MT
1735 const auto last( (*rhs).lowerBound(
row -
column + 1UL ) );
1737 for(
auto element=(*rhs).begin(); element!=last; ++element ) {
1765template<
typename MT
1783 for(
const auto& element : *rhs ) {
1812template<
typename MT1
1828 const size_t M( (*rhs).rows() );
1829 const size_t N( (*rhs).columns() );
1836 for(
size_t i=ibegin; i<M; ++i )
1840 for(
size_t j=0UL; j<jend; ++j ) {
1869template<
typename MT1
1885 const size_t M( (*rhs).rows() );
1886 const size_t N( (*rhs).columns() );
1893 for(
size_t j=0UL; j<jend; ++j )
1895 const bool containsDiagonal(
column + j >=
row );
1896 const size_t ibegin( ( containsDiagonal )?(
column + j -
row ):( 0UL ) );
1898 for(
size_t i=ibegin; i<M; ++i ) {
1927template<
typename MT1
1943 const size_t M( (*rhs).rows() );
1944 const size_t N( (*rhs).columns() );
1951 for(
size_t i=ibegin; i<M; ++i )
1953 const size_t index(
row + i -
column + 1UL );
1954 const auto last( (*rhs).lowerBound( i,
min( index, N ) ) );
1956 for(
auto element=(*rhs).begin(i); element!=last; ++element ) {
1985template<
typename MT1
2001 const size_t M( (*rhs).rows() );
2002 const size_t N( (*rhs).columns() );
2009 for(
size_t j=0UL; j<jend; ++j )
2011 const bool containsDiagonal(
column + j >=
row );
2012 const size_t index( ( containsDiagonal )?(
column + j -
row ):( 0UL ) );
2014 const auto last( (*rhs).end(j) );
2015 auto element( (*rhs).lowerBound( index, j ) );
2017 for( ; element!=last; ++element ) {
2046template<
typename MT
2054 return tryAddAssign( lhs, *rhs,
row,
column );
2078template<
typename MT
2109template<
typename MT1
2117 return tryAddAssign( lhs, *rhs,
row,
column );
2140template<
typename MT
2180template<
typename MT
2220template<
typename MT
2238 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
2239 if( !
isOne( (*rhs)[i] ) )
2267template<
typename MT
2285 if( (*rhs).nonZeros() != (*rhs).size() )
2287 for(
const auto& element : *rhs ) {
2288 if( !
isOne( element.value() ) )
2316template<
typename MT1
2333 const size_t M( (*rhs).rows() );
2334 const size_t N( (*rhs).columns() );
2342 for( ; i<M && j<N; ++i, ++j )
2344 if( !
isOne( (*rhs)(i,j) ) )
2370template<
typename MT
2378 return tryMultAssign( lhs, *rhs,
row,
column );
2401template<
typename MT
2431template<
typename MT
2470template<
typename MT
2510template<
typename MT
2528 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
2557template<
typename MT
2575 if( (*rhs).nonZeros() != (*rhs).size() )
2577 for(
const auto& element : *rhs ) {
2605template<
typename MT1
2622 const size_t M( (*rhs).rows() );
2623 const size_t N( (*rhs).columns() );
2631 for( ; i<M && j<N; ++i, ++j )
2660template<
typename MT
2700template<
typename MT
2740template<
typename MT
2758 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
2787template<
typename MT
2805 if( (*rhs).nonZeros() != (*rhs).size() )
2807 for(
const auto& element : *rhs ) {
2836template<
typename MT1
2853 const size_t M( (*rhs).rows() );
2854 const size_t N( (*rhs).columns() );
2862 for( ; i<M && j<N; ++i, ++j )
2891template<
typename MT
2899 return tryAssign( lhs, *rhs,
row,
column );
2922template<
typename MT
2953template<
typename MT1
2961 return tryAssign( lhs, *rhs,
row,
column );
2984template<
typename MT
2992 return tryAddAssign( lhs, *rhs,
row,
column );
3015template<
typename MT
3046template<
typename MT1
3054 return tryAddAssign( lhs, *rhs,
row,
column );
3074template<
typename MT
3095template<
typename MT,
bool SO,
bool DF >
3097 :
public Size<MT,0UL>
3100template<
typename MT,
bool SO,
bool DF >
3102 :
public Size<MT,1UL>
3118template<
typename MT,
bool SO,
bool DF >
3123template<
typename MT,
bool SO,
bool DF >
3141template<
typename MT,
bool SO,
bool DF >
3159template<
typename MT,
bool SO,
bool DF >
3177template<
typename MT,
bool SO,
bool DF >
3195template<
typename MT,
bool SO,
bool DF >
3213template<
typename MT,
bool SO >
3231template<
typename MT,
bool SO,
bool DF >
3249template<
typename MT,
bool SO,
bool DF >
3267template<
typename MT,
bool SO,
bool DF >
3285template<
typename MT,
bool SO,
bool DF >
3304template<
typename T1,
typename T2 >
3305struct AddTraitEval1< T1, T2
3330template<
typename T1,
typename T2 >
3331struct SubTraitEval1< T1, T2
3354template<
typename T1,
typename T2 >
3355struct SchurTraitEval1< T1, T2
3378template<
typename T1,
typename T2 >
3379struct MultTraitEval1< T1, T2
3401template<
typename T1,
typename T2 >
3402struct KronTraitEval1< T1, T2
3425template<
typename T,
typename OP >
3426struct UnaryMapTraitEval1< T, OP
3438template<
typename T1,
typename T2,
typename OP >
3439struct BinaryMapTraitEval1< T1, T2, OP
3459template<
typename MT,
bool SO,
bool DF >
3462 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
3478template<
typename MT,
bool SO,
bool DF >
3481 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
3497template<
typename MT,
bool SO,
bool DF >
3500 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
3516template<
typename MT,
bool SO,
bool DF >
3519 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
3535template<
typename MT,
bool SO,
bool DF >
3538 using Type = INVALID_TYPE;
3554template<
typename MT,
bool SO,
bool DF >
3557 using Type = UniUpperMatrix<MT,SO,DF>;
3573template<
typename MT,
bool SO,
bool DF >
3576 using Type = UniUpperMatrix<MT,SO,DF>;
3592template<
typename MT,
bool SO,
bool DF >
3595 using Type = INVALID_TYPE;
3611template<
typename MT,
bool SO,
bool DF >
3614 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
3630template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
3633 using Type = UniUpperMatrix< typename HighType<MT1,MT2>::Type >;
3649template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
3652 using Type = UniUpperMatrix< typename LowType<MT1,MT2>::Type >;
3668template<
typename MT,
size_t I,
size_t N >
3669struct SubmatrixTraitEval1< MT, I, I, N, N
Header file for the addition trait.
Header file for auxiliary alias declarations.
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 decldiag trait.
Header file for the declherm trait.
Header file for the decllow trait.
Header file for the declstrlow trait.
Header file for the declstrupp trait.
Header file for the declsym trait.
Header file for the declunilow trait.
Header file for the decluniupp trait.
Header file for the declupp trait.
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Constraint on the data type.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Utility type for generic codes.
Header file for the dense matrix inversion flags.
Header file for the IsAdaptor type trait.
Header file for the IsAligned type trait.
Header file for the IsContiguous type trait.
Header file for the isDefault shim.
Header file for the IsDiagonal type trait.
Header file for the IsIdentity type trait.
Header file for the IsMatrix type trait.
Header file for the isOne shim.
Header file for the IsPadded type trait.
Header file for the IsRestricted type trait.
Header file for the IsSquare type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniUpper type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Constraint on the data type.
Header file for the map trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Header file for the relaxation flag enumeration.
Header file for the RemoveAdaptor type trait.
Header file for the Schur product trait.
Header file for the subtraction trait.
Header file for the submatrix trait.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the YieldsIdentity type trait.
Header file for the YieldsUniUpper type trait.
Header file for the implementation of the base template of the UniUpperMatrix.
UniUpperMatrix specialization for dense matrices.
UniUpperMatrix specialization for sparse matrices.
Base class for dense matrices.
Definition DenseMatrix.h:82
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Base class for matrices.
Definition Matrix.h:85
Base class for sparse matrices.
Definition SparseMatrix.h:77
Base class for sparse vectors.
Definition SparseVector.h:72
Matrix adapter for upper unitriangular matrices.
Definition BaseTemplate.h:581
Base class for N-dimensional vectors.
Definition Vector.h:82
Constraint on the data type.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition Band.h:140
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition Column.h:137
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:222
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:1339
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an identity matrix.
Definition DenseMatrix.h:2561
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition DiagonalMatrix.h:225
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition HermitianProxy.h:693
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition Symmetric.h:79
#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_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.
Definition Hermitian.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.
Definition Upper.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.
Definition Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition UniTriangular.h:81
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.
Definition IsStrictlyUpper.h:173
constexpr bool YieldsIdentity_v
Auxiliary variable template for the YieldsIdentity type trait.
Definition YieldsIdentity.h:126
constexpr bool IsUniUpper_v
Auxiliary variable template for the IsUniUpper type trait.
Definition IsUniUpper.h:173
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.
Definition IsStrictlyLower.h:173
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.
Definition Size.h:176
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition Size.h:72
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.
Definition IsDiagonal.h:148
constexpr bool StorageOrder_v
Auxiliary variable template for the StorageOrder type trait.
Definition StorageOrder.h:93
constexpr bool IsZero_v
Auxiliary variable template for the IsZero type trait.
Definition IsZero.h:166
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition IsMatrix.h:124
constexpr bool IsIdentity_v
Auxiliary variable template for the IsIdentity type trait.
Definition IsIdentity.h:137
constexpr bool YieldsUniUpper_v
Auxiliary variable template for the YieldsUniUpper type trait.
Definition YieldsUniUpper.h:124
constexpr bool IsUniLower_v
Auxiliary variable template for the IsUniLower type trait.
Definition IsUniLower.h:173
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition Infinity.h:1080
bool isOne(const Proxy< PT, RT > &proxy)
Returns whether the represented element is 1.
Definition Proxy.h:2337
InversionFlag
Inversion flag.
Definition InversionFlag.h:102
@ asUniLower
Flag for the inversion of a lower unitriangular matrix.
Definition InversionFlag.h:112
@ asLower
Flag for the inversion of a lower triangular matrix.
Definition InversionFlag.h:111
@ asUpper
Flag for the inversion of a upper triangular matrix.
Definition InversionFlag.h:113
@ asUniUpper
Flag for the inversion of a upper unitriangular matrix.
Definition InversionFlag.h:114
@ asDiagonal
Flag for the inversion of a diagonal matrix.
Definition InversionFlag.h:115
@ byLU
Flag for the LU-based matrix inversion.
Definition InversionFlag.h:103
@ asGeneral
Flag for the inversion of a general matrix (same as byLU).
Definition InversionFlag.h:108
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition Matrix.h:806
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition Matrix.h:1108
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition MaybeUnused.h:81
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
BoolConstant< true > TrueType
Type traits base class.
Definition IntegralConstant.h:132
Header file for all forward declarations of the math module.
Header file for the Size type trait.
Header file for the StorageOrder type trait.
Base template for the DeclDiagTrait class.
Definition DeclDiagTrait.h:127
Base template for the DeclHermTrait class.
Definition DeclHermTrait.h:126
Base template for the DeclLowTrait class.
Definition DeclLowTrait.h:126
Base template for the DeclStrLowTrait class.
Definition DeclStrLowTrait.h:128
Base template for the DeclStrUppTrait class.
Definition DeclStrUppTrait.h:128
Base template for the DeclSymTrait class.
Definition DeclSymTrait.h:126
Base template for the DeclUniLowTrait class.
Definition DeclUniLowTrait.h:128
Base template for the DeclUniUppTrait class.
Definition DeclUniUppTrait.h:128
Base template for the DeclUppTrait class.
Definition DeclUppTrait.h:126
Compile time check for low-level access to constant data.
Definition HasConstDataAccess.h:76
Base template for the HighType type trait.
Definition HighType.h:322
Compile time check for adaptors.
Definition IsAdaptor.h:89
Compile time check for the alignment of data types.
Definition IsAligned.h:88
Compile time check for the memory layout of data types.
Definition IsContiguous.h:87
Compile time check for data types with padding.
Definition IsPadded.h:77
Compile time check for data types with restricted data access.
Definition IsRestricted.h:83
Compile time check for square matrices.
Definition IsSquare.h:89
Compile time check for upper unitriangular matrices.
Definition IsUniUpper.h:116
Base template for the LowType type trait.
Definition LowType.h:322
Compile time evaluation of the maximum size of vectors and matrices.
Definition MaxSize.h:118
Removal of top level adaptor types.
Definition RemoveAdaptor.h:77
Compile time evaluation of the size of vectors and matrices.
Definition Size.h:119
Header file for the IsZero type trait.
Header file for the generic min algorithm.