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>
44 #include <iterator>
51 #include <blaze/math/Intrinsics.h>
78 #include <blaze/system/Inline.h>
79 #include <blaze/util/Assert.h>
81 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/Exception.h>
83 #include <blaze/util/InvalidType.h>
85 #include <blaze/util/SelectType.h>
86 #include <blaze/util/Types.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // CLASS DMATABSEXPR
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
105 template< typename MT // Type of the dense matrix
106  , bool SO > // Storage order
107 class DMatAbsExpr : public DenseMatrix< DMatAbsExpr<MT,SO>, SO >
108  , private MatAbsExpr
109  , private Computation
110 {
111  private:
112  //**Type definitions****************************************************************************
113  typedef typename MT::ReturnType RN;
114  typedef typename MT::ElementType ET;
115  //**********************************************************************************************
116 
117  //**Return type evaluation**********************************************************************
119 
124  enum { returnExpr = !IsTemporary<RN>::value };
125 
128  //**********************************************************************************************
129 
130  //**Serial evaluation strategy******************************************************************
132 
138  enum { useAssign = RequiresEvaluation<MT>::value };
139 
141  template< typename MT2 >
143  struct UseAssign {
144  enum { value = useAssign };
145  };
147  //**********************************************************************************************
148 
149  //**Parallel evaluation strategy****************************************************************
151 
157  template< typename MT2 >
158  struct UseSMPAssign {
159  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
160  };
162  //**********************************************************************************************
163 
164  public:
165  //**Type definitions****************************************************************************
167  typedef typename MT::ResultType ResultType;
168  typedef typename MT::OppositeType OppositeType;
169  typedef typename MT::TransposeType TransposeType;
170  typedef typename MT::ElementType ElementType;
172 
175 
178 
180  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type Operand;
181  //**********************************************************************************************
182 
183  //**ConstIterator class definition**************************************************************
187  {
188  public:
189  //**Type definitions*************************************************************************
190  typedef std::random_access_iterator_tag IteratorCategory;
191  typedef ElementType ValueType;
192  typedef ElementType* PointerType;
193  typedef ElementType& ReferenceType;
195 
196  // STL iterator requirements
197  typedef IteratorCategory iterator_category;
198  typedef ValueType value_type;
199  typedef PointerType pointer;
200  typedef ReferenceType reference;
201  typedef DifferenceType difference_type;
202 
204  typedef typename MT::ConstIterator IteratorType;
205  //*******************************************************************************************
206 
207  //**Constructor******************************************************************************
212  explicit inline ConstIterator( IteratorType it )
213  : it_( it ) // Iterator to the current matrix element
214  {}
215  //*******************************************************************************************
216 
217  //**Addition assignment operator*************************************************************
223  inline ConstIterator& operator+=( size_t inc ) {
224  it_ += inc;
225  return *this;
226  }
227  //*******************************************************************************************
228 
229  //**Subtraction assignment operator**********************************************************
235  inline ConstIterator& operator-=( size_t dec ) {
236  it_ -= dec;
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Prefix increment operator****************************************************************
247  ++it_;
248  return *this;
249  }
250  //*******************************************************************************************
251 
252  //**Postfix increment operator***************************************************************
257  inline const ConstIterator operator++( int ) {
258  return ConstIterator( it_++ );
259  }
260  //*******************************************************************************************
261 
262  //**Prefix decrement operator****************************************************************
268  --it_;
269  return *this;
270  }
271  //*******************************************************************************************
272 
273  //**Postfix decrement operator***************************************************************
278  inline const ConstIterator operator--( int ) {
279  return ConstIterator( it_-- );
280  }
281  //*******************************************************************************************
282 
283  //**Element access operator******************************************************************
288  inline ReturnType operator*() const {
289  using std::abs;
290  return abs( *it_ );
291  }
292  //*******************************************************************************************
293 
294  //**Load function****************************************************************************
299  inline IntrinsicType load() const {
300  return abs( it_.load() );
301  }
302  //*******************************************************************************************
303 
304  //**Equality operator************************************************************************
310  inline bool operator==( const ConstIterator& rhs ) const {
311  return it_ == rhs.it_;
312  }
313  //*******************************************************************************************
314 
315  //**Inequality operator**********************************************************************
321  inline bool operator!=( const ConstIterator& rhs ) const {
322  return it_ != rhs.it_;
323  }
324  //*******************************************************************************************
325 
326  //**Less-than operator***********************************************************************
332  inline bool operator<( const ConstIterator& rhs ) const {
333  return it_ < rhs.it_;
334  }
335  //*******************************************************************************************
336 
337  //**Greater-than operator********************************************************************
343  inline bool operator>( const ConstIterator& rhs ) const {
344  return it_ > rhs.it_;
345  }
346  //*******************************************************************************************
347 
348  //**Less-or-equal-than operator**************************************************************
354  inline bool operator<=( const ConstIterator& rhs ) const {
355  return it_ <= rhs.it_;
356  }
357  //*******************************************************************************************
358 
359  //**Greater-or-equal-than operator***********************************************************
365  inline bool operator>=( const ConstIterator& rhs ) const {
366  return it_ >= rhs.it_;
367  }
368  //*******************************************************************************************
369 
370  //**Subtraction operator*********************************************************************
376  inline DifferenceType operator-( const ConstIterator& rhs ) const {
377  return it_ - rhs.it_;
378  }
379  //*******************************************************************************************
380 
381  //**Addition operator************************************************************************
388  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
389  return ConstIterator( it.it_ + inc );
390  }
391  //*******************************************************************************************
392 
393  //**Addition operator************************************************************************
400  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
401  return ConstIterator( it.it_ + inc );
402  }
403  //*******************************************************************************************
404 
405  //**Subtraction operator*********************************************************************
412  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
413  return ConstIterator( it.it_ - dec );
414  }
415  //*******************************************************************************************
416 
417  private:
418  //**Member variables*************************************************************************
419  IteratorType it_;
420  //*******************************************************************************************
421  };
422  //**********************************************************************************************
423 
424  //**Compilation flags***************************************************************************
426  enum { vectorizable = MT::vectorizable &&
428 
430  enum { smpAssignable = MT::smpAssignable };
431  //**********************************************************************************************
432 
433  //**Constructor*********************************************************************************
438  explicit inline DMatAbsExpr( const MT& dm )
439  : dm_( dm ) // Dense matrix of the absolute value expression
440  {}
441  //**********************************************************************************************
442 
443  //**Access operator*****************************************************************************
450  inline ReturnType operator()( size_t i, size_t j ) const {
451  using std::abs;
452  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
453  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
454  return abs( dm_(i,j) );
455  }
456  //**********************************************************************************************
457 
458  //**At function*********************************************************************************
466  inline ReturnType at( size_t i, size_t j ) const {
467  if( i >= dm_.rows() ) {
468  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
469  }
470  if( j >= dm_.columns() ) {
471  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
472  }
473  return (*this)(i,j);
474  }
475  //**********************************************************************************************
476 
477  //**Load function*******************************************************************************
484  BLAZE_ALWAYS_INLINE IntrinsicType load( size_t i, size_t j ) const {
485  typedef IntrinsicTrait<ElementType> IT;
486  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
487  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
488  BLAZE_INTERNAL_ASSERT( !SO || ( i % IT::size == 0UL ), "Invalid row access index" );
489  BLAZE_INTERNAL_ASSERT( SO || ( j % IT::size == 0UL ), "Invalid column access index" );
490  return abs( dm_.load(i,j) );
491  }
492  //**********************************************************************************************
493 
494  //**Begin function******************************************************************************
500  inline ConstIterator begin( size_t i ) const {
501  return ConstIterator( dm_.begin(i) );
502  }
503  //**********************************************************************************************
504 
505  //**End function********************************************************************************
511  inline ConstIterator end( size_t i ) const {
512  return ConstIterator( dm_.end(i) );
513  }
514  //**********************************************************************************************
515 
516  //**Rows function*******************************************************************************
521  inline size_t rows() const {
522  return dm_.rows();
523  }
524  //**********************************************************************************************
525 
526  //**Columns function****************************************************************************
531  inline size_t columns() const {
532  return dm_.columns();
533  }
534  //**********************************************************************************************
535 
536  //**Operand access******************************************************************************
541  inline Operand operand() const {
542  return dm_;
543  }
544  //**********************************************************************************************
545 
546  //**********************************************************************************************
552  template< typename T >
553  inline bool canAlias( const T* alias ) const {
554  return IsComputation<MT>::value && dm_.canAlias( alias );
555  }
556  //**********************************************************************************************
557 
558  //**********************************************************************************************
564  template< typename T >
565  inline bool isAliased( const T* alias ) const {
566  return dm_.isAliased( alias );
567  }
568  //**********************************************************************************************
569 
570  //**********************************************************************************************
575  inline bool isAligned() const {
576  return dm_.isAligned();
577  }
578  //**********************************************************************************************
579 
580  //**********************************************************************************************
585  inline bool canSMPAssign() const {
586  return dm_.canSMPAssign();
587  }
588  //**********************************************************************************************
589 
590  private:
591  //**Member variables****************************************************************************
592  Operand dm_;
593  //**********************************************************************************************
594 
595  //**Assignment to dense matrices****************************************************************
609  template< typename MT2 // Type of the target dense matrix
610  , bool SO2 > // Storage order or the target dense matrix
611  friend inline typename EnableIf< UseAssign<MT2> >::Type
612  assign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
613  {
615 
616  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
617  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
618 
619  assign( ~lhs, rhs.dm_ );
620  assign( ~lhs, abs( ~lhs ) );
621  }
623  //**********************************************************************************************
624 
625  //**Assignment to sparse matrices***************************************************************
639  template< typename MT2 // Type of the target sparse matrix
640  , bool SO2 > // Storage order or the target sparse matrix
641  friend inline typename EnableIf< UseAssign<MT2> >::Type
642  assign( SparseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
643  {
645 
647 
654 
655  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
656  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
657 
658  const TmpType tmp( serial( rhs ) );
659  assign( ~lhs, tmp );
660  }
662  //**********************************************************************************************
663 
664  //**Addition assignment to dense matrices*******************************************************
678  template< typename MT2 // Type of the target dense matrix
679  , bool SO2 > // Storage order of the target dense matrix
680  friend inline typename EnableIf< UseAssign<MT2> >::Type
681  addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
682  {
684 
688 
689  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
690  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
691 
692  const ResultType tmp( serial( rhs ) );
693  addAssign( ~lhs, tmp );
694  }
696  //**********************************************************************************************
697 
698  //**Addition assignment to sparse matrices******************************************************
699  // No special implementation for the addition assignment to sparse matrices.
700  //**********************************************************************************************
701 
702  //**Subtraction assignment to dense matrices****************************************************
716  template< typename MT2 // Type of the target dense matrix
717  , bool SO2 > // Storage order of the target dense matrix
718  friend inline typename EnableIf< UseAssign<MT2> >::Type
719  subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
720  {
722 
726 
727  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
728  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
729 
730  const ResultType tmp( serial( rhs ) );
731  subAssign( ~lhs, tmp );
732  }
734  //**********************************************************************************************
735 
736  //**Subtraction assignment to sparse matrices***************************************************
737  // No special implementation for the subtraction assignment to sparse matrices.
738  //**********************************************************************************************
739 
740  //**Multiplication assignment to dense matrices*************************************************
741  // No special implementation for the multiplication assignment to dense matrices.
742  //**********************************************************************************************
743 
744  //**Multiplication assignment to sparse matrices************************************************
745  // No special implementation for the multiplication assignment to sparse matrices.
746  //**********************************************************************************************
747 
748  //**SMP assignment to dense matrices************************************************************
762  template< typename MT2 // Type of the target dense matrix
763  , bool SO2 > // Storage order or the target dense matrix
764  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
765  smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
766  {
768 
769  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
770  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
771 
772  smpAssign( ~lhs, rhs.dm_ );
773  smpAssign( ~lhs, abs( ~lhs ) );
774  }
776  //**********************************************************************************************
777 
778  //**SMP assignment to sparse matrices***********************************************************
792  template< typename MT2 // Type of the target sparse matrix
793  , bool SO2 > // Storage order or the target sparse matrix
794  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
795  smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
796  {
798 
799  typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
800 
807 
808  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
809  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
810 
811  const TmpType tmp( rhs );
812  smpAssign( ~lhs, tmp );
813  }
815  //**********************************************************************************************
816 
817  //**SMP addition assignment to dense matrices***************************************************
831  template< typename MT2 // Type of the target dense matrix
832  , bool SO2 > // Storage order of the target dense matrix
833  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
834  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
835  {
837 
841 
842  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
843  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
844 
845  const ResultType tmp( rhs );
846  smpAddAssign( ~lhs, tmp );
847  }
849  //**********************************************************************************************
850 
851  //**SMP addition assignment to sparse matrices**************************************************
852  // No special implementation for the SMP addition assignment to sparse matrices.
853  //**********************************************************************************************
854 
855  //**SMP subtraction assignment to dense matrices************************************************
869  template< typename MT2 // Type of the target dense matrix
870  , bool SO2 > // Storage order of the target dense matrix
871  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
872  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatAbsExpr& rhs )
873  {
875 
879 
880  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
881  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
882 
883  const ResultType tmp( rhs );
884  smpSubAssign( ~lhs, tmp );
885  }
887  //**********************************************************************************************
888 
889  //**SMP subtraction assignment to sparse matrices***********************************************
890  // No special implementation for the SMP subtraction assignment to sparse matrices.
891  //**********************************************************************************************
892 
893  //**SMP multiplication assignment to dense matrices*********************************************
894  // No special implementation for the SMP multiplication assignment to dense matrices.
895  //**********************************************************************************************
896 
897  //**SMP multiplication assignment to sparse matrices********************************************
898  // No special implementation for the SMP multiplication assignment to sparse matrices.
899  //**********************************************************************************************
900 
901  //**Compile time checks*************************************************************************
906  //**********************************************************************************************
907 };
908 //*************************************************************************************************
909 
910 
911 
912 
913 //=================================================================================================
914 //
915 // GLOBAL FUNCTIONS
916 //
917 //=================================================================================================
918 
919 //*************************************************************************************************
936 template< typename MT // Type of the dense matrix
937  , bool SO > // Storage order
938 inline const DMatAbsExpr<MT,SO> abs( const DenseMatrix<MT,SO>& dm )
939 {
941 
942  return DMatAbsExpr<MT,SO>( ~dm );
943 }
944 //*************************************************************************************************
945 
946 
947 
948 
949 //=================================================================================================
950 //
951 // GLOBAL RESTRUCTURING FUNCTIONS
952 //
953 //=================================================================================================
954 
955 //*************************************************************************************************
966 template< typename MT // Type of the dense matrix
967  , bool SO > // Storage order
968 inline const DMatAbsExpr<MT,SO>& abs( const DMatAbsExpr<MT,SO>& dm )
969 {
971 
972  return dm;
973 }
975 //*************************************************************************************************
976 
977 
978 
979 
980 //=================================================================================================
981 //
982 // ROWS SPECIALIZATIONS
983 //
984 //=================================================================================================
985 
986 //*************************************************************************************************
988 template< typename MT, bool SO >
989 struct Rows< DMatAbsExpr<MT,SO> > : public Rows<MT>
990 {};
992 //*************************************************************************************************
993 
994 
995 
996 
997 //=================================================================================================
998 //
999 // COLUMNS SPECIALIZATIONS
1000 //
1001 //=================================================================================================
1002 
1003 //*************************************************************************************************
1005 template< typename MT, bool SO >
1006 struct Columns< DMatAbsExpr<MT,SO> > : public Columns<MT>
1007 {};
1009 //*************************************************************************************************
1010 
1011 
1012 
1013 
1014 //=================================================================================================
1015 //
1016 // ISALIGNED SPECIALIZATIONS
1017 //
1018 //=================================================================================================
1019 
1020 //*************************************************************************************************
1022 template< typename MT, bool SO >
1023 struct IsAligned< DMatAbsExpr<MT,SO> > : public IsTrue< IsAligned<MT>::value >
1024 {};
1026 //*************************************************************************************************
1027 
1028 
1029 
1030 
1031 //=================================================================================================
1032 //
1033 // ISPADDED SPECIALIZATIONS
1034 //
1035 //=================================================================================================
1036 
1037 //*************************************************************************************************
1039 template< typename MT, bool SO >
1040 struct IsPadded< DMatAbsExpr<MT,SO> > : public IsTrue< IsPadded<MT>::value >
1041 {};
1043 //*************************************************************************************************
1044 
1045 
1046 
1047 
1048 //=================================================================================================
1049 //
1050 // ISSYMMETRIC SPECIALIZATIONS
1051 //
1052 //=================================================================================================
1053 
1054 //*************************************************************************************************
1056 template< typename MT, bool SO >
1057 struct IsSymmetric< DMatAbsExpr<MT,SO> > : public IsTrue< IsSymmetric<MT>::value >
1058 {};
1060 //*************************************************************************************************
1061 
1062 
1063 
1064 
1065 //=================================================================================================
1066 //
1067 // ISHERMITIAN SPECIALIZATIONS
1068 //
1069 //=================================================================================================
1070 
1071 //*************************************************************************************************
1073 template< typename MT, bool SO >
1074 struct IsHermitian< DMatAbsExpr<MT,SO> > : public IsTrue< IsHermitian<MT>::value >
1075 {};
1077 //*************************************************************************************************
1078 
1079 
1080 
1081 
1082 //=================================================================================================
1083 //
1084 // ISLOWER SPECIALIZATIONS
1085 //
1086 //=================================================================================================
1087 
1088 //*************************************************************************************************
1090 template< typename MT, bool SO >
1091 struct IsLower< DMatAbsExpr<MT,SO> > : public IsTrue< IsLower<MT>::value >
1092 {};
1094 //*************************************************************************************************
1095 
1096 
1097 
1098 
1099 //=================================================================================================
1100 //
1101 // ISUNILOWER SPECIALIZATIONS
1102 //
1103 //=================================================================================================
1104 
1105 //*************************************************************************************************
1107 template< typename MT, bool SO >
1108 struct IsUniLower< DMatAbsExpr<MT,SO> > : public IsTrue< IsUniLower<MT>::value >
1109 {};
1111 //*************************************************************************************************
1112 
1113 
1114 
1115 
1116 //=================================================================================================
1117 //
1118 // ISSTRICTLYLOWER SPECIALIZATIONS
1119 //
1120 //=================================================================================================
1121 
1122 //*************************************************************************************************
1124 template< typename MT, bool SO >
1125 struct IsStrictlyLower< DMatAbsExpr<MT,SO> > : public IsTrue< IsStrictlyLower<MT>::value >
1126 {};
1128 //*************************************************************************************************
1129 
1130 
1131 
1132 
1133 //=================================================================================================
1134 //
1135 // ISUPPER SPECIALIZATIONS
1136 //
1137 //=================================================================================================
1138 
1139 //*************************************************************************************************
1141 template< typename MT, bool SO >
1142 struct IsUpper< DMatAbsExpr<MT,SO> > : public IsTrue< IsUpper<MT>::value >
1143 {};
1145 //*************************************************************************************************
1146 
1147 
1148 
1149 
1150 //=================================================================================================
1151 //
1152 // ISUNIUPPER SPECIALIZATIONS
1153 //
1154 //=================================================================================================
1155 
1156 //*************************************************************************************************
1158 template< typename MT, bool SO >
1159 struct IsUniUpper< DMatAbsExpr<MT,SO> > : public IsTrue< IsUniUpper<MT>::value >
1160 {};
1162 //*************************************************************************************************
1163 
1164 
1165 
1166 
1167 //=================================================================================================
1168 //
1169 // ISSTRICTLYUPPER SPECIALIZATIONS
1170 //
1171 //=================================================================================================
1172 
1173 //*************************************************************************************************
1175 template< typename MT, bool SO >
1176 struct IsStrictlyUpper< DMatAbsExpr<MT,SO> > : public IsTrue< IsStrictlyUpper<MT>::value >
1177 {};
1179 //*************************************************************************************************
1180 
1181 
1182 
1183 
1184 //=================================================================================================
1185 //
1186 // EXPRESSION TRAIT SPECIALIZATIONS
1187 //
1188 //=================================================================================================
1189 
1190 //*************************************************************************************************
1192 template< typename MT >
1193 struct DMatAbsExprTrait< DMatAbsExpr<MT,false> >
1194 {
1195  public:
1196  //**********************************************************************************************
1197  typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1198  , DMatAbsExpr<MT,false>
1199  , INVALID_TYPE >::Type Type;
1200  //**********************************************************************************************
1201 };
1203 //*************************************************************************************************
1204 
1205 
1206 //*************************************************************************************************
1208 template< typename MT >
1209 struct TDMatAbsExprTrait< DMatAbsExpr<MT,true> >
1210 {
1211  public:
1212  //**********************************************************************************************
1213  typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1214  , DMatAbsExpr<MT,true>
1215  , INVALID_TYPE >::Type Type;
1216  //**********************************************************************************************
1217 };
1219 //*************************************************************************************************
1220 
1221 
1222 //*************************************************************************************************
1224 template< typename MT, bool SO, bool AF >
1225 struct SubmatrixExprTrait< DMatAbsExpr<MT,SO>, AF >
1226 {
1227  public:
1228  //**********************************************************************************************
1229  typedef typename AbsExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1230  //**********************************************************************************************
1231 };
1233 //*************************************************************************************************
1234 
1235 
1236 //*************************************************************************************************
1238 template< typename MT, bool SO >
1239 struct RowExprTrait< DMatAbsExpr<MT,SO> >
1240 {
1241  public:
1242  //**********************************************************************************************
1243  typedef typename AbsExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1244  //**********************************************************************************************
1245 };
1247 //*************************************************************************************************
1248 
1249 
1250 //*************************************************************************************************
1252 template< typename MT, bool SO >
1253 struct ColumnExprTrait< DMatAbsExpr<MT,SO> >
1254 {
1255  public:
1256  //**********************************************************************************************
1257  typedef typename AbsExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
1258  //**********************************************************************************************
1259 };
1261 //*************************************************************************************************
1262 
1263 } // namespace blaze
1264 
1265 #endif
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