35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATABSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATABSEXPR_H_
105 template<
typename MT
141 template<
typename MT2 >
144 enum { value = useAssign };
157 template<
typename MT2 >
158 struct UseSMPAssign {
159 enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
299 inline IntrinsicType
load()
const {
300 return abs( it_.load() );
311 return it_ == rhs.
it_;
322 return it_ != rhs.
it_;
333 return it_ < rhs.
it_;
344 return it_ > rhs.
it_;
355 return it_ <= rhs.
it_;
366 return it_ >= rhs.
it_;
377 return it_ - rhs.
it_;
426 enum { vectorizable = MT::vectorizable &&
430 enum { smpAssignable = MT::smpAssignable };
466 inline ReturnType
at(
size_t i,
size_t j )
const {
467 if( i >=
dm_.rows() ) {
470 if( j >=
dm_.columns() ) {
490 return abs(
dm_.load(i,j) );
532 return dm_.columns();
552 template<
typename T >
564 template<
typename T >
566 return dm_.isAliased( alias );
576 return dm_.isAligned();
586 return dm_.canSMPAssign();
609 template<
typename MT2
619 assign( ~lhs, rhs.
dm_ );
620 assign( ~lhs,
abs( ~lhs ) );
639 template<
typename MT2
658 const TmpType tmp(
serial( rhs ) );
678 template<
typename MT2
680 friend inline typename EnableIf< UseAssign<MT2> >::Type
681 addAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatAbsExpr& rhs )
692 const ResultType tmp(
serial( rhs ) );
693 addAssign( ~lhs, tmp );
716 template<
typename MT2
718 friend inline typename EnableIf< UseAssign<MT2> >::Type
719 subAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatAbsExpr& rhs )
730 const ResultType tmp(
serial( rhs ) );
731 subAssign( ~lhs, tmp );
762 template<
typename MT2
764 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
792 template<
typename MT2
794 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
799 typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
811 const TmpType tmp( rhs );
831 template<
typename MT2
833 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
845 const ResultType tmp( rhs );
869 template<
typename MT2
871 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
883 const ResultType tmp( rhs );
936 template<
typename MT
966 template<
typename MT
968 inline const DMatAbsExpr<MT,SO>&
abs(
const DMatAbsExpr<MT,SO>& dm )
988 template<
typename MT,
bool SO >
989 struct Rows<
DMatAbsExpr<MT,SO> > :
public Rows<MT>
1005 template<
typename MT,
bool SO >
1006 struct Columns<
DMatAbsExpr<MT,SO> > :
public Columns<MT>
1022 template<
typename MT,
bool SO >
1023 struct IsAligned<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsAligned<MT>::value >
1039 template<
typename MT,
bool SO >
1040 struct IsPadded<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsPadded<MT>::value >
1056 template<
typename MT,
bool SO >
1057 struct IsSymmetric<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsSymmetric<MT>::value >
1073 template<
typename MT,
bool SO >
1074 struct IsHermitian<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsHermitian<MT>::value >
1090 template<
typename MT,
bool SO >
1091 struct IsLower<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsLower<MT>::value >
1107 template<
typename MT,
bool SO >
1108 struct IsUniLower<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsUniLower<MT>::value >
1124 template<
typename MT,
bool SO >
1125 struct IsStrictlyLower<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsStrictlyLower<MT>::value >
1141 template<
typename MT,
bool SO >
1142 struct IsUpper<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsUpper<MT>::value >
1158 template<
typename MT,
bool SO >
1159 struct IsUniUpper<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsUniUpper<MT>::value >
1175 template<
typename MT,
bool SO >
1176 struct IsStrictlyUpper<
DMatAbsExpr<MT,SO> > :
public IsTrue< IsStrictlyUpper<MT>::value >
1192 template<
typename MT >
1197 typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1198 , DMatAbsExpr<MT,false>
1199 , INVALID_TYPE >::Type Type;
1208 template<
typename MT >
1213 typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1214 , DMatAbsExpr<MT,true>
1215 , INVALID_TYPE >::Type Type;
1224 template<
typename MT,
bool SO,
bool AF >
1225 struct SubmatrixExprTrait<
DMatAbsExpr<MT,SO>, AF >
1229 typedef typename AbsExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1238 template<
typename MT,
bool SO >
1243 typedef typename AbsExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1252 template<
typename MT,
bool SO >
1257 typedef typename AbsExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
IntrinsicTrait< ET >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DMatAbsExpr.h:171
Pointer difference type of the Blaze library.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatAbsExpr.h:288
Header file for the DMatAbsExprTrait class template.
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:180
Header file for the Rows type trait.
ValueType value_type
Type of the underlying elements.
Definition: DMatAbsExpr.h:198
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:343
IteratorCategory iterator_category
The iterator category.
Definition: DMatAbsExpr.h:197
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatAbsExpr.h:223
#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:81
#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.
Header file for the IsColumnMajorMatrix type trait.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatAbsExpr.h:466
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatAbsExpr.h:531
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
MT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatAbsExpr.h:169
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:938
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatAbsExpr.h:412
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
AbsExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DMatAbsExpr.h:127
Header file for the Computation base class.
SelectType< useAssign, const ResultType, const DMatAbsExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatAbsExpr.h:177
Header file for the RequiresEvaluation type trait.
ElementType * PointerType
Pointer return type.
Definition: DMatAbsExpr.h:192
Operand dm_
Dense matrix of the absolute value expression.
Definition: DMatAbsExpr.h:592
Header file for the IsUniLower type trait.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
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:117
PointerType pointer
Pointer return type.
Definition: DMatAbsExpr.h:199
Constraint on the data type.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DMatAbsExpr.h:174
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:310
Expression object for the dense matrix abs() function.The DMatAbsExpr class represents the compile ti...
Definition: DMatAbsExpr.h:107
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:585
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:261
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatAbsExpr.h:267
MT::ResultType ResultType
Result type for expression template evaluations.
Definition: DMatAbsExpr.h:167
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:2592
Operand operand() const
Returns the dense matrix operand.
Definition: DMatAbsExpr.h:541
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatAbsExpr.h:450
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:354
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatAbsExpr.h:257
Header file for the DenseMatrix base class.
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:388
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatAbsExpr.h:400
ReferenceType reference
Reference return type.
Definition: DMatAbsExpr.h:200
Header file for the MatAbsExpr base class.
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
DifferenceType difference_type
Difference between two iterators.
Definition: DMatAbsExpr.h:201
#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:193
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
Constraints on the storage order of matrix types.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
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:484
Header file for the RowExprTrait class template.
Iterator over the elements of the dense matrix.
Definition: DMatAbsExpr.h:186
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:500
Header file for the IsPadded type trait.
Header file for the serial shim.
IteratorType it_
Iterator to the current matrix element.
Definition: DMatAbsExpr.h:419
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:2587
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
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:299
Utility type for generic codes.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:321
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatAbsExpr.h:565
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatAbsExpr.h:521
DMatAbsExpr(const MT &dm)
Constructor for the DMatAbsExpr class.
Definition: DMatAbsExpr.h:438
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:114
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatAbsExpr.h:575
ElementType ValueType
Type of the underlying elements.
Definition: DMatAbsExpr.h:191
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:166
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: DMatAbsExpr.h:212
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatAbsExpr.h:190
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatAbsExpr.h:168
#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:122
Header file for the IsDenseVector type trait.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatAbsExpr.h:194
Header file for all intrinsic functionality.
MT::ReturnType RN
Return type of the dense matrix expression.
Definition: DMatAbsExpr.h:113
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatAbsExpr.h:246
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatAbsExpr.h:511
Header file for the TDMatAbsExprTrait class template.
Header file for the IsRowMajorMatrix type trait.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatAbsExpr.h:278
Header file for the IsComputation type trait class.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:365
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatAbsExpr.h:332
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:2583
Header file for the IsTrue value trait.
MT::ElementType ElementType
Resulting element type.
Definition: DMatAbsExpr.h:170
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatAbsExpr.h:235
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatAbsExpr.h:376
Header file for the IsUpper type trait.
Header file for exception macros.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatAbsExpr.h:553
Header file for the AbsExprTrait class template.
Evaluation of the return type of an absolute value expression.Via this type trait it is possible to e...
Definition: AbsExprTrait.h:88
Header file for the IsHermitian type trait.
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.
MT::ConstIterator IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatAbsExpr.h:204