35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATEVALEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATEVALEXPR_H_
99 class SMatEvalExpr :
public SparseMatrix< SMatEvalExpr<MT,SO>, SO >
100 ,
private MatEvalExpr
101 ,
private Computation
121 enum :
bool { smpAssignable = MT::smpAssignable };
156 inline ReturnType
at(
size_t i,
size_t j )
const {
157 if( i >=
sm_.rows() ) {
160 if( j >=
sm_.columns() ) {
172 inline size_t rows() const noexcept {
183 return sm_.columns();
193 return sm_.nonZeros();
204 return sm_.nonZeros(i);
224 template<
typename T >
225 inline bool canAlias(
const T* alias )
const noexcept {
226 return sm_.canAlias( alias );
236 template<
typename T >
237 inline bool isAliased(
const T* alias )
const noexcept {
238 return sm_.isAliased( alias );
248 return sm_.canSMPAssign();
269 template<
typename MT2
278 assign( ~lhs, rhs.sm_ );
295 template<
typename MT2
304 assign( ~lhs, rhs.sm_ );
321 template<
typename MT2
323 friend inline void addAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatEvalExpr& rhs )
330 addAssign( ~lhs, rhs.sm_ );
347 template<
typename MT2
349 friend inline void addAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatEvalExpr& rhs )
356 addAssign( ~lhs, rhs.sm_ );
373 template<
typename MT2
375 friend inline void subAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatEvalExpr& rhs )
382 subAssign( ~lhs, rhs.sm_ );
399 template<
typename MT2
401 friend inline void subAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatEvalExpr& rhs )
408 subAssign( ~lhs, rhs.sm_ );
425 template<
typename MT2
427 friend inline void multAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatEvalExpr& rhs )
434 multAssign( ~lhs, rhs.sm_ );
451 template<
typename MT2
453 friend inline void multAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatEvalExpr& rhs )
460 multAssign( ~lhs, rhs.sm_ );
477 template<
typename MT2
503 template<
typename MT2
529 template<
typename MT2
555 template<
typename MT2
581 template<
typename MT2
607 template<
typename MT2
634 template<
typename MT2
661 template<
typename MT2
710 template<
typename MT
740 template<
typename MT
742 inline const SMatEvalExpr<MT,SO>
eval(
const SMatEvalExpr<MT,SO>& sm )
760 template<
typename MT,
bool SO >
761 struct Rows< SMatEvalExpr<MT,SO> > :
public Rows<MT>
777 template<
typename MT,
bool SO >
778 struct Columns< SMatEvalExpr<MT,SO> > :
public Columns<MT>
794 template<
typename MT,
bool SO >
795 struct IsSymmetric< SMatEvalExpr<MT,SO> >
812 template<
typename MT,
bool SO >
813 struct IsHermitian< SMatEvalExpr<MT,SO> >
830 template<
typename MT,
bool SO >
831 struct IsLower< SMatEvalExpr<MT,SO> >
848 template<
typename MT,
bool SO >
849 struct IsUniLower< SMatEvalExpr<MT,SO> >
866 template<
typename MT,
bool SO >
867 struct IsStrictlyLower< SMatEvalExpr<MT,SO> >
884 template<
typename MT,
bool SO >
885 struct IsUpper< SMatEvalExpr<MT,SO> >
902 template<
typename MT,
bool SO >
903 struct IsUniUpper< SMatEvalExpr<MT,SO> >
920 template<
typename MT,
bool SO >
921 struct IsStrictlyUpper< SMatEvalExpr<MT,SO> >
938 template<
typename MT >
939 struct SMatEvalExprTrait< SMatEvalExpr<MT,false> >
943 using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT> >
944 , SMatEvalExpr<MT,false>
954 template<
typename MT >
955 struct TSMatEvalExprTrait< SMatEvalExpr<MT,true> >
959 using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT> >
960 , SMatEvalExpr<MT,true>
970 template<
typename MT,
bool SO,
bool AF >
971 struct SubmatrixExprTrait< SMatEvalExpr<MT,SO>, AF >
975 using Type = EvalExprTrait_< SubmatrixExprTrait_<const MT,AF> >;
984 template<
typename MT,
bool SO >
985 struct RowExprTrait< SMatEvalExpr<MT,SO> >
989 using Type = EvalExprTrait_< RowExprTrait_<const MT> >;
998 template<
typename MT,
bool SO >
999 struct ColumnExprTrait< SMatEvalExpr<MT,SO> >
1003 using Type = EvalExprTrait_< ColumnExprTrait_<const MT> >;
Header file for auxiliary alias declarations.
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
Header file for basic type definitions.
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseMatrix type trait.
#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
Header file for the ColumnExprTrait class template.
Header file for the TSMatEvalExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
Header file for the And class template.
Header file for the MatEvalExpr base class.
Header file for the Computation base class.
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
Constraint on the data type.
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
SMatEvalExpr< MT, SO > This
Type of this SMatEvalExpr instance.
Definition: SMatEvalExpr.h:105
Header file for the SparseMatrix base class.
SMatEvalExpr(const MT &sm) noexcept
Constructor for the SMatEvalExpr class.
Definition: SMatEvalExpr.h:129
Constraint on the data type.
Header file for the SMatEvalExprTrait class template.
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatEvalExpr.h:213
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatEvalExpr.h:172
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
#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 Columns type trait.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for the IsLower type trait.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatEvalExpr.h:141
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatEvalExpr.h:203
Header file for the RowExprTrait class template.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatEvalExpr.h:182
Header file for all forward declarations for expression class templates.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatEvalExpr.h:156
Header file for the IsStrictlyLower type trait.
Operand sm_
Sparse matrix of the evaluation expression.
Definition: SMatEvalExpr.h:254
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatEvalExpr.h:192
Header file for the SubmatrixExprTrait class template.
Header file for run time assertion macros.
TransposeType_< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SMatEvalExpr.h:108
Utility type for generic codes.
ElementType_< MT > ElementType
Resulting element type.
Definition: SMatEvalExpr.h:109
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatEvalExpr.h:110
Header file for the EvalExprTrait class template.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatEvalExpr.h:247
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatEvalExpr.h:237
ResultType_< MT > ResultType
Result type for expression template evaluations.
Definition: SMatEvalExpr.h:106
If_< IsExpression< MT >, const MT, const MT & > Operand
Composite data type of the sparse matrix expression.
Definition: SMatEvalExpr.h:116
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:705
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatEvalExpr.h:113
Header file for the IsRowMajorMatrix type 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:157
Header file for the IntegralConstant class template.
Expression object for the forced evaluation of sparse matrices.The SMatEvalExpr class represents the ...
Definition: Forward.h:93
OppositeType_< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatEvalExpr.h:107
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsUpper type trait.
Header file for the IsHermitian type trait.
#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
#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 IsExpression type trait class.
Header file for the FunctionTrace class.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatEvalExpr.h:225