35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSERIALEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATSERIALEXPR_H_
99 class SMatSerialExpr :
public SparseMatrix< SMatSerialExpr<MT,SO>, SO >
100 ,
private MatSerialExpr
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);
234 template<
typename T >
235 inline bool canAlias(
const T* alias )
const noexcept {
236 return sm_.canAlias( alias );
246 template<
typename T >
247 inline bool isAliased(
const T* alias )
const noexcept {
248 return sm_.isAliased( alias );
258 return sm_.canSMPAssign();
279 template<
typename MT2
288 assign( ~lhs, rhs.sm_ );
305 template<
typename MT2
314 assign( ~lhs, rhs.sm_ );
331 template<
typename MT2
333 friend inline void addAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatSerialExpr& rhs )
340 addAssign( ~lhs, rhs.sm_ );
357 template<
typename MT2
359 friend inline void addAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatSerialExpr& rhs )
366 addAssign( ~lhs, rhs.sm_ );
384 template<
typename MT2
386 friend inline void subAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatSerialExpr& rhs )
393 subAssign( ~lhs, rhs.sm_ );
411 template<
typename MT2
413 friend inline void subAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatSerialExpr& rhs )
420 subAssign( ~lhs, rhs.sm_ );
438 template<
typename MT2
440 friend inline void multAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatSerialExpr& rhs )
447 multAssign( ~lhs, rhs.sm_ );
465 template<
typename MT2
467 friend inline void multAssign( SparseMatrix<MT2,SO2>& lhs,
const SMatSerialExpr& rhs )
474 multAssign( ~lhs, rhs.sm_ );
491 template<
typename MT2
500 assign( ~lhs, rhs.sm_ );
517 template<
typename MT2
526 assign( ~lhs, rhs.sm_ );
544 template<
typename MT2
553 addAssign( ~lhs, rhs.sm_ );
571 template<
typename MT2
580 addAssign( ~lhs, rhs.sm_ );
598 template<
typename MT2
607 subAssign( ~lhs, rhs.sm_ );
625 template<
typename MT2
634 subAssign( ~lhs, rhs.sm_ );
652 template<
typename MT2
661 multAssign( ~lhs, rhs.sm_ );
679 template<
typename MT2
688 multAssign( ~lhs, rhs.sm_ );
728 template<
typename MT
758 template<
typename MT
760 inline const SMatSerialExpr<MT,SO>
serial(
const SMatSerialExpr<MT,SO>& sm )
778 template<
typename MT,
bool SO >
779 struct Rows< SMatSerialExpr<MT,SO> > :
public Rows<MT>
795 template<
typename MT,
bool SO >
796 struct Columns< SMatSerialExpr<MT,SO> > :
public Columns<MT>
812 template<
typename MT,
bool SO >
813 struct IsSymmetric< SMatSerialExpr<MT,SO> >
830 template<
typename MT,
bool SO >
831 struct IsHermitian< SMatSerialExpr<MT,SO> >
848 template<
typename MT,
bool SO >
849 struct IsLower< SMatSerialExpr<MT,SO> >
866 template<
typename MT,
bool SO >
867 struct IsUniLower< SMatSerialExpr<MT,SO> >
884 template<
typename MT,
bool SO >
885 struct IsStrictlyLower< SMatSerialExpr<MT,SO> >
902 template<
typename MT,
bool SO >
903 struct IsUpper< SMatSerialExpr<MT,SO> >
920 template<
typename MT,
bool SO >
921 struct IsUniUpper< SMatSerialExpr<MT,SO> >
938 template<
typename MT,
bool SO >
939 struct IsStrictlyUpper< SMatSerialExpr<MT,SO> >
956 template<
typename MT >
957 struct SMatSerialExprTrait< SMatSerialExpr<MT,false> >
961 using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT> >
962 , SMatSerialExpr<MT,false>
972 template<
typename MT >
973 struct TSMatSerialExprTrait< SMatSerialExpr<MT,true> >
977 using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT> >
978 , SMatSerialExpr<MT,true>
988 template<
typename MT,
bool SO,
bool AF >
989 struct SubmatrixExprTrait< SMatSerialExpr<MT,SO>, AF >
993 using Type = SerialExprTrait_< SubmatrixExprTrait_<const MT,AF> >;
1002 template<
typename MT,
bool SO >
1003 struct RowExprTrait< SMatSerialExpr<MT,SO> >
1007 using Type = SerialExprTrait_< RowExprTrait_<const MT> >;
1016 template<
typename MT,
bool SO >
1017 struct ColumnExprTrait< SMatSerialExpr<MT,SO> >
1021 using Type = SerialExprTrait_< ColumnExprTrait_<const MT> >;
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatSerialExpr.h:182
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatSerialExpr.h:141
Header file for auxiliary alias declarations.
SMatSerialExpr(const MT &sm) noexcept
Constructor for the SMatSerialExpr class.
Definition: SMatSerialExpr.h:129
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatSerialExpr.h:110
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatSerialExpr.h:247
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
Header file for basic type definitions.
Header file for the SMatSerialExprTrait class template.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatSerialExpr.h:192
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 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.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
Header file for the Computation base class.
ResultType_< MT > ResultType
Result type for expression template evaluations.
Definition: SMatSerialExpr.h:106
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.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatSerialExpr.h:203
Header file for the TSMatSerialExprTrait class template.
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
Header file for the SparseMatrix base class.
TransposeType_< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SMatSerialExpr.h:108
Constraint on the data type.
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.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatSerialExpr.h:257
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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatSerialExpr.h:235
#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.
Header file for the SerialExprTrait class template.
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatSerialExpr.h:113
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatSerialExpr.h:156
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Header file for the MatSerialExpr base class.
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatSerialExpr.h:213
Header file for the IsStrictlyLower type trait.
Operand sm_
Sparse matrix of the serial evaluation expression.
Definition: SMatSerialExpr.h:264
Header file for the SubmatrixExprTrait class template.
Header file for run time assertion macros.
Utility type for generic codes.
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
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
ElementType_< MT > ElementType
Resulting element type.
Definition: SMatSerialExpr.h:109
If_< IsExpression< MT >, const MT, const MT & > Operand
Composite data type of the sparse matrix expression.
Definition: SMatSerialExpr.h:116
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.
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.
Expression object for the forced serial evaluation of sparse matrices.The SMatSerialExpr class repres...
Definition: Forward.h:97
Header file for the IsHermitian type trait.
OppositeType_< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatSerialExpr.h:107
#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
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatSerialExpr.h:172
SMatSerialExpr< MT, SO > This
Type of this SMatSerialExpr instance.
Definition: SMatSerialExpr.h:105
#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.