35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_ 36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_ 115 template<
typename MT,
bool SO,
bool DF,
bool NF >
116 void reset( SymmetricMatrix<MT,SO,DF,NF>& m );
118 template<
typename MT,
bool SO,
bool DF,
bool NF >
119 void reset( SymmetricMatrix<MT,SO,DF,NF>& m,
size_t i );
121 template<
typename MT,
bool SO,
bool DF,
bool NF >
122 void clear( SymmetricMatrix<MT,SO,DF,NF>& m );
124 template<
bool RF,
typename MT,
bool SO,
bool DF,
bool NF >
125 bool isDefault(
const SymmetricMatrix<MT,SO,DF,NF>& m );
127 template<
typename MT,
bool SO,
bool DF,
bool NF >
128 bool isIntact(
const SymmetricMatrix<MT,SO,DF,NF>& m );
130 template<
typename MT,
bool SO,
bool DF,
bool NF >
131 void swap( SymmetricMatrix<MT,SO,DF,NF>& a, SymmetricMatrix<MT,SO,DF,NF>& b ) noexcept;
143 template<
typename MT
167 template<
typename MT
185 template<
typename MT
228 return isDefault<RF>( m.matrix_ );
254 template<
typename MT
273 template<
typename MT
310 inline void invert( SymmetricMatrix<MT,SO,true,true>& m )
328 m.matrix_ = std::move( tmp );
352 template<
typename MT1
358 inline bool tryAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
359 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
370 const size_t M( (~rhs).
rows() );
371 const size_t N( (~rhs).
columns() );
382 const size_t subrow( lower ? 0UL :
column -
row );
383 const size_t subcol( lower ?
row -
column : 0UL );
407 template<
typename MT1
413 inline bool tryAddAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
414 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
416 return tryAssign( lhs, ~rhs,
row,
column );
439 template<
typename MT1
445 inline bool trySubAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
446 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
448 return tryAssign( lhs, ~rhs,
row,
column );
471 template<
typename MT1
477 inline bool trySchurAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
478 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
480 return tryAssign( lhs, ~rhs,
row,
column );
496 template<
typename MT,
bool SO,
bool DF,
bool NF >
497 struct Size< SymmetricMatrix<MT,SO,DF,NF>, 0UL >
498 :
public Size<MT,0UL>
501 template<
typename MT,
bool SO,
bool DF,
bool NF >
502 struct Size< SymmetricMatrix<MT,SO,DF,NF>, 1UL >
503 :
public Size<MT,1UL>
519 template<
typename MT,
bool SO,
bool DF,
bool NF >
520 struct MaxSize< SymmetricMatrix<MT,SO,DF,NF>, 0UL >
521 :
public MaxSize<MT,0UL>
524 template<
typename MT,
bool SO,
bool DF,
bool NF >
525 struct MaxSize< SymmetricMatrix<MT,SO,DF,NF>, 1UL >
526 :
public MaxSize<MT,1UL>
542 template<
typename MT,
bool SO,
bool DF,
bool NF >
543 struct IsSquare< SymmetricMatrix<MT,SO,DF,NF> >
560 template<
typename MT,
bool SO,
bool DF,
bool NF >
561 struct IsUniform< SymmetricMatrix<MT,SO,DF,NF> >
562 :
public IsUniform<MT>
578 template<
typename MT,
bool SO,
bool DF,
bool NF >
579 struct IsSymmetric< SymmetricMatrix<MT,SO,DF,NF> >
596 template<
typename MT,
bool SO,
bool DF,
bool NF >
597 struct IsHermitian< SymmetricMatrix<MT,SO,DF,NF> >
598 :
public IsBuiltin< ElementType_t<MT> >
614 template<
typename MT,
bool SO,
bool DF,
bool NF >
615 struct IsStrictlyLower< SymmetricMatrix<MT,SO,DF,NF> >
632 template<
typename MT,
bool SO,
bool DF,
bool NF >
633 struct IsStrictlyUpper< SymmetricMatrix<MT,SO,DF,NF> >
650 template<
typename MT,
bool SO,
bool DF,
bool NF >
651 struct IsAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
668 template<
typename MT,
bool SO,
bool DF,
bool NF >
669 struct IsRestricted< SymmetricMatrix<MT,SO,DF,NF> >
686 template<
typename MT,
bool SO,
bool NF >
687 struct HasConstDataAccess< SymmetricMatrix<MT,SO,true,NF> >
704 template<
typename MT,
bool SO,
bool DF,
bool NF >
705 struct IsAligned< SymmetricMatrix<MT,SO,DF,NF> >
706 :
public IsAligned<MT>
722 template<
typename MT,
bool SO,
bool DF,
bool NF >
723 struct IsContiguous< SymmetricMatrix<MT,SO,DF,NF> >
724 :
public IsContiguous<MT>
740 template<
typename MT,
bool SO,
bool DF,
bool NF >
741 struct IsPadded< SymmetricMatrix<MT,SO,DF,NF> >
742 :
public IsPadded<MT>
758 template<
typename MT,
bool SO,
bool DF,
bool NF >
759 struct IsResizable< SymmetricMatrix<MT,SO,DF,NF> >
760 :
public IsResizable<MT>
776 template<
typename MT,
bool SO,
bool DF,
bool NF >
777 struct IsShrinkable< SymmetricMatrix<MT,SO,DF,NF> >
778 :
public IsShrinkable<MT>
794 template<
typename MT,
bool SO,
bool DF,
bool NF >
795 struct RemoveAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
813 template<
typename T1,
typename T2 >
814 struct AddTraitEval1< T1, T2
817 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
818 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
819 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
820 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
821 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
822 !( IsZero_v<T1> || IsZero_v<T2> ) > >
824 using Type = SymmetricMatrix< typename AddTraitEval2<T1,T2>::Type >;
840 template<
typename T1,
typename T2 >
841 struct SubTraitEval1< T1, T2
844 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
845 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
846 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
847 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
848 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
849 !( IsZero_v<T1> || IsZero_v<T2> ) > >
851 using Type = SymmetricMatrix< typename SubTraitEval2<T1,T2>::Type >;
867 template<
typename T1,
typename T2 >
868 struct SchurTraitEval1< T1, T2
871 ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
872 !( IsDiagonal_v<T1> || IsDiagonal_v<T2> ) &&
873 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
874 !( IsZero_v<T1> || IsZero_v<T2> ) > >
876 using Type = SymmetricMatrix< typename SchurTraitEval2<T1,T2>::Type >;
892 template<
typename T1,
typename T2 >
893 struct MultTraitEval1< T1, T2
896 ( IsSymmetric_v<T1> && !IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
898 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
901 template<
typename T1,
typename T2 >
902 struct MultTraitEval1< T1, T2
905 ( IsSymmetric_v<T2> && !IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
907 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
923 template<
typename T1,
typename T2 >
924 struct DivTraitEval1< T1, T2
927 using Type = SymmetricMatrix< typename DivTraitEval2<T1,T2>::Type >;
943 template<
typename T,
typename OP >
944 struct UnaryMapTraitEval1< T, OP
946 !YieldsHermitian_v<OP,T> &&
947 !YieldsDiagonal_v<OP,T> &&
948 !YieldsIdentity_v<OP,T> > >
950 using Type = SymmetricMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
958 template<
typename T1,
typename T2,
typename OP >
959 struct BinaryMapTraitEval1< T1, T2, OP
961 !YieldsHermitian_v<OP,T1,T2> &&
962 !YieldsDiagonal_v<OP,T1,T2> &&
963 !YieldsIdentity_v<OP,T1,T2> > >
965 using Type = SymmetricMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
981 template<
typename MT,
bool SO,
bool DF,
bool NF >
982 struct DeclSymTrait< SymmetricMatrix<MT,SO,DF,NF> >
984 using Type = SymmetricMatrix<MT,SO,DF,NF>;
1000 template<
typename MT,
bool SO,
bool DF,
bool NF >
1001 struct DeclHermTrait< SymmetricMatrix<MT,SO,DF,NF> >
1003 using Type = HermitianMatrix<MT>;
1019 template<
typename MT,
bool SO,
bool DF,
bool NF >
1020 struct DeclLowTrait< SymmetricMatrix<MT,SO,DF,NF> >
1022 using Type = DiagonalMatrix<MT>;
1038 template<
typename MT,
bool SO,
bool DF,
bool NF >
1039 struct DeclUppTrait< SymmetricMatrix<MT,SO,DF,NF> >
1041 using Type = DiagonalMatrix<MT>;
1057 template<
typename MT,
bool SO,
bool DF,
bool NF >
1058 struct DeclDiagTrait< SymmetricMatrix<MT,SO,DF,NF> >
1060 using Type = DiagonalMatrix<MT>;
1076 template<
typename MT1,
bool SO1,
bool DF1,
bool NF1,
typename MT2,
bool SO2,
bool DF2,
bool NF2 >
1077 struct HighType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1079 using Type = SymmetricMatrix< typename HighType<MT1,MT2>::Type >;
1095 template<
typename MT1,
bool SO1,
bool DF1,
bool NF1,
typename MT2,
bool SO2,
bool DF2,
bool NF2 >
1096 struct LowType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1098 using Type = SymmetricMatrix< typename LowType<MT1,MT2>::Type >;
1114 template<
typename MT,
size_t I,
size_t N >
1115 struct SubmatrixTraitEval1< MT, I, I, N, N
1117 !IsDiagonal_v<MT> > >
1119 using Type = SymmetricMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
Header file for auxiliary alias declarations.
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.
Header file for the subtraction trait.
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
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 declherm trait.
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
Header file for the IsDiagonal type trait.
Header file for the dense matrix inversion flags.
Flag for the Bunch-Kaufman-based inversion for Hermitian matrices.
Definition: InversionFlag.h:105
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
Header file for the YieldsIdentity type trait.
Matrix adapter for symmetric matrices.
Definition: BaseTemplate.h:608
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 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
constexpr bool YieldsSymmetric_v
Auxiliary variable template for the YieldsSymmetric type trait.The YieldsSymmetric_v variable templat...
Definition: YieldsSymmetric.h:125
Header file for the implementation of the base template of the SymmetricMatrix.
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1644
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
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:775
Constraint on the data type.
SymmetricMatrix specialization for dense matrices with non-numeric element type.
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
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Header file for the IsShrinkable type trait.
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
SymmetricMatrix specialization for sparse matrices with numeric element type.
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
Flag for the inversion of a Hermitian matrix (same as byLDLH).
Definition: InversionFlag.h:110
Header file for the IsAligned type trait.
Flag for the Bunch-Kaufman-based inversion for symmetric matrices.
Definition: InversionFlag.h:104
constexpr bool IsSymmetric_v
Auxiliary variable template for the IsSymmetric type trait.The IsSymmetric_v variable template provid...
Definition: IsSymmetric.h:171
Header file for the exception macros of the math module.
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:360
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.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
Header file for the declupp trait.
SymmetricMatrix specialization for sparse matrices with non-numeric element type. ...
Flag for the inversion of a symmetric matrix (same as byLDLT).
Definition: InversionFlag.h:109
Header file for run time assertion macros.
Header file for the YieldsSymmetric type trait.
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.
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_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:61
Flag for the Cholesky-based inversion for positive-definite matrices.
Definition: InversionFlag.h:106
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:539
#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
SymmetricMatrix specialization for dense matrices with numeric element type.
Header file for the YieldsDiagonal type trait.
Header file for the IsBuiltin type trait.
Header file for the isDivisor shim.
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 YieldsHermitian 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.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#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.