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>
74 #include <blaze/util/Assert.h>
78 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/mpl/And.h>
81 #include <blaze/util/mpl/If.h>
82 #include <blaze/util/mpl/Or.h>
83 #include <blaze/util/Types.h>
89 
90 
91 namespace blaze {
92 
93 //=================================================================================================
94 //
95 // CLASS SMATSCALARDIVEXPR
96 //
97 //=================================================================================================
98 
99 //*************************************************************************************************
106 template< typename MT // Type of the left-hand side sparse matrix
107  , typename ST // Type of the right-hand side scalar value
108  , bool SO > // Storage order
109 class SMatScalarDivExpr
110  : public MatScalarDivExpr< SparseMatrix< SMatScalarDivExpr<MT,ST,SO>, SO > >
111  , private Computation
112 {
113  private:
114  //**Type definitions****************************************************************************
115  using RT = ResultType_<MT>;
116  using RN = ReturnType_<MT>;
118  //**********************************************************************************************
119 
120  //**Return type evaluation**********************************************************************
122 
127  enum : bool { returnExpr = !IsTemporary<RN>::value };
128 
131  //**********************************************************************************************
132 
133  //**Serial evaluation strategy******************************************************************
135 
141  enum : bool { useAssign = RequiresEvaluation<MT>::value };
142 
144  template< typename MT2 >
146  struct UseAssign {
147  enum : bool { value = useAssign };
148  };
150  //**********************************************************************************************
151 
152  //**Parallel evaluation strategy****************************************************************
154 
160  template< typename MT2 >
161  struct UseSMPAssign {
162  enum : bool { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
163  };
165  //**********************************************************************************************
166 
167  public:
168  //**Type definitions****************************************************************************
174 
177 
180 
182  using LeftOperand = If_< IsExpression<MT>, const MT, const MT& >;
183 
185  using RightOperand = ST;
186  //**********************************************************************************************
187 
188  //**ConstIterator class definition**************************************************************
192  {
193  public:
194  //**Type definitions*************************************************************************
197 
200 
201  using IteratorCategory = std::forward_iterator_tag;
202  using ValueType = Element;
206 
207  // STL iterator requirements
213  //*******************************************************************************************
214 
215  //**Constructor******************************************************************************
218  inline ConstIterator( IteratorType matrix, RightOperand scalar )
219  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
220  , scalar_( scalar ) // Right-hand side scalar of the division expression
221  {}
222  //*******************************************************************************************
223 
224  //**Prefix increment operator****************************************************************
230  ++matrix_;
231  return *this;
232  }
233  //*******************************************************************************************
234 
235  //**Element access operator******************************************************************
240  inline const Element operator*() const {
241  return Element( matrix_->value() / scalar_, matrix_->index() );
242  }
243  //*******************************************************************************************
244 
245  //**Element access operator******************************************************************
250  inline const ConstIterator* operator->() const {
251  return this;
252  }
253  //*******************************************************************************************
254 
255  //**Value function***************************************************************************
260  inline ReturnType value() const {
261  return matrix_->value() / scalar_;
262  }
263  //*******************************************************************************************
264 
265  //**Index function***************************************************************************
270  inline size_t index() const {
271  return matrix_->index();
272  }
273  //*******************************************************************************************
274 
275  //**Equality operator************************************************************************
281  inline bool operator==( const ConstIterator& rhs ) const {
282  return matrix_ == rhs.matrix_;
283  }
284  //*******************************************************************************************
285 
286  //**Inequality operator**********************************************************************
292  inline bool operator!=( const ConstIterator& rhs ) const {
293  return matrix_ != rhs.matrix_;
294  }
295  //*******************************************************************************************
296 
297  //**Subtraction operator*********************************************************************
303  inline DifferenceType operator-( const ConstIterator& rhs ) const {
304  return matrix_ - rhs.matrix_;
305  }
306  //*******************************************************************************************
307 
308  private:
309  //**Member variables*************************************************************************
312  //*******************************************************************************************
313  };
314  //**********************************************************************************************
315 
316  //**Compilation flags***************************************************************************
318  enum : bool { smpAssignable = false };
319  //**********************************************************************************************
320 
321  //**Constructor*********************************************************************************
327  explicit inline SMatScalarDivExpr( const MT& matrix, ST scalar ) noexcept
328  : matrix_( matrix ) // Left-hand side sparse matrix of the division expression
329  , scalar_( scalar ) // Right-hand side scalar of the division expression
330  {}
331  //**********************************************************************************************
332 
333  //**Access operator*****************************************************************************
340  inline ReturnType operator()( size_t i, size_t j ) const {
341  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
342  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
343  return matrix_(i,j) / scalar_;
344  }
345  //**********************************************************************************************
346 
347  //**At function*********************************************************************************
355  inline ReturnType at( size_t i, size_t j ) const {
356  if( i >= matrix_.rows() ) {
357  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
358  }
359  if( j >= matrix_.columns() ) {
360  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
361  }
362  return (*this)(i,j);
363  }
364  //**********************************************************************************************
365 
366  //**Begin function******************************************************************************
372  inline ConstIterator begin( size_t i ) const {
373  return ConstIterator( matrix_.begin(i), scalar_ );
374  }
375  //**********************************************************************************************
376 
377  //**End function********************************************************************************
383  inline ConstIterator end( size_t i ) const {
384  return ConstIterator( matrix_.end(i), scalar_ );
385  }
386  //**********************************************************************************************
387 
388  //**Rows function*******************************************************************************
393  inline size_t rows() const noexcept {
394  return matrix_.rows();
395  }
396  //**********************************************************************************************
397 
398  //**Columns function****************************************************************************
403  inline size_t columns() const noexcept {
404  return matrix_.columns();
405  }
406  //**********************************************************************************************
407 
408  //**NonZeros function***************************************************************************
413  inline size_t nonZeros() const {
414  return matrix_.nonZeros();
415  }
416  //**********************************************************************************************
417 
418  //**NonZeros function***************************************************************************
424  inline size_t nonZeros( size_t i ) const {
425  return matrix_.nonZeros(i);
426  }
427  //**********************************************************************************************
428 
429  //**Find function*******************************************************************************
436  inline ConstIterator find( size_t i, size_t j ) const {
438  return ConstIterator( matrix_.find( i, j ), scalar_ );
439  }
440  //**********************************************************************************************
441 
442  //**LowerBound function*************************************************************************
449  inline ConstIterator lowerBound( size_t i, size_t j ) const {
451  return ConstIterator( matrix_.lowerBound( i, j ), scalar_ );
452  }
453  //**********************************************************************************************
454 
455  //**UpperBound function*************************************************************************
462  inline ConstIterator upperBound( size_t i, size_t j ) const {
464  return ConstIterator( matrix_.upperBound( i, j ), scalar_ );
465  }
466  //**********************************************************************************************
467 
468  //**Left operand access*************************************************************************
473  inline LeftOperand leftOperand() const noexcept {
474  return matrix_;
475  }
476  //**********************************************************************************************
477 
478  //**Right operand access************************************************************************
483  inline RightOperand rightOperand() const noexcept {
484  return scalar_;
485  }
486  //**********************************************************************************************
487 
488  //**********************************************************************************************
494  template< typename T >
495  inline bool canAlias( const T* alias ) const noexcept {
496  return matrix_.canAlias( alias );
497  }
498  //**********************************************************************************************
499 
500  //**********************************************************************************************
506  template< typename T >
507  inline bool isAliased( const T* alias ) const noexcept {
508  return matrix_.isAliased( alias );
509  }
510  //**********************************************************************************************
511 
512  private:
513  //**Member variables****************************************************************************
516  //**********************************************************************************************
517 
518  //**Assignment to dense matrices****************************************************************
532  template< typename MT2 // Type of the target dense matrix
533  , bool SO2 > // Storage order of the target dense matrix
534  friend inline EnableIf_< UseAssign<MT2> >
535  assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
536  {
538 
539  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
540  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
541 
542  assign( ~lhs, rhs.matrix_ );
543  (~lhs) /= rhs.scalar_;
544  }
546  //**********************************************************************************************
547 
548  //**Assignment to sparse matrices***************************************************************
562  template< typename MT2 // Type of the target sparse matrix
563  , bool SO2 > // Storage order of the target sparse matrix
564  friend inline EnableIf_< UseAssign<MT2> >
565  assign( SparseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
566  {
568 
569  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
570  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
571 
572  assign( ~lhs, rhs.matrix_ );
573  (~lhs) /= rhs.scalar_;
574  }
576  //**********************************************************************************************
577 
578  //**Addition assignment to dense matrices*******************************************************
592  template< typename MT2 // Type of the target dense matrix
593  , bool SO2 > // Storage order of the target dense matrix
594  friend inline EnableIf_< UseAssign<MT2> >
595  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
596  {
598 
601 
602  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
603  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
604 
605  const ResultType tmp( serial( rhs ) );
606  addAssign( ~lhs, tmp );
607  }
609  //**********************************************************************************************
610 
611  //**Addition assignment to sparse matrices******************************************************
612  // No special implementation for the addition assignment to sparse matrices.
613  //**********************************************************************************************
614 
615  //**Subtraction assignment to dense matrices****************************************************
629  template< typename MT2 // Type of the target dense matrix
630  , bool SO2 > // Storage order of the target dense matrix
631  friend inline EnableIf_< UseAssign<MT2> >
632  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
633  {
635 
638 
639  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
640  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
641 
642  const ResultType tmp( serial( rhs ) );
643  subAssign( ~lhs, tmp );
644  }
646  //**********************************************************************************************
647 
648  //**Subtraction assignment to sparse matrices***************************************************
649  // No special implementation for the subtraction assignment to sparse matrices.
650  //**********************************************************************************************
651 
652  //**Schur product assignment to dense matrices**************************************************
666  template< typename MT2 // Type of the target dense matrix
667  , bool SO2 > // Storage order of the target dense matrix
668  friend inline EnableIf_< UseAssign<MT2> >
669  schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
670  {
672 
675 
676  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
677  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
678 
679  const ResultType tmp( serial( rhs ) );
680  schurAssign( ~lhs, tmp );
681  }
683  //**********************************************************************************************
684 
685  //**Schur product assignment to sparse matrices*************************************************
686  // No special implementation for the Schur product assignment to sparse matrices.
687  //**********************************************************************************************
688 
689  //**Multiplication assignment to dense matrices*************************************************
690  // No special implementation for the multiplication assignment to dense matrices.
691  //**********************************************************************************************
692 
693  //**Multiplication assignment to sparse matrices************************************************
694  // No special implementation for the multiplication assignment to sparse matrices.
695  //**********************************************************************************************
696 
697  //**SMP assignment to dense matrices************************************************************
698  // No special implementation for the SMP assignment to dense matrices.
699  //**********************************************************************************************
700 
701  //**SMP assignment to sparse matrices***********************************************************
702  // No special implementation for the SMP assignment to sparse matrices.
703  //**********************************************************************************************
704 
705  //**SMP addition assignment to dense matrices***************************************************
719  template< typename MT2 // Type of the target dense matrix
720  , bool SO2 > // Storage order of the target dense matrix
721  friend inline EnableIf_< UseSMPAssign<MT2> >
722  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
723  {
725 
728 
729  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
730  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
731 
732  const ResultType tmp( rhs );
733  smpAddAssign( ~lhs, tmp );
734  }
736  //**********************************************************************************************
737 
738  //**SMP addition assignment to sparse matrices**************************************************
739  // No special implementation for the SMP addition assignment to sparse matrices.
740  //**********************************************************************************************
741 
742  //**SMP subtraction assignment to dense matrices************************************************
756  template< typename MT2 // Type of the target dense matrix
757  , bool SO2 > // Storage order of the target dense matrix
758  friend inline EnableIf_< UseSMPAssign<MT2> >
759  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
760  {
762 
765 
766  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
767  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
768 
769  const ResultType tmp( rhs );
770  smpSubAssign( ~lhs, tmp );
771  }
773  //**********************************************************************************************
774 
775  //**SMP subtraction assignment to sparse matrices***********************************************
776  // No special implementation for the SMP subtraction assignment to sparse matrices.
777  //**********************************************************************************************
778 
779  //**SMP Schur product assignment to dense matrices**********************************************
793  template< typename MT2 // Type of the target dense matrix
794  , bool SO2 > // Storage order of the target dense matrix
795  friend inline EnableIf_< UseSMPAssign<MT2> >
796  smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
797  {
799 
802 
803  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
804  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
805 
806  const ResultType tmp( rhs );
807  smpSchurAssign( ~lhs, tmp );
808  }
810  //**********************************************************************************************
811 
812  //**SMP Schur product assignment to sparse matrices*********************************************
813  // No special implementation for the SMP Schur product assignment to sparse matrices.
814  //**********************************************************************************************
815 
816  //**Multiplication assignment to dense matrices*************************************************
817  // No special implementation for the SMP multiplication assignment to dense matrices.
818  //**********************************************************************************************
819 
820  //**SMP multiplication assignment to sparse matrices********************************************
821  // No special implementation for the SMP multiplication assignment to sparse matrices.
822  //**********************************************************************************************
823 
824  //**Compile time checks*************************************************************************
833  //**********************************************************************************************
834 };
835 //*************************************************************************************************
836 
837 
838 
839 
840 //=================================================================================================
841 //
842 // GLOBAL BINARY ARITHMETIC OPERATORS
843 //
844 //=================================================================================================
845 
846 //*************************************************************************************************
851 template< typename MT // Type of the left-hand side sparse matrix
852  , typename ST // Type of the right-hand side scalar
853  , bool SO > // Storage order
854 struct SMatScalarDivExprHelper
855 {
856  private:
857  //**********************************************************************************************
858  using ScalarType = If_< Or< IsFloatingPoint< UnderlyingBuiltin_<MT> >
859  , IsFloatingPoint< UnderlyingBuiltin_<ST> > >
860  , If_< And< IsComplex< UnderlyingNumeric_<MT> >
861  , IsBuiltin<ST> >
862  , DivTrait_< UnderlyingBuiltin_<MT>, ST >
863  , DivTrait_< UnderlyingNumeric_<MT>, ST > >
864  , ST >;
865  //**********************************************************************************************
866 
867  public:
868  //**********************************************************************************************
869  using Type = If_< IsInvertible<ScalarType>
870  , SMatScalarMultExpr<MT,ScalarType,SO>
871  , SMatScalarDivExpr<MT,ScalarType,SO> >;
872  //**********************************************************************************************
873 };
875 //*************************************************************************************************
876 
877 
878 //*************************************************************************************************
900 template< typename MT // Type of the left-hand side sparse matrix
901  , bool SO // Storage order of the left-hand side sparse matrix
902  , typename ST // Type of the right-hand side scalar
903  , typename = EnableIf_< IsNumeric<ST> > >
904 inline decltype(auto) operator/( const SparseMatrix<MT,SO>& mat, ST scalar )
905 {
907 
908  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
909 
910  using ReturnType = typename SMatScalarDivExprHelper<MT,ST,SO>::Type;
911  using ScalarType = RightOperand_<ReturnType>;
912 
914  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
915  }
916  else {
917  return ReturnType( ~mat, scalar );
918  }
919 }
920 //*************************************************************************************************
921 
922 
923 
924 
925 //=================================================================================================
926 //
927 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
928 //
929 //=================================================================================================
930 
931 //*************************************************************************************************
944 template< typename MT // Type of the sparse matrix of the left-hand side expression
945  , typename ST1 // Type of the scalar of the left-hand side expression
946  , bool SO // Storage order of the sparse matrix
947  , typename ST2 // Type of the right-hand side scalar
949 inline decltype(auto) operator*( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
950 {
952 
953  return mat.leftOperand() * ( scalar / mat.rightOperand() );
954 }
956 //*************************************************************************************************
957 
958 
959 //*************************************************************************************************
972 template< typename ST1 // Type of the left-hand side scalar
973  , typename MT // Type of the sparse matrix of the right-hand side expression
974  , typename ST2 // Type of the scalar of the right-hand side expression
975  , bool SO // Storage order of the sparse matrix
976  , typename = EnableIf_< And< IsNumeric<ST1>, Or< IsInvertible<ST1>, IsInvertible<ST2> > > > >
977 inline decltype(auto) operator*( ST1 scalar, const SMatScalarDivExpr<MT,ST2,SO>& mat )
978 {
980 
981  return mat.leftOperand() * ( scalar / mat.rightOperand() );
982 }
984 //*************************************************************************************************
985 
986 
987 //*************************************************************************************************
1000 template< typename MT // Type of the sparse matrix of the left-hand side expression
1001  , typename ST1 // Type of the scalar of the left-hand side expression
1002  , bool SO // Storage order of the sparse matrix
1003  , typename ST2 // Type of the right-hand side scalar
1004  , typename = EnableIf_< IsNumeric<ST2> > >
1005 inline decltype(auto) operator/( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1006 {
1008 
1009  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1010 
1011  using MultType = MultTrait_<ST1,ST2>;
1012  using ReturnType = typename SMatScalarDivExprHelper<MT,MultType,SO>::Type;
1013  using ScalarType = RightOperand_<ReturnType>;
1014 
1016  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
1017  }
1018  else {
1019  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
1020  }
1021 }
1023 //*************************************************************************************************
1024 
1025 
1026 
1027 
1028 //=================================================================================================
1029 //
1030 // SIZE SPECIALIZATIONS
1031 //
1032 //=================================================================================================
1033 
1034 //*************************************************************************************************
1036 template< typename MT, typename ST, bool SO >
1037 struct Size< SMatScalarDivExpr<MT,ST,SO>, 0UL >
1038  : public Size<MT,0UL>
1039 {};
1040 
1041 template< typename MT, typename ST, bool SO >
1042 struct Size< SMatScalarDivExpr<MT,ST,SO>, 1UL >
1043  : public Size<MT,1UL>
1044 {};
1046 //*************************************************************************************************
1047 
1048 
1049 
1050 
1051 //=================================================================================================
1052 //
1053 // ISSYMMETRIC SPECIALIZATIONS
1054 //
1055 //=================================================================================================
1056 
1057 //*************************************************************************************************
1059 template< typename MT, typename ST, bool SO >
1060 struct IsSymmetric< SMatScalarDivExpr<MT,ST,SO> >
1061  : public IsSymmetric<MT>
1062 {};
1064 //*************************************************************************************************
1065 
1066 
1067 
1068 
1069 //=================================================================================================
1070 //
1071 // ISHERMITIAN SPECIALIZATIONS
1072 //
1073 //=================================================================================================
1074 
1075 //*************************************************************************************************
1077 template< typename MT, typename ST, bool SO >
1078 struct IsHermitian< SMatScalarDivExpr<MT,ST,SO> >
1079  : public IsHermitian<MT>
1080 {};
1082 //*************************************************************************************************
1083 
1084 
1085 
1086 
1087 //=================================================================================================
1088 //
1089 // ISLOWER SPECIALIZATIONS
1090 //
1091 //=================================================================================================
1092 
1093 //*************************************************************************************************
1095 template< typename MT, typename ST, bool SO >
1096 struct IsLower< SMatScalarDivExpr<MT,ST,SO> >
1097  : public IsLower<MT>
1098 {};
1100 //*************************************************************************************************
1101 
1102 
1103 
1104 
1105 //=================================================================================================
1106 //
1107 // ISSTRICTLYLOWER SPECIALIZATIONS
1108 //
1109 //=================================================================================================
1110 
1111 //*************************************************************************************************
1113 template< typename MT, typename ST, bool SO >
1114 struct IsStrictlyLower< SMatScalarDivExpr<MT,ST,SO> >
1115  : public IsStrictlyLower<MT>
1116 {};
1118 //*************************************************************************************************
1119 
1120 
1121 
1122 
1123 //=================================================================================================
1124 //
1125 // ISUPPER SPECIALIZATIONS
1126 //
1127 //=================================================================================================
1128 
1129 //*************************************************************************************************
1131 template< typename MT, typename ST, bool SO >
1132 struct IsUpper< SMatScalarDivExpr<MT,ST,SO> >
1133  : public IsUpper<MT>
1134 {};
1136 //*************************************************************************************************
1137 
1138 
1139 
1140 
1141 //=================================================================================================
1142 //
1143 // ISSTRICTLYUPPER SPECIALIZATIONS
1144 //
1145 //=================================================================================================
1146 
1147 //*************************************************************************************************
1149 template< typename MT, typename ST, bool SO >
1150 struct IsStrictlyUpper< SMatScalarDivExpr<MT,ST,SO> >
1151  : public IsStrictlyUpper<MT>
1152 {};
1154 //*************************************************************************************************
1155 
1156 } // namespace blaze
1157 
1158 #endif
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarDivExpr.h:310
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:218
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:69
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:250
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:507
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:1070
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatScalarDivExpr.h:355
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
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SMatScalarDivExpr.h:173
Header file for the And class template.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatScalarDivExpr.h:403
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarDivExpr.h:185
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
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:87
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarDivExpr.h:172
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:80
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:182
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:495
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:71
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:260
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarDivExpr.h:462
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:58
Header file for the If class template.
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarDivExpr.h:130
Header file for the IsFloatingPoint type trait.
Iterator over the elements of the sparse matrix/scalar division expression.
Definition: SMatScalarDivExpr.h:191
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:281
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarDivExpr.h:483
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
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_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:514
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatScalarDivExpr.h:383
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:240
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:311
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:116
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:424
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:170
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarDivExpr.h:171
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:436
Header file for run time assertion macros.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:292
Header file for the division trait.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarDivExpr.h:413
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarDivExpr.h:229
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:372
SMatScalarDivExpr(const MT &matrix, ST scalar) noexcept
Constructor for the SMatScalarDivExpr class.
Definition: SMatScalarDivExpr.h:327
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:208
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:82
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:199
#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:449
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:117
#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:3080
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:115
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:393
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:473
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 &#39;or&#39; evaluation.The Or alias declaration performs at compile time a logical &#39;or&#39;...
Definition: Or.h:76
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarDivExpr.h:340
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SMatScalarDivExpr.h:176
Header file for the IsComplex type trait.
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:515
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:270
IfTrue_< useAssign, const ResultType, const SMatScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatScalarDivExpr.h:179
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:303
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarDivExpr.h:201
Header file for the IsExpression type trait class.
Header file for the function trace functionality.