35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_ 36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_ 116 template<
typename MT,
bool SO,
bool DF,
bool NF >
117 void reset( SymmetricMatrix<MT,SO,DF,NF>& m );
119 template<
typename MT,
bool SO,
bool DF,
bool NF >
120 void reset( SymmetricMatrix<MT,SO,DF,NF>& m,
size_t i );
122 template<
typename MT,
bool SO,
bool DF,
bool NF >
123 void clear( SymmetricMatrix<MT,SO,DF,NF>& m );
125 template<
bool RF,
typename MT,
bool SO,
bool DF,
bool NF >
126 bool isDefault(
const SymmetricMatrix<MT,SO,DF,NF>& m );
128 template<
typename MT,
bool SO,
bool DF,
bool NF >
129 bool isIntact(
const SymmetricMatrix<MT,SO,DF,NF>& m );
131 template<
typename MT,
bool SO,
bool DF,
bool NF >
132 void swap( SymmetricMatrix<MT,SO,DF,NF>& a, SymmetricMatrix<MT,SO,DF,NF>& b ) noexcept;
144 template<
typename MT
168 template<
typename MT
186 template<
typename MT
229 return isDefault<RF>( m.matrix_ );
255 template<
typename MT
274 template<
typename MT
311 inline void invert( SymmetricMatrix<MT,SO,true,true>& m )
329 m.matrix_ = std::move( tmp );
353 template<
typename MT1
359 inline bool tryAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
360 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
371 const size_t M( (~rhs).
rows() );
372 const size_t N( (~rhs).
columns() );
383 const size_t subrow( lower ? 0UL :
column -
row );
384 const size_t subcol( lower ?
row -
column : 0UL );
408 template<
typename MT1
414 inline bool tryAddAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
415 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
417 return tryAssign( lhs, ~rhs,
row,
column );
440 template<
typename MT1
446 inline bool trySubAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
447 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
449 return tryAssign( lhs, ~rhs,
row,
column );
472 template<
typename MT1
478 inline bool trySchurAssign(
const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
479 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
481 return tryAssign( lhs, ~rhs,
row,
column );
497 template<
typename MT,
bool SO,
bool DF,
bool NF >
498 struct Size< SymmetricMatrix<MT,SO,DF,NF>, 0UL >
499 :
public Size<MT,0UL>
502 template<
typename MT,
bool SO,
bool DF,
bool NF >
503 struct Size< SymmetricMatrix<MT,SO,DF,NF>, 1UL >
504 :
public Size<MT,1UL>
520 template<
typename MT,
bool SO,
bool DF,
bool NF >
521 struct MaxSize< SymmetricMatrix<MT,SO,DF,NF>, 0UL >
522 :
public MaxSize<MT,0UL>
525 template<
typename MT,
bool SO,
bool DF,
bool NF >
526 struct MaxSize< SymmetricMatrix<MT,SO,DF,NF>, 1UL >
527 :
public MaxSize<MT,1UL>
543 template<
typename MT,
bool SO,
bool DF,
bool NF >
544 struct IsSquare< SymmetricMatrix<MT,SO,DF,NF> >
561 template<
typename MT,
bool SO,
bool DF,
bool NF >
562 struct IsUniform< SymmetricMatrix<MT,SO,DF,NF> >
563 :
public IsUniform<MT>
579 template<
typename MT,
bool SO,
bool DF,
bool NF >
580 struct IsSymmetric< SymmetricMatrix<MT,SO,DF,NF> >
597 template<
typename MT,
bool SO,
bool DF,
bool NF >
598 struct IsHermitian< SymmetricMatrix<MT,SO,DF,NF> >
599 :
public IsBuiltin< ElementType_t<MT> >
615 template<
typename MT,
bool SO,
bool DF,
bool NF >
616 struct IsStrictlyLower< SymmetricMatrix<MT,SO,DF,NF> >
633 template<
typename MT,
bool SO,
bool DF,
bool NF >
634 struct IsStrictlyUpper< SymmetricMatrix<MT,SO,DF,NF> >
651 template<
typename MT,
bool SO,
bool DF,
bool NF >
652 struct IsAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
669 template<
typename MT,
bool SO,
bool DF,
bool NF >
670 struct IsRestricted< SymmetricMatrix<MT,SO,DF,NF> >
687 template<
typename MT,
bool SO,
bool NF >
688 struct HasConstDataAccess< SymmetricMatrix<MT,SO,true,NF> >
705 template<
typename MT,
bool SO,
bool DF,
bool NF >
706 struct IsAligned< SymmetricMatrix<MT,SO,DF,NF> >
707 :
public IsAligned<MT>
723 template<
typename MT,
bool SO,
bool DF,
bool NF >
724 struct IsContiguous< SymmetricMatrix<MT,SO,DF,NF> >
725 :
public IsContiguous<MT>
741 template<
typename MT,
bool SO,
bool DF,
bool NF >
742 struct IsPadded< SymmetricMatrix<MT,SO,DF,NF> >
743 :
public IsPadded<MT>
759 template<
typename MT,
bool SO,
bool DF,
bool NF >
760 struct IsResizable< SymmetricMatrix<MT,SO,DF,NF> >
761 :
public IsResizable<MT>
777 template<
typename MT,
bool SO,
bool DF,
bool NF >
778 struct IsShrinkable< SymmetricMatrix<MT,SO,DF,NF> >
779 :
public IsShrinkable<MT>
795 template<
typename MT,
bool SO,
bool DF,
bool NF >
796 struct RemoveAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
814 template<
typename T1,
typename T2 >
815 struct AddTraitEval1< T1, T2
818 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
819 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
820 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
821 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
822 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
823 !( IsZero_v<T1> || IsZero_v<T2> ) > >
825 using Type = SymmetricMatrix< typename AddTraitEval2<T1,T2>::Type >;
841 template<
typename T1,
typename T2 >
842 struct SubTraitEval1< T1, T2
845 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
846 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
847 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
848 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
849 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
850 !( IsZero_v<T1> || IsZero_v<T2> ) > >
852 using Type = SymmetricMatrix< typename SubTraitEval2<T1,T2>::Type >;
868 template<
typename T1,
typename T2 >
869 struct SchurTraitEval1< T1, T2
872 ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
873 !( IsDiagonal_v<T1> || IsDiagonal_v<T2> ) &&
874 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
875 !( IsZero_v<T1> || IsZero_v<T2> ) > >
877 using Type = SymmetricMatrix< typename SchurTraitEval2<T1,T2>::Type >;
893 template<
typename T1,
typename T2 >
894 struct MultTraitEval1< T1, T2
897 ( IsSymmetric_v<T1> && !IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
899 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
902 template<
typename T1,
typename T2 >
903 struct MultTraitEval1< T1, T2
906 ( IsSymmetric_v<T2> && !IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
908 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
924 template<
typename T1,
typename T2 >
925 struct KronTraitEval1< T1, T2
928 ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
929 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
930 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
931 !( IsZero_v<T1> || IsZero_v<T2> ) > >
933 using Type = SymmetricMatrix< typename KronTraitEval2<T1,T2>::Type >;
949 template<
typename T1,
typename T2 >
950 struct DivTraitEval1< T1, T2
953 using Type = SymmetricMatrix< typename DivTraitEval2<T1,T2>::Type >;
969 template<
typename T,
typename OP >
970 struct UnaryMapTraitEval1< T, OP
972 !YieldsHermitian_v<OP,T> &&
973 !YieldsDiagonal_v<OP,T> &&
974 !YieldsIdentity_v<OP,T> > >
976 using Type = SymmetricMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
984 template<
typename T1,
typename T2,
typename OP >
985 struct BinaryMapTraitEval1< T1, T2, OP
987 !YieldsHermitian_v<OP,T1,T2> &&
988 !YieldsDiagonal_v<OP,T1,T2> &&
989 !YieldsIdentity_v<OP,T1,T2> > >
991 using Type = SymmetricMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
1007 template<
typename MT,
bool SO,
bool DF,
bool NF >
1008 struct DeclSymTrait< SymmetricMatrix<MT,SO,DF,NF> >
1010 using Type = SymmetricMatrix<MT,SO,DF,NF>;
1026 template<
typename MT,
bool SO,
bool DF,
bool NF >
1027 struct DeclHermTrait< SymmetricMatrix<MT,SO,DF,NF> >
1029 using Type = HermitianMatrix<MT>;
1045 template<
typename MT,
bool SO,
bool DF,
bool NF >
1046 struct DeclLowTrait< SymmetricMatrix<MT,SO,DF,NF> >
1048 using Type = DiagonalMatrix<MT>;
1064 template<
typename MT,
bool SO,
bool DF,
bool NF >
1065 struct DeclUppTrait< SymmetricMatrix<MT,SO,DF,NF> >
1067 using Type = DiagonalMatrix<MT>;
1083 template<
typename MT,
bool SO,
bool DF,
bool NF >
1084 struct DeclDiagTrait< SymmetricMatrix<MT,SO,DF,NF> >
1086 using Type = DiagonalMatrix<MT>;
1102 template<
typename MT1,
bool SO1,
bool DF1,
bool NF1,
typename MT2,
bool SO2,
bool DF2,
bool NF2 >
1103 struct HighType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1105 using Type = SymmetricMatrix< typename HighType<MT1,MT2>::Type >;
1121 template<
typename MT1,
bool SO1,
bool DF1,
bool NF1,
typename MT2,
bool SO2,
bool DF2,
bool NF2 >
1122 struct LowType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1124 using Type = SymmetricMatrix< typename LowType<MT1,MT2>::Type >;
1140 template<
typename MT,
size_t I,
size_t N >
1141 struct SubmatrixTraitEval1< MT, I, I, N, N
1143 !IsDiagonal_v<MT> > >
1145 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.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
Header file for the subtraction trait.
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:178
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
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
constexpr bool YieldsSymmetric_v
Auxiliary variable template for the YieldsSymmetric type trait.The YieldsSymmetric_v variable templat...
Definition: YieldsSymmetric.h:124
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:595
Header file for the YieldsIdentity type trait.
Header file for the MAYBE_UNUSED function template.
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: IntegralConstant.h:132
Header file for all forward declarations of the math module.
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 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:2433
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:779
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.
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:1162
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
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
Flag for the Bunch-Kaufman-based inversion for symmetric matrices.
Definition: InversionFlag.h:104
Header file for the Kron product trait.
Header file for the exception macros of the math module.
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:615
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:282
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:1328
#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 IntegralConstant class template.
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:264
constexpr bool IsSymmetric_v
Auxiliary variable template for the IsSymmetric type trait.The IsSymmetric_v variable template provid...
Definition: IsSymmetric.h:172
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
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,...
Definition: Assert.h:101
Header file for the HighType type trait.