SMatDeclLowExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDECLLOWEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATDECLLOWEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
68 #include <blaze/util/Assert.h>
69 #include <blaze/util/DisableIf.h>
70 #include <blaze/util/EnableIf.h>
72 #include <blaze/util/InvalidType.h>
73 #include <blaze/util/mpl/And.h>
74 #include <blaze/util/mpl/If.h>
75 #include <blaze/util/mpl/Not.h>
76 #include <blaze/util/mpl/Or.h>
77 #include <blaze/util/TrueType.h>
78 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS SMATDECLLOWEXPR
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
97 template< typename MT // Type of the sparse matrix
98  , bool SO > // Storage order
99 class SMatDeclLowExpr
100  : public DeclLowExpr< SparseMatrix< SMatDeclLowExpr<MT,SO>, SO > >
101  , public Declaration<MT>
102 {
103  private:
104  //**Type definitions****************************************************************************
105  using RT = ResultType_<MT>;
106  //**********************************************************************************************
107 
108  //**Serial evaluation strategy******************************************************************
110 
116  enum : bool { useAssign = RequiresEvaluation<MT>::value };
117 
119  template< typename MT2 >
121  struct UseAssign {
122  enum : bool { value = useAssign };
123  };
125  //**********************************************************************************************
126 
127  //**Parallel evaluation strategy****************************************************************
129 
134  template< typename MT2 >
135  struct UseSMPAssign {
136  enum : bool { value = MT2::smpAssignable && useAssign };
137  };
139  //**********************************************************************************************
140 
141  //**********************************************************************************************
143 
147  template< typename MT2 >
148  struct GetConstIterator {
150  struct Success { using Type = typename MT2::ConstIterator; };
151  struct Failure { using Type = INVALID_TYPE; };
152  using Type = typename If_< HasConstIterator<MT2>, Success, Failure >::Type;
153  };
155  //**********************************************************************************************
156 
157  public:
158  //**Type definitions****************************************************************************
165 
168 
170  using ConstIterator = typename GetConstIterator<MT>::Type;
171 
173  using Operand = If_< IsExpression<MT>, const MT, const MT& >;
174  //**********************************************************************************************
175 
176  //**Compilation flags***************************************************************************
178  enum : bool { smpAssignable = MT::smpAssignable };
179  //**********************************************************************************************
180 
181  //**Constructor*********************************************************************************
186  explicit inline SMatDeclLowExpr( const MT& sm ) noexcept
187  : sm_( sm ) // Sparse matrix of the decllow expression
188  {
189  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
190  }
191  //**********************************************************************************************
192 
193  //**Access operator*****************************************************************************
200  inline ReturnType operator()( size_t i, size_t j ) const {
201  BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
202  BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
203  return sm_(i,j);
204  }
205  //**********************************************************************************************
206 
207  //**At function*********************************************************************************
215  inline ReturnType at( size_t i, size_t j ) const {
216  if( i >= sm_.rows() ) {
217  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
218  }
219  if( j >= sm_.columns() ) {
220  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
221  }
222  return (*this)(i,j);
223  }
224  //**********************************************************************************************
225 
226  //**Begin function******************************************************************************
232  inline ConstIterator begin( size_t i ) const {
233  return ConstIterator( sm_.begin(i) );
234  }
235  //**********************************************************************************************
236 
237  //**End function********************************************************************************
243  inline ConstIterator end( size_t i ) const {
244  return ConstIterator( sm_.end(i) );
245  }
246  //**********************************************************************************************
247 
248  //**Rows function*******************************************************************************
253  inline size_t rows() const noexcept {
254  return sm_.rows();
255  }
256  //**********************************************************************************************
257 
258  //**Columns function****************************************************************************
263  inline size_t columns() const noexcept {
264  return sm_.columns();
265  }
266  //**********************************************************************************************
267 
268  //**NonZeros function***************************************************************************
273  inline size_t nonZeros() const {
274  return sm_.nonZeros();
275  }
276  //**********************************************************************************************
277 
278  //**NonZeros function***************************************************************************
284  inline size_t nonZeros( size_t i ) const {
285  return sm_.nonZeros(i);
286  }
287  //**********************************************************************************************
288 
289  //**Operand access******************************************************************************
294  inline Operand operand() const noexcept {
295  return sm_;
296  }
297  //**********************************************************************************************
298 
299  //**********************************************************************************************
305  template< typename T >
306  inline bool canAlias( const T* alias ) const noexcept {
307  return sm_.canAlias( alias );
308  }
309  //**********************************************************************************************
310 
311  //**********************************************************************************************
317  template< typename T >
318  inline bool isAliased( const T* alias ) const noexcept {
319  return sm_.isAliased( alias );
320  }
321  //**********************************************************************************************
322 
323  //**********************************************************************************************
328  inline bool canSMPAssign() const noexcept {
329  return sm_.canSMPAssign();
330  }
331  //**********************************************************************************************
332 
333  private:
334  //**Member variables****************************************************************************
336  //**********************************************************************************************
337 
338  //**Assignment to dense matrices****************************************************************
350  template< typename MT2 // Type of the target dense matrix
351  , bool SO2 > // Storage order of the target dense matrix
352  friend inline EnableIf_< UseAssign<MT2> >
353  assign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
354  {
356 
357  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
358  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
359 
360  assign( ~lhs, rhs.sm_ );
361  }
363  //**********************************************************************************************
364 
365  //**Assignment to sparse matrices***************************************************************
377  template< typename MT2 // Type of the target sparse matrix
378  , bool SO2 > // Storage order of the target sparse matrix
379  friend inline EnableIf_< UseAssign<MT2> >
380  assign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
381  {
383 
384  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
385  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
386 
387  assign( ~lhs, rhs.sm_ );
388  }
390  //**********************************************************************************************
391 
392  //**Addition assignment to dense matrices*******************************************************
404  template< typename MT2 // Type of the target dense matrix
405  , bool SO2 > // Storage order of the target dense matrix
406  friend inline EnableIf_< UseAssign<MT2> >
407  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
408  {
410 
411  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
412  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
413 
414  addAssign( ~lhs, rhs.sm_ );
415  }
417  //**********************************************************************************************
418 
419  //**Addition assignment to sparse matrices******************************************************
431  template< typename MT2 // Type of the target sparse matrix
432  , bool SO2 > // Storage order of the target sparse matrix
433  friend inline EnableIf_< UseAssign<MT2> >
434  addAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
435  {
437 
438  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
439  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
440 
441  addAssign( ~lhs, rhs.sm_ );
442  }
444  //**********************************************************************************************
445 
446  //**Subtraction assignment to dense matrices****************************************************
458  template< typename MT2 // Type of the target dense matrix
459  , bool SO2 > // Storage order of the target dense matrix
460  friend inline EnableIf_< UseAssign<MT2> >
461  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
462  {
464 
465  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
466  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
467 
468  subAssign( ~lhs, rhs.sm_ );
469  }
471  //**********************************************************************************************
472 
473  //**Subtraction assignment to sparse matrices***************************************************
485  template< typename MT2 // Type of the target sparse matrix
486  , bool SO2 > // Storage order of the target sparse matrix
487  friend inline EnableIf_< UseAssign<MT2> >
488  subAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
489  {
491 
492  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
493  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
494 
495  subAssign( ~lhs, rhs.sm_ );
496  }
498  //**********************************************************************************************
499 
500  //**Schur product assignment to dense matrices**************************************************
512  template< typename MT2 // Type of the target dense matrix
513  , bool SO2 > // Storage order of the target dense matrix
514  friend inline EnableIf_< UseAssign<MT2> >
515  schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
516  {
518 
519  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
520  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
521 
522  schurAssign( ~lhs, rhs.sm_ );
523  }
525  //**********************************************************************************************
526 
527  //**Schur product assignment to sparse matrices*************************************************
539  template< typename MT2 // Type of the target sparse matrix
540  , bool SO2 > // Storage order of the target sparse matrix
541  friend inline EnableIf_< UseAssign<MT2> >
542  schurAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
543  {
545 
546  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
547  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
548 
549  schurAssign( ~lhs, rhs.sm_ );
550  }
552  //**********************************************************************************************
553 
554  //**Multiplication assignment to dense matrices*************************************************
566  template< typename MT2 // Type of the target dense matrix
567  , bool SO2 > // Storage order of the target dense matrix
568  friend inline EnableIf_< UseAssign<MT2> >
569  multAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
570  {
572 
573  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
574  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
575 
576  multAssign( ~lhs, rhs.sm_ );
577  }
579  //**********************************************************************************************
580 
581  //**Multiplication assignment to sparse matrices************************************************
593  template< typename MT2 // Type of the target sparse matrix
594  , bool SO2 > // Storage order of the target sparse matrix
595  friend inline EnableIf_< UseAssign<MT2> >
596  multAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
597  {
599 
600  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
601  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
602 
603  multAssign( ~lhs, rhs.sm_ );
604  }
606  //**********************************************************************************************
607 
608  //**SMP assignment to dense matrices************************************************************
620  template< typename MT2 // Type of the target dense matrix
621  , bool SO2 > // Storage order of the target dense matrix
622  friend inline EnableIf_< UseSMPAssign<MT2> >
623  smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
624  {
626 
627  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
628  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
629 
630  smpAssign( ~lhs, rhs.sm_ );
631  }
633  //**********************************************************************************************
634 
635  //**SMP assignment to sparse matrices***********************************************************
647  template< typename MT2 // Type of the target sparse matrix
648  , bool SO2 > // Storage order of the target sparse matrix
649  friend inline EnableIf_< UseSMPAssign<MT2> >
650  smpAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
651  {
653 
654  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
655  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
656 
657  smpAssign( ~lhs, rhs.sm_ );
658  }
660  //**********************************************************************************************
661 
662  //**SMP addition assignment to dense matrices***************************************************
674  template< typename MT2 // Type of the target dense matrix
675  , bool SO2 > // Storage order of the target dense matrix
676  friend inline EnableIf_< UseSMPAssign<MT2> >
677  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
678  {
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  smpAddAssign( ~lhs, rhs.sm_ );
685  }
687  //**********************************************************************************************
688 
689  //**SMP addition assignment to sparse matrices**************************************************
701  template< typename MT2 // Type of the target sparse matrix
702  , bool SO2 > // Storage order of the target sparse matrix
703  friend inline EnableIf_< UseSMPAssign<MT2> >
704  smpAddAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
705  {
707 
708  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
709  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
710 
711  smpAddAssign( ~lhs, rhs.sm_ );
712  }
714  //**********************************************************************************************
715 
716  //**SMP subtraction assignment to dense matrices************************************************
728  template< typename MT2 // Type of the target dense matrix
729  , bool SO2 > // Storage order of the target dense matrix
730  friend inline EnableIf_< UseSMPAssign<MT2> >
731  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
732  {
734 
735  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
736  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
737 
738  smpSubAssign( ~lhs, rhs.sm_ );
739  }
741  //**********************************************************************************************
742 
743  //**SMP subtraction assignment to sparse matrices***********************************************
755  template< typename MT2 // Type of the target sparse matrix
756  , bool SO2 > // Storage order of the target sparse matrix
757  friend inline EnableIf_< UseSMPAssign<MT2> >
758  smpSubAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
759  {
761 
762  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
763  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
764 
765  smpSubAssign( ~lhs, rhs.sm_ );
766  }
768  //**********************************************************************************************
769 
770  //**SMP Schur product assignment to dense matrices**********************************************
782  template< typename MT2 // Type of the target dense matrix
783  , bool SO2 > // Storage order of the target dense matrix
784  friend inline EnableIf_< UseSMPAssign<MT2> >
785  smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
786  {
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  smpSchurAssign( ~lhs, rhs.sm_ );
793  }
795  //**********************************************************************************************
796 
797  //**SMP Schur product assignment to sparse matrices*********************************************
809  template< typename MT2 // Type of the target sparse matrix
810  , bool SO2 > // Storage order of the target sparse matrix
811  friend inline EnableIf_< UseSMPAssign<MT2> >
812  smpSchurAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
813  {
815 
816  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
817  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
818 
819  smpSchurAssign( ~lhs, rhs.sm_ );
820  }
822  //**********************************************************************************************
823 
824  //**SMP multiplication assignment to dense matrices*********************************************
837  template< typename MT2 // Type of the target dense matrix
838  , bool SO2 > // Storage order of the target dense matrix
839  friend inline EnableIf_< UseSMPAssign<MT2> >
840  smpMultAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
841  {
843 
844  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
845  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
846 
847  smpMultAssign( ~lhs, rhs.sm_ );
848  }
850  //**********************************************************************************************
851 
852  //**SMP multiplication assignment to sparse matrices********************************************
865  template< typename MT2 // Type of the target sparse matrix
866  , bool SO2 > // Storage order of the target sparse matrix
867  friend inline EnableIf_< UseSMPAssign<MT2> >
868  smpMultAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclLowExpr& rhs )
869  {
871 
872  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
873  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
874 
875  smpMultAssign( ~lhs, rhs.sm_ );
876  }
878  //**********************************************************************************************
879 
880  //**Compile time checks*************************************************************************
887  //**********************************************************************************************
888 };
889 //*************************************************************************************************
890 
891 
892 
893 
894 //=================================================================================================
895 //
896 // GLOBAL FUNCTIONS
897 //
898 //=================================================================================================
899 
900 //*************************************************************************************************
911 template< typename MT // Type of the sparse matrix
912  , bool SO // Storage order
913  , typename = DisableIf_< Or< IsLower<MT>, IsUniUpper<MT> > > >
914 inline const SMatDeclLowExpr<MT,SO> decllow_backend( const SparseMatrix<MT,SO>& sm )
915 {
917 
918  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
919 
920  return SMatDeclLowExpr<MT,SO>( ~sm );
921 }
923 //*************************************************************************************************
924 
925 
926 //*************************************************************************************************
937 template< typename MT // Type of the sparse matrix
938  , bool SO // Storage order
940 inline const IdentityMatrix<ElementType_<MT>,SO> decllow_backend( const SparseMatrix<MT,SO>& sm )
941 {
943 
944  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
945 
946  return IdentityMatrix<ElementType_<MT>,SO>( (~sm).rows() );
947 }
949 //*************************************************************************************************
950 
951 
952 //*************************************************************************************************
963 template< typename MT // Type of the sparse matrix
964  , bool SO // Storage order
965  , typename = EnableIf_< IsLower<MT> > >
966 inline const MT& decllow_backend( const SparseMatrix<MT,SO>& sm )
967 {
969 
970  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
971 
972  return ~sm;
973 }
975 //*************************************************************************************************
976 
977 
978 //*************************************************************************************************
996 template< typename MT // Type of the sparse matrix
997  , bool SO > // Storage order
998 inline decltype(auto) decllow( const SparseMatrix<MT,SO>& sm )
999 {
1001 
1002  if( !isSquare( ~sm ) ) {
1003  BLAZE_THROW_INVALID_ARGUMENT( "Invalid lower matrix specification" );
1004  }
1005 
1006  return decllow_backend( ~sm );
1007 }
1008 //*************************************************************************************************
1009 
1010 
1011 
1012 
1013 //=================================================================================================
1014 //
1015 // GLOBAL RESTRUCTURING FUNCTIONS
1016 //
1017 //=================================================================================================
1018 
1019 //*************************************************************************************************
1033 template< typename MT // Type of the left-hand side sparse matrix
1034  , typename ST // Type of the right-hand side scalar value
1035  , bool SO // Storage order
1036  , typename = DisableIf_< IsLower<MT> > >
1037 inline decltype(auto) decllow( const SMatScalarMultExpr<MT,ST,SO>& sm )
1038 {
1040 
1041  if( !isSquare( ~sm ) ) {
1042  BLAZE_THROW_INVALID_ARGUMENT( "Invalid lower matrix specification" );
1043  }
1044 
1045  return decllow( sm.leftOperand() ) * sm.rightOperand();
1046 }
1048 //*************************************************************************************************
1049 
1050 
1051 
1052 
1053 //=================================================================================================
1054 //
1055 // SIZE SPECIALIZATIONS
1056 //
1057 //=================================================================================================
1058 
1059 //*************************************************************************************************
1061 template< typename MT, bool SO >
1062 struct Size< SMatDeclLowExpr<MT,SO>, 0UL >
1063  : public Size<MT,0UL>
1064 {};
1065 
1066 template< typename MT, bool SO >
1067 struct Size< SMatDeclLowExpr<MT,SO>, 1UL >
1068  : public Size<MT,1UL>
1069 {};
1071 //*************************************************************************************************
1072 
1073 
1074 
1075 
1076 //=================================================================================================
1077 //
1078 // ISSYMMETRIC SPECIALIZATIONS
1079 //
1080 //=================================================================================================
1081 
1082 //*************************************************************************************************
1084 template< typename MT, bool SO >
1085 struct IsSymmetric< SMatDeclLowExpr<MT,SO> >
1086  : public IsSymmetric<MT>
1087 {};
1089 //*************************************************************************************************
1090 
1091 
1092 
1093 
1094 //=================================================================================================
1095 //
1096 // ISHERMITIAN SPECIALIZATIONS
1097 //
1098 //=================================================================================================
1099 
1100 //*************************************************************************************************
1102 template< typename MT, bool SO >
1103 struct IsHermitian< SMatDeclLowExpr<MT,SO> >
1104  : public IsHermitian<MT>
1105 {};
1107 //*************************************************************************************************
1108 
1109 
1110 
1111 
1112 //=================================================================================================
1113 //
1114 // ISLOWER SPECIALIZATIONS
1115 //
1116 //=================================================================================================
1117 
1118 //*************************************************************************************************
1120 template< typename MT, bool SO >
1121 struct IsLower< SMatDeclLowExpr<MT,SO> >
1122  : public TrueType
1123 {};
1125 //*************************************************************************************************
1126 
1127 
1128 
1129 
1130 //=================================================================================================
1131 //
1132 // ISUNILOWER SPECIALIZATIONS
1133 //
1134 //=================================================================================================
1135 
1136 //*************************************************************************************************
1138 template< typename MT, bool SO >
1139 struct IsUniLower< SMatDeclLowExpr<MT,SO> >
1140  : public IsUniLower<MT>
1141 {};
1143 //*************************************************************************************************
1144 
1145 
1146 
1147 
1148 //=================================================================================================
1149 //
1150 // ISSTRICTLYLOWER SPECIALIZATIONS
1151 //
1152 //=================================================================================================
1153 
1154 //*************************************************************************************************
1156 template< typename MT, bool SO >
1157 struct IsStrictlyLower< SMatDeclLowExpr<MT,SO> >
1158  : public IsStrictlyLower<MT>
1159 {};
1161 //*************************************************************************************************
1162 
1163 
1164 
1165 
1166 //=================================================================================================
1167 //
1168 // ISUPPER SPECIALIZATIONS
1169 //
1170 //=================================================================================================
1171 
1172 //*************************************************************************************************
1174 template< typename MT, bool SO >
1175 struct IsUpper< SMatDeclLowExpr<MT,SO> >
1176  : public Or< IsSymmetric<MT>, IsHermitian<MT>, IsUpper<MT> >
1177 {};
1179 //*************************************************************************************************
1180 
1181 
1182 
1183 
1184 //=================================================================================================
1185 //
1186 // ISUNIUPPER SPECIALIZATIONS
1187 //
1188 //=================================================================================================
1189 
1190 //*************************************************************************************************
1192 template< typename MT, bool SO >
1193 struct IsUniUpper< SMatDeclLowExpr<MT,SO> >
1194  : public IsUniUpper<MT>
1195 {};
1197 //*************************************************************************************************
1198 
1199 
1200 
1201 
1202 //=================================================================================================
1203 //
1204 // ISSTRICTLYUPPER SPECIALIZATIONS
1205 //
1206 //=================================================================================================
1207 
1208 //*************************************************************************************************
1210 template< typename MT, bool SO >
1211 struct IsStrictlyUpper< SMatDeclLowExpr<MT,SO> >
1212  : public IsStrictlyUpper<MT>
1213 {};
1215 //*************************************************************************************************
1216 
1217 } // namespace blaze
1218 
1219 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for the IsUniUpper type trait.
EnableIf_< IsDenseMatrix< MT1 > > smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:196
DeclLowTrait_< RT > ResultType
Result type for expression template evaluations.
Definition: SMatDeclLowExpr.h:160
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarMultExpr.h:475
Header file for basic type definitions.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatDeclLowExpr.h:306
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:164
#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
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatDeclLowExpr.h:164
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNIUPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper unitriangular matrix type...
Definition: UniUpper.h:81
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarMultExpr.h:465
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the And class template.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
#define BLAZE_CREATE_HAS_TYPE_MEMBER_TYPE_TRAIT(TYPE_TRAIT_NAME, MEMBER_NAME)
Macro for the creation of a type trait for compile time checks for member types.This macro creates th...
Definition: HasMember.h:182
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDeclLowExpr.h:328
Expression object for the explicit lower declaration of sparse matrices.The SMatDeclLowExpr class rep...
Definition: Forward.h:104
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatDeclLowExpr.h:215
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
typename DeclLowTrait< MT >::Type DeclLowTrait_
Auxiliary alias declaration for the DeclLowTrait type trait.The DeclLowTrait_ alias declaration provi...
Definition: DeclLowTrait.h:156
Header file for the RequiresEvaluation type trait.
Constraint on the data type.
Header file for the IsUniLower type trait.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatDeclLowExpr.h:200
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
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:133
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
Header file for all forward declarations for sparse vectors and matrices.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatDeclLowExpr.h:243
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
Header file for the SparseMatrix base class.
If_< RequiresEvaluation< MT >, const ResultType, const SMatDeclLowExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatDeclLowExpr.h:167
Constraint on the data type.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatDeclLowExpr.h:232
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:71
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
Efficient implementation of an identity matrix.The IdentityMatrix class template is the representati...
Definition: Forward.h:49
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
ElementType_< MT > ElementType
Resulting element type.
Definition: SMatDeclLowExpr.h:163
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatDeclLowExpr.h:294
Header file for the If class template.
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:102
Header file for the Or class template.
Header file for the decllow trait.
#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 Not class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatDeclLowExpr.h:253
decltype(auto) decllow(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as lower.
Definition: DMatDeclLowExpr.h:1026
Header file for the IsLower type trait.
Constraints on the storage order of matrix types.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatDeclLowExpr.h:273
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Header file for the DeclLowExpr base class.
Expression object for sparse matrix-scalar multiplications.The SMatScalarMult class represents the co...
Definition: Forward.h:114
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:86
Header file for the Declaration base class.
Header file for run time assertion macros.
Utility type for generic codes.
ResultType_< MT > RT
Result type of the sparse matrix expression.
Definition: SMatDeclLowExpr.h:105
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:154
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Header file for the HasMember type traits.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:263
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDeclLowExpr.h:162
If_< IsExpression< MT >, const MT, const MT &> Operand
Composite data type of the sparse matrix expression.
Definition: SMatDeclLowExpr.h:173
typename GetConstIterator< MT >::Type ConstIterator
Iterator over the elements of the dense matrix.
Definition: SMatDeclLowExpr.h:170
Header file for the implementation of the base template of the LowerMatrix.
SMatDeclLowExpr(const MT &sm) noexcept
Constructor for the SMatDeclLowExpr class.
Definition: SMatDeclLowExpr.h:186
Compile time logical &#39;or&#39; evaluation.The Or alias declaration performs at compile time a logical &#39;or&#39;...
Definition: Or.h:76
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
Operand sm_
Sparse matrix of the decllow expression.
Definition: SMatDeclLowExpr.h:335
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatDeclLowExpr.h:161
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
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.
Definition: SMatDeclLowExpr.h:284
Header file for the IsHermitian type trait.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatDeclLowExpr.h:263
Header file for the Size type trait.
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDeclLowExpr.h:318
Header file for the TrueType type/value trait base class.
Header file for the IsExpression type trait class.
Header file for the function trace functionality.