DMatTransExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATTRANSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATTRANSEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
47 #include <blaze/math/Exception.h>
78 #include <blaze/system/Inline.h>
79 #include <blaze/util/Assert.h>
81 #include <blaze/util/EmptyType.h>
82 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/InvalidType.h>
86 #include <blaze/util/mpl/And.h>
87 #include <blaze/util/mpl/If.h>
88 #include <blaze/util/Types.h>
89 
90 
91 namespace blaze {
92 
93 //=================================================================================================
94 //
95 // CLASS DMATTRANSEXPR
96 //
97 //=================================================================================================
98 
99 //*************************************************************************************************
106 template< typename MT // Type of the dense matrix
107  , bool SO > // Storage order
108 class DMatTransExpr : public DenseMatrix< DMatTransExpr<MT,SO>, SO >
109  , private MatTransExpr
110  , private If< IsComputation<MT>, Computation, EmptyType >::Type
111 {
112  private:
113  //**Type definitions****************************************************************************
114  typedef ResultType_<MT> RT;
116  //**********************************************************************************************
117 
118  //**Serial evaluation strategy******************************************************************
120 
126  enum : bool { useAssign = RequiresEvaluation<MT>::value };
127 
129  template< typename MT2 >
131  struct UseAssign {
132  enum : bool { value = useAssign };
133  };
135  //**********************************************************************************************
136 
137  //**Parallel evaluation strategy****************************************************************
139 
144  template< typename MT2 >
145  struct UseSMPAssign {
146  enum : bool { value = MT2::smpAssignable && useAssign };
147  };
149  //**********************************************************************************************
150 
151  public:
152  //**Type definitions****************************************************************************
159 
162 
164  typedef If_< IsExpression<MT>, const MT, const MT& > Operand;
165  //**********************************************************************************************
166 
167  //**ConstIterator class definition**************************************************************
171  {
172  public:
173  //**Type definitions*************************************************************************
174  typedef std::random_access_iterator_tag IteratorCategory;
175  typedef ElementType ValueType;
176  typedef ElementType* PointerType;
177  typedef ElementType& ReferenceType;
179 
180  // STL iterator requirements
181  typedef IteratorCategory iterator_category;
182  typedef ValueType value_type;
183  typedef PointerType pointer;
184  typedef ReferenceType reference;
185  typedef DifferenceType difference_type;
186 
189  //*******************************************************************************************
190 
191  //**Constructor******************************************************************************
196  explicit inline ConstIterator( IteratorType iterator )
197  : iterator_( iterator ) // Iterator to the current element
198  {}
199  //*******************************************************************************************
200 
201  //**Addition assignment operator*************************************************************
207  inline ConstIterator& operator+=( size_t inc ) {
208  iterator_ += inc;
209  return *this;
210  }
211  //*******************************************************************************************
212 
213  //**Subtraction assignment operator**********************************************************
219  inline ConstIterator& operator-=( size_t dec ) {
220  iterator_ -= dec;
221  return *this;
222  }
223  //*******************************************************************************************
224 
225  //**Prefix increment operator****************************************************************
231  ++iterator_;
232  return *this;
233  }
234  //*******************************************************************************************
235 
236  //**Postfix increment operator***************************************************************
241  inline const ConstIterator operator++( int ) {
242  return ConstIterator( iterator_++ );
243  }
244  //*******************************************************************************************
245 
246  //**Prefix decrement operator****************************************************************
252  --iterator_;
253  return *this;
254  }
255  //*******************************************************************************************
256 
257  //**Postfix decrement operator***************************************************************
262  inline const ConstIterator operator--( int ) {
263  return ConstIterator( iterator_-- );
264  }
265  //*******************************************************************************************
266 
267  //**Element access operator******************************************************************
272  inline ReturnType operator*() const {
273  return *iterator_;
274  }
275  //*******************************************************************************************
276 
277  //**Load function****************************************************************************
282  inline auto load() const noexcept {
283  return iterator_.load();
284  }
285  //*******************************************************************************************
286 
287  //**Equality operator************************************************************************
293  inline bool operator==( const ConstIterator& rhs ) const {
294  return iterator_ == rhs.iterator_;
295  }
296  //*******************************************************************************************
297 
298  //**Inequality operator**********************************************************************
304  inline bool operator!=( const ConstIterator& rhs ) const {
305  return iterator_ != rhs.iterator_;
306  }
307  //*******************************************************************************************
308 
309  //**Less-than operator***********************************************************************
315  inline bool operator<( const ConstIterator& rhs ) const {
316  return iterator_ < rhs.iterator_;
317  }
318  //*******************************************************************************************
319 
320  //**Greater-than operator********************************************************************
326  inline bool operator>( const ConstIterator& rhs ) const {
327  return iterator_ > rhs.iterator_;
328  }
329  //*******************************************************************************************
330 
331  //**Less-or-equal-than operator**************************************************************
337  inline bool operator<=( const ConstIterator& rhs ) const {
338  return iterator_ <= rhs.iterator_;
339  }
340  //*******************************************************************************************
341 
342  //**Greater-or-equal-than operator***********************************************************
348  inline bool operator>=( const ConstIterator& rhs ) const {
349  return iterator_ >= rhs.iterator_;
350  }
351  //*******************************************************************************************
352 
353  //**Subtraction operator*********************************************************************
359  inline DifferenceType operator-( const ConstIterator& rhs ) const {
360  return iterator_ - rhs.iterator_;
361  }
362  //*******************************************************************************************
363 
364  //**Addition operator************************************************************************
371  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
372  return ConstIterator( it.iterator_ + inc );
373  }
374  //*******************************************************************************************
375 
376  //**Addition operator************************************************************************
383  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
384  return ConstIterator( it.iterator_ + inc );
385  }
386  //*******************************************************************************************
387 
388  //**Subtraction operator*********************************************************************
395  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
396  return ConstIterator( it.iterator_ - dec );
397  }
398  //*******************************************************************************************
399 
400  private:
401  //**Member variables*************************************************************************
402  IteratorType iterator_;
403  //*******************************************************************************************
404  };
405  //**********************************************************************************************
406 
407  //**Compilation flags***************************************************************************
409  enum : bool { simdEnabled = MT::simdEnabled };
410 
412  enum : bool { smpAssignable = MT::smpAssignable };
413  //**********************************************************************************************
414 
415  //**SIMD properties*****************************************************************************
417  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
418  //**********************************************************************************************
419 
420  //**Constructor*********************************************************************************
425  explicit inline DMatTransExpr( const MT& dm ) noexcept
426  : dm_( dm ) // Dense matrix of the transposition expression
427  {}
428  //**********************************************************************************************
429 
430  //**Access operator*****************************************************************************
437  inline ReturnType operator()( size_t i, size_t j ) const {
438  BLAZE_INTERNAL_ASSERT( i < dm_.columns(), "Invalid row access index" );
439  BLAZE_INTERNAL_ASSERT( j < dm_.rows() , "Invalid column access index" );
440  return dm_(j,i);
441  }
442  //**********************************************************************************************
443 
444  //**At function*********************************************************************************
452  inline ReturnType at( size_t i, size_t j ) const {
453  if( i >= dm_.columns() ) {
454  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
455  }
456  if( j >= dm_.rows() ) {
457  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
458  }
459  return (*this)(i,j);
460  }
461  //**********************************************************************************************
462 
463  //**Load function*******************************************************************************
470  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
471  BLAZE_INTERNAL_ASSERT( i < dm_.columns(), "Invalid row access index" );
472  BLAZE_INTERNAL_ASSERT( j < dm_.rows() , "Invalid column access index" );
473  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
474  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
475  return dm_.load(j,i);
476  }
477  //**********************************************************************************************
478 
479  //**Low-level data access***********************************************************************
484  inline const ElementType* data() const noexcept {
485  return dm_.data();
486  }
487  //**********************************************************************************************
488 
489  //**Begin function******************************************************************************
495  inline ConstIterator begin( size_t i ) const {
496  return ConstIterator( dm_.begin(i) );
497  }
498  //**********************************************************************************************
499 
500  //**End function********************************************************************************
506  inline ConstIterator end( size_t i ) const {
507  return ConstIterator( dm_.end(i) );
508  }
509  //**********************************************************************************************
510 
511  //**Rows function*******************************************************************************
516  inline size_t rows() const noexcept {
517  return dm_.columns();
518  }
519  //**********************************************************************************************
520 
521  //**Columns function****************************************************************************
526  inline size_t columns() const noexcept {
527  return dm_.rows();
528  }
529  //**********************************************************************************************
530 
531  //**Spacing function****************************************************************************
536  inline size_t spacing() const noexcept {
537  return dm_.spacing();
538  }
539  //**********************************************************************************************
540 
541  //**NonZeros function***************************************************************************
546  inline size_t nonZeros() const {
547  return dm_.nonZeros();
548  }
549  //**********************************************************************************************
550 
551  //**NonZeros function***************************************************************************
557  inline size_t nonZeros( size_t i ) const {
558  return dm_.nonZeros( i );
559  }
560  //**********************************************************************************************
561 
562  //**Operand access******************************************************************************
567  inline Operand operand() const noexcept {
568  return dm_;
569  }
570  //**********************************************************************************************
571 
572  //**********************************************************************************************
578  template< typename T >
579  inline bool canAlias( const T* alias ) const noexcept {
580  return dm_.isAliased( alias );
581  }
582  //**********************************************************************************************
583 
584  //**********************************************************************************************
590  template< typename T >
591  inline bool isAliased( const T* alias ) const noexcept {
592  return dm_.isAliased( alias );
593  }
594  //**********************************************************************************************
595 
596  //**********************************************************************************************
601  inline bool isAligned() const noexcept {
602  return dm_.isAligned();
603  }
604  //**********************************************************************************************
605 
606  //**********************************************************************************************
611  inline bool canSMPAssign() const noexcept {
612  return dm_.canSMPAssign();
613  }
614  //**********************************************************************************************
615 
616  private:
617  //**Member variables****************************************************************************
618  Operand dm_;
619  //**********************************************************************************************
620 
621  //**Assignment to dense matrices****************************************************************
635  template< typename MT2 // Type of the target dense matrix
636  , bool SO2 > // Storage order of the target dense matrix
637  friend inline EnableIf_< UseAssign<MT2> >
638  assign( DenseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
639  {
641 
642  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
643  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
644 
645  DMatTransposer<MT2,!SO2> tmp( ~lhs );
646  assign( tmp, rhs.dm_ );
647  }
649  //**********************************************************************************************
650 
651  //**Assignment to sparse matrices***************************************************************
665  template< typename MT2 // Type of the target sparse matrix
666  , bool SO2 > // Storage order of the target sparse matrix
667  friend inline EnableIf_< UseAssign<MT2> >
668  assign( SparseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
669  {
671 
673 
680 
681  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
682  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
683 
684  const TmpType tmp( serial( rhs ) );
685  assign( ~lhs, tmp );
686  }
688  //**********************************************************************************************
689 
690  //**Addition assignment to dense matrices*******************************************************
704  template< typename MT2 // Type of the target dense matrix
705  , bool SO2 > // Storage order of the target dense matrix
706  friend inline EnableIf_< UseAssign<MT2> >
707  addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
708  {
710 
711  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
712  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
713 
714  DMatTransposer<MT2,!SO2> tmp( ~lhs );
715  addAssign( tmp, rhs.dm_ );
716  }
718  //**********************************************************************************************
719 
720  //**Addition assignment to sparse matrices******************************************************
721  // No special implementation for the addition assignment to sparse matrices.
722  //**********************************************************************************************
723 
724  //**Subtraction assignment to dense matrices****************************************************
738  template< typename MT2 // Type of the target dense matrix
739  , bool SO2 > // Storage order of the target dense matrix
740  friend inline EnableIf_< UseAssign<MT2> >
741  subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
742  {
744 
745  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
746  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
747 
748  DMatTransposer<MT2,!SO2> tmp( ~lhs );
749  subAssign( tmp, rhs.dm_ );
750  }
752  //**********************************************************************************************
753 
754  //**Subtraction assignment to sparse matrices***************************************************
755  // No special implementation for the subtraction assignment to sparse matrices.
756  //**********************************************************************************************
757 
758  //**Multiplication assignment to dense matrices*************************************************
759  // No special implementation for the multiplication assignment to dense matrices.
760  //**********************************************************************************************
761 
762  //**Multiplication assignment to sparse matrices************************************************
763  // No special implementation for the multiplication assignment to sparse matrices.
764  //**********************************************************************************************
765 
766  //**SMP assignment to dense matrices************************************************************
780  template< typename MT2 // Type of the target dense matrix
781  , bool SO2 > // Storage order of the target dense matrix
782  friend inline EnableIf_< UseSMPAssign<MT2> >
783  smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
784  {
786 
787  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
788  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
789 
790  DMatTransposer<MT2,!SO2> tmp( ~lhs );
791  smpAssign( tmp, rhs.dm_ );
792  }
794  //**********************************************************************************************
795 
796  //**SMP assignment to sparse matrices***********************************************************
810  template< typename MT2 // Type of the target sparse matrix
811  , bool SO2 > // Storage order of the target sparse matrix
812  friend inline EnableIf_< UseSMPAssign<MT2> >
813  smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
814  {
816 
817  typedef IfTrue_< SO == SO2, ResultType, OppositeType > TmpType;
818 
824  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<TmpType> );
825 
826  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
827  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
828 
829  const TmpType tmp( rhs );
830  smpAssign( ~lhs, tmp );
831  }
833  //**********************************************************************************************
834 
835  //**SMP addition assignment to dense matrices***************************************************
849  template< typename MT2 // Type of the target dense matrix
850  , bool SO2 > // Storage order of the target dense matrix
851  friend inline EnableIf_< UseSMPAssign<MT2> >
852  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
853  {
855 
856  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
857  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
858 
859  DMatTransposer<MT2,!SO2> tmp( ~lhs );
860  smpAddAssign( tmp, rhs.dm_ );
861  }
863  //**********************************************************************************************
864 
865  //**SMP addition assignment to sparse matrices**************************************************
866  // No special implementation for the SMP addition assignment to sparse matrices.
867  //**********************************************************************************************
868 
869  //**SMP subtraction assignment to dense matrices************************************************
883  template< typename MT2 // Type of the target dense matrix
884  , bool SO2 > // Storage order of the target dense matrix
885  friend inline EnableIf_< UseSMPAssign<MT2> >
886  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatTransExpr& rhs )
887  {
889 
890  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
891  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
892 
893  DMatTransposer<MT2,!SO2> tmp( ~lhs );
894  smpSubAssign( tmp, rhs.dm_ );
895  }
897  //**********************************************************************************************
898 
899  //**SMP subtraction assignment to sparse matrices***********************************************
900  // No special implementation for the SMP subtraction assignment to sparse matrices.
901  //**********************************************************************************************
902 
903  //**SMP multiplication assignment to dense matrices*********************************************
904  // No special implementation for the SMP multiplication assignment to dense matrices.
905  //**********************************************************************************************
906 
907  //**SMP multiplication assignment to sparse matrices********************************************
908  // No special implementation for the SMP multiplication assignment to sparse matrices.
909  //**********************************************************************************************
910 
911  //**Compile time checks*************************************************************************
916  //**********************************************************************************************
917 };
918 //*************************************************************************************************
919 
920 
921 
922 
923 //=================================================================================================
924 //
925 // GLOBAL OPERATORS
926 //
927 //=================================================================================================
928 
929 //*************************************************************************************************
948 template< typename MT // Type of the dense matrix
949  , bool SO > // Storage order
951 {
953 
954  return DMatTransExpr<MT,!SO>( ~dm );
955 }
956 //*************************************************************************************************
957 
958 
959 
960 
961 //=================================================================================================
962 //
963 // GLOBAL RESTRUCTURING FUNCTIONS
964 //
965 //=================================================================================================
966 
967 //*************************************************************************************************
987 template< typename MT // Type of the dense matrix
988  , bool SO > // Storage order
989 inline typename DMatTransExpr<MT,SO>::Operand trans( const DMatTransExpr<MT,SO>& dm )
990 {
992 
993  return dm.operand();
994 }
996 //*************************************************************************************************
997 
998 
999 
1000 
1001 //=================================================================================================
1002 //
1003 // ROWS SPECIALIZATIONS
1004 //
1005 //=================================================================================================
1006 
1007 //*************************************************************************************************
1009 template< typename MT, bool SO >
1010 struct Rows< DMatTransExpr<MT,SO> > : public Columns<MT>
1011 {};
1013 //*************************************************************************************************
1014 
1015 
1016 
1017 
1018 //=================================================================================================
1019 //
1020 // COLUMNS SPECIALIZATIONS
1021 //
1022 //=================================================================================================
1023 
1024 //*************************************************************************************************
1026 template< typename MT, bool SO >
1027 struct Columns< DMatTransExpr<MT,SO> > : public Rows<MT>
1028 {};
1030 //*************************************************************************************************
1031 
1032 
1033 
1034 
1035 //=================================================================================================
1036 //
1037 // ISALIGNED SPECIALIZATIONS
1038 //
1039 //=================================================================================================
1040 
1041 //*************************************************************************************************
1043 template< typename MT, bool SO >
1044 struct IsAligned< DMatTransExpr<MT,SO> >
1045  : public BoolConstant< IsAligned<MT>::value >
1046 {};
1048 //*************************************************************************************************
1049 
1050 
1051 
1052 
1053 //=================================================================================================
1054 //
1055 // ISPADDED SPECIALIZATIONS
1056 //
1057 //=================================================================================================
1058 
1059 //*************************************************************************************************
1061 template< typename MT, bool SO >
1062 struct IsPadded< DMatTransExpr<MT,SO> >
1063  : public BoolConstant< IsPadded<MT>::value >
1064 {};
1066 //*************************************************************************************************
1067 
1068 
1069 
1070 
1071 //=================================================================================================
1072 //
1073 // ISSYMMETRIC SPECIALIZATIONS
1074 //
1075 //=================================================================================================
1076 
1077 //*************************************************************************************************
1079 template< typename MT, bool SO >
1080 struct IsSymmetric< DMatTransExpr<MT,SO> >
1081  : public BoolConstant< IsSymmetric<MT>::value >
1082 {};
1084 //*************************************************************************************************
1085 
1086 
1087 
1088 
1089 //=================================================================================================
1090 //
1091 // ISHERMITIAN SPECIALIZATIONS
1092 //
1093 //=================================================================================================
1094 
1095 //*************************************************************************************************
1097 template< typename MT, bool SO >
1098 struct IsHermitian< DMatTransExpr<MT,SO> >
1099  : public BoolConstant< IsHermitian<MT>::value >
1100 {};
1102 //*************************************************************************************************
1103 
1104 
1105 
1106 
1107 //=================================================================================================
1108 //
1109 // ISLOWER SPECIALIZATIONS
1110 //
1111 //=================================================================================================
1112 
1113 //*************************************************************************************************
1115 template< typename MT, bool SO >
1116 struct IsLower< DMatTransExpr<MT,SO> >
1117  : public BoolConstant< IsUpper<MT>::value >
1118 {};
1120 //*************************************************************************************************
1121 
1122 
1123 
1124 
1125 //=================================================================================================
1126 //
1127 // ISUNILOWER SPECIALIZATIONS
1128 //
1129 //=================================================================================================
1130 
1131 //*************************************************************************************************
1133 template< typename MT, bool SO >
1134 struct IsUniLower< DMatTransExpr<MT,SO> >
1135  : public BoolConstant< IsUniUpper<MT>::value >
1136 {};
1138 //*************************************************************************************************
1139 
1140 
1141 
1142 
1143 //=================================================================================================
1144 //
1145 // ISSTRICTLYLOWER SPECIALIZATIONS
1146 //
1147 //=================================================================================================
1148 
1149 //*************************************************************************************************
1151 template< typename MT, bool SO >
1152 struct IsStrictlyLower< DMatTransExpr<MT,SO> >
1153  : public BoolConstant< IsStrictlyUpper<MT>::value >
1154 {};
1156 //*************************************************************************************************
1157 
1158 
1159 
1160 
1161 //=================================================================================================
1162 //
1163 // ISUPPER SPECIALIZATIONS
1164 //
1165 //=================================================================================================
1166 
1167 //*************************************************************************************************
1169 template< typename MT, bool SO >
1170 struct IsUpper< DMatTransExpr<MT,SO> >
1171  : public BoolConstant< IsLower<MT>::value >
1172 {};
1174 //*************************************************************************************************
1175 
1176 
1177 
1178 
1179 //=================================================================================================
1180 //
1181 // ISUNIUPPER SPECIALIZATIONS
1182 //
1183 //=================================================================================================
1184 
1185 //*************************************************************************************************
1187 template< typename MT, bool SO >
1188 struct IsUniUpper< DMatTransExpr<MT,SO> >
1189  : public BoolConstant< IsUniLower<MT>::value >
1190 {};
1192 //*************************************************************************************************
1193 
1194 
1195 
1196 
1197 //=================================================================================================
1198 //
1199 // ISSTRICTLYUPPER SPECIALIZATIONS
1200 //
1201 //=================================================================================================
1202 
1203 //*************************************************************************************************
1205 template< typename MT, bool SO >
1206 struct IsStrictlyUpper< DMatTransExpr<MT,SO> >
1207  : public BoolConstant< IsStrictlyLower<MT>::value >
1208 {};
1210 //*************************************************************************************************
1211 
1212 
1213 
1214 
1215 //=================================================================================================
1216 //
1217 // EXPRESSION TRAIT SPECIALIZATIONS
1218 //
1219 //=================================================================================================
1220 
1221 //*************************************************************************************************
1223 template< typename MT >
1224 struct DMatTransExprTrait< DMatTransExpr<MT,false> >
1225 {
1226  public:
1227  //**********************************************************************************************
1228  using Type = If_< And< IsDenseMatrix<MT>, IsColumnMajorMatrix<MT> >
1229  , Operand_< DMatTransExpr<MT,false> >
1230  , INVALID_TYPE >;
1231  //**********************************************************************************************
1232 };
1234 //*************************************************************************************************
1235 
1236 
1237 //*************************************************************************************************
1239 template< typename MT >
1240 struct TDMatTransExprTrait< DMatTransExpr<MT,true> >
1241 {
1242  public:
1243  //**********************************************************************************************
1244  using Type = If_< And< IsDenseMatrix<MT>, IsRowMajorMatrix<MT> >
1245  , Operand_< DMatTransExpr<MT,true> >
1246  , INVALID_TYPE >;
1247  //**********************************************************************************************
1248 };
1250 //*************************************************************************************************
1251 
1252 
1253 //*************************************************************************************************
1255 template< typename MT, bool SO, bool AF >
1256 struct SubmatrixExprTrait< DMatTransExpr<MT,SO>, AF >
1257 {
1258  public:
1259  //**********************************************************************************************
1260  using Type = TransExprTrait_< SubmatrixExprTrait_<const MT,AF> >;
1261  //**********************************************************************************************
1262 };
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1269 template< typename MT, bool SO >
1270 struct RowExprTrait< DMatTransExpr<MT,SO> >
1271 {
1272  public:
1273  //**********************************************************************************************
1274  using Type = TransExprTrait_< ColumnExprTrait_<const MT> >;
1275  //**********************************************************************************************
1276 };
1278 //*************************************************************************************************
1279 
1280 
1281 //*************************************************************************************************
1283 template< typename MT, bool SO >
1284 struct ColumnExprTrait< DMatTransExpr<MT,SO> >
1285 {
1286  public:
1287  //**********************************************************************************************
1288  using Type = TransExprTrait_< RowExprTrait_<const MT> >;
1289  //**********************************************************************************************
1290 };
1292 //*************************************************************************************************
1293 
1294 } // namespace blaze
1295 
1296 #endif
Pointer difference type of the Blaze library.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatTransExpr.h:219
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatTransExpr.h:567
Header file for auxiliary alias declarations.
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatTransExpr.h:230
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:132
IteratorCategory iterator_category
The iterator category.
Definition: DMatTransExpr.h:181
Header file for basic type definitions.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatTransExpr.h:207
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatTransExpr.h:611
EnableIf_< IsDenseMatrix< MT1 > > 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 serial shim.
Expression object for dense matrix transpositions.The DMatTransExpr class represents the compile time...
Definition: DMatTransExpr.h:108
#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:63
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatTransExpr.h:579
Header file for the MatTransExpr base class.
#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:61
Header file for the ColumnExprTrait class template.
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatTransExpr.h:383
Header file for the IsColumnMajorMatrix type trait.
Header file for the And class template.
ResultType_< MT > TransposeType
Transpose type for expression template evaluations.
Definition: DMatTransExpr.h:156
If_< IsExpression< MT >, const MT, const MT & > Operand
Composite data type of the dense matrix expression.
Definition: DMatTransExpr.h:164
TransposeType_< MT > ResultType
Result type for expression template evaluations.
Definition: DMatTransExpr.h:154
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
Header file for the Computation base class.
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: DMatTransExpr.h:158
Header file for the RequiresEvaluation type trait.
Operand dm_
Dense matrix of the transposition expression.
Definition: DMatTransExpr.h:618
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > 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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatTransExpr.h:591
ReferenceType reference
Reference return type.
Definition: DMatTransExpr.h:184
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatTransExpr.h:495
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:109
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatTransExpr.h:262
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatTransExpr.h:452
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
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:72
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Header file for the DMatTransExprTrait class template.
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatTransExpr.h:371
ValueType value_type
Type of the underlying elements.
Definition: DMatTransExpr.h:182
ConstIterator(IteratorType iterator)
Constructor for the ConstIterator class.
Definition: DMatTransExpr.h:196
ResultType_< MT > RT
Result type of the dense matrix expression.
Definition: DMatTransExpr.h:114
PointerType pointer
Pointer return type.
Definition: DMatTransExpr.h:183
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
Header file for the If class template.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatTransExpr.h:178
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatTransExpr.h:304
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
IfTrue_< useAssign, const ResultType, const DMatTransExpr & > CompositeType
Data type for composite expression templates.
Definition: DMatTransExpr.h:161
EnableIf_< IsDenseMatrix< MT1 > > 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
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
IteratorType iterator_
Iterator to the current element.
Definition: DMatTransExpr.h:402
ElementType_< MT > ElementType
Resulting element type.
Definition: DMatTransExpr.h:157
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Expression object for the transposition of a dense matrix.The DMatTransposer class is a wrapper objec...
Definition: DMatTransposer.h:80
Header file for the TDMatTransExprTrait class template.
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatTransExpr.h:470
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatTransExpr.h:251
#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:60
DifferenceType difference_type
Difference between two iterators.
Definition: DMatTransExpr.h:185
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatTransExpr.h:348
Header file for the IsDenseMatrix type trait.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatTransExpr.h:526
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the IsPadded type trait.
CompositeType_< MT > CT
Composite type of the dense matrix expression.
Definition: DMatTransExpr.h:115
ElementType * PointerType
Pointer return type.
Definition: DMatTransExpr.h:176
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatTransExpr.h:359
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatTransExpr.h:395
const ElementType * data() const noexcept
Low-level data access to the matrix elements.
Definition: DMatTransExpr.h:484
Header file for the dense matrix transposer.
DMatTransExpr(const MT &dm) noexcept
Constructor for the DMatTransExpr class.
Definition: DMatTransExpr.h:425
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatTransExpr.h:601
Header file for the SubmatrixExprTrait class template.
Header file for run time assertion macros.
ElementType ValueType
Type of the underlying elements.
Definition: DMatTransExpr.h:175
Utility type for generic codes.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatTransExpr.h:293
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
ConstIterator_< MT > IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatTransExpr.h:188
Header file for the TransExprTrait class template.
Base class for all matrix transposition expression templates.The MatTransExpr class serves as a tag f...
Definition: MatTransExpr.h:65
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatTransExpr.h:437
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatTransExpr.h:506
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatTransExpr.h:241
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
#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:84
size_t spacing() const noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DMatTransExpr.h:536
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
ElementType & ReferenceType
Reference return type.
Definition: DMatTransExpr.h:177
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatTransExpr.h:282
Iterator over the elements of the dense matrix.
Definition: DMatTransExpr.h:170
Header file for the IsRowMajorMatrix type trait.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatTransExpr.h:272
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
Header file for the IsComputation type trait class.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatTransExpr.h:174
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatTransExpr.h:337
#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
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatTransExpr.h:155
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatTransExpr.h:516
Header file for the IntegralConstant class template.
size_t nonZeros() const
Returns the number of non-zero elements in the dense matrix.
Definition: DMatTransExpr.h:546
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsUpper type trait.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row/column.
Definition: DMatTransExpr.h:557
Header file for the empty type.
DMatTransExpr< MT, SO > This
Type of this DMatTransExpr instance.
Definition: DMatTransExpr.h:153
Header file for the IsHermitian type trait.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatTransExpr.h:326
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
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatTransExpr.h:315
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.