35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDECLUPPEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_SMATDECLUPPEXPR_H_ 91 :
public DeclUppExpr< SparseMatrix< SMatDeclUppExpr<MT,SO>, SO > >
92 ,
public Declaration<MT>
110 static constexpr
bool useAssign = RequiresEvaluation_v<MT>;
113 template<
typename MT2 >
115 static constexpr
bool UseAssign_v =
useAssign;
127 template<
typename MT2 >
192 if( i >=
sm_.rows() ) {
195 if( j >=
sm_.columns() ) {
229 inline size_t rows() const noexcept {
240 return sm_.columns();
250 return sm_.nonZeros();
261 return sm_.nonZeros(i);
281 template<
typename T >
282 inline bool canAlias(
const T* alias )
const noexcept {
283 return sm_.canAlias( alias );
293 template<
typename T >
294 inline bool isAliased(
const T* alias )
const noexcept {
295 return sm_.isAliased( alias );
305 return sm_.canSMPAssign();
326 template<
typename MT2
336 assign( ~lhs, rhs.sm_ );
353 template<
typename MT2
363 assign( ~lhs, rhs.sm_ );
380 template<
typename MT2
382 friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
383 -> EnableIf_t< UseAssign_v<MT2> >
390 addAssign( ~lhs, rhs.sm_ );
407 template<
typename MT2
409 friend inline auto addAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
410 -> EnableIf_t< UseAssign_v<MT2> >
417 addAssign( ~lhs, rhs.sm_ );
434 template<
typename MT2
436 friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
437 -> EnableIf_t< UseAssign_v<MT2> >
444 subAssign( ~lhs, rhs.sm_ );
461 template<
typename MT2
463 friend inline auto subAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
464 -> EnableIf_t< UseAssign_v<MT2> >
471 subAssign( ~lhs, rhs.sm_ );
488 template<
typename MT2
490 friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
491 -> EnableIf_t< UseAssign_v<MT2> >
498 schurAssign( ~lhs, rhs.sm_ );
515 template<
typename MT2
517 friend inline auto schurAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
518 -> EnableIf_t< UseAssign_v<MT2> >
525 schurAssign( ~lhs, rhs.sm_ );
542 template<
typename MT2
544 friend inline auto multAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
545 -> EnableIf_t< UseAssign_v<MT2> >
552 multAssign( ~lhs, rhs.sm_ );
569 template<
typename MT2
571 friend inline auto multAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatDeclUppExpr& rhs )
572 -> EnableIf_t< UseAssign_v<MT2> >
579 multAssign( ~lhs, rhs.sm_ );
596 template<
typename MT2
599 -> EnableIf_t< UseSMPAssign_v<MT2> >
623 template<
typename MT2
626 -> EnableIf_t< UseSMPAssign_v<MT2> >
650 template<
typename MT2
653 -> EnableIf_t< UseSMPAssign_v<MT2> >
677 template<
typename MT2
680 -> EnableIf_t< UseSMPAssign_v<MT2> >
704 template<
typename MT2
707 -> EnableIf_t< UseSMPAssign_v<MT2> >
731 template<
typename MT2
734 -> EnableIf_t< UseSMPAssign_v<MT2> >
758 template<
typename MT2
761 -> EnableIf_t< UseSMPAssign_v<MT2> >
785 template<
typename MT2
788 -> EnableIf_t< UseSMPAssign_v<MT2> >
813 template<
typename MT2
816 -> EnableIf_t< UseSMPAssign_v<MT2> >
841 template<
typename MT2
844 -> EnableIf_t< UseSMPAssign_v<MT2> >
887 template<
typename MT
889 , DisableIf_t< IsUpper_v<MT> || IsUniLower_v<MT> >* =
nullptr >
890 inline const SMatDeclUppExpr<MT,SO> declupp_backend(
const SparseMatrix<MT,SO>& sm )
896 return SMatDeclUppExpr<MT,SO>( ~sm );
913 template<
typename MT
915 , EnableIf_t< !IsUpper_v<MT> && IsUniLower_v<MT> >* =
nullptr >
916 inline const IdentityMatrix<ElementType_t<MT>,SO> declupp_backend(
const SparseMatrix<MT,SO>& sm )
922 return IdentityMatrix<ElementType_t<MT>,SO>( (~sm).
rows() );
939 template<
typename MT
941 , EnableIf_t< IsUpper_v<MT> >* =
nullptr >
942 inline const MT& declupp_backend(
const SparseMatrix<MT,SO>& sm )
972 template<
typename MT
982 return declupp_backend( ~sm );
1009 template<
typename MT
1012 , DisableIf_t< IsUpper_v<MT> >* =
nullptr >
1013 inline decltype(
auto)
declupp( const SMatScalarMultExpr<MT,ST,SO>& sm )
1021 return declupp( sm.leftOperand() ) * sm.rightOperand();
1037 template<
typename MT,
bool SO >
1038 struct IsUpper< SMatDeclUppExpr<MT,SO> >
If_t< IsExpression_v< MT >, const MT, const MT &> Operand
Composite data type of the sparse matrix expression.
Definition: SMatDeclUppExpr.h:149
#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.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDeclUppExpr.h:304
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
ElementType_t< MT > ElementType
Resulting element type.
Definition: SMatDeclUppExpr.h:139
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the upper declaration expression.
Definition: SMatDeclUppExpr.h:110
decltype(auto) declupp(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as upper.
Definition: DMatDeclUppExpr.h:1002
Operand sm_
Sparse matrix of the declupp expression.
Definition: SMatDeclUppExpr.h:311
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
Constraint on the data type.
Header file for the RequiresEvaluation type trait.
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 IsUniLower type trait.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDeclUppExpr.h:138
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatDeclUppExpr.h:249
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.
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatDeclUppExpr.h:137
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatDeclUppExpr.h:208
Header file for the SparseMatrix base class.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDeclUppExpr.h:294
Constraint on the data type.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatDeclUppExpr.h:176
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.
If_t< RequiresEvaluation_v< MT >, const ResultType, const SMatDeclUppExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatDeclUppExpr.h:143
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
#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 GetMemberType type trait.
GetConstIterator_t< MT > ConstIterator
Iterator over the elements of the dense matrix.
Definition: SMatDeclUppExpr.h:146
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatDeclUppExpr.h:140
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatDeclUppExpr.h:260
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatDeclUppExpr.h:191
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
Header file for the Declaration base class.
Header file for the declupp trait.
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
Constraint on the data type.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatDeclUppExpr.h:282
#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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNILOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower unitriangular matrix type...
Definition: UniLower.h:81
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
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatDeclUppExpr.h:270
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
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatDeclUppExpr.h:229
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatDeclUppExpr.h:219
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
SMatDeclUppExpr(const MT &sm) noexcept
Constructor for the SMatDeclUppExpr class.
Definition: SMatDeclUppExpr.h:162
Expression object for the explicit upper declaration of sparse matrices.The SMatDeclUppExpr class rep...
Definition: Forward.h:114
Header file for the DeclUppExpr base class.
Header file for the IntegralConstant class template.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatDeclUppExpr.h:154
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatDeclUppExpr.h:239
Header file for the IsUpper type trait.
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatDeclUppExpr.h:96
Header file for the implementation of the base template of the UpperMatrix.
DeclUppTrait_t< RT > ResultType
Result type for expression template evaluations.
Definition: SMatDeclUppExpr.h:136
typename DeclUppTrait< MT >::Type DeclUppTrait_t
Auxiliary alias declaration for the DeclUppTrait type trait.The DeclUppTrait_t alias declaration prov...
Definition: DeclUppTrait.h:160
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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
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.