DMatAbsExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATABSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATABSEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <cmath>
50 #include <blaze/math/Intrinsics.h>
74 #include <blaze/system/Inline.h>
75 #include <blaze/util/Assert.h>
77 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/InvalidType.h>
80 #include <blaze/util/SelectType.h>
81 #include <blaze/util/Types.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS DMATABSEXPR
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
100 template< typename MT // Type of the dense matrix
101  , bool SO > // Storage order
102 class DMatAbsExpr : public DenseMatrix< DMatAbsExpr<MT,SO>, SO >
103  , private MatAbsExpr
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
108  typedef typename MT::ReturnType RN;
109  typedef typename MT::ElementType ET;
110  //**********************************************************************************************
111 
112  //**Return type evaluation**********************************************************************
114 
119  enum { returnExpr = !IsTemporary<RN>::value };
120 
123  //**********************************************************************************************
124 
125  //**Serial evaluation strategy******************************************************************
127 
133  enum { useAssign = RequiresEvaluation<MT>::value };
134 
136  template< typename MT2 >
138  struct UseAssign {
139  enum { value = useAssign };
140  };
142  //**********************************************************************************************
143 
144  //**Parallel evaluation strategy****************************************************************
146 
152  template< typename MT2 >
153  struct UseSMPAssign {
154  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
155  };
157  //**********************************************************************************************
158 
159  public:
160  //**Type definitions****************************************************************************
162  typedef typename MT::ResultType ResultType;
163  typedef typename MT::OppositeType OppositeType;
164  typedef typename MT::TransposeType TransposeType;
165  typedef typename MT::ElementType ElementType;
167 
170 
173 
175  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type Operand;
176  //**********************************************************************************************
177 
178  //**ConstIterator class definition**************************************************************
182  {
183  public:
184  //**Type definitions*************************************************************************
185  typedef std::random_access_iterator_tag IteratorCategory;
186  typedef ElementType ValueType;
187  typedef ElementType* PointerType;
188  typedef ElementType& ReferenceType;
190 
191  // STL iterator requirements
192  typedef IteratorCategory iterator_category;
193  typedef ValueType value_type;
194  typedef PointerType pointer;
195  typedef ReferenceType reference;
196  typedef DifferenceType difference_type;
197 
199  typedef typename MT::ConstIterator IteratorType;
200  //*******************************************************************************************
201 
202  //**Constructor******************************************************************************
207  explicit inline ConstIterator( IteratorType it )
208  : it_( it ) // Iterator to the current matrix element
209  {}
210  //*******************************************************************************************
211 
212  //**Addition assignment operator*************************************************************
218  inline ConstIterator& operator+=( size_t inc ) {
219  it_ += inc;
220  return *this;
221  }
222  //*******************************************************************************************
223 
224  //**Subtraction assignment operator**********************************************************
230  inline ConstIterator& operator-=( size_t dec ) {
231  it_ -= dec;
232  return *this;
233  }
234  //*******************************************************************************************
235 
236  //**Prefix increment operator****************************************************************
242  ++it_;
243  return *this;
244  }
245  //*******************************************************************************************
246 
247  //**Postfix increment operator***************************************************************
252  inline const ConstIterator operator++( int ) {
253  return ConstIterator( it_++ );
254  }
255  //*******************************************************************************************
256 
257  //**Prefix decrement operator****************************************************************
263  --it_;
264  return *this;
265  }
266  //*******************************************************************************************
267 
268  //**Postfix decrement operator***************************************************************
273  inline const ConstIterator operator--( int ) {
274  return ConstIterator( it_-- );
275  }
276  //*******************************************************************************************
277 
278  //**Element access operator******************************************************************
283  inline ReturnType operator*() const {
284  using std::abs;
285  return abs( *it_ );
286  }
287  //*******************************************************************************************
288 
289  //**Load function****************************************************************************
294  inline IntrinsicType load() const {
295  return abs( it_.load() );
296  }
297  //*******************************************************************************************
298 
299  //**Equality operator************************************************************************
305  inline bool operator==( const ConstIterator& rhs ) const {
306  return it_ == rhs.it_;
307  }
308  //*******************************************************************************************
309 
310  //**Inequality operator**********************************************************************
316  inline bool operator!=( const ConstIterator& rhs ) const {
317  return it_ != rhs.it_;
318  }
319  //*******************************************************************************************
320 
321  //**Less-than operator***********************************************************************
327  inline bool operator<( const ConstIterator& rhs ) const {
328  return it_ < rhs.it_;
329  }
330  //*******************************************************************************************
331 
332  //**Greater-than operator********************************************************************
338  inline bool operator>( const ConstIterator& rhs ) const {
339  return it_ > rhs.it_;
340  }
341  //*******************************************************************************************
342 
343  //**Less-or-equal-than operator**************************************************************
349  inline bool operator<=( const ConstIterator& rhs ) const {
350  return it_ <= rhs.it_;
351  }
352  //*******************************************************************************************
353 
354  //**Greater-or-equal-than operator***********************************************************
360  inline bool operator>=( const ConstIterator& rhs ) const {
361  return it_ >= rhs.it_;
362  }
363  //*******************************************************************************************
364 
365  //**Subtraction operator*********************************************************************
371  inline DifferenceType operator-( const ConstIterator& rhs ) const {
372  return it_ - rhs.it_;
373  }
374  //*******************************************************************************************
375 
376  //**Addition operator************************************************************************
383  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
384  return ConstIterator( it.it_ + inc );
385  }
386  //*******************************************************************************************
387 
388  //**Addition operator************************************************************************
395  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
396  return ConstIterator( it.it_ + inc );
397  }
398  //*******************************************************************************************
399 
400  //**Subtraction operator*********************************************************************
407  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
408  return ConstIterator( it.it_ - dec );
409  }
410  //*******************************************************************************************
411 
412  private:
413  //**Member variables*************************************************************************
414  IteratorType it_;
415  //*******************************************************************************************
416  };
417  //**********************************************************************************************
418 
419  //**Compilation flags***************************************************************************
421  enum { vectorizable = MT::vectorizable &&
423 
425  enum { smpAssignable = MT::smpAssignable };
426  //**********************************************************************************************
427 
428  //**Constructor*********************************************************************************
433  explicit inline DMatAbsExpr( const MT& dm )
434  : dm_( dm ) // Dense matrix of the absolute value expression
435  {}
436  //**********************************************************************************************
437 
438  //**Access operator*****************************************************************************
445  inline ReturnType operator()( size_t i, size_t j ) const {
446  using std::abs;
447  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
448  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
449  return abs( dm_(i,j) );
450  }
451  //**********************************************************************************************
452 
453  //**Load function*******************************************************************************
460  BLAZE_ALWAYS_INLINE IntrinsicType load( size_t i, size_t j ) const {
461  typedef IntrinsicTrait<ElementType> IT;
462  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
463  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
464  BLAZE_INTERNAL_ASSERT( !SO || ( i % IT::size == 0UL ), "Invalid row access index" );
465  BLAZE_INTERNAL_ASSERT( SO || ( j % IT::size == 0UL ), "Invalid column access index" );
466  return abs( dm_.load(i,j) );
467  }
468  //**********************************************************************************************
469 
470  //**Begin function******************************************************************************
476  inline ConstIterator begin( size_t i ) const {
477  return ConstIterator( dm_.begin(i) );
478  }
479  //**********************************************************************************************
480 
481  //**End function********************************************************************************
487  inline ConstIterator end( size_t i ) const {
488  return ConstIterator( dm_.end(i) );
489  }
490  //**********************************************************************************************
491 
492  //**Rows function*******************************************************************************
497  inline size_t rows() const {
498  return dm_.rows();
499  }
500  //**********************************************************************************************
501 
502  //**Columns function****************************************************************************
507  inline size_t columns() const {
508  return dm_.columns();
509  }
510  //**********************************************************************************************
511 
512  //**Operand access******************************************************************************
517  inline Operand operand() const {
518  return dm_;
519  }
520  //**********************************************************************************************
521 
522  //**********************************************************************************************
528  template< typename T >
529  inline bool canAlias( const T* alias ) const {
530  return IsComputation<MT>::value && dm_.canAlias( alias );
531  }
532  //**********************************************************************************************
533 
534  //**********************************************************************************************
540  template< typename T >
541  inline bool isAliased( const T* alias ) const {
542  return dm_.isAliased( alias );
543  }
544  //**********************************************************************************************
545 
546  //**********************************************************************************************
551  inline bool isAligned() const {
552  return dm_.isAligned();
553  }
554  //**********************************************************************************************
555 
556  //**********************************************************************************************
561  inline bool canSMPAssign() const {
562  return dm_.canSMPAssign();
563  }
564  //**********************************************************************************************
565 
566  private:
567  //**Member variables****************************************************************************
568  Operand dm_;
569  //**********************************************************************************************
570 
571  //**Assignment to dense matrices****************************************************************
585  template< typename MT2 // Type of the target dense matrix
586  , bool SO2 > // Storage order or the target dense matrix
587  friend inline typename EnableIf< UseAssign<MT2> >::Type
588  assign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
589  {
591 
592  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
593  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
594 
595  assign( ~lhs, rhs.dm_ );
596  assign( ~lhs, abs( ~lhs ) );
597  }
599  //**********************************************************************************************
600 
601  //**Assignment to sparse matrices***************************************************************
615  template< typename MT2 // Type of the target sparse matrix
616  , bool SO2 > // Storage order or the target sparse matrix
617  friend inline typename EnableIf< UseAssign<MT2> >::Type
618  assign( SparseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
619  {
621 
623 
630 
631  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
632  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
633 
634  const TmpType tmp( serial( rhs ) );
635  assign( ~lhs, tmp );
636  }
638  //**********************************************************************************************
639 
640  //**Addition assignment to dense matrices*******************************************************
654  template< typename MT2 // Type of the target dense matrix
655  , bool SO2 > // Storage order of the target dense matrix
656  friend inline typename EnableIf< UseAssign<MT2> >::Type
657  addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
658  {
660 
664 
665  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
666  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
667 
668  const ResultType tmp( serial( rhs ) );
669  addAssign( ~lhs, tmp );
670  }
672  //**********************************************************************************************
673 
674  //**Addition assignment to sparse matrices******************************************************
675  // No special implementation for the addition assignment to sparse matrices.
676  //**********************************************************************************************
677 
678  //**Subtraction assignment to dense matrices****************************************************
692  template< typename MT2 // Type of the target dense matrix
693  , bool SO2 > // Storage order of the target dense matrix
694  friend inline typename EnableIf< UseAssign<MT2> >::Type
695  subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
696  {
698 
702 
703  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
704  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
705 
706  const ResultType tmp( serial( rhs ) );
707  subAssign( ~lhs, tmp );
708  }
710  //**********************************************************************************************
711 
712  //**Subtraction assignment to sparse matrices***************************************************
713  // No special implementation for the subtraction assignment to sparse matrices.
714  //**********************************************************************************************
715 
716  //**Multiplication assignment to dense matrices*************************************************
717  // No special implementation for the multiplication assignment to dense matrices.
718  //**********************************************************************************************
719 
720  //**Multiplication assignment to sparse matrices************************************************
721  // No special implementation for the multiplication assignment to sparse matrices.
722  //**********************************************************************************************
723 
724  //**SMP assignment to dense matrices************************************************************
738  template< typename MT2 // Type of the target dense matrix
739  , bool SO2 > // Storage order or the target dense matrix
740  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
741  smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
742  {
744 
745  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
746  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
747 
748  smpAssign( ~lhs, rhs.dm_ );
749  smpAssign( ~lhs, abs( ~lhs ) );
750  }
752  //**********************************************************************************************
753 
754  //**SMP assignment to sparse matrices***********************************************************
768  template< typename MT2 // Type of the target sparse matrix
769  , bool SO2 > // Storage order or the target sparse matrix
770  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
771  smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
772  {
774 
775  typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
776 
783 
784  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
785  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
786 
787  const TmpType tmp( rhs );
788  smpAssign( ~lhs, tmp );
789  }
791  //**********************************************************************************************
792 
793  //**SMP addition assignment to dense matrices***************************************************
807  template< typename MT2 // Type of the target dense matrix
808  , bool SO2 > // Storage order of the target dense matrix
809  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
810  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
811  {
813 
817 
818  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
819  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
820 
821  const ResultType tmp( rhs );
822  smpAddAssign( ~lhs, tmp );
823  }
825  //**********************************************************************************************
826 
827  //**SMP addition assignment to sparse matrices**************************************************
828  // No special implementation for the SMP addition assignment to sparse matrices.
829  //**********************************************************************************************
830 
831  //**SMP subtraction assignment to dense matrices************************************************
845  template< typename MT2 // Type of the target dense matrix
846  , bool SO2 > // Storage order of the target dense matrix
847  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
848  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
849  {
851 
855 
856  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
857  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
858 
859  const ResultType tmp( rhs );
860  smpSubAssign( ~lhs, tmp );
861  }
863  //**********************************************************************************************
864 
865  //**SMP subtraction assignment to sparse matrices***********************************************
866  // No special implementation for the SMP subtraction assignment to sparse matrices.
867  //**********************************************************************************************
868 
869  //**SMP multiplication assignment to dense matrices*********************************************
870  // No special implementation for the SMP multiplication assignment to dense matrices.
871  //**********************************************************************************************
872 
873  //**SMP multiplication assignment to sparse matrices********************************************
874  // No special implementation for the SMP multiplication assignment to sparse matrices.
875  //**********************************************************************************************
876 
877  //**Compile time checks*************************************************************************
882  //**********************************************************************************************
883 };
884 //*************************************************************************************************
885 
886 
887 
888 
889 //=================================================================================================
890 //
891 // GLOBAL FUNCTIONS
892 //
893 //=================================================================================================
894 
895 //*************************************************************************************************
912 template< typename MT // Type of the dense matrix
913  , bool SO > // Storage order
914 inline const DMatAbsExpr<MT,SO> abs( const DenseMatrix<MT,SO>& dm )
915 {
917 
918  return DMatAbsExpr<MT,SO>( ~dm );
919 }
920 //*************************************************************************************************
921 
922 
923 
924 
925 //=================================================================================================
926 //
927 // GLOBAL RESTRUCTURING FUNCTIONS
928 //
929 //=================================================================================================
930 
931 //*************************************************************************************************
942 template< typename MT // Type of the dense matrix
943  , bool SO > // Storage order
944 inline const DMatAbsExpr<MT,SO>& abs( const DMatAbsExpr<MT,SO>& dm )
945 {
947 
948  return dm;
949 }
951 //*************************************************************************************************
952 
953 
954 
955 
956 //=================================================================================================
957 //
958 // ROWS SPECIALIZATIONS
959 //
960 //=================================================================================================
961 
962 //*************************************************************************************************
964 template< typename MT, bool SO >
965 struct Rows< DMatAbsExpr<MT,SO> > : public Rows<MT>
966 {};
968 //*************************************************************************************************
969 
970 
971 
972 
973 //=================================================================================================
974 //
975 // COLUMNS SPECIALIZATIONS
976 //
977 //=================================================================================================
978 
979 //*************************************************************************************************
981 template< typename MT, bool SO >
982 struct Columns< DMatAbsExpr<MT,SO> > : public Columns<MT>
983 {};
985 //*************************************************************************************************
986 
987 
988 
989 
990 //=================================================================================================
991 //
992 // ISSYMMETRIC SPECIALIZATIONS
993 //
994 //=================================================================================================
995 
996 //*************************************************************************************************
998 template< typename MT, bool SO >
999 struct IsSymmetric< DMatAbsExpr<MT,SO> > : public IsTrue< IsSymmetric<MT>::value >
1000 {};
1002 //*************************************************************************************************
1003 
1004 
1005 
1006 
1007 //=================================================================================================
1008 //
1009 // ISLOWER SPECIALIZATIONS
1010 //
1011 //=================================================================================================
1012 
1013 //*************************************************************************************************
1015 template< typename MT, bool SO >
1016 struct IsLower< DMatAbsExpr<MT,SO> > : public IsTrue< IsLower<MT>::value >
1017 {};
1019 //*************************************************************************************************
1020 
1021 
1022 
1023 
1024 //=================================================================================================
1025 //
1026 // ISUNILOWER SPECIALIZATIONS
1027 //
1028 //=================================================================================================
1029 
1030 //*************************************************************************************************
1032 template< typename MT, bool SO >
1033 struct IsUniLower< DMatAbsExpr<MT,SO> > : public IsTrue< IsUniLower<MT>::value >
1034 {};
1036 //*************************************************************************************************
1037 
1038 
1039 
1040 
1041 //=================================================================================================
1042 //
1043 // ISSTRICTLYLOWER SPECIALIZATIONS
1044 //
1045 //=================================================================================================
1046 
1047 //*************************************************************************************************
1049 template< typename MT, bool SO >
1050 struct IsStrictlyLower< DMatAbsExpr<MT,SO> > : public IsTrue< IsStrictlyLower<MT>::value >
1051 {};
1053 //*************************************************************************************************
1054 
1055 
1056 
1057 
1058 //=================================================================================================
1059 //
1060 // ISUPPER SPECIALIZATIONS
1061 //
1062 //=================================================================================================
1063 
1064 //*************************************************************************************************
1066 template< typename MT, bool SO >
1067 struct IsUpper< DMatAbsExpr<MT,SO> > : public IsTrue< IsUpper<MT>::value >
1068 {};
1070 //*************************************************************************************************
1071 
1072 
1073 
1074 
1075 //=================================================================================================
1076 //
1077 // ISUNIUPPER SPECIALIZATIONS
1078 //
1079 //=================================================================================================
1080 
1081 //*************************************************************************************************
1083 template< typename MT, bool SO >
1084 struct IsUniUpper< DMatAbsExpr<MT,SO> > : public IsTrue< IsUniUpper<MT>::value >
1085 {};
1087 //*************************************************************************************************
1088 
1089 
1090 
1091 
1092 //=================================================================================================
1093 //
1094 // ISSTRICTLYUPPER SPECIALIZATIONS
1095 //
1096 //=================================================================================================
1097 
1098 //*************************************************************************************************
1100 template< typename MT, bool SO >
1101 struct IsStrictlyUpper< DMatAbsExpr<MT,SO> > : public IsTrue< IsStrictlyUpper<MT>::value >
1102 {};
1104 //*************************************************************************************************
1105 
1106 
1107 
1108 
1109 //=================================================================================================
1110 //
1111 // EXPRESSION TRAIT SPECIALIZATIONS
1112 //
1113 //=================================================================================================
1114 
1115 //*************************************************************************************************
1117 template< typename MT >
1118 struct DMatAbsExprTrait< DMatAbsExpr<MT,false> >
1119 {
1120  public:
1121  //**********************************************************************************************
1122  typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1123  , DMatAbsExpr<MT,false>
1124  , INVALID_TYPE >::Type Type;
1125  //**********************************************************************************************
1126 };
1128 //*************************************************************************************************
1129 
1130 
1131 //*************************************************************************************************
1133 template< typename MT >
1134 struct TDMatAbsExprTrait< DMatAbsExpr<MT,true> >
1135 {
1136  public:
1137  //**********************************************************************************************
1138  typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1139  , DMatAbsExpr<MT,true>
1140  , INVALID_TYPE >::Type Type;
1141  //**********************************************************************************************
1142 };
1144 //*************************************************************************************************
1145 
1146 
1147 //*************************************************************************************************
1149 template< typename MT, bool SO, bool AF >
1150 struct SubmatrixExprTrait< DMatAbsExpr<MT,SO>, AF >
1151 {
1152  public:
1153  //**********************************************************************************************
1154  typedef typename AbsExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1155  //**********************************************************************************************
1156 };
1158 //*************************************************************************************************
1159 
1160 
1161 //*************************************************************************************************
1163 template< typename MT, bool SO >
1164 struct RowExprTrait< DMatAbsExpr<MT,SO> >
1165 {
1166  public:
1167  //**********************************************************************************************
1168  typedef typename AbsExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1169  //**********************************************************************************************
1170 };
1172 //*************************************************************************************************
1173 
1174 
1175 //*************************************************************************************************
1177 template< typename MT, bool SO >
1178 struct ColumnExprTrait< DMatAbsExpr<MT,SO> >
1179 {
1180  public:
1181  //**********************************************************************************************
1182  typedef typename AbsExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
1183  //**********************************************************************************************
1184 };
1186 //*************************************************************************************************
1187 
1188 } // namespace blaze
1189 
1190 #endif
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