SMatDeclDiagExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDECLDIAGEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATDECLDIAGEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
45 #include <blaze/math/Aliases.h>
49 #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/If.h>
74 #include <blaze/util/TrueType.h>
75 #include <blaze/util/Types.h>
77 
78 
79 namespace blaze {
80 
81 //=================================================================================================
82 //
83 // CLASS SMATDECLHERMEXPR
84 //
85 //=================================================================================================
86 
87 //*************************************************************************************************
94 template< typename MT // Type of the sparse matrix
95  , bool SO > // Storage order
96 class SMatDeclDiagExpr
97  : public DeclDiagExpr< SparseMatrix< SMatDeclDiagExpr<MT,SO>, SO > >
98  , public Declaration<MT>
99 {
100  private:
101  //**Type definitions****************************************************************************
102  using RT = ResultType_<MT>;
103  //**********************************************************************************************
104 
105  //**Serial evaluation strategy******************************************************************
107 
113  enum : bool { useAssign = RequiresEvaluation<MT>::value };
114 
116  template< typename MT2 >
118  struct UseAssign {
119  enum : bool { value = useAssign };
120  };
122  //**********************************************************************************************
123 
124  //**Parallel evaluation strategy****************************************************************
126 
131  template< typename MT2 >
132  struct UseSMPAssign {
133  enum : bool { value = MT2::smpAssignable && useAssign };
134  };
136  //**********************************************************************************************
137 
138  //**********************************************************************************************
140 
144  template< typename MT2 >
145  struct GetConstIterator {
147  struct Success { using Type = typename MT2::ConstIterator; };
148  struct Failure { using Type = INVALID_TYPE; };
149  using Type = typename If_< HasConstIterator<MT2>, Success, Failure >::Type;
150  };
152  //**********************************************************************************************
153 
154  public:
155  //**Type definitions****************************************************************************
162 
165 
167  using ConstIterator = typename GetConstIterator<MT>::Type;
168 
170  using Operand = If_< IsExpression<MT>, const MT, const MT& >;
171  //**********************************************************************************************
172 
173  //**Compilation flags***************************************************************************
175  enum : bool { smpAssignable = MT::smpAssignable };
176  //**********************************************************************************************
177 
178  //**Constructor*********************************************************************************
183  explicit inline SMatDeclDiagExpr( const MT& sm ) noexcept
184  : sm_( sm ) // Sparse matrix of the decldiag expression
185  {
186  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
187  }
188  //**********************************************************************************************
189 
190  //**Access operator*****************************************************************************
197  inline ReturnType operator()( size_t i, size_t j ) const {
198  BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
199  BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
200  return sm_(i,j);
201  }
202  //**********************************************************************************************
203 
204  //**At function*********************************************************************************
212  inline ReturnType at( size_t i, size_t j ) const {
213  if( i >= sm_.rows() ) {
214  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
215  }
216  if( j >= sm_.columns() ) {
217  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
218  }
219  return (*this)(i,j);
220  }
221  //**********************************************************************************************
222 
223  //**Begin function******************************************************************************
229  inline ConstIterator begin( size_t i ) const {
230  return ConstIterator( sm_.begin(i) );
231  }
232  //**********************************************************************************************
233 
234  //**End function********************************************************************************
240  inline ConstIterator end( size_t i ) const {
241  return ConstIterator( sm_.end(i) );
242  }
243  //**********************************************************************************************
244 
245  //**Rows function*******************************************************************************
250  inline size_t rows() const noexcept {
251  return sm_.rows();
252  }
253  //**********************************************************************************************
254 
255  //**Columns function****************************************************************************
260  inline size_t columns() const noexcept {
261  return sm_.columns();
262  }
263  //**********************************************************************************************
264 
265  //**NonZeros function***************************************************************************
270  inline size_t nonZeros() const {
271  return sm_.nonZeros();
272  }
273  //**********************************************************************************************
274 
275  //**NonZeros function***************************************************************************
281  inline size_t nonZeros( size_t i ) const {
282  return sm_.nonZeros(i);
283  }
284  //**********************************************************************************************
285 
286  //**Operand access******************************************************************************
291  inline Operand operand() const noexcept {
292  return sm_;
293  }
294  //**********************************************************************************************
295 
296  //**********************************************************************************************
302  template< typename T >
303  inline bool canAlias( const T* alias ) const noexcept {
304  return sm_.canAlias( alias );
305  }
306  //**********************************************************************************************
307 
308  //**********************************************************************************************
314  template< typename T >
315  inline bool isAliased( const T* alias ) const noexcept {
316  return sm_.isAliased( alias );
317  }
318  //**********************************************************************************************
319 
320  //**********************************************************************************************
325  inline bool canSMPAssign() const noexcept {
326  return sm_.canSMPAssign();
327  }
328  //**********************************************************************************************
329 
330  private:
331  //**Member variables****************************************************************************
333  //**********************************************************************************************
334 
335  //**Assignment to dense matrices****************************************************************
347  template< typename MT2 // Type of the target dense matrix
348  , bool SO2 > // Storage order of the target dense matrix
349  friend inline EnableIf_< UseAssign<MT2> >
350  assign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
351  {
353 
354  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
355  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
356 
357  assign( ~lhs, rhs.sm_ );
358  }
360  //**********************************************************************************************
361 
362  //**Assignment to sparse matrices***************************************************************
374  template< typename MT2 // Type of the target sparse matrix
375  , bool SO2 > // Storage order of the target sparse matrix
376  friend inline EnableIf_< UseAssign<MT2> >
377  assign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
378  {
380 
381  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
382  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
383 
384  assign( ~lhs, rhs.sm_ );
385  }
387  //**********************************************************************************************
388 
389  //**Addition assignment to dense matrices*******************************************************
401  template< typename MT2 // Type of the target dense matrix
402  , bool SO2 > // Storage order of the target dense matrix
403  friend inline EnableIf_< UseAssign<MT2> >
404  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
405  {
407 
408  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
409  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
410 
411  addAssign( ~lhs, rhs.sm_ );
412  }
414  //**********************************************************************************************
415 
416  //**Addition assignment to sparse matrices******************************************************
428  template< typename MT2 // Type of the target sparse matrix
429  , bool SO2 > // Storage order of the target sparse matrix
430  friend inline EnableIf_< UseAssign<MT2> >
431  addAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
432  {
434 
435  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
436  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
437 
438  addAssign( ~lhs, rhs.sm_ );
439  }
441  //**********************************************************************************************
442 
443  //**Subtraction assignment to dense matrices****************************************************
455  template< typename MT2 // Type of the target dense matrix
456  , bool SO2 > // Storage order of the target dense matrix
457  friend inline EnableIf_< UseAssign<MT2> >
458  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
459  {
461 
462  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
463  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
464 
465  subAssign( ~lhs, rhs.sm_ );
466  }
468  //**********************************************************************************************
469 
470  //**Subtraction assignment to sparse matrices***************************************************
482  template< typename MT2 // Type of the target sparse matrix
483  , bool SO2 > // Storage order of the target sparse matrix
484  friend inline EnableIf_< UseAssign<MT2> >
485  subAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
486  {
488 
489  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
490  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
491 
492  subAssign( ~lhs, rhs.sm_ );
493  }
495  //**********************************************************************************************
496 
497  //**Schur product assignment to dense matrices**************************************************
509  template< typename MT2 // Type of the target dense matrix
510  , bool SO2 > // Storage order of the target dense matrix
511  friend inline EnableIf_< UseAssign<MT2> >
512  schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
513  {
515 
516  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
517  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
518 
519  schurAssign( ~lhs, rhs.sm_ );
520  }
522  //**********************************************************************************************
523 
524  //**Schur product assignment to sparse matrices*************************************************
536  template< typename MT2 // Type of the target sparse matrix
537  , bool SO2 > // Storage order of the target sparse matrix
538  friend inline EnableIf_< UseAssign<MT2> >
539  schurAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
540  {
542 
543  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
544  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
545 
546  schurAssign( ~lhs, rhs.sm_ );
547  }
549  //**********************************************************************************************
550 
551  //**Multiplication assignment to dense matrices*************************************************
563  template< typename MT2 // Type of the target dense matrix
564  , bool SO2 > // Storage order of the target dense matrix
565  friend inline EnableIf_< UseAssign<MT2> >
566  multAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
567  {
569 
570  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
571  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
572 
573  multAssign( ~lhs, rhs.sm_ );
574  }
576  //**********************************************************************************************
577 
578  //**Multiplication assignment to sparse matrices************************************************
590  template< typename MT2 // Type of the target sparse matrix
591  , bool SO2 > // Storage order of the target sparse matrix
592  friend inline EnableIf_< UseAssign<MT2> >
593  multAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
594  {
596 
597  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
598  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
599 
600  multAssign( ~lhs, rhs.sm_ );
601  }
603  //**********************************************************************************************
604 
605  //**SMP assignment to dense matrices************************************************************
617  template< typename MT2 // Type of the target dense matrix
618  , bool SO2 > // Storage order of the target dense matrix
619  friend inline EnableIf_< UseSMPAssign<MT2> >
620  smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
621  {
623 
624  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
625  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
626 
627  smpAssign( ~lhs, rhs.sm_ );
628  }
630  //**********************************************************************************************
631 
632  //**SMP assignment to sparse matrices***********************************************************
644  template< typename MT2 // Type of the target sparse matrix
645  , bool SO2 > // Storage order of the target sparse matrix
646  friend inline EnableIf_< UseSMPAssign<MT2> >
647  smpAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
648  {
650 
651  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
652  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
653 
654  smpAssign( ~lhs, rhs.sm_ );
655  }
657  //**********************************************************************************************
658 
659  //**SMP addition assignment to dense matrices***************************************************
671  template< typename MT2 // Type of the target dense matrix
672  , bool SO2 > // Storage order of the target dense matrix
673  friend inline EnableIf_< UseSMPAssign<MT2> >
674  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
675  {
677 
678  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
679  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
680 
681  smpAddAssign( ~lhs, rhs.sm_ );
682  }
684  //**********************************************************************************************
685 
686  //**SMP addition assignment to sparse matrices**************************************************
698  template< typename MT2 // Type of the target sparse matrix
699  , bool SO2 > // Storage order of the target sparse matrix
700  friend inline EnableIf_< UseSMPAssign<MT2> >
701  smpAddAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
702  {
704 
705  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
706  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
707 
708  smpAddAssign( ~lhs, rhs.sm_ );
709  }
711  //**********************************************************************************************
712 
713  //**SMP subtraction assignment to dense matrices************************************************
725  template< typename MT2 // Type of the target dense matrix
726  , bool SO2 > // Storage order of the target dense matrix
727  friend inline EnableIf_< UseSMPAssign<MT2> >
728  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
729  {
731 
732  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
733  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
734 
735  smpSubAssign( ~lhs, rhs.sm_ );
736  }
738  //**********************************************************************************************
739 
740  //**SMP subtraction assignment to sparse matrices***********************************************
752  template< typename MT2 // Type of the target sparse matrix
753  , bool SO2 > // Storage order of the target sparse matrix
754  friend inline EnableIf_< UseSMPAssign<MT2> >
755  smpSubAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
756  {
758 
759  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
760  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
761 
762  smpSubAssign( ~lhs, rhs.sm_ );
763  }
765  //**********************************************************************************************
766 
767  //**SMP Schur product assignment to dense matrices**********************************************
779  template< typename MT2 // Type of the target dense matrix
780  , bool SO2 > // Storage order of the target dense matrix
781  friend inline EnableIf_< UseSMPAssign<MT2> >
782  smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
783  {
785 
786  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
787  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
788 
789  smpSchurAssign( ~lhs, rhs.sm_ );
790  }
792  //**********************************************************************************************
793 
794  //**SMP Schur product assignment to sparse matrices*********************************************
806  template< typename MT2 // Type of the target sparse matrix
807  , bool SO2 > // Storage order of the target sparse matrix
808  friend inline EnableIf_< UseSMPAssign<MT2> >
809  smpSchurAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
810  {
812 
813  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
814  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
815 
816  smpSchurAssign( ~lhs, rhs.sm_ );
817  }
819  //**********************************************************************************************
820 
821  //**SMP multiplication assignment to dense matrices*********************************************
834  template< typename MT2 // Type of the target dense matrix
835  , bool SO2 > // Storage order of the target dense matrix
836  friend inline EnableIf_< UseSMPAssign<MT2> >
837  smpMultAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
838  {
840 
841  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
842  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
843 
844  smpMultAssign( ~lhs, rhs.sm_ );
845  }
847  //**********************************************************************************************
848 
849  //**SMP multiplication assignment to sparse matrices********************************************
862  template< typename MT2 // Type of the target sparse matrix
863  , bool SO2 > // Storage order of the target sparse matrix
864  friend inline EnableIf_< UseSMPAssign<MT2> >
865  smpMultAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclDiagExpr& rhs )
866  {
868 
869  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
870  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
871 
872  smpMultAssign( ~lhs, rhs.sm_ );
873  }
875  //**********************************************************************************************
876 
877  //**Compile time checks*************************************************************************
883  //**********************************************************************************************
884 };
885 //*************************************************************************************************
886 
887 
888 
889 
890 //=================================================================================================
891 //
892 // GLOBAL FUNCTIONS
893 //
894 //=================================================================================================
895 
896 //*************************************************************************************************
907 template< typename MT // Type of the sparse matrix
908  , bool SO // Storage order
909  , typename = DisableIf_< IsDiagonal<MT> > >
910 inline const SMatDeclDiagExpr<MT,SO> decldiag_backend( const SparseMatrix<MT,SO>& sm )
911 {
913 
914  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
915 
916  return SMatDeclDiagExpr<MT,SO>( ~sm );
917 }
919 //*************************************************************************************************
920 
921 
922 //*************************************************************************************************
933 template< typename MT // Type of the sparse matrix
934  , bool SO // Storage order
935  , typename = EnableIf_< IsDiagonal<MT> > >
936 inline const MT& decldiag_backend( const SparseMatrix<MT,SO>& sm )
937 {
939 
940  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
941 
942  return ~sm;
943 }
945 //*************************************************************************************************
946 
947 
948 //*************************************************************************************************
966 template< typename MT // Type of the sparse matrix
967  , bool SO > // Storage order
968 inline decltype(auto) decldiag( const SparseMatrix<MT,SO>& sm )
969 {
971 
972  if( !isSquare( ~sm ) ) {
973  BLAZE_THROW_INVALID_ARGUMENT( "Invalid diagonal matrix specification" );
974  }
975 
976  return decldiag_backend( ~sm );
977 }
978 //*************************************************************************************************
979 
980 
981 
982 
983 //=================================================================================================
984 //
985 // GLOBAL RESTRUCTURING FUNCTIONS
986 //
987 //=================================================================================================
988 
989 //*************************************************************************************************
1003 template< typename MT // Type of the left-hand side sparse matrix
1004  , typename ST // Type of the right-hand side scalar value
1005  , bool SO // Storage order
1006  , typename = DisableIf_< IsDiagonal<MT> > >
1007 inline decltype(auto) decldiag( const SMatScalarMultExpr<MT,ST,SO>& sm )
1008 {
1010 
1011  if( !isSquare( ~sm ) ) {
1012  BLAZE_THROW_INVALID_ARGUMENT( "Invalid diagonal matrix specification" );
1013  }
1014 
1015  return decldiag( sm.leftOperand() ) * sm.rightOperand();
1016 }
1018 //*************************************************************************************************
1019 
1020 
1021 
1022 
1023 //=================================================================================================
1024 //
1025 // SIZE SPECIALIZATIONS
1026 //
1027 //=================================================================================================
1028 
1029 //*************************************************************************************************
1031 template< typename MT, bool SO >
1032 struct Size< SMatDeclDiagExpr<MT,SO>, 0UL >
1033  : public Size<MT,0UL>
1034 {};
1035 
1036 template< typename MT, bool SO >
1037 struct Size< SMatDeclDiagExpr<MT,SO>, 1UL >
1038  : public Size<MT,1UL>
1039 {};
1041 //*************************************************************************************************
1042 
1043 
1044 
1045 
1046 //=================================================================================================
1047 //
1048 // ISSYMMETRIC SPECIALIZATIONS
1049 //
1050 //=================================================================================================
1051 
1052 //*************************************************************************************************
1054 template< typename MT, bool SO >
1055 struct IsSymmetric< SMatDeclDiagExpr<MT,SO> >
1056  : public TrueType
1057 {};
1059 //*************************************************************************************************
1060 
1061 
1062 
1063 
1064 //=================================================================================================
1065 //
1066 // ISHERMITIAN SPECIALIZATIONS
1067 //
1068 //=================================================================================================
1069 
1070 //*************************************************************************************************
1072 template< typename MT, bool SO >
1073 struct IsHermitian< SMatDeclDiagExpr<MT,SO> >
1074  : public IsHermitian<MT>
1075 {};
1077 //*************************************************************************************************
1078 
1079 
1080 
1081 
1082 //=================================================================================================
1083 //
1084 // ISLOWER SPECIALIZATIONS
1085 //
1086 //=================================================================================================
1087 
1088 //*************************************************************************************************
1090 template< typename MT, bool SO >
1091 struct IsLower< SMatDeclDiagExpr<MT,SO> >
1092  : public TrueType
1093 {};
1095 //*************************************************************************************************
1096 
1097 
1098 
1099 
1100 //=================================================================================================
1101 //
1102 // ISUNILOWER SPECIALIZATIONS
1103 //
1104 //=================================================================================================
1105 
1106 //*************************************************************************************************
1108 template< typename MT, bool SO >
1109 struct IsUniLower< SMatDeclDiagExpr<MT,SO> >
1110  : public IsUniLower<MT>
1111 {};
1113 //*************************************************************************************************
1114 
1115 
1116 
1117 
1118 //=================================================================================================
1119 //
1120 // ISSTRICTLYLOWER SPECIALIZATIONS
1121 //
1122 //=================================================================================================
1123 
1124 //*************************************************************************************************
1126 template< typename MT, bool SO >
1127 struct IsStrictlyLower< SMatDeclDiagExpr<MT,SO> >
1128  : public IsStrictlyLower<MT>
1129 {};
1131 //*************************************************************************************************
1132 
1133 
1134 
1135 
1136 //=================================================================================================
1137 //
1138 // ISUPPER SPECIALIZATIONS
1139 //
1140 //=================================================================================================
1141 
1142 //*************************************************************************************************
1144 template< typename MT, bool SO >
1145 struct IsUpper< SMatDeclDiagExpr<MT,SO> >
1146  : public TrueType
1147 {};
1149 //*************************************************************************************************
1150 
1151 
1152 
1153 
1154 //=================================================================================================
1155 //
1156 // ISUNIUPPER SPECIALIZATIONS
1157 //
1158 //=================================================================================================
1159 
1160 //*************************************************************************************************
1162 template< typename MT, bool SO >
1163 struct IsUniUpper< SMatDeclDiagExpr<MT,SO> >
1164  : public IsUniUpper<MT>
1165 {};
1167 //*************************************************************************************************
1168 
1169 
1170 
1171 
1172 //=================================================================================================
1173 //
1174 // ISSTRICTLYUPPER SPECIALIZATIONS
1175 //
1176 //=================================================================================================
1177 
1178 //*************************************************************************************************
1180 template< typename MT, bool SO >
1181 struct IsStrictlyUpper< SMatDeclDiagExpr<MT,SO> >
1182  : public IsStrictlyUpper<MT>
1183 {};
1185 //*************************************************************************************************
1186 
1187 } // namespace blaze
1188 
1189 #endif
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatDeclDiagExpr.h:281
#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 decldiag trait.
decltype(auto) decldiag(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as diagonal.
Definition: DMatDeclDiagExpr.h:996
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
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: SMatDeclDiagExpr.h:303
DeclDiagTrait_< RT > ResultType
Result type for expression template evaluations.
Definition: SMatDeclDiagExpr.h:157
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
Header file for the IsDiagonal type trait.
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
ResultType_< MT > RT
Result type of the sparse matrix expression.
Definition: SMatDeclDiagExpr.h:102
Expression object for the explicit diagonal declaration of sparse matrices.The SMatDeclDiagExpr class...
Definition: Forward.h:102
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
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatDeclDiagExpr.h:161
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
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatDeclDiagExpr.h:250
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
Header file for the RequiresEvaluation type trait.
SMatDeclDiagExpr(const MT &sm) noexcept
Constructor for the SMatDeclDiagExpr class.
Definition: SMatDeclDiagExpr.h:183
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: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.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDeclDiagExpr.h:315
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.
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:71
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
If_< RequiresEvaluation< MT >, const ResultType, const SMatDeclDiagExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatDeclDiagExpr.h:164
typename GetConstIterator< MT >::Type ConstIterator
Iterator over the elements of the dense matrix.
Definition: SMatDeclDiagExpr.h:167
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the DeclDiagExpr base class.
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
#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
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatDeclDiagExpr.h:260
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_DIAGONAL_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a diagonal matrix type, a compilation error is created.
Definition: Diagonal.h:79
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatDeclDiagExpr.h:240
Header file for the IsLower type trait.
If_< IsExpression< MT >, const MT, const MT &> Operand
Composite data type of the sparse matrix expression.
Definition: SMatDeclDiagExpr.h:170
Constraints on the storage order of matrix types.
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
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatDeclDiagExpr.h:229
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.
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatDeclDiagExpr.h:291
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
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDeclDiagExpr.h:325
Operand sm_
Sparse matrix of the decldiag expression.
Definition: SMatDeclDiagExpr.h:332
Header file for the Declaration base class.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDeclDiagExpr.h:159
Header file for run time assertion macros.
Utility type for generic codes.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatDeclDiagExpr.h:270
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_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
Constraint on the data type.
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
Header file for the implementation of the base template of the DiagonalMatrix.
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
ElementType_< MT > ElementType
Resulting element type.
Definition: SMatDeclDiagExpr.h:160
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatDeclDiagExpr.h:158
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.
typename DeclDiagTrait< MT >::Type DeclDiagTrait_
Auxiliary alias declaration for the DeclDiagTrait type trait.The DeclDiagTrait_ alias declaration pro...
Definition: DeclDiagTrait.h:156
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
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
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatDeclDiagExpr.h:197
#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
Header file for the TrueType type/value trait base class.
Header file for the IsExpression type trait class.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatDeclDiagExpr.h:212
Header file for the function trace functionality.