DMatRealExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATREALEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATREALEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <cmath>
44 #include <iterator>
51 #include <blaze/math/shims/Real.h>
79 #include <blaze/system/Inline.h>
80 #include <blaze/util/Assert.h>
83 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/Exception.h>
85 #include <blaze/util/InvalidType.h>
87 #include <blaze/util/SelectType.h>
88 #include <blaze/util/Types.h>
90 
91 
92 namespace blaze {
93 
94 //=================================================================================================
95 //
96 // CLASS DMATREALEXPR
97 //
98 //=================================================================================================
99 
100 //*************************************************************************************************
107 template< typename MT // Type of the dense matrix
108  , bool SO > // Storage order
109 class DMatRealExpr : public DenseMatrix< DMatRealExpr<MT,SO>, SO >
110  , private MatRealExpr
111  , private Computation
112 {
113  private:
114  //**Type definitions****************************************************************************
115  typedef typename MT::ResultType RT;
116  typedef typename MT::OppositeType OT;
117  typedef typename MT::ReturnType RN;
118  //**********************************************************************************************
119 
120  //**Return type evaluation**********************************************************************
122 
127  enum { returnExpr = !IsTemporary<RN>::value };
128 
131  //**********************************************************************************************
132 
133  //**Serial evaluation strategy******************************************************************
135 
141  enum { useAssign = RequiresEvaluation<MT>::value };
142 
144  template< typename MT2 >
146  struct UseAssign {
147  enum { value = useAssign };
148  };
150  //**********************************************************************************************
151 
152  //**Parallel evaluation strategy****************************************************************
154 
160  template< typename MT2 >
161  struct UseSMPAssign {
162  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
163  };
165  //**********************************************************************************************
166 
167  public:
168  //**Type definitions****************************************************************************
170  typedef typename RealTrait<RT>::Type ResultType;
174 
177 
180 
182  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type Operand;
183  //**********************************************************************************************
184 
185  //**ConstIterator class definition**************************************************************
189  {
190  public:
191  //**Type definitions*************************************************************************
192  typedef std::random_access_iterator_tag IteratorCategory;
193  typedef ElementType ValueType;
194  typedef ElementType* PointerType;
195  typedef ElementType& ReferenceType;
197 
198  // STL iterator requirements
199  typedef IteratorCategory iterator_category;
200  typedef ValueType value_type;
201  typedef PointerType pointer;
202  typedef ReferenceType reference;
203  typedef DifferenceType difference_type;
204 
206  typedef typename MT::ConstIterator IteratorType;
207  //*******************************************************************************************
208 
209  //**Constructor******************************************************************************
214  explicit inline ConstIterator( IteratorType it )
215  : it_( it ) // Iterator to the current matrix element
216  {}
217  //*******************************************************************************************
218 
219  //**Addition assignment operator*************************************************************
225  inline ConstIterator& operator+=( size_t inc ) {
226  it_ += inc;
227  return *this;
228  }
229  //*******************************************************************************************
230 
231  //**Subtraction assignment operator**********************************************************
237  inline ConstIterator& operator-=( size_t dec ) {
238  it_ -= dec;
239  return *this;
240  }
241  //*******************************************************************************************
242 
243  //**Prefix increment operator****************************************************************
249  ++it_;
250  return *this;
251  }
252  //*******************************************************************************************
253 
254  //**Postfix increment operator***************************************************************
259  inline const ConstIterator operator++( int ) {
260  return ConstIterator( it_++ );
261  }
262  //*******************************************************************************************
263 
264  //**Prefix decrement operator****************************************************************
270  --it_;
271  return *this;
272  }
273  //*******************************************************************************************
274 
275  //**Postfix decrement operator***************************************************************
280  inline const ConstIterator operator--( int ) {
281  return ConstIterator( it_-- );
282  }
283  //*******************************************************************************************
284 
285  //**Element access operator******************************************************************
290  inline ReturnType operator*() const {
291  return real( *it_ );
292  }
293  //*******************************************************************************************
294 
295  //**Equality operator************************************************************************
301  inline bool operator==( const ConstIterator& rhs ) const {
302  return it_ == rhs.it_;
303  }
304  //*******************************************************************************************
305 
306  //**Inequality operator**********************************************************************
312  inline bool operator!=( const ConstIterator& rhs ) const {
313  return it_ != rhs.it_;
314  }
315  //*******************************************************************************************
316 
317  //**Less-than operator***********************************************************************
323  inline bool operator<( const ConstIterator& rhs ) const {
324  return it_ < rhs.it_;
325  }
326  //*******************************************************************************************
327 
328  //**Greater-than operator********************************************************************
334  inline bool operator>( const ConstIterator& rhs ) const {
335  return it_ > rhs.it_;
336  }
337  //*******************************************************************************************
338 
339  //**Less-or-equal-than operator**************************************************************
345  inline bool operator<=( const ConstIterator& rhs ) const {
346  return it_ <= rhs.it_;
347  }
348  //*******************************************************************************************
349 
350  //**Greater-or-equal-than operator***********************************************************
356  inline bool operator>=( const ConstIterator& rhs ) const {
357  return it_ >= rhs.it_;
358  }
359  //*******************************************************************************************
360 
361  //**Subtraction operator*********************************************************************
367  inline DifferenceType operator-( const ConstIterator& rhs ) const {
368  return it_ - rhs.it_;
369  }
370  //*******************************************************************************************
371 
372  //**Addition operator************************************************************************
379  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
380  return ConstIterator( it.it_ + inc );
381  }
382  //*******************************************************************************************
383 
384  //**Addition operator************************************************************************
391  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
392  return ConstIterator( it.it_ + inc );
393  }
394  //*******************************************************************************************
395 
396  //**Subtraction operator*********************************************************************
403  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
404  return ConstIterator( it.it_ - dec );
405  }
406  //*******************************************************************************************
407 
408  private:
409  //**Member variables*************************************************************************
410  IteratorType it_;
411  //*******************************************************************************************
412  };
413  //**********************************************************************************************
414 
415  //**Compilation flags***************************************************************************
417  enum { vectorizable = 0 };
418 
420  enum { smpAssignable = MT::smpAssignable };
421  //**********************************************************************************************
422 
423  //**Constructor*********************************************************************************
428  explicit inline DMatRealExpr( const MT& dm )
429  : dm_( dm ) // Dense matrix of the real part expression
430  {}
431  //**********************************************************************************************
432 
433  //**Access operator*****************************************************************************
440  inline ReturnType operator()( size_t i, size_t j ) const {
441  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
442  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
443  return real( dm_(i,j) );
444  }
445  //**********************************************************************************************
446 
447  //**At function*********************************************************************************
455  inline ReturnType at( size_t i, size_t j ) const {
456  if( i >= dm_.rows() ) {
457  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
458  }
459  if( j >= dm_.columns() ) {
460  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
461  }
462  return (*this)(i,j);
463  }
464  //**********************************************************************************************
465 
466  //**Begin function******************************************************************************
472  inline ConstIterator begin( size_t i ) const {
473  return ConstIterator( dm_.begin(i) );
474  }
475  //**********************************************************************************************
476 
477  //**End function********************************************************************************
483  inline ConstIterator end( size_t i ) const {
484  return ConstIterator( dm_.end(i) );
485  }
486  //**********************************************************************************************
487 
488  //**Rows function*******************************************************************************
493  inline size_t rows() const {
494  return dm_.rows();
495  }
496  //**********************************************************************************************
497 
498  //**Columns function****************************************************************************
503  inline size_t columns() const {
504  return dm_.columns();
505  }
506  //**********************************************************************************************
507 
508  //**Operand access******************************************************************************
513  inline Operand operand() const {
514  return dm_;
515  }
516  //**********************************************************************************************
517 
518  //**********************************************************************************************
524  template< typename T >
525  inline bool canAlias( const T* alias ) const {
526  return IsComputation<MT>::value && dm_.canAlias( alias );
527  }
528  //**********************************************************************************************
529 
530  //**********************************************************************************************
536  template< typename T >
537  inline bool isAliased( const T* alias ) const {
538  return dm_.isAliased( alias );
539  }
540  //**********************************************************************************************
541 
542  //**********************************************************************************************
547  inline bool isAligned() const {
548  return dm_.isAligned();
549  }
550  //**********************************************************************************************
551 
552  //**********************************************************************************************
557  inline bool canSMPAssign() const {
558  return dm_.canSMPAssign();
559  }
560  //**********************************************************************************************
561 
562  private:
563  //**Member variables****************************************************************************
564  Operand dm_;
565  //**********************************************************************************************
566 
567  //**Assignment to dense matrices****************************************************************
581  template< typename MT2 // Type of the target dense matrix
582  , bool SO2 > // Storage order or the target dense matrix
583  friend inline typename EnableIf< UseAssign<MT2> >::Type
584  assign( DenseMatrix<MT2,SO2>& lhs, const DMatRealExpr& rhs )
585  {
587 
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  const RT tmp( serial( rhs.dm_ ) );
596  assign( ~lhs, real( tmp ) );
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 DMatRealExpr& rhs )
619  {
621 
622  typedef typename SelectType< SO == SO2, RT, OT >::Type TmpType;
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.dm_ ) );
635  assign( ~lhs, real( 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 DMatRealExpr& 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 RT tmp( serial( rhs.dm_ ) );
669  addAssign( ~lhs, real( 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 DMatRealExpr& 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 RT tmp( serial( rhs.dm_ ) );
707  subAssign( ~lhs, real( 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************************************************************
739  template< typename MT2 // Type of the target dense matrix
740  , bool SO2 > // Storage order or the target dense matrix
741  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
742  smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatRealExpr& rhs )
743  {
745 
749 
750  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
751  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
752 
753  const RT tmp( rhs.dm_ );
754  smpAssign( ~lhs, real( tmp ) );
755  }
757  //**********************************************************************************************
758 
759  //**SMP assignment to sparse matrices***********************************************************
773  template< typename MT2 // Type of the target sparse matrix
774  , bool SO2 > // Storage order or the target sparse matrix
775  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
776  smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatRealExpr& rhs )
777  {
779 
780  typedef typename SelectType< SO == SO2, RT, OT >::Type TmpType;
781 
788 
789  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
790  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
791 
792  const TmpType tmp( rhs.dm_ );
793  smpAssign( ~lhs, real( tmp ) );
794  }
796  //**********************************************************************************************
797 
798  //**SMP addition assignment to dense matrices***************************************************
812  template< typename MT2 // Type of the target dense matrix
813  , bool SO2 > // Storage order of the target dense matrix
814  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
815  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatRealExpr& rhs )
816  {
818 
822 
823  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
824  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
825 
826  const RT tmp( rhs.dm_ );
827  smpAddAssign( ~lhs, real( tmp ) );
828  }
830  //**********************************************************************************************
831 
832  //**SMP addition assignment to sparse matrices**************************************************
833  // No special implementation for the SMP addition assignment to sparse matrices.
834  //**********************************************************************************************
835 
836  //**SMP subtraction assignment to dense matrices************************************************
850  template< typename MT2 // Type of the target dense matrix
851  , bool SO2 > // Storage order of the target dense matrix
852  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
853  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatRealExpr& rhs )
854  {
856 
860 
861  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
862  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
863 
864  const RT tmp( rhs.dm_ );
865  smpSubAssign( ~lhs, real( tmp ) );
866  }
868  //**********************************************************************************************
869 
870  //**SMP subtraction assignment to sparse matrices***********************************************
871  // No special implementation for the SMP subtraction assignment to sparse matrices.
872  //**********************************************************************************************
873 
874  //**SMP multiplication assignment to dense matrices*********************************************
875  // No special implementation for the SMP multiplication assignment to dense matrices.
876  //**********************************************************************************************
877 
878  //**SMP multiplication assignment to sparse matrices********************************************
879  // No special implementation for the SMP multiplication assignment to sparse matrices.
880  //**********************************************************************************************
881 
882  //**Compile time checks*************************************************************************
886  BLAZE_CONSTRAINT_MUST_NOT_BE_BUILTIN_TYPE( typename UnderlyingNumeric<MT>::Type );
888  //**********************************************************************************************
889 };
890 //*************************************************************************************************
891 
892 
893 
894 
895 //=================================================================================================
896 //
897 // GLOBAL FUNCTIONS
898 //
899 //=================================================================================================
900 
901 //*************************************************************************************************
918 template< typename MT // Type of the dense matrix
919  , bool SO > // Storage order
920 inline const typename RealExprTrait<MT>::Type real( const DenseMatrix<MT,SO>& dm )
921 {
923 
924  return typename RealExprTrait<MT>::Type( ~dm );
925 }
926 //*************************************************************************************************
927 
928 
929 
930 
931 //=================================================================================================
932 //
933 // GLOBAL RESTRUCTURING FUNCTIONS
934 //
935 //=================================================================================================
936 
937 //*************************************************************************************************
948 template< typename MT // Type of the dense matrix
949  , bool SO > // Storage order
950 inline const DMatRealExpr<MT,SO>& real( const DMatRealExpr<MT,SO>& dm )
951 {
953 
954  return dm;
955 }
957 //*************************************************************************************************
958 
959 
960 
961 
962 //=================================================================================================
963 //
964 // ROWS SPECIALIZATIONS
965 //
966 //=================================================================================================
967 
968 //*************************************************************************************************
970 template< typename MT, bool SO >
971 struct Rows< DMatRealExpr<MT,SO> > : public Rows<MT>
972 {};
974 //*************************************************************************************************
975 
976 
977 
978 
979 //=================================================================================================
980 //
981 // COLUMNS SPECIALIZATIONS
982 //
983 //=================================================================================================
984 
985 //*************************************************************************************************
987 template< typename MT, bool SO >
988 struct Columns< DMatRealExpr<MT,SO> > : public Columns<MT>
989 {};
991 //*************************************************************************************************
992 
993 
994 
995 
996 //=================================================================================================
997 //
998 // ISALIGNED SPECIALIZATIONS
999 //
1000 //=================================================================================================
1001 
1002 //*************************************************************************************************
1004 template< typename MT, bool SO >
1005 struct IsAligned< DMatRealExpr<MT,SO> > : public IsTrue< IsAligned<MT>::value >
1006 {};
1008 //*************************************************************************************************
1009 
1010 
1011 
1012 
1013 //=================================================================================================
1014 //
1015 // ISSYMMETRIC SPECIALIZATIONS
1016 //
1017 //=================================================================================================
1018 
1019 //*************************************************************************************************
1021 template< typename MT, bool SO >
1022 struct IsSymmetric< DMatRealExpr<MT,SO> > : public IsTrue< IsSymmetric<MT>::value >
1023 {};
1025 //*************************************************************************************************
1026 
1027 
1028 
1029 
1030 //=================================================================================================
1031 //
1032 // ISHERMITIAN SPECIALIZATIONS
1033 //
1034 //=================================================================================================
1035 
1036 //*************************************************************************************************
1038 template< typename MT, bool SO >
1039 struct IsHermitian< DMatRealExpr<MT,SO> > : public IsTrue< IsHermitian<MT>::value >
1040 {};
1042 //*************************************************************************************************
1043 
1044 
1045 
1046 
1047 //=================================================================================================
1048 //
1049 // ISLOWER SPECIALIZATIONS
1050 //
1051 //=================================================================================================
1052 
1053 //*************************************************************************************************
1055 template< typename MT, bool SO >
1056 struct IsLower< DMatRealExpr<MT,SO> > : public IsTrue< IsLower<MT>::value >
1057 {};
1059 //*************************************************************************************************
1060 
1061 
1062 
1063 
1064 //=================================================================================================
1065 //
1066 // ISUNILOWER SPECIALIZATIONS
1067 //
1068 //=================================================================================================
1069 
1070 //*************************************************************************************************
1072 template< typename MT, bool SO >
1073 struct IsUniLower< DMatRealExpr<MT,SO> > : public IsTrue< IsUniLower<MT>::value >
1074 {};
1076 //*************************************************************************************************
1077 
1078 
1079 
1080 
1081 //=================================================================================================
1082 //
1083 // ISSTRICTLYLOWER SPECIALIZATIONS
1084 //
1085 //=================================================================================================
1086 
1087 //*************************************************************************************************
1089 template< typename MT, bool SO >
1090 struct IsStrictlyLower< DMatRealExpr<MT,SO> > : public IsTrue< IsStrictlyLower<MT>::value >
1091 {};
1093 //*************************************************************************************************
1094 
1095 
1096 
1097 
1098 //=================================================================================================
1099 //
1100 // ISUPPER SPECIALIZATIONS
1101 //
1102 //=================================================================================================
1103 
1104 //*************************************************************************************************
1106 template< typename MT, bool SO >
1107 struct IsUpper< DMatRealExpr<MT,SO> > : public IsTrue< IsUpper<MT>::value >
1108 {};
1110 //*************************************************************************************************
1111 
1112 
1113 
1114 
1115 //=================================================================================================
1116 //
1117 // ISUNIUPPER SPECIALIZATIONS
1118 //
1119 //=================================================================================================
1120 
1121 //*************************************************************************************************
1123 template< typename MT, bool SO >
1124 struct IsUniUpper< DMatRealExpr<MT,SO> > : public IsTrue< IsUniUpper<MT>::value >
1125 {};
1127 //*************************************************************************************************
1128 
1129 
1130 
1131 
1132 //=================================================================================================
1133 //
1134 // ISSTRICTLYUPPER SPECIALIZATIONS
1135 //
1136 //=================================================================================================
1137 
1138 //*************************************************************************************************
1140 template< typename MT, bool SO >
1141 struct IsStrictlyUpper< DMatRealExpr<MT,SO> > : public IsTrue< IsStrictlyUpper<MT>::value >
1142 {};
1144 //*************************************************************************************************
1145 
1146 
1147 
1148 
1149 //=================================================================================================
1150 //
1151 // EXPRESSION TRAIT SPECIALIZATIONS
1152 //
1153 //=================================================================================================
1154 
1155 //*************************************************************************************************
1157 template< typename MT >
1158 struct DMatRealExprTrait< DMatRealExpr<MT,false> >
1159 {
1160  public:
1161  //**********************************************************************************************
1162  typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1163  , DMatRealExpr<MT,false>
1164  , INVALID_TYPE >::Type Type;
1165  //**********************************************************************************************
1166 };
1168 //*************************************************************************************************
1169 
1170 
1171 //*************************************************************************************************
1173 template< typename MT >
1174 struct TDMatRealExprTrait< DMatRealExpr<MT,true> >
1175 {
1176  public:
1177  //**********************************************************************************************
1178  typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1179  , DMatRealExpr<MT,true>
1180  , INVALID_TYPE >::Type Type;
1181  //**********************************************************************************************
1182 };
1184 //*************************************************************************************************
1185 
1186 
1187 //*************************************************************************************************
1189 template< typename MT, bool SO, bool AF >
1190 struct SubmatrixExprTrait< DMatRealExpr<MT,SO>, AF >
1191 {
1192  public:
1193  //**********************************************************************************************
1194  typedef typename RealExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1195  //**********************************************************************************************
1196 };
1198 //*************************************************************************************************
1199 
1200 
1201 //*************************************************************************************************
1203 template< typename MT, bool SO >
1204 struct RowExprTrait< DMatRealExpr<MT,SO> >
1205 {
1206  public:
1207  //**********************************************************************************************
1208  typedef typename RealExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1209  //**********************************************************************************************
1210 };
1212 //*************************************************************************************************
1213 
1214 
1215 //*************************************************************************************************
1217 template< typename MT, bool SO >
1218 struct ColumnExprTrait< DMatRealExpr<MT,SO> >
1219 {
1220  public:
1221  //**********************************************************************************************
1222  typedef typename RealExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
1223  //**********************************************************************************************
1224 };
1226 //*************************************************************************************************
1227 
1228 } // namespace blaze
1229 
1230 #endif
RealExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DMatRealExpr.h:130
Header file for the UnderlyingNumeric type trait.
Pointer difference type of the Blaze library.
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
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatRealExpr.h:455
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
ElementType & ReferenceType
Reference return type.
Definition: DMatRealExpr.h:195
Header file for basic type definitions.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatRealExpr.h:440
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatRealExpr.h:172
#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
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
#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
PointerType pointer
Pointer return type.
Definition: DMatRealExpr.h:201
MT::OppositeType OT
Opposite type of the dense matrix expression.
Definition: DMatRealExpr.h:116
Header file for the ColumnExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatRealExpr.h:472
Header file for the RealExprTrait class template.
Header file for the MatRealExpr base class.
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
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
DMatRealExpr< MT, SO > This
Type of this DMatRealExpr instance.
Definition: DMatRealExpr.h:169
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
Constraint on the data type.
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatRealExpr.h:248
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatRealExpr.h:323
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
ValueType value_type
Type of the underlying elements.
Definition: DMatRealExpr.h:200
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatRealExpr.h:334
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatRealExpr.h:192
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
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatRealExpr.h:280
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatRealExpr.h:345
#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
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
DMatRealExpr(const MT &dm)
Constructor for the DMatRealExpr class.
Definition: DMatRealExpr.h:428
const RealExprTrait< MT >::Type real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatRealExpr.h:920
ReferenceType reference
Reference return type.
Definition: DMatRealExpr.h:202
Base class for all matrix real part expression templates.The MatRealExpr class serves as a tag for al...
Definition: MatRealExpr.h:65
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatRealExpr.h:403
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
Header file for the real trait.
#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
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: DMatRealExpr.h:214
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatRealExpr.h:367
Constraints on the storage order of matrix types.
Header file for the real shim.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatRealExpr.h:356
IteratorType it_
Iterator to the current matrix element.
Definition: DMatRealExpr.h:410
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatRealExpr.h:557
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Operand dm_
Dense matrix of the real part expression.
Definition: DMatRealExpr.h:564
Header file for the DMatRealExprTrait class template.
Header file for the serial shim.
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatRealExpr.h:269
Header file for the TDMatRealExprTrait class template.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatRealExpr.h:503
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
MT::ResultType RT
Result type of the dense matrix expression.
Definition: DMatRealExpr.h:115
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
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
Utility type for generic codes.
Expression object for the dense matrix real() function.The DMatRealExpr class represents the compile ...
Definition: DMatRealExpr.h:109
Base template for the RealTrait class.The RealTrait class template offers the possibility to select t...
Definition: RealTrait.h:78
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatRealExpr.h:301
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatRealExpr.h:312
ResultType::ElementType ElementType
Resulting element type.
Definition: DMatRealExpr.h:173
MT::ReturnType RN
Return type of the dense matrix expression.
Definition: DMatRealExpr.h:117
#define BLAZE_CONSTRAINT_MUST_NOT_BE_BUILTIN_TYPE(T)
Constraint on the data type.In case the given data type T is a built-in data type, a compilation error is created.
Definition: Builtin.h:116
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatRealExpr.h:391
ElementType ValueType
Type of the underlying elements.
Definition: DMatRealExpr.h:193
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatRealExpr.h:290
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatRealExpr.h:196
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatRealExpr.h:525
RealTrait< RT >::Type ResultType
Result type for expression template evaluations.
Definition: DMatRealExpr.h:170
ElementType * PointerType
Pointer return type.
Definition: DMatRealExpr.h:194
#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.
IteratorCategory iterator_category
The iterator category.
Definition: DMatRealExpr.h:199
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DMatRealExpr.h:182
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatRealExpr.h:379
Operand operand() const
Returns the dense matrix operand.
Definition: DMatRealExpr.h:513
Header file for the IsRowMajorMatrix type trait.
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatRealExpr.h:171
Header file for the IsComputation type trait class.
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatRealExpr.h:259
Evaluation of the return type of a real part expression.Via this type trait it is possible to evaluat...
Definition: RealExprTrait.h:88
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
MT::ConstIterator IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatRealExpr.h:206
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatRealExpr.h:237
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DMatRealExpr.h:176
#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.
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatRealExpr.h:547
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatRealExpr.h:493
Header file for the IsUpper type trait.
Header file for exception macros.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatRealExpr.h:483
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatRealExpr.h:537
Iterator over the elements of the dense matrix.
Definition: DMatRealExpr.h:188
Header file for the IsHermitian type trait.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatRealExpr.h:225
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
Constraint on the data type.
SelectType< useAssign, const ResultType, const DMatRealExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatRealExpr.h:179
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
DifferenceType difference_type
Difference between two iterators.
Definition: DMatRealExpr.h:203