35#ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_
36#define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_
120template< RelaxationFlag RF,
typename MT,
bool SO,
bool DF,
bool SF >
121bool isDefault(
const SymmetricMatrix<MT,SO,DF,SF>& m );
123template<
typename MT,
bool SO,
bool DF,
bool SF >
124bool isIntact(
const SymmetricMatrix<MT,SO,DF,SF>& m );
126template<
typename MT,
bool SO,
bool DF,
bool SF >
127void swap( SymmetricMatrix<MT,SO,DF,SF>& a, SymmetricMatrix<MT,SO,DF,SF>& b )
noexcept;
162inline bool isDefault(
const SymmetricMatrix<MT,SO,DF,SF>& m )
165 return m.rows() == 0UL;
166 else return isStrictlyLower<RF>( m );
196inline bool isIntact(
const SymmetricMatrix<MT,SO,DF,SF>& m )
215inline void swap( SymmetricMatrix<MT,SO,DF,SF>& a, SymmetricMatrix<MT,SO,DF,SF>& b )
noexcept
248inline void invert( SymmetricMatrix<MT,SO,true,true>& m )
266 m.matrix_ = std::move( tmp );
290template<
typename MT1
296inline bool tryAssign(
const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
297 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
308 const size_t M( (*rhs).rows() );
309 const size_t N( (*rhs).columns() );
320 const size_t subrow( lower ? 0UL :
column -
row );
321 const size_t subcol( lower ?
row -
column : 0UL );
345template<
typename MT1
351inline bool tryAddAssign(
const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
352 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
354 return tryAssign( lhs, *rhs,
row,
column );
377template<
typename MT1
383inline bool trySubAssign(
const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
384 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
386 return tryAssign( lhs, *rhs,
row,
column );
409template<
typename MT1
415inline bool trySchurAssign(
const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
416 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
418 return tryAssign( lhs, *rhs,
row,
column );
434template<
typename MT,
bool SO,
bool DF,
bool SF >
435struct Size< SymmetricMatrix<MT,SO,DF,SF>, 0UL >
436 :
public Size<MT,0UL>
439template<
typename MT,
bool SO,
bool DF,
bool SF >
440struct Size< SymmetricMatrix<MT,SO,DF,SF>, 1UL >
441 :
public Size<MT,1UL>
457template<
typename MT,
bool SO,
bool DF,
bool SF >
458struct MaxSize< SymmetricMatrix<MT,SO,DF,SF>, 0UL >
459 :
public MaxSize<MT,0UL>
462template<
typename MT,
bool SO,
bool DF,
bool SF >
463struct MaxSize< SymmetricMatrix<MT,SO,DF,SF>, 1UL >
464 :
public MaxSize<MT,1UL>
480template<
typename MT,
bool SO,
bool DF,
bool SF >
481struct IsSquare< SymmetricMatrix<MT,SO,DF,SF> >
498template<
typename MT,
bool SO,
bool DF,
bool SF >
499struct IsUniform< SymmetricMatrix<MT,SO,DF,SF> >
500 :
public IsUniform<MT>
516template<
typename MT,
bool SO,
bool DF,
bool SF >
517struct IsSymmetric< SymmetricMatrix<MT,SO,DF,SF> >
534template<
typename MT,
bool SO,
bool DF,
bool SF >
535struct IsHermitian< SymmetricMatrix<MT,SO,DF,SF> >
536 :
public IsBuiltin< ElementType_t<MT> >
552template<
typename MT,
bool SO,
bool DF,
bool SF >
553struct IsStrictlyLower< SymmetricMatrix<MT,SO,DF,SF> >
570template<
typename MT,
bool SO,
bool DF,
bool SF >
571struct IsStrictlyUpper< SymmetricMatrix<MT,SO,DF,SF> >
588template<
typename MT,
bool SO,
bool DF,
bool SF >
589struct IsAdaptor< SymmetricMatrix<MT,SO,DF,SF> >
606template<
typename MT,
bool SO,
bool DF,
bool SF >
607struct IsRestricted< SymmetricMatrix<MT,SO,DF,SF> >
624template<
typename MT,
bool SO,
bool SF >
625struct HasConstDataAccess< SymmetricMatrix<MT,SO,true,SF> >
642template<
typename MT,
bool SO,
bool DF,
bool SF >
643struct IsAligned< SymmetricMatrix<MT,SO,DF,SF> >
644 :
public IsAligned<MT>
660template<
typename MT,
bool SO,
bool DF,
bool SF >
661struct IsContiguous< SymmetricMatrix<MT,SO,DF,SF> >
662 :
public IsContiguous<MT>
678template<
typename MT,
bool SO,
bool DF,
bool SF >
679struct IsPadded< SymmetricMatrix<MT,SO,DF,SF> >
680 :
public IsPadded<MT>
696template<
typename MT,
bool SO,
bool DF,
bool SF >
697struct RemoveAdaptor< SymmetricMatrix<MT,SO,DF,SF> >
715template<
typename T1,
typename T2 >
716struct AddTraitEval1< T1, T2
719 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
720 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
721 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
722 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
723 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
724 !( IsZero_v<T1> || IsZero_v<T2> ) > >
726 using Type = SymmetricMatrix< typename AddTraitEval2<T1,T2>::Type >;
742template<
typename T1,
typename T2 >
743struct SubTraitEval1< T1, T2
746 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
747 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
748 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
749 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
750 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
751 !( IsZero_v<T1> || IsZero_v<T2> ) > >
753 using Type = SymmetricMatrix< typename SubTraitEval2<T1,T2>::Type >;
769template<
typename T1,
typename T2 >
770struct SchurTraitEval1< T1, T2
773 ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
774 !( IsDiagonal_v<T1> || IsDiagonal_v<T2> ) &&
775 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
776 !( IsZero_v<T1> || IsZero_v<T2> ) > >
778 using Type = SymmetricMatrix< typename SchurTraitEval2<T1,T2>::Type >;
794template<
typename T1,
typename T2 >
795struct MultTraitEval1< T1, T2
798 ( IsSymmetric_v<T1> && !IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
800 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
803template<
typename T1,
typename T2 >
804struct MultTraitEval1< T1, T2
807 ( IsSymmetric_v<T2> && !IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
809 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
825template<
typename T1,
typename T2 >
826struct KronTraitEval1< T1, T2
829 ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
830 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
831 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
832 !( IsZero_v<T1> || IsZero_v<T2> ) > >
834 using Type = SymmetricMatrix< typename KronTraitEval2<T1,T2>::Type >;
850template<
typename T1,
typename T2 >
851struct DivTraitEval1< T1, T2
854 using Type = SymmetricMatrix< typename DivTraitEval2<T1,T2>::Type >;
870template<
typename T,
typename OP >
871struct UnaryMapTraitEval1< T, OP
873 !YieldsHermitian_v<OP,T> &&
874 !YieldsDiagonal_v<OP,T> &&
875 !YieldsIdentity_v<OP,T> > >
877 using Type = SymmetricMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
885template<
typename T1,
typename T2,
typename OP >
886struct BinaryMapTraitEval1< T1, T2, OP
888 !YieldsHermitian_v<OP,T1,T2> &&
889 !YieldsDiagonal_v<OP,T1,T2> &&
890 !YieldsIdentity_v<OP,T1,T2> > >
892 using Type = SymmetricMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
908template<
typename T,
size_t R0,
size_t R1 >
909struct RepeatTraitEval1< T, R0, R1,
inf
913 using Type = SymmetricMatrix< typename RepeatTraitEval2<T,R0,R1,inf>::Type >;
929template<
typename MT,
bool SO,
bool DF,
bool SF >
930struct DeclSymTrait< SymmetricMatrix<MT,SO,DF,SF> >
932 using Type = SymmetricMatrix<MT,SO,DF,SF>;
948template<
typename MT,
bool SO,
bool DF,
bool SF >
949struct DeclHermTrait< SymmetricMatrix<MT,SO,DF,SF> >
951 using Type = HermitianMatrix<MT,SO,DF>;
967template<
typename MT,
bool SO,
bool DF,
bool SF >
968struct DeclLowTrait< SymmetricMatrix<MT,SO,DF,SF> >
970 using Type = DiagonalMatrix<MT,SO,DF>;
986template<
typename MT,
bool SO,
bool DF,
bool SF >
987struct DeclUniLowTrait< SymmetricMatrix<MT,SO,DF,SF> >
989 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
1005template<
typename MT,
bool SO,
bool DF,
bool SF >
1006struct DeclStrLowTrait< SymmetricMatrix<MT,SO,DF,SF> >
1008 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
1024template<
typename MT,
bool SO,
bool DF,
bool SF >
1025struct DeclUppTrait< SymmetricMatrix<MT,SO,DF,SF> >
1027 using Type = DiagonalMatrix<MT,SO,DF>;
1043template<
typename MT,
bool SO,
bool DF,
bool SF >
1044struct DeclUniUppTrait< SymmetricMatrix<MT,SO,DF,SF> >
1046 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
1062template<
typename MT,
bool SO,
bool DF,
bool SF >
1063struct DeclStrUppTrait< SymmetricMatrix<MT,SO,DF,SF> >
1065 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
1081template<
typename MT,
bool SO,
bool DF,
bool SF >
1082struct DeclDiagTrait< SymmetricMatrix<MT,SO,DF,SF> >
1084 using Type = DiagonalMatrix<MT,SO,DF>;
1100template<
typename MT1,
bool SO1,
bool DF1,
bool SF1,
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
1101struct HighType< SymmetricMatrix<MT1,SO1,DF1,SF1>, SymmetricMatrix<MT2,SO2,DF2,SF2> >
1103 using Type = SymmetricMatrix< typename HighType<MT1,MT2>::Type >;
1119template<
typename MT1,
bool SO1,
bool DF1,
bool SF1,
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
1120struct LowType< SymmetricMatrix<MT1,SO1,DF1,SF1>, SymmetricMatrix<MT2,SO2,DF2,SF2> >
1122 using Type = SymmetricMatrix< typename LowType<MT1,MT2>::Type >;
1138template<
typename MT,
size_t I,
size_t N >
1139struct SubmatrixTraitEval1< MT, I, I, N, N
1141 IsSymmetric_v<MT> &&
1142 !IsDiagonal_v<MT> &&
1146 using Type = SymmetricMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
Header file for the addition trait.
Header file for auxiliary alias declarations.
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.
SymmetricMatrix specialization for dense matrices with non-scalar element type.
SymmetricMatrix specialization for dense matrices with scalar element type.
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Header file for the HighType type trait.
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 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 Kron product trait.
Header file for the LowType type trait.
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 repeat trait.
Header file for the Schur product trait.
SymmetricMatrix specialization for sparse matrices with non-scalar element type.
SymmetricMatrix specialization for sparse matrices with scalar element type.
Header file for the subtraction trait.
Header file for the submatrix trait.
Header file for the YieldsDiagonal type trait.
Header file for the YieldsHermitian type trait.
Header file for the YieldsIdentity type trait.
Header file for the YieldsSymmetric type trait.
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
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 isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:1456
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_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
constexpr bool IsSymmetric_v
Auxiliary variable template for the IsSymmetric type trait.
Definition: IsSymmetric.h:172
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition: IsMatrix.h:124
constexpr bool YieldsSymmetric_v
Auxiliary variable template for the YieldsSymmetric type trait.
Definition: YieldsSymmetric.h:124
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
@ byLDLT
Flag for the Bunch-Kaufman-based inversion for symmetric matrices.
Definition: InversionFlag.h:104
@ asHermitian
Flag for the inversion of a Hermitian matrix (same as byLDLH).
Definition: InversionFlag.h:110
@ asUniLower
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
@ asSymmetric
Flag for the inversion of a symmetric matrix (same as byLDLT).
Definition: InversionFlag.h:109
@ asUniUpper
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
@ byLDLH
Flag for the Bunch-Kaufman-based inversion for Hermitian matrices.
Definition: InversionFlag.h:105
@ 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
@ byLLH
Flag for the Cholesky-based inversion for positive-definite matrices.
Definition: InversionFlag.h:106
@ asGeneral
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
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
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:181
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
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.
Header file for the IsZero type trait.
Header file for the generic min algorithm.