35#ifndef _BLAZE_MATH_EXPRESSIONS_SVECEXPANDEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SVECEXPANDEXPR_H_
90 :
public VecExpandExpr< SparseMatrix< SVecExpandExpr<VT,TF,CEAs...>, !TF >, CEAs... >
91 ,
private If_t< IsComputation_v<VT>, Computation, Transformation >
112 static constexpr bool useAssign = IsComputation_v<VT> || RequiresEvaluation_v<VT>;
116 template<
typename MT >
117 static constexpr bool UseAssign_v =
useAssign;
129 template<
typename MT >
130 static constexpr bool UseSMPAssign_v = ( MT::smpAssignable &&
useAssign );
169 template<
typename... REAs >
206 if( i >= ( TF ? expansion() :
sv_.size() ) ) {
209 if( j >= ( TF ?
sv_.size() : expansion() ) ) {
245 inline size_t rows() const noexcept {
246 return ( TF ? expansion() :
sv_.size() );
256 return ( TF ?
sv_.size() : expansion() );
266 return sv_.nonZeros() * expansion();
278 return sv_.nonZeros();
291 return sv_.find( TF ? j : i );
304 return sv_.lowerBound( TF ? j : i );
317 return sv_.upperBound( TF ? j : i );
332 using DataType::expansion;
341 template<
typename T >
342 inline bool canAlias(
const T* alias )
const noexcept {
343 return sv_.isAliased( alias );
353 template<
typename T >
354 inline bool isAliased(
const T* alias )
const noexcept {
355 return sv_.isAliased( alias );
365 return sv_.canSMPAssign();
388 template<
typename MT
402 assign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
421 template<
typename MT
435 addAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
454 template<
typename MT
456 friend inline auto subAssign( Matrix<MT,SO>& lhs,
const SVecExpandExpr& rhs )
457 -> EnableIf_t< UseAssign_v<MT> >
468 subAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
487 template<
typename MT
489 friend inline auto schurAssign( Matrix<MT,SO>& lhs,
const SVecExpandExpr& rhs )
490 -> EnableIf_t< UseAssign_v<MT> >
501 schurAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
520 template<
typename MT
522 friend inline auto multAssign( Matrix<MT,SO>& lhs,
const SVecExpandExpr& rhs )
523 -> EnableIf_t< UseAssign_v<MT> >
534 multAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
553 template<
typename MT
556 -> EnableIf_t< UseSMPAssign_v<MT> >
565 const RT tmp( *rhs.sv_ );
567 smpAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
586 template<
typename MT
589 -> EnableIf_t< UseSMPAssign_v<MT> >
598 const RT tmp( *rhs.sv_ );
600 smpAddAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
619 template<
typename MT
622 -> EnableIf_t< UseSMPAssign_v<MT> >
631 const RT tmp( *rhs.sv_ );
633 smpSubAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
652 template<
typename MT
655 -> EnableIf_t< UseSMPAssign_v<MT> >
664 const RT tmp( *rhs.sv_ );
685 template<
typename MT
688 -> EnableIf_t< UseSMPAssign_v<MT> >
697 const RT tmp( *rhs.sv_ );
699 smpMultAssign( *lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
770 return ReturnType( *sv, expansion );
823 return ReturnType( *sv );
843inline decltype(
auto)
expand(
const SparseVector<VT,TF>& sv,
size_t expansion )
849 using ReturnType =
const SVecExpandExpr<VT,TF,E>;
850 return ReturnType( *sv );
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition: Aliases.h:310
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the EnableIf class template.
Header file for the implementation of the ExpandExprData class template.
Header file for the expand trait.
Header file for the function trace functionality.
Header file for the GetMemberType type trait.
Header file for the If class template.
Utility type for generic codes.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the MAYBE_UNUSED function template.
Auxiliary class template for the data members of expansion expression classes.
Definition: ExpandExprData.h:64
Base class for matrices.
Definition: Matrix.h:85
Expression object for sparse vector expansion.
Definition: SVecExpandExpr.h:93
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecExpandExpr.h:160
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecExpandExpr.h:342
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecExpandExpr.h:144
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SVecExpandExpr.h:222
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SVecExpandExpr.h:255
ResultType_t< VT > RT
Result type of the sparse vector expression.
Definition: SVecExpandExpr.h:96
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SVecExpandExpr.h:289
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the expansion expression.
Definition: SVecExpandExpr.h:112
Operand operand() const noexcept
Returns the sparse vector operand.
Definition: SVecExpandExpr.h:326
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SVecExpandExpr.h:143
SVecExpandExpr(const VT &sv, REAs... args) noexcept
Constructor for the SVecExpandExpr class.
Definition: SVecExpandExpr.h:170
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SVecExpandExpr.h:183
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SVecExpandExpr.h:234
Operand sv_
Sparse vector of the expansion expression.
Definition: SVecExpandExpr.h:371
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecExpandExpr.h:354
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SVecExpandExpr.h:364
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the sparse matrix expression.
Definition: SVecExpandExpr.h:155
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SVecExpandExpr.h:245
ExpandExprData< CEAs... > DataType
The type of the ExpandExprData base class.
Definition: SVecExpandExpr.h:98
If_t< useAssign, const ResultType, const SVecExpandExpr & > CompositeType
Data type for composite expression templates.
Definition: SVecExpandExpr.h:149
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition: SVecExpandExpr.h:146
ExpandTrait_t< VT, CEAs... > ResultType
Result type for expression template evaluations.
Definition: SVecExpandExpr.h:142
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SVecExpandExpr.h:315
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SVecExpandExpr.h:265
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
ElementType_t< VT > ElementType
Resulting element type.
Definition: SVecExpandExpr.h:145
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SVecExpandExpr.h:205
GetConstIterator_t< VT > ConstIterator
Iterator over the elements of the sparse matrix.
Definition: SVecExpandExpr.h:152
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row/column.
Definition: SVecExpandExpr.h:276
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SVecExpandExpr.h:302
Base class for sparse vectors.
Definition: SparseVector.h:72
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the SparseMatrix base class.
Header file for the SparseVector base class.
Header file for the VecExpandExpr base class.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) expand(const DenseVector< VT, TF > &dv, size_t expansion)
Expansion of the given dense vector.
Definition: DVecExpandExpr.h:746
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition: TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
typename ExpandTrait< T, CEAs... >::Type ExpandTrait_t
Auxiliary alias declaration for the ExpandTrait type trait.
Definition: ExpandTrait.h:145
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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
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
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:192
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
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 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
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Base class for all vector expansion expression templates.
Definition: VecExpandExpr.h:69
System settings for the inline keywords.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.