SMatScalarDivExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
48 #include <blaze/math/Exception.h>
75 #include <blaze/util/Assert.h>
79 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/InvalidType.h>
83 #include <blaze/util/mpl/And.h>
84 #include <blaze/util/mpl/If.h>
85 #include <blaze/util/mpl/Or.h>
86 #include <blaze/util/Types.h>
92 
93 
94 namespace blaze {
95 
96 //=================================================================================================
97 //
98 // CLASS SMATSCALARDIVEXPR
99 //
100 //=================================================================================================
101 
102 //*************************************************************************************************
109 template< typename MT // Type of the left-hand side sparse matrix
110  , typename ST // Type of the right-hand side scalar value
111  , bool SO > // Storage order
112 class SMatScalarDivExpr
113  : public MatScalarDivExpr< SparseMatrix< SMatScalarDivExpr<MT,ST,SO>, SO > >
114  , private Computation
115 {
116  private:
117  //**Type definitions****************************************************************************
118  using RT = ResultType_<MT>;
119  using RN = ReturnType_<MT>;
121  //**********************************************************************************************
122 
123  //**Return type evaluation**********************************************************************
125 
130  enum : bool { returnExpr = !IsTemporary<RN>::value };
131 
134  //**********************************************************************************************
135 
136  //**Serial evaluation strategy******************************************************************
138 
144  enum : bool { useAssign = RequiresEvaluation<MT>::value };
145 
147  template< typename MT2 >
149  struct UseAssign {
150  enum : bool { value = useAssign };
151  };
153  //**********************************************************************************************
154 
155  //**Parallel evaluation strategy****************************************************************
157 
163  template< typename MT2 >
164  struct UseSMPAssign {
165  enum : bool { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
166  };
168  //**********************************************************************************************
169 
170  public:
171  //**Type definitions****************************************************************************
177 
180 
183 
185  using LeftOperand = If_< IsExpression<MT>, const MT, const MT& >;
186 
188  using RightOperand = ST;
189  //**********************************************************************************************
190 
191  //**ConstIterator class definition**************************************************************
195  {
196  public:
197  //**Type definitions*************************************************************************
200 
203 
204  using IteratorCategory = std::forward_iterator_tag;
205  using ValueType = Element;
209 
210  // STL iterator requirements
216  //*******************************************************************************************
217 
218  //**Constructor******************************************************************************
221  inline ConstIterator( IteratorType matrix, RightOperand scalar )
222  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
223  , scalar_( scalar ) // Right-hand side scalar of the division expression
224  {}
225  //*******************************************************************************************
226 
227  //**Prefix increment operator****************************************************************
233  ++matrix_;
234  return *this;
235  }
236  //*******************************************************************************************
237 
238  //**Element access operator******************************************************************
243  inline const Element operator*() const {
244  return Element( matrix_->value() / scalar_, matrix_->index() );
245  }
246  //*******************************************************************************************
247 
248  //**Element access operator******************************************************************
253  inline const ConstIterator* operator->() const {
254  return this;
255  }
256  //*******************************************************************************************
257 
258  //**Value function***************************************************************************
263  inline ReturnType value() const {
264  return matrix_->value() / scalar_;
265  }
266  //*******************************************************************************************
267 
268  //**Index function***************************************************************************
273  inline size_t index() const {
274  return matrix_->index();
275  }
276  //*******************************************************************************************
277 
278  //**Equality operator************************************************************************
284  inline bool operator==( const ConstIterator& rhs ) const {
285  return matrix_ == rhs.matrix_;
286  }
287  //*******************************************************************************************
288 
289  //**Inequality operator**********************************************************************
295  inline bool operator!=( const ConstIterator& rhs ) const {
296  return matrix_ != rhs.matrix_;
297  }
298  //*******************************************************************************************
299 
300  //**Subtraction operator*********************************************************************
306  inline DifferenceType operator-( const ConstIterator& rhs ) const {
307  return matrix_ - rhs.matrix_;
308  }
309  //*******************************************************************************************
310 
311  private:
312  //**Member variables*************************************************************************
315  //*******************************************************************************************
316  };
317  //**********************************************************************************************
318 
319  //**Compilation flags***************************************************************************
321  enum : bool { smpAssignable = false };
322  //**********************************************************************************************
323 
324  //**Constructor*********************************************************************************
330  explicit inline SMatScalarDivExpr( const MT& matrix, ST scalar ) noexcept
331  : matrix_( matrix ) // Left-hand side sparse matrix of the division expression
332  , scalar_( scalar ) // Right-hand side scalar of the division expression
333  {}
334  //**********************************************************************************************
335 
336  //**Access operator*****************************************************************************
343  inline ReturnType operator()( size_t i, size_t j ) const {
344  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
345  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
346  return matrix_(i,j) / scalar_;
347  }
348  //**********************************************************************************************
349 
350  //**At function*********************************************************************************
358  inline ReturnType at( size_t i, size_t j ) const {
359  if( i >= matrix_.rows() ) {
360  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
361  }
362  if( j >= matrix_.columns() ) {
363  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
364  }
365  return (*this)(i,j);
366  }
367  //**********************************************************************************************
368 
369  //**Begin function******************************************************************************
375  inline ConstIterator begin( size_t i ) const {
376  return ConstIterator( matrix_.begin(i), scalar_ );
377  }
378  //**********************************************************************************************
379 
380  //**End function********************************************************************************
386  inline ConstIterator end( size_t i ) const {
387  return ConstIterator( matrix_.end(i), scalar_ );
388  }
389  //**********************************************************************************************
390 
391  //**Rows function*******************************************************************************
396  inline size_t rows() const noexcept {
397  return matrix_.rows();
398  }
399  //**********************************************************************************************
400 
401  //**Columns function****************************************************************************
406  inline size_t columns() const noexcept {
407  return matrix_.columns();
408  }
409  //**********************************************************************************************
410 
411  //**NonZeros function***************************************************************************
416  inline size_t nonZeros() const {
417  return matrix_.nonZeros();
418  }
419  //**********************************************************************************************
420 
421  //**NonZeros function***************************************************************************
427  inline size_t nonZeros( size_t i ) const {
428  return matrix_.nonZeros(i);
429  }
430  //**********************************************************************************************
431 
432  //**Find function*******************************************************************************
439  inline ConstIterator find( size_t i, size_t j ) const {
441  return ConstIterator( matrix_.find( i, j ), scalar_ );
442  }
443  //**********************************************************************************************
444 
445  //**LowerBound function*************************************************************************
452  inline ConstIterator lowerBound( size_t i, size_t j ) const {
454  return ConstIterator( matrix_.lowerBound( i, j ), scalar_ );
455  }
456  //**********************************************************************************************
457 
458  //**UpperBound function*************************************************************************
465  inline ConstIterator upperBound( size_t i, size_t j ) const {
467  return ConstIterator( matrix_.upperBound( i, j ), scalar_ );
468  }
469  //**********************************************************************************************
470 
471  //**Left operand access*************************************************************************
476  inline LeftOperand leftOperand() const noexcept {
477  return matrix_;
478  }
479  //**********************************************************************************************
480 
481  //**Right operand access************************************************************************
486  inline RightOperand rightOperand() const noexcept {
487  return scalar_;
488  }
489  //**********************************************************************************************
490 
491  //**********************************************************************************************
497  template< typename T >
498  inline bool canAlias( const T* alias ) const noexcept {
499  return matrix_.canAlias( alias );
500  }
501  //**********************************************************************************************
502 
503  //**********************************************************************************************
509  template< typename T >
510  inline bool isAliased( const T* alias ) const noexcept {
511  return matrix_.isAliased( alias );
512  }
513  //**********************************************************************************************
514 
515  private:
516  //**Member variables****************************************************************************
519  //**********************************************************************************************
520 
521  //**Assignment to dense matrices****************************************************************
535  template< typename MT2 // Type of the target dense matrix
536  , bool SO2 > // Storage order of the target dense matrix
537  friend inline EnableIf_< UseAssign<MT2> >
538  assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
539  {
541 
542  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
543  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
544 
545  assign( ~lhs, rhs.matrix_ );
546  (~lhs) /= rhs.scalar_;
547  }
549  //**********************************************************************************************
550 
551  //**Assignment to sparse matrices***************************************************************
565  template< typename MT2 // Type of the target sparse matrix
566  , bool SO2 > // Storage order of the target sparse matrix
567  friend inline EnableIf_< UseAssign<MT2> >
568  assign( SparseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
569  {
571 
572  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
573  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
574 
575  assign( ~lhs, rhs.matrix_ );
576  (~lhs) /= rhs.scalar_;
577  }
579  //**********************************************************************************************
580 
581  //**Addition assignment to dense matrices*******************************************************
595  template< typename MT2 // Type of the target dense matrix
596  , bool SO2 > // Storage order of the target dense matrix
597  friend inline EnableIf_< UseAssign<MT2> >
598  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
599  {
601 
604 
605  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
606  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
607 
608  const ResultType tmp( serial( rhs ) );
609  addAssign( ~lhs, tmp );
610  }
612  //**********************************************************************************************
613 
614  //**Addition assignment to sparse matrices******************************************************
615  // No special implementation for the addition assignment to sparse matrices.
616  //**********************************************************************************************
617 
618  //**Subtraction assignment to dense matrices****************************************************
632  template< typename MT2 // Type of the target dense matrix
633  , bool SO2 > // Storage order of the target dense matrix
634  friend inline EnableIf_< UseAssign<MT2> >
635  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
636  {
638 
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  const ResultType tmp( serial( rhs ) );
646  subAssign( ~lhs, tmp );
647  }
649  //**********************************************************************************************
650 
651  //**Subtraction assignment to sparse matrices***************************************************
652  // No special implementation for the subtraction assignment to sparse matrices.
653  //**********************************************************************************************
654 
655  //**Schur product assignment to dense matrices**************************************************
669  template< typename MT2 // Type of the target dense matrix
670  , bool SO2 > // Storage order of the target dense matrix
671  friend inline EnableIf_< UseAssign<MT2> >
672  schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
673  {
675 
678 
679  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
680  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
681 
682  const ResultType tmp( serial( rhs ) );
683  schurAssign( ~lhs, tmp );
684  }
686  //**********************************************************************************************
687 
688  //**Schur product assignment to sparse matrices*************************************************
689  // No special implementation for the Schur product assignment to sparse matrices.
690  //**********************************************************************************************
691 
692  //**Multiplication assignment to dense matrices*************************************************
693  // No special implementation for the multiplication assignment to dense matrices.
694  //**********************************************************************************************
695 
696  //**Multiplication assignment to sparse matrices************************************************
697  // No special implementation for the multiplication assignment to sparse matrices.
698  //**********************************************************************************************
699 
700  //**SMP assignment to dense matrices************************************************************
701  // No special implementation for the SMP assignment to dense matrices.
702  //**********************************************************************************************
703 
704  //**SMP assignment to sparse matrices***********************************************************
705  // No special implementation for the SMP assignment to sparse matrices.
706  //**********************************************************************************************
707 
708  //**SMP addition assignment to dense matrices***************************************************
722  template< typename MT2 // Type of the target dense matrix
723  , bool SO2 > // Storage order of the target dense matrix
724  friend inline EnableIf_< UseSMPAssign<MT2> >
725  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
726  {
728 
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  const ResultType tmp( rhs );
736  smpAddAssign( ~lhs, tmp );
737  }
739  //**********************************************************************************************
740 
741  //**SMP addition assignment to sparse matrices**************************************************
742  // No special implementation for the SMP addition assignment to sparse matrices.
743  //**********************************************************************************************
744 
745  //**SMP subtraction assignment to dense matrices************************************************
759  template< typename MT2 // Type of the target dense matrix
760  , bool SO2 > // Storage order of the target dense matrix
761  friend inline EnableIf_< UseSMPAssign<MT2> >
762  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
763  {
765 
768 
769  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
770  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
771 
772  const ResultType tmp( rhs );
773  smpSubAssign( ~lhs, tmp );
774  }
776  //**********************************************************************************************
777 
778  //**SMP subtraction assignment to sparse matrices***********************************************
779  // No special implementation for the SMP subtraction assignment to sparse matrices.
780  //**********************************************************************************************
781 
782  //**SMP Schur product assignment to dense matrices**********************************************
796  template< typename MT2 // Type of the target dense matrix
797  , bool SO2 > // Storage order of the target dense matrix
798  friend inline EnableIf_< UseSMPAssign<MT2> >
799  smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
800  {
802 
805 
806  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
807  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
808 
809  const ResultType tmp( rhs );
810  smpSchurAssign( ~lhs, tmp );
811  }
813  //**********************************************************************************************
814 
815  //**SMP Schur product assignment to sparse matrices*********************************************
816  // No special implementation for the SMP Schur product assignment to sparse matrices.
817  //**********************************************************************************************
818 
819  //**Multiplication assignment to dense matrices*************************************************
820  // No special implementation for the SMP multiplication assignment to dense matrices.
821  //**********************************************************************************************
822 
823  //**SMP multiplication assignment to sparse matrices********************************************
824  // No special implementation for the SMP multiplication assignment to sparse matrices.
825  //**********************************************************************************************
826 
827  //**Compile time checks*************************************************************************
836  //**********************************************************************************************
837 };
838 //*************************************************************************************************
839 
840 
841 
842 
843 //=================================================================================================
844 //
845 // GLOBAL BINARY ARITHMETIC OPERATORS
846 //
847 //=================================================================================================
848 
849 //*************************************************************************************************
854 template< typename MT // Type of the left-hand side sparse matrix
855  , typename ST // Type of the right-hand side scalar
856  , bool SO > // Storage order
857 struct SMatScalarDivExprHelper
858 {
859  private:
860  //**********************************************************************************************
861  using ScalarType = If_< Or< IsFloatingPoint< UnderlyingBuiltin_<MT> >
862  , IsFloatingPoint< UnderlyingBuiltin_<ST> > >
863  , If_< And< IsComplex< UnderlyingNumeric_<MT> >
864  , IsBuiltin<ST> >
865  , DivTrait_< UnderlyingBuiltin_<MT>, ST >
866  , DivTrait_< UnderlyingNumeric_<MT>, ST > >
867  , ST >;
868  //**********************************************************************************************
869 
870  public:
871  //**********************************************************************************************
872  using Type = If_< IsInvertible<ScalarType>
873  , SMatScalarMultExpr<MT,ScalarType,SO>
874  , SMatScalarDivExpr<MT,ScalarType,SO> >;
875  //**********************************************************************************************
876 };
878 //*************************************************************************************************
879 
880 
881 //*************************************************************************************************
903 template< typename MT // Type of the left-hand side sparse matrix
904  , bool SO // Storage order of the left-hand side sparse matrix
905  , typename ST // Type of the right-hand side scalar
906  , typename = EnableIf_< IsNumeric<ST> > >
907 inline decltype(auto) operator/( const SparseMatrix<MT,SO>& mat, ST scalar )
908 {
910 
911  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
912 
913  using ReturnType = typename SMatScalarDivExprHelper<MT,ST,SO>::Type;
914  using ScalarType = RightOperand_<ReturnType>;
915 
917  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
918  }
919  else {
920  return ReturnType( ~mat, scalar );
921  }
922 }
923 //*************************************************************************************************
924 
925 
926 
927 
928 //=================================================================================================
929 //
930 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
931 //
932 //=================================================================================================
933 
934 //*************************************************************************************************
947 template< typename MT // Type of the sparse matrix of the left-hand side expression
948  , typename ST1 // Type of the scalar of the left-hand side expression
949  , bool SO // Storage order of the sparse matrix
950  , typename ST2 // Type of the right-hand side scalar
952 inline decltype(auto) operator*( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
953 {
955 
956  return mat.leftOperand() * ( scalar / mat.rightOperand() );
957 }
959 //*************************************************************************************************
960 
961 
962 //*************************************************************************************************
975 template< typename ST1 // Type of the left-hand side scalar
976  , typename MT // Type of the sparse matrix of the right-hand side expression
977  , typename ST2 // Type of the scalar of the right-hand side expression
978  , bool SO // Storage order of the sparse matrix
979  , typename = EnableIf_< And< IsNumeric<ST1>, Or< IsInvertible<ST1>, IsInvertible<ST2> > > > >
980 inline decltype(auto) operator*( ST1 scalar, const SMatScalarDivExpr<MT,ST2,SO>& mat )
981 {
983 
984  return mat.leftOperand() * ( scalar / mat.rightOperand() );
985 }
987 //*************************************************************************************************
988 
989 
990 //*************************************************************************************************
1003 template< typename MT // Type of the sparse matrix of the left-hand side expression
1004  , typename ST1 // Type of the scalar of the left-hand side expression
1005  , bool SO // Storage order of the sparse matrix
1006  , typename ST2 // Type of the right-hand side scalar
1007  , typename = EnableIf_< IsNumeric<ST2> > >
1008 inline decltype(auto) operator/( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1009 {
1011 
1012  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1013 
1014  using MultType = MultTrait_<ST1,ST2>;
1015  using ReturnType = typename SMatScalarDivExprHelper<MT,MultType,SO>::Type;
1016  using ScalarType = RightOperand_<ReturnType>;
1017 
1019  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
1020  }
1021  else {
1022  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
1023  }
1024 }
1026 //*************************************************************************************************
1027 
1028 
1029 
1030 
1031 //=================================================================================================
1032 //
1033 // ROWS SPECIALIZATIONS
1034 //
1035 //=================================================================================================
1036 
1037 //*************************************************************************************************
1039 template< typename MT, typename ST, bool SO >
1040 struct Rows< SMatScalarDivExpr<MT,ST,SO> >
1041  : public Rows<MT>
1042 {};
1044 //*************************************************************************************************
1045 
1046 
1047 
1048 
1049 //=================================================================================================
1050 //
1051 // COLUMNS SPECIALIZATIONS
1052 //
1053 //=================================================================================================
1054 
1055 //*************************************************************************************************
1057 template< typename MT, typename ST, bool SO >
1058 struct Columns< SMatScalarDivExpr<MT,ST,SO> >
1059  : public Columns<MT>
1060 {};
1062 //*************************************************************************************************
1063 
1064 
1065 
1066 
1067 //=================================================================================================
1068 //
1069 // ISSYMMETRIC SPECIALIZATIONS
1070 //
1071 //=================================================================================================
1072 
1073 //*************************************************************************************************
1075 template< typename MT, typename ST, bool SO >
1076 struct IsSymmetric< SMatScalarDivExpr<MT,ST,SO> >
1077  : public BoolConstant< IsSymmetric<MT>::value >
1078 {};
1080 //*************************************************************************************************
1081 
1082 
1083 
1084 
1085 //=================================================================================================
1086 //
1087 // ISHERMITIAN SPECIALIZATIONS
1088 //
1089 //=================================================================================================
1090 
1091 //*************************************************************************************************
1093 template< typename MT, typename ST, bool SO >
1094 struct IsHermitian< SMatScalarDivExpr<MT,ST,SO> >
1095  : public BoolConstant< IsHermitian<MT>::value >
1096 {};
1098 //*************************************************************************************************
1099 
1100 
1101 
1102 
1103 //=================================================================================================
1104 //
1105 // ISLOWER SPECIALIZATIONS
1106 //
1107 //=================================================================================================
1108 
1109 //*************************************************************************************************
1111 template< typename MT, typename ST, bool SO >
1112 struct IsLower< SMatScalarDivExpr<MT,ST,SO> >
1113  : public BoolConstant< IsLower<MT>::value >
1114 {};
1116 //*************************************************************************************************
1117 
1118 
1119 
1120 
1121 //=================================================================================================
1122 //
1123 // ISSTRICTLYLOWER SPECIALIZATIONS
1124 //
1125 //=================================================================================================
1126 
1127 //*************************************************************************************************
1129 template< typename MT, typename ST, bool SO >
1130 struct IsStrictlyLower< SMatScalarDivExpr<MT,ST,SO> >
1131  : public BoolConstant< IsStrictlyLower<MT>::value >
1132 {};
1134 //*************************************************************************************************
1135 
1136 
1137 
1138 
1139 //=================================================================================================
1140 //
1141 // ISUPPER SPECIALIZATIONS
1142 //
1143 //=================================================================================================
1144 
1145 //*************************************************************************************************
1147 template< typename MT, typename ST, bool SO >
1148 struct IsUpper< SMatScalarDivExpr<MT,ST,SO> >
1149  : public BoolConstant< IsUpper<MT>::value >
1150 {};
1152 //*************************************************************************************************
1153 
1154 
1155 
1156 
1157 //=================================================================================================
1158 //
1159 // ISSTRICTLYUPPER SPECIALIZATIONS
1160 //
1161 //=================================================================================================
1162 
1163 //*************************************************************************************************
1165 template< typename MT, typename ST, bool SO >
1166 struct IsStrictlyUpper< SMatScalarDivExpr<MT,ST,SO> >
1167  : public BoolConstant< IsStrictlyUpper<MT>::value >
1168 {};
1170 //*************************************************************************************************
1171 
1172 } // namespace blaze
1173 
1174 #endif
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarDivExpr.h:313
Header file for the UnderlyingNumeric type trait.
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Data type constraint.
ConstIterator(IteratorType matrix, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SMatScalarDivExpr.h:221
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:253
Header file for the Rows 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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarDivExpr.h:510
Header file for basic type definitions.
Compile time check whether the given type is a multiplication expression template.This type trait class tests whether or not the given type Type is a multiplication expression template (i.e. an expression representing an element-wise vector multiplication, a matrix/vector multiplication, a vector/matrix multiplication, or a matrix multiplication). In order to qualify as a valid multiplication expression template, the given type has to derive publicly from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:97
decltype(auto) operator/(const DenseMatrix< MT, SO > &mat, ST scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:1073
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatScalarDivExpr.h:358
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
Header file for the serial shim.
#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
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SMatScalarDivExpr.h:176
Header file for the And class template.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatScalarDivExpr.h:406
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarDivExpr.h:188
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
Header file for the Computation base class.
Header file for the UnderlyingElement type trait.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarDivExpr.h:175
Header file for the RequiresEvaluation 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:78
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
If_< IsExpression< MT >, const MT, const MT &> LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:185
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
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.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatScalarDivExpr.h:498
Header file for the DivExprTrait class template.
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 ValueIndexPair class.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarDivExpr.h:263
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarDivExpr.h:465
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
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
Header file for the If class template.
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarDivExpr.h:133
Header file for the IsFloatingPoint type trait.
Iterator over the elements of the sparse matrix/scalar division expression.
Definition: SMatScalarDivExpr.h:194
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:284
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarDivExpr.h:486
Header file for the UnderlyingBuiltin type trait.
Header file for the IsMultExpr type trait class.
Header file for the Or class template.
#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 Columns type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:71
Header file for the IsLower type trait.
LeftOperand matrix_
Left-hand side sparse matrix of the division expression.
Definition: SMatScalarDivExpr.h:517
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatScalarDivExpr.h:386
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:243
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:314
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.
ReturnType_< MT > RN
Return type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:119
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarDivExpr.h:427
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
MultTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SMatScalarDivExpr.h:173
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarDivExpr.h:174
Header file for the IsNumeric type trait.
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatScalarDivExpr.h:439
Header file for run time assertion macros.
Utility type for generic codes.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:295
Header file for the division trait.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarDivExpr.h:416
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarDivExpr.h:232
Expression object for sparse matrix-scalar divisions.The SMatScalarMult class represents the compile ...
Definition: Forward.h:113
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
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatScalarDivExpr.h:375
SMatScalarDivExpr(const MT &matrix, ST scalar) noexcept
Constructor for the SMatScalarDivExpr class.
Definition: SMatScalarDivExpr.h:330
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#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
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarDivExpr.h:211
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsInvertible.h:83
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:202
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatScalarDivExpr.h:452
Header file for the RemoveReference type trait.
Header file for the IsInvertible type trait.
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
CompositeType_< MT > CT
Composite type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:120
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is a floating point data type...
Definition: FloatingPoint.h:81
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
ResultType_< MT > RT
Result type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:118
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatScalarDivExpr.h:396
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarDivExpr.h:476
typename DivExprTrait< T1, T2 >::Type DivExprTrait_
Auxiliary alias declaration for the DivExprTrait class template.The DivExprTrait_ alias declaration p...
Definition: DivExprTrait.h:112
Compile time logical or evaluation.The Or alias declaration performs at compile time a logical or (&#39;&&&#3...
Definition: Or.h:76
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarDivExpr.h:343
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SMatScalarDivExpr.h:179
Header file for the IntegralConstant class template.
Compile time evaluation of the number of columns of a matrix.The Columns type trait evaluates the num...
Definition: Columns.h:75
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:75
Header file for the IsComplex type trait.
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:518
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:383
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.
Header file for the MatScalarDivExpr base class.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarDivExpr.h:273
IfTrue_< useAssign, const ResultType, const SMatScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatScalarDivExpr.h:182
Header file for the IsHermitian type trait.
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarDivExpr.h:306
#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
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarDivExpr.h:204
Header file for the IsExpression type trait class.
Header file for the function trace functionality.