35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECEXPANDEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DVECEXPANDEXPR_H_ 91 :
public VecExpandExpr< DenseMatrix< DVecExpandExpr<VT,TF,CEAs...>, !TF >, CEAs... >
113 static constexpr
bool useAssign = IsComputation_v<VT> || RequiresEvaluation_v<VT>;
116 template<
typename MT >
118 static constexpr
bool UseAssign_v =
useAssign;
129 template<
typename MT >
130 static constexpr
bool UseSMPAssign_v = ( !VT::smpAssignable &&
useAssign );
173 template<
typename... REAs >
210 if( i >= ( TF ? expansion() :
dv_.size() ) ) {
213 if( j >= ( TF ?
dv_.size() : expansion() ) ) {
272 inline size_t rows() const noexcept {
273 return ( TF ? expansion() :
dv_.size() );
283 return ( TF ?
dv_.size() : expansion() );
298 using DataType::expansion;
307 template<
typename T >
308 inline bool canAlias(
const T* alias )
const noexcept {
309 return dv_.canAlias( alias );
319 template<
typename T >
320 inline bool isAliased(
const T* alias )
const noexcept {
321 return dv_.isAliased( alias );
331 return dv_.isAligned();
341 return dv_.canSMPAssign();
364 template<
typename MT
378 assign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
397 template<
typename MT
411 addAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
430 template<
typename MT
432 friend inline auto subAssign( Matrix<MT,SO>& lhs,
const DVecExpandExpr& rhs )
433 -> EnableIf_t< UseAssign_v<MT> >
444 subAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
463 template<
typename MT
465 friend inline auto schurAssign( Matrix<MT,SO>& lhs,
const DVecExpandExpr& rhs )
466 -> EnableIf_t< UseAssign_v<MT> >
477 schurAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
496 template<
typename MT
498 friend inline auto multAssign( Matrix<MT,SO>& lhs,
const DVecExpandExpr& rhs )
499 -> EnableIf_t< UseAssign_v<MT> >
510 multAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
529 template<
typename MT
532 -> EnableIf_t< UseSMPAssign_v<MT> >
541 const RT tmp( ~rhs.dv_ );
543 smpAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
562 template<
typename MT
565 -> EnableIf_t< UseSMPAssign_v<MT> >
574 const RT tmp( ~rhs.dv_ );
576 smpAddAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
595 template<
typename MT
598 -> EnableIf_t< UseSMPAssign_v<MT> >
607 const RT tmp( ~rhs.dv_ );
609 smpSubAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
628 template<
typename MT
631 -> EnableIf_t< UseSMPAssign_v<MT> >
640 const RT tmp( ~rhs.dv_ );
661 template<
typename MT
664 -> EnableIf_t< UseSMPAssign_v<MT> >
673 const RT tmp( ~rhs.dv_ );
675 smpMultAssign( ~lhs, expand<CEAs...>( tmp, rhs.expansion() ) );
737 template<
typename VT
744 return ReturnType( ~dv, expansion );
795 return ReturnType( ~dv );
815 inline decltype(
auto)
expand( const DenseVector<VT,TF>& dv,
size_t expansion )
821 using ReturnType =
const DVecExpandExpr<VT,TF,E>;
822 return ReturnType( ~dv );
838 template<
typename VT,
bool TF,
size_t... CEAs >
839 struct IsAligned< DVecExpandExpr<VT,TF,CEAs...> >
840 :
public IsAligned<VT>
856 template<
typename VT,
bool TF,
size_t... CEAs >
857 struct IsPadded< DVecExpandExpr<VT,TF,CEAs...> >
858 :
public IsPadded<VT>
Header file for auxiliary alias declarations.
ElementType_t< VT > ElementType
Resulting element type.
Definition: DVecExpandExpr.h:141
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition: DVecExpandExpr.h:142
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
Header file for the implementation of the ExpandExprData class template.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecExpandExpr.h:330
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DVecExpandExpr.h:139
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DVecExpandExpr.h:249
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
ExpandTrait_t< VT, CEAs... > ResultType
Result type for expression template evaluations.
Definition: DVecExpandExpr.h:138
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecExpandExpr.h:308
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DVecExpandExpr.h:209
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DVecExpandExpr.h:187
Header file for the DenseVector base class.
Header file for the MAYBE_UNUSED function template.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecExpandExpr.h:340
Header file for the RequiresEvaluation type trait.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecExpandExpr.h:140
Operand operand() const noexcept
Returns the dense vector operand.
Definition: DVecExpandExpr.h:292
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.
ResultType_t< VT > RT
Result type of the dense vector expression.
Definition: DVecExpandExpr.h:97
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes....
Definition: DenseMatrix.h:81
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DVecExpandExpr.h:272
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
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecExpandExpr.h:159
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
Header file for the If class template.
Header file for the expand trait.
ExpandExprData< CEAs... > DataType
The type of the ExpandExprData base class.
Definition: DVecExpandExpr.h:99
DVecExpandExpr(const VT &dv, REAs... args) noexcept
Constructor for the DVecExpandExpr class.
Definition: DVecExpandExpr.h:174
#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.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
Header file for the GetMemberType type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
Constraint on the data type.
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the dense matrix expression.
Definition: DVecExpandExpr.h:151
Constraint on the data type.
Header file for the exception macros of the math module.
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecExpandExpr.h:164
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecExpandExpr.h:156
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
decltype(auto) expand(const DenseVector< VT, TF > &dv, size_t expansion)
Expansion of the given dense vector.
Definition: DVecExpandExpr.h:739
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecExpandExpr.h:320
Header file for all forward declarations for expression class templates.
Operand dv_
Dense vector of the expansion expression.
Definition: DVecExpandExpr.h:347
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:114
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
GetConstIterator_t< VT > ConstIterator
Iterator over the elements of the dense matrix.
Definition: DVecExpandExpr.h:148
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DVecExpandExpr.h:227
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Base class for all vector expansion expression templates.The VecExpandExpr class serves as a tag for ...
Definition: VecExpandExpr.h:67
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
typename ExpandTrait< T, CEAs... >::Type ExpandTrait_t
Auxiliary alias declaration for the ExpandTrait type trait.The ExpandTrait_t alias declaration provid...
Definition: ExpandTrait.h:171
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type,...
Definition: DenseVector.h:61
Header file for the VecExpandExpr base class.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the expansion expression.
Definition: DVecExpandExpr.h:113
Header file for the IsComputation type trait class.
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
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
If_t< useAssign, const ResultType, const DVecExpandExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecExpandExpr.h:145
Auxiliary class template for the data members of expressions expression classes.The auxiliary ExpandE...
Definition: ExpandExprData.h:63
Expression object for dense vector expansion.The DVecExpandExpr class represents the compile time exp...
Definition: DVecExpandExpr.h:90
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DVecExpandExpr.h:282
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DVecExpandExpr.h:261
System settings for the inline keywords.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
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 IsExpression type trait class.
Header file for the function trace functionality.