35#ifndef _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_H_
36#define _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_H_
125template< RelaxationFlag RF,
typename MT,
bool SO,
bool DF >
128template<
typename MT,
bool SO,
bool DF >
131template<
typename MT,
bool SO,
bool DF >
172 return m.rows() == 0UL;
174 for(
size_t i=0UL; i<m.rows(); ++i ) {
258inline void invert( DiagonalMatrix<MT,SO,true>& m )
294template<
typename MT1,
bool SO1,
typename MT2,
typename MT3,
typename MT4,
bool SO2 >
313 const size_t n( (*A).rows() );
315 decltype(
auto) U2( derestrict( *U ) );
325 for(
size_t i=0UL; i<n; ++i ) {
399 return ( m == 0UL ) ||
401 (
row ==
column && m == 1UL && n == 1UL ) ||
430 return trySet( mat, i, j, value );
461 return trySet( mat,
row,
column, m, n, value );
489 return trySet( mat, i, j, value );
520 return trySet( mat,
row,
column, m, n, value );
548 return trySet( mat, i, j, value );
579 return trySet( mat,
row,
column, m, n, value );
607 return tryAdd( mat, i, j, value );
638 return tryAdd( mat,
row,
column, m, n, value );
677 for(
size_t i=0UL; i<index; ++i ) {
682 for(
size_t i=index+1UL; i<(*rhs).size(); ++i ) {
726 for(
size_t i=0UL; i<index; ++i ) {
731 for(
size_t i=index+1UL; i<(*rhs).size(); ++i ) {
777 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
822 for(
auto element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
823 if( element->index() != index && !
isDefault( element->value() ) )
866 for(
auto element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
867 if( element->index() != index && !
isDefault( element->value() ) )
912 for(
const auto& element : *rhs ) {
940template<
typename MT1
956 const size_t M( (*rhs).rows() );
957 const size_t N( (*rhs).columns() );
959 for(
size_t i=0UL; i<M; ++i ) {
960 for(
size_t j=0UL; j<N; ++j ) {
988template<
typename MT1
1004 const size_t M( (*rhs).rows() );
1005 const size_t N( (*rhs).columns() );
1007 for(
size_t j=0UL; j<N; ++j ) {
1008 for(
size_t i=0UL; i<M; ++i ) {
1036template<
typename MT1
1052 const size_t M( (*rhs).rows() );
1054 for(
size_t i=0UL; i<M; ++i ) {
1055 for(
auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element ) {
1083template<
typename MT1
1099 const size_t N( (*rhs).columns() );
1101 for(
size_t j=0UL; j<N; ++j ) {
1102 for(
auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element ) {
1130template<
typename MT
1138 return tryAssign( lhs, *rhs,
row,
column );
1162template<
typename MT
1192template<
typename MT1
1200 return tryAssign( lhs, *rhs,
row,
column );
1223template<
typename MT
1231 return tryAssign( lhs, *rhs,
row,
column );
1255template<
typename MT
1286template<
typename MT1
1294 return tryAssign( lhs, *rhs,
row,
column );
1317template<
typename MT
1325 return tryAssign( lhs, *rhs,
row,
column );
1348template<
typename MT
1378template<
typename MT1
1386 return tryAssign( lhs, *rhs,
row,
column );
1409template<
typename MT
1417 return tryAssign( lhs, *rhs,
row,
column );
1440template<
typename MT
1471template<
typename MT1
1479 return tryAssign( lhs, *rhs,
row,
column );
1500template<
typename MT
1521template<
typename MT,
bool SO,
bool DF >
1523 :
public Size<MT,0UL>
1526template<
typename MT,
bool SO,
bool DF >
1528 :
public Size<MT,1UL>
1544template<
typename MT,
bool SO,
bool DF >
1549template<
typename MT,
bool SO,
bool DF >
1567template<
typename MT,
bool SO,
bool DF >
1585template<
typename MT,
bool SO,
bool DF >
1603template<
typename MT,
bool SO,
bool DF >
1621template<
typename MT,
bool SO,
bool DF >
1639template<
typename MT,
bool SO,
bool DF >
1657template<
typename MT,
bool SO,
bool DF >
1675template<
typename MT,
bool SO,
bool DF >
1693template<
typename MT,
bool SO,
bool DF >
1711template<
typename MT,
bool SO,
bool DF >
1729template<
typename MT,
bool SO,
bool DF >
1747template<
typename MT,
bool SO >
1765template<
typename MT,
bool SO,
bool DF >
1783template<
typename MT,
bool SO,
bool DF >
1801template<
typename MT,
bool SO,
bool DF >
1819template<
typename MT,
bool SO,
bool DF >
1838template<
typename T1,
typename T2 >
1839struct AddTraitEval1< T1, T2
1861template<
typename T1,
typename T2 >
1862struct SubTraitEval1< T1, T2
1871template<
typename T1,
typename T2 >
1872struct SubTraitEval1< T1, T2
1894template<
typename T1,
typename T2 >
1895struct SchurTraitEval1< T1, T2
1925template<
typename T1,
typename T2 >
1926struct MultTraitEval1< T1, T2
1934template<
typename T1,
typename T2 >
1935struct MultTraitEval1< T1, T2
1943template<
typename T1,
typename T2 >
1944struct MultTraitEval1< T1, T2
1967template<
typename T1,
typename T2 >
1968struct KronTraitEval1< T1, T2
1991template<
typename T1,
typename T2 >
1992struct DivTraitEval1< T1, T2
2011template<
typename T,
typename OP >
2012struct UnaryMapTraitEval1< T, OP
2025template<
typename T1,
typename T2,
typename OP >
2026struct BinaryMapTraitEval1< T1, T2, OP
2047template<
typename MT,
bool SO,
bool DF >
2050 using Type = DiagonalMatrix<MT,SO,DF>;
2066template<
typename MT,
bool SO,
bool DF >
2069 using Type = HermitianMatrix<MT,SO,DF>;
2085template<
typename MT,
bool SO,
bool DF >
2088 using Type = DiagonalMatrix<MT,SO,DF>;
2104template<
typename MT,
bool SO,
bool DF >
2107 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
2123template<
typename MT,
bool SO,
bool DF >
2126 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
2142template<
typename MT,
bool SO,
bool DF >
2145 using Type = DiagonalMatrix<MT,SO,DF>;
2161template<
typename MT,
bool SO,
bool DF >
2164 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
2180template<
typename MT,
bool SO,
bool DF >
2183 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
2199template<
typename MT,
bool SO,
bool DF >
2202 using Type = DiagonalMatrix<MT,SO,DF>;
2218template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2221 using Type = DiagonalMatrix< typename HighType<MT1,MT2>::Type >;
2237template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2240 using Type = DiagonalMatrix< typename LowType<MT1,MT2>::Type >;
2256template<
typename MT,
size_t I,
size_t N >
2257struct SubmatrixTraitEval1< MT, I, I, N, N
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition Aliases.h:310
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 division 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 If class template.
Header file for the IntegralConstant class template.
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 IsBuiltin 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 isDivisor shim.
Header file for the IsHermitian type trait.
Header file for the IsIdentity type trait.
Header file for the IsLower type trait.
Header file for the IsMatrix type trait.
Header file for the IsPadded type trait.
Header file for the IsRestricted type trait.
Header file for the IsScalar 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 IsSymmetric type trait.
Header file for the IsUniTriangular type trait.
Header file for the IsUpper 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 MaxSize type 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 YieldsDiagonal type trait.
Header file for the YieldsIdentity type trait.
Header file for the YieldsZero type trait.
Header file for the implementation of the base template of the DiagonalMatrix.
DiagonalMatrix specialization for dense matrices.
DiagonalMatrix specialization for sparse matrices.
Base class for dense matrices.
Definition DenseMatrix.h:82
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Matrix adapter for diagonal matrices.
Definition BaseTemplate.h:565
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
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
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 IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition IsScalar.h:104
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.
Definition IsStrictlyLower.h:173
constexpr bool IsUniform_v
Auxiliary variable template for the IsUniform type trait.
Definition IsUniform.h:164
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.
Definition IsUpper.h:175
constexpr bool YieldsDiagonal_v
Auxiliary variable template for the YieldsDiagonal type trait.
Definition YieldsDiagonal.h:126
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 YieldsZero_v
Auxiliary variable template for the YieldsZero type trait.
Definition YieldsZero.h:125
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 IsUniTriangular_v
Auxiliary variable template for the IsUniTriangular type trait.
Definition IsUniTriangular.h:106
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.
Definition IsLower.h:175
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition Infinity.h:1080
InversionFlag
Inversion flag.
Definition InversionFlag.h:102
@ asUniLower
Flag for the inversion of a lower unitriangular matrix.
Definition InversionFlag.h:112
@ asUniUpper
Flag for the inversion of a upper unitriangular matrix.
Definition InversionFlag.h:114
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
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition If.h:108
Header file for the exception macros of the math module.
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 built-in data types.
Definition IsBuiltin.h:77
Compile time check for the memory layout of data types.
Definition IsContiguous.h:87
Compile time check for Hermitian matrices.
Definition IsHermitian.h:115
Compile time check for lower triangular matrices.
Definition IsLower.h:118
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 strictly lower triangular matrices.
Definition IsStrictlyLower.h:116
Compile time check for strictly upper triangular matrices.
Definition IsStrictlyUpper.h:116
Compile time check for symmetric matrices.
Definition IsSymmetric.h:115
Compile time check for upper triangular matrices.
Definition IsUpper.h:118
Compile time check for zero vectors or matrices.
Definition IsZero.h:109
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.