35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATEXPEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATEXPEXPR_H_
86 :
public MatExpExpr< DenseMatrix< DMatExpExpr<MT,SO>, SO > >
96 static constexpr size_t K = 18;
145 inline size_t rows() const noexcept {
146 return dm_.columns();
176 template<
typename T >
177 inline bool canAlias(
const T* alias )
const noexcept {
178 return dm_.isAliased( alias );
188 template<
typename T >
189 inline bool isAliased(
const T* alias )
const noexcept {
190 return dm_.isAliased( alias );
211 template<
typename MT2
220 const size_t N( rhs.
rows() );
222 if( IsDiagonal_v<MT> || N < 2UL )
224 assign( *lhs, rhs.
dm_ );
225 for(
size_t i=0UL; i<N; ++i ) {
226 (*lhs)(i,i) =
exp( (*lhs)(i,i) );
236 frexp(
norm, &exponent );
237 exponent =
max( 0, exponent );
243 for(
size_t i=0UL; i<N; ++i ) {
248 for(
size_t k=2UL; k<
K; ++k ) {
251 addAssign( B, ( A / factor ) );
254 for(
int i=0; i<exponent; ++i ) {
276 template<
typename MT2
307 template<
typename MT2
309 friend inline void addAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatExpExpr& rhs )
316 const size_t N( rhs.rows() );
318 if( IsDiagonal_v<MT> || N < 2UL )
320 CompositeType_t<MT> tmp( rhs.dm_ );
321 for(
size_t i=0UL; i<N; ++i ) {
322 (*lhs)(i,i) +=
exp( tmp(i,i) );
327 using BT = UnderlyingBuiltin_t<ET>;
332 frexp(
norm, &exponent );
333 exponent =
max( 0, exponent );
339 for(
size_t i=0UL; i<N; ++i ) {
344 for(
size_t k=2UL; k<
K; ++k ) {
347 addAssign( B, ( A / factor ) );
350 for(
int i=0; i<exponent; ++i ) {
354 addAssign( *lhs, B );
376 template<
typename MT2
378 friend inline void subAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatExpExpr& rhs )
385 const size_t N( rhs.rows() );
387 if( IsDiagonal_v<MT> || N < 2UL )
389 CompositeType_t<MT> tmp( rhs.dm_ );
390 for(
size_t i=0UL; i<N; ++i ) {
391 (*lhs)(i,i) -=
exp( tmp(i,i) );
396 using BT = UnderlyingBuiltin_t<ET>;
401 frexp(
norm, &exponent );
402 exponent =
max( 0, exponent );
408 for(
size_t i=0UL; i<N; ++i ) {
413 for(
size_t k=2UL; k<
K; ++k ) {
416 addAssign( B, ( A / factor ) );
419 for(
int i=0; i<exponent; ++i ) {
423 subAssign( *lhs, B );
445 template<
typename MT2
447 friend inline void schurAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatExpExpr& rhs )
454 const size_t N( rhs.rows() );
456 if( IsDiagonal_v<MT> || N < 2UL )
458 CompositeType_t<MT> tmp( rhs.dm_ );
459 for(
size_t i=0UL; i<N; ++i ) {
460 (*lhs)(i,i) *=
exp( tmp(i,i) );
465 using BT = UnderlyingBuiltin_t<ET>;
470 frexp(
norm, &exponent );
471 exponent =
max( 0, exponent );
477 for(
size_t i=0UL; i<N; ++i ) {
482 for(
size_t k=2UL; k<
K; ++k ) {
485 addAssign( B, ( A / factor ) );
488 for(
int i=0; i<exponent; ++i ) {
492 schurAssign( *lhs, B );
575 return ReturnType( *dm );
607inline decltype(
auto)
det(
const DMatExpExpr<MT,SO>& dm )
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.
Constraint on the data type.
Header file for the frexp shim.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsDiagonal type trait.
Header file for the IsExpression type trait class.
Header file for the RemoveAdaptor type trait.
Header file for the UnderlyingBuiltin type trait.
Expression object for dense matrix exponential.
Definition: DMatExpExpr.h:88
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatExpExpr.h:125
Operand dm_
Dense matrix of the exponential expression.
Definition: DMatExpExpr.h:196
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatExpExpr.h:122
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatExpExpr.h:189
ElementType_t< MT > ElementType
Resulting element type.
Definition: DMatExpExpr.h:110
static constexpr size_t K
The approximation limit for the exponential computation.
Definition: DMatExpExpr.h:96
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatExpExpr.h:155
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatExpExpr.h:91
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatExpExpr.h:177
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite data type of the dense matrix expression.
Definition: DMatExpExpr.h:117
DMatExpExpr(const MT &dm) noexcept
Constructor for the DMatExpExpr class.
Definition: DMatExpExpr.h:133
OppositeType_t< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatExpExpr.h:108
const ResultType CompositeType
Data type for composite expression templates.
Definition: DMatExpExpr.h:114
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: DMatExpExpr.h:111
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatExpExpr.h:145
RemoveAdaptor_t< RT > ResultType
Result type for expression template evaluations.
Definition: DMatExpExpr.h:107
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatExpExpr.h:165
ElementType_t< MT > ET
Element type of the dense matrix expression.
Definition: DMatExpExpr.h:92
TransposeType_t< MT > TransposeType
Transpose type for expression template evaluations.
Definition: DMatExpExpr.h:109
Base class for dense matrices.
Definition: DenseMatrix.h:82
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseMatrix base class.
Header file for the MatExpExpr base class.
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1801
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) maxNorm(const DenseMatrix< MT, SO > &dm)
Computes the maximum norm for the given dense matrix.
Definition: DMatNormExpr.h:825
decltype(auto) pow(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise exponential value for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1448
decltype(auto) norm(const DenseMatrix< MT, SO > &dm)
Computes the L2 norm for the given dense matrix.
Definition: DMatNormExpr.h:573
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
ElementType_t< MT > det(const DenseMatrix< MT, SO > &dm)
Computation of the determinant of the given dense square matrix.
Definition: DMatDetExpr.h:384
decltype(auto) matexp(const DenseMatrix< MT, SO > &dm)
Calculation of the exponential of the given dense matrix.
Definition: DMatExpExpr.h:564
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.
Definition: BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
typename UnderlyingBuiltin< T >::Type UnderlyingBuiltin_t
Auxiliary alias declaration for the UnderlyingBuiltin type trait.
Definition: UnderlyingBuiltin.h:117
typename RemoveAdaptor< T >::Type RemoveAdaptor_t
Auxiliary alias declaration for the RemoveAdaptor type trait.
Definition: RemoveAdaptor.h:153
MT::ResultType evaluate(const Matrix< MT, SO > &matrix)
Evaluates the given matrix expression.
Definition: Matrix.h:1282
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraints on the storage order of matrix types.
Header file for all forward declarations for expression class templates.
Header file for the exp shim.
Header file for the pow shim.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all matrix exponential expression templates.
Definition: MatExpExpr.h:68
Header file for basic type definitions.
Header file for the generic max algorithm.