35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATDECLSYMEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DMATDECLSYMEXPR_H_ 94 :
public DeclSymExpr< DenseMatrix< DMatDeclSymExpr<MT,SO>, SO > >
113 static constexpr
bool useAssign = RequiresEvaluation_v<MT>;
116 template<
typename MT2 >
118 static constexpr
bool UseAssign_v =
useAssign;
130 template<
typename MT2 >
203 if( i >=
dm_.rows() ) {
206 if( j >=
dm_.columns() ) {
225 return dm_.load(i,j);
266 inline size_t rows() const noexcept {
277 return dm_.columns();
297 template<
typename T >
298 inline bool canAlias(
const T* alias )
const noexcept {
299 return dm_.canAlias( alias );
309 template<
typename T >
310 inline bool isAliased(
const T* alias )
const noexcept {
311 return dm_.isAliased( alias );
321 return dm_.isAligned();
331 return dm_.canSMPAssign();
352 template<
typename MT2
362 assign( ~lhs, rhs.dm_ );
379 template<
typename MT2
389 assign( ~lhs, rhs.dm_ );
406 template<
typename MT2
408 friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
409 -> EnableIf_t< UseAssign_v<MT2> >
416 addAssign( ~lhs, rhs.dm_ );
433 template<
typename MT2
435 friend inline auto addAssign( SparseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
436 -> EnableIf_t< UseAssign_v<MT2> >
443 addAssign( ~lhs, rhs.dm_ );
460 template<
typename MT2
462 friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
463 -> EnableIf_t< UseAssign_v<MT2> >
470 subAssign( ~lhs, rhs.dm_ );
487 template<
typename MT2
489 friend inline auto subAssign( SparseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
490 -> EnableIf_t< UseAssign_v<MT2> >
497 subAssign( ~lhs, rhs.dm_ );
514 template<
typename MT2
516 friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
517 -> EnableIf_t< UseAssign_v<MT2> >
524 schurAssign( ~lhs, rhs.dm_ );
541 template<
typename MT2
543 friend inline auto schurAssign( SparseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
544 -> EnableIf_t< UseAssign_v<MT2> >
551 schurAssign( ~lhs, rhs.dm_ );
568 template<
typename MT2
570 friend inline auto multAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
571 -> EnableIf_t< UseAssign_v<MT2> >
578 multAssign( ~lhs, rhs.dm_ );
595 template<
typename MT2
597 friend inline auto multAssign( SparseMatrix<MT2,SO2>& lhs,
const DMatDeclSymExpr& rhs )
598 -> EnableIf_t< UseAssign_v<MT2> >
605 multAssign( ~lhs, rhs.dm_ );
622 template<
typename MT2
625 -> EnableIf_t< UseSMPAssign_v<MT2> >
649 template<
typename MT2
652 -> EnableIf_t< UseSMPAssign_v<MT2> >
676 template<
typename MT2
679 -> EnableIf_t< UseSMPAssign_v<MT2> >
703 template<
typename MT2
706 -> EnableIf_t< UseSMPAssign_v<MT2> >
730 template<
typename MT2
733 -> EnableIf_t< UseSMPAssign_v<MT2> >
757 template<
typename MT2
760 -> EnableIf_t< UseSMPAssign_v<MT2> >
784 template<
typename MT2
787 -> EnableIf_t< UseSMPAssign_v<MT2> >
811 template<
typename MT2
814 -> EnableIf_t< UseSMPAssign_v<MT2> >
839 template<
typename MT2
842 -> EnableIf_t< UseSMPAssign_v<MT2> >
867 template<
typename MT2
870 -> EnableIf_t< UseSMPAssign_v<MT2> >
914 template<
typename MT
916 , DisableIf_t< IsSymmetric_v<MT> || IsUniTriangular_v<MT> >* =
nullptr >
917 inline const DMatDeclSymExpr<MT,SO> declsym_backend(
const DenseMatrix<MT,SO>& dm )
923 return DMatDeclSymExpr<MT,SO>( ~dm );
940 template<
typename MT
942 , EnableIf_t< !IsSymmetric_v<MT> && IsUniTriangular_v<MT> >* =
nullptr >
943 inline const IdentityMatrix<ElementType_t<MT>,SO> declsym_backend(
const DenseMatrix<MT,SO>& dm )
949 return IdentityMatrix<ElementType_t<MT>,SO>( (~dm).
rows() );
966 template<
typename MT
968 , EnableIf_t< IsSymmetric_v<MT> >* =
nullptr >
969 inline const MT& declsym_backend(
const DenseMatrix<MT,SO>& dm )
1000 template<
typename MT
1010 return declsym_backend( ~dm );
1037 template<
typename MT
1040 , DisableIf_t< IsSymmetric_v<MT> >* =
nullptr >
1041 inline decltype(
auto)
declsym( const DMatScalarMultExpr<MT,ST,SO>& dm )
1049 return declsym( dm.leftOperand() ) * dm.rightOperand();
1065 template<
typename MT,
bool SO >
1066 struct HasConstDataAccess< DMatDeclSymExpr<MT,SO> >
1067 :
public HasConstDataAccess<MT>
1083 template<
typename MT,
bool SO >
1084 struct IsAligned< DMatDeclSymExpr<MT,SO> >
1085 :
public IsAligned<MT>
1101 template<
typename MT,
bool SO >
1102 struct IsSymmetric< DMatDeclSymExpr<MT,SO> >
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatDeclSymExpr.h:160
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatDeclSymExpr.h:245
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDeclSymExpr.h:298
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
Base class for all declaration expression templates.The Declaration class serves as a tag for all dec...
Definition: Declaration.h:70
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatDeclSymExpr.h:165
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
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
Header file for the RequiresEvaluation type trait.
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatDeclSymExpr.h:286
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDeclSymExpr.h:320
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDeclSymExpr.h:202
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
Header file for the SIMD trait.
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:137
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Header file for all forward declarations for sparse vectors and matrices.
Header file for the implementation of the base template of the SymmetricMatrix.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDeclSymExpr.h:310
Constraint on the data type.
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
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
If_t< IsExpression_v< MT >, const MT, const MT &> Operand
Composite data type of the dense matrix expression.
Definition: DMatDeclSymExpr.h:152
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
DMatDeclSymExpr(const MT &dm) noexcept
Constructor for the DMatDeclSymExpr class.
Definition: DMatDeclSymExpr.h:173
Header file for the If class template.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatDeclSymExpr.h:256
DeclSymTrait_t< RT > ResultType
Result type for expression template evaluations.
Definition: DMatDeclSymExpr.h:139
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDeclSymExpr.h:140
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDeclSymExpr.h:266
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDeclSymExpr.h:276
Header file for the GetMemberType type trait.
Operand dm_
Dense matrix of the declsym expression.
Definition: DMatDeclSymExpr.h:337
Header file for the IsAligned type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a matrix/matrix multiplication expressio...
Definition: MatMatMultExpr.h:83
Header file for the IsUniTriangular type trait.
Constraints on the storage order of matrix types.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDeclSymExpr.h:330
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
Base class for all declsym expression templates.The DeclSymExpr class serves as a tag for all express...
Definition: DeclSymExpr.h:66
Header file for the EnableIf class template.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the symmetry declaration expression...
Definition: DMatDeclSymExpr.h:113
Header file for the DeclSymExpr base class.
const ElementType * data() const noexcept
Low-level data access to the matrix elements.
Definition: DMatDeclSymExpr.h:234
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
Constraint on the data type.
Header file for the HasConstDataAccess type trait.
GetConstIterator_t< MT > ConstIterator
Iterator over the elements of the dense matrix.
Definition: DMatDeclSymExpr.h:149
Header file for the Declaration base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
Utility type for generic codes.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
typename DeclSymTrait< MT >::Type DeclSymTrait_t
Auxiliary alias declaration for the DeclSymTrait type trait.The DeclSymTrait_t alias declaration prov...
Definition: DeclSymTrait.h:160
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
Header file for the declsym trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
decltype(auto) declsym(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as symmetric.
Definition: DMatDeclSymExpr.h:1002
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatDeclSymExpr.h:99
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Constraint on the data type.
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
If_t< RequiresEvaluation_v< MT >, const ResultType, const DMatDeclSymExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatDeclSymExpr.h:146
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: DMatDeclSymExpr.h:143
ElementType_t< MT > ElementType
Resulting element type.
Definition: DMatDeclSymExpr.h:142
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDeclSymExpr.h:141
Expression object for the explicit symmetry declaration of dense matrices.The DMatDeclSymExpr class r...
Definition: DMatDeclSymExpr.h:93
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatDeclSymExpr.h:157
Constraint on the data type.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDeclSymExpr.h:187
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDeclSymExpr.h:220
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
#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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the TrueType type/value trait base class.
Header file for the IsExpression type trait class.
Header file for the function trace functionality.