35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATABSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATABSEXPR_H_
100 template<
typename MT
136 template<
typename MT2 >
139 enum { value = useAssign };
152 template<
typename MT2 >
153 struct UseSMPAssign {
154 enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
294 inline IntrinsicType
load()
const {
295 return abs( it_.load() );
306 return it_ == rhs.
it_;
317 return it_ != rhs.
it_;
328 return it_ < rhs.
it_;
339 return it_ > rhs.
it_;
350 return it_ <= rhs.
it_;
361 return it_ >= rhs.
it_;
372 return it_ - rhs.
it_;
421 enum { vectorizable = MT::vectorizable &&
425 enum { smpAssignable = MT::smpAssignable };
466 return abs(
dm_.load(i,j) );
508 return dm_.columns();
528 template<
typename T >
540 template<
typename T >
542 return dm_.isAliased( alias );
552 return dm_.isAligned();
562 return dm_.canSMPAssign();
585 template<
typename MT2
615 template<
typename MT2
634 const TmpType tmp(
serial( rhs ) );
654 template<
typename MT2
656 friend inline typename EnableIf< UseAssign<MT2> >::Type
668 const ResultType tmp(
serial( rhs ) );
692 template<
typename MT2
694 friend inline typename EnableIf< UseAssign<MT2> >::Type
706 const ResultType tmp(
serial( rhs ) );
738 template<
typename MT2
740 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
768 template<
typename MT2
770 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
775 typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
787 const TmpType tmp( rhs );
807 template<
typename MT2
809 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
821 const ResultType tmp( rhs );
845 template<
typename MT2
847 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
859 const ResultType tmp( rhs );
912 template<
typename MT
942 template<
typename MT
944 inline const DMatAbsExpr<MT,SO>&
abs(
const DMatAbsExpr<MT,SO>& dm )
964 template<
typename MT,
bool SO >
965 struct Rows<
DMatAbsExpr<MT,SO> > :
public Rows<MT>
981 template<
typename MT,
bool SO >
982 struct Columns<
DMatAbsExpr<MT,SO> > :
public Columns<MT>
998 template<
typename MT,
bool SO >
999 struct IsSymmetric<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsSymmetric<MT>::value >
1015 template<
typename MT,
bool SO >
1016 struct IsLower<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsLower<MT>::value >
1032 template<
typename MT,
bool SO >
1033 struct IsUniLower<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsUniLower<MT>::value >
1049 template<
typename MT,
bool SO >
1050 struct IsStrictlyLower<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsStrictlyLower<MT>::value >
1066 template<
typename MT,
bool SO >
1067 struct IsUpper<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsUpper<MT>::value >
1083 template<
typename MT,
bool SO >
1084 struct IsUniUpper<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsUniUpper<MT>::value >
1100 template<
typename MT,
bool SO >
1101 struct IsStrictlyUpper<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsStrictlyUpper<MT>::value >
1117 template<
typename MT >
1122 typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1123 , DMatAbsExpr<MT,false>
1124 , INVALID_TYPE >::Type Type;
1133 template<
typename MT >
1138 typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1139 , DMatAbsExpr<MT,true>
1140 , INVALID_TYPE >::Type Type;
1149 template<
typename MT,
bool SO,
bool AF >
1150 struct SubmatrixExprTrait<
DMatAbsExpr<MT,SO>, AF >
1154 typedef typename AbsExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1163 template<
typename MT,
bool SO >
1168 typedef typename AbsExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1177 template<
typename MT,
bool SO >
1182 typedef typename AbsExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
IntrinsicTrait< ET >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DMatAbsExpr.h:166
Pointer difference type of the Blaze library.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatAbsExpr.h:283
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DMatAbsExpr.h:175
Header file for the Rows type trait.
ValueType value_type
Type of the underlying elements.
Definition: DMatAbsExpr.h:193
Header file for the IsUniUpper type trait.
Header file for basic type definitions.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:338
IteratorCategory iterator_category
The iterator category.
Definition: DMatAbsExpr.h:192
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatAbsExpr.h:218
#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:242
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
Header file for the ColumnExprTrait class template.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatAbsExpr.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
Header file for the IsRowVector type trait.
MT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatAbsExpr.h:164
const DMatAbsExpr< MT, SO > abs(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the absolute values of each single element of dm.
Definition: DMatAbsExpr.h:914
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatAbsExpr.h:407
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
AbsExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DMatAbsExpr.h:122
Header file for the Computation base class.
SelectType< useAssign, const ResultType, const DMatAbsExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatAbsExpr.h:172
Header file for the RequiresEvaluation type trait.
ElementType * PointerType
Pointer return type.
Definition: DMatAbsExpr.h:187
Operand dm_
Dense matrix of the absolute value expression.
Definition: DMatAbsExpr.h:568
Header file for the IsUniLower type trait.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2503
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:107
Header file for the TDVecAbsExprTrait class template.
PointerType pointer
Pointer return type.
Definition: DMatAbsExpr.h:194
Constraint on the data type.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DMatAbsExpr.h:169
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:305
Expression object for the dense matrix abs() function.The DMatAbsExpr class represents the compile ti...
Definition: DMatAbsExpr.h:102
Constraint on the data type.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatAbsExpr.h:561
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:263
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatAbsExpr.h:262
MT::ResultType ResultType
Result type for expression template evaluations.
Definition: DMatAbsExpr.h:162
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
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
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
Operand operand() const
Returns the dense matrix operand.
Definition: DMatAbsExpr.h:517
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatAbsExpr.h:445
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:349
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatAbsExpr.h:252
Header file for the DenseMatrix base class.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the Columns type trait.
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatAbsExpr.h:383
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatAbsExpr.h:395
ReferenceType reference
Reference return type.
Definition: DMatAbsExpr.h:195
Header file for the DVecAbsExprTrait class template.
Header file for the MatAbsExpr base class.
Header file for the IsLower type trait.
DifferenceType difference_type
Difference between two iterators.
Definition: DMatAbsExpr.h:196
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
ElementType & ReferenceType
Reference return type.
Definition: DMatAbsExpr.h:188
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2504
Constraints on the storage order of matrix types.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
Header file for the SelectType class template.
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t i, size_t j) const
Access to the intrinsic elements of the matrix.
Definition: DMatAbsExpr.h:460
Header file for the RowExprTrait class template.
Iterator over the elements of the dense matrix.
Definition: DMatAbsExpr.h:181
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatAbsExpr.h:476
Header file for the serial shim.
IteratorType it_
Iterator to the current matrix element.
Definition: DMatAbsExpr.h:414
EnableIf< IsDenseMatrix< MT1 > >::Type 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 SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
IntrinsicType load() const
Access to the intrinsic elements of the matrix.
Definition: DMatAbsExpr.h:294
Utility type for generic codes.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:316
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatAbsExpr.h:541
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatAbsExpr.h:497
DMatAbsExpr(const MT &dm)
Constructor for the DMatAbsExpr class.
Definition: DMatAbsExpr.h:433
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
MT::ElementType ET
Element type of the dense matrix expression.
Definition: DMatAbsExpr.h:109
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatAbsExpr.h:551
ElementType ValueType
Type of the underlying elements.
Definition: DMatAbsExpr.h:186
Base class for all matrix absolute value expression templates.The MatAbsExpr class serves as a tag fo...
Definition: MatAbsExpr.h:65
DMatAbsExpr< MT, SO > This
Type of this DMatAbsExpr instance.
Definition: DMatAbsExpr.h:161
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: DMatAbsExpr.h:207
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatAbsExpr.h:185
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatAbsExpr.h:163
#define BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.In case either of the two given data types T1 or T2 is not a matrix type ...
Definition: StorageOrder.h:283
Header file for the IsDenseVector type trait.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatAbsExpr.h:189
Header file for all intrinsic functionality.
MT::ReturnType RN
Return type of the dense matrix expression.
Definition: DMatAbsExpr.h:108
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatAbsExpr.h:241
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatAbsExpr.h:487
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatAbsExpr.h:273
Header file for the IsComputation type trait class.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:360
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:327
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
EnableIf< IsDenseMatrix< MT1 > >::Type 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
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
Header file for the IsTrue value trait.
MT::ElementType ElementType
Resulting element type.
Definition: DMatAbsExpr.h:165
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatAbsExpr.h:230
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatAbsExpr.h:371
Header file for the IsUpper type trait.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatAbsExpr.h:529
Header file for the AbsExprTrait class template.
Header file for the IsColumnVector type trait.
Evaluation of the return type of an absolute value expression.Via this type trait it is possible to e...
Definition: AbsExprTrait.h:87
System settings for the inline keywords.
#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
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
MT::ConstIterator IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatAbsExpr.h:199