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 <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
69 #include <blaze/util/Assert.h>
73 #include <blaze/util/DisableIf.h>
74 #include <blaze/util/EnableIf.h>
76 #include <blaze/util/mpl/If.h>
77 #include <blaze/util/Types.h>
83 #include <blaze/util/Unused.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS SMATSCALARDIVEXPR
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
101 template< typename MT // Type of the left-hand side sparse matrix
102  , typename ST // Type of the right-hand side scalar value
103  , bool SO > // Storage order
104 class SMatScalarDivExpr
105  : public MatScalarDivExpr< SparseMatrix< SMatScalarDivExpr<MT,ST,SO>, SO > >
106  , private Computation
107 {
108  private:
109  //**Type definitions****************************************************************************
113  //**********************************************************************************************
114 
115  //**Return type evaluation**********************************************************************
117 
122  static constexpr bool returnExpr = !IsTemporary_v<RN>;
123 
125  using ExprReturnType = decltype( std::declval<RN>() / std::declval<ST>() );
126  //**********************************************************************************************
127 
128  //**Serial evaluation strategy******************************************************************
130 
136  static constexpr bool useAssign = RequiresEvaluation_v<MT>;
137 
139  template< typename MT2 >
141  static constexpr bool UseAssign_v = useAssign;
143  //**********************************************************************************************
144 
145  //**Parallel evaluation strategy****************************************************************
147 
153  template< typename MT2 >
154  static constexpr bool UseSMPAssign_v =
157  //**********************************************************************************************
158 
159  public:
160  //**Type definitions****************************************************************************
167 
170 
173 
175  using LeftOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
176 
178  using RightOperand = ST;
179  //**********************************************************************************************
180 
181  //**ConstIterator class definition**************************************************************
185  {
186  public:
187  //**Type definitions*************************************************************************
190 
193 
194  using IteratorCategory = std::forward_iterator_tag;
195  using ValueType = Element;
199 
200  // STL iterator requirements
206  //*******************************************************************************************
207 
208  //**Constructor******************************************************************************
211  inline ConstIterator( IteratorType matrix, RightOperand scalar )
212  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
213  , scalar_( scalar ) // Right-hand side scalar of the division expression
214  {}
215  //*******************************************************************************************
216 
217  //**Prefix increment operator****************************************************************
223  ++matrix_;
224  return *this;
225  }
226  //*******************************************************************************************
227 
228  //**Element access operator******************************************************************
233  inline const Element operator*() const {
234  return Element( matrix_->value() / scalar_, matrix_->index() );
235  }
236  //*******************************************************************************************
237 
238  //**Element access operator******************************************************************
243  inline const ConstIterator* operator->() const {
244  return this;
245  }
246  //*******************************************************************************************
247 
248  //**Value function***************************************************************************
253  inline ReturnType value() const {
254  return matrix_->value() / scalar_;
255  }
256  //*******************************************************************************************
257 
258  //**Index function***************************************************************************
263  inline size_t index() const {
264  return matrix_->index();
265  }
266  //*******************************************************************************************
267 
268  //**Equality operator************************************************************************
274  inline bool operator==( const ConstIterator& rhs ) const {
275  return matrix_ == rhs.matrix_;
276  }
277  //*******************************************************************************************
278 
279  //**Inequality operator**********************************************************************
285  inline bool operator!=( const ConstIterator& rhs ) const {
286  return matrix_ != rhs.matrix_;
287  }
288  //*******************************************************************************************
289 
290  //**Subtraction operator*********************************************************************
296  inline DifferenceType operator-( const ConstIterator& rhs ) const {
297  return matrix_ - rhs.matrix_;
298  }
299  //*******************************************************************************************
300 
301  private:
302  //**Member variables*************************************************************************
305  //*******************************************************************************************
306  };
307  //**********************************************************************************************
308 
309  //**Compilation flags***************************************************************************
311  static constexpr bool smpAssignable = false;
312  //**********************************************************************************************
313 
314  //**Constructor*********************************************************************************
320  explicit inline SMatScalarDivExpr( const MT& matrix, ST scalar ) noexcept
321  : matrix_( matrix ) // Left-hand side sparse matrix of the division expression
322  , scalar_( scalar ) // Right-hand side scalar of the division expression
323  {}
324  //**********************************************************************************************
325 
326  //**Access operator*****************************************************************************
333  inline ReturnType operator()( size_t i, size_t j ) const {
334  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
335  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
336  return matrix_(i,j) / scalar_;
337  }
338  //**********************************************************************************************
339 
340  //**At function*********************************************************************************
348  inline ReturnType at( size_t i, size_t j ) const {
349  if( i >= matrix_.rows() ) {
350  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
351  }
352  if( j >= matrix_.columns() ) {
353  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
354  }
355  return (*this)(i,j);
356  }
357  //**********************************************************************************************
358 
359  //**Begin function******************************************************************************
365  inline ConstIterator begin( size_t i ) const {
366  return ConstIterator( matrix_.begin(i), scalar_ );
367  }
368  //**********************************************************************************************
369 
370  //**End function********************************************************************************
376  inline ConstIterator end( size_t i ) const {
377  return ConstIterator( matrix_.end(i), scalar_ );
378  }
379  //**********************************************************************************************
380 
381  //**Rows function*******************************************************************************
386  inline size_t rows() const noexcept {
387  return matrix_.rows();
388  }
389  //**********************************************************************************************
390 
391  //**Columns function****************************************************************************
396  inline size_t columns() const noexcept {
397  return matrix_.columns();
398  }
399  //**********************************************************************************************
400 
401  //**NonZeros function***************************************************************************
406  inline size_t nonZeros() const {
407  return matrix_.nonZeros();
408  }
409  //**********************************************************************************************
410 
411  //**NonZeros function***************************************************************************
417  inline size_t nonZeros( size_t i ) const {
418  return matrix_.nonZeros(i);
419  }
420  //**********************************************************************************************
421 
422  //**Find function*******************************************************************************
429  inline ConstIterator find( size_t i, size_t j ) const {
431  return ConstIterator( matrix_.find( i, j ), scalar_ );
432  }
433  //**********************************************************************************************
434 
435  //**LowerBound function*************************************************************************
442  inline ConstIterator lowerBound( size_t i, size_t j ) const {
444  return ConstIterator( matrix_.lowerBound( i, j ), scalar_ );
445  }
446  //**********************************************************************************************
447 
448  //**UpperBound function*************************************************************************
455  inline ConstIterator upperBound( size_t i, size_t j ) const {
457  return ConstIterator( matrix_.upperBound( i, j ), scalar_ );
458  }
459  //**********************************************************************************************
460 
461  //**Left operand access*************************************************************************
466  inline LeftOperand leftOperand() const noexcept {
467  return matrix_;
468  }
469  //**********************************************************************************************
470 
471  //**Right operand access************************************************************************
476  inline RightOperand rightOperand() const noexcept {
477  return scalar_;
478  }
479  //**********************************************************************************************
480 
481  //**********************************************************************************************
487  template< typename T >
488  inline bool canAlias( const T* alias ) const noexcept {
489  return matrix_.canAlias( alias );
490  }
491  //**********************************************************************************************
492 
493  //**********************************************************************************************
499  template< typename T >
500  inline bool isAliased( const T* alias ) const noexcept {
501  return matrix_.isAliased( alias );
502  }
503  //**********************************************************************************************
504 
505  private:
506  //**Member variables****************************************************************************
509  //**********************************************************************************************
510 
511  //**Assignment to dense matrices****************************************************************
525  template< typename MT2 // Type of the target dense matrix
526  , bool SO2 > // Storage order of the target dense matrix
527  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
529  {
531 
532  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
533  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
534 
535  assign( ~lhs, rhs.matrix_ );
536  (~lhs) /= rhs.scalar_;
537  }
539  //**********************************************************************************************
540 
541  //**Assignment to sparse matrices***************************************************************
555  template< typename MT2 // Type of the target sparse matrix
556  , bool SO2 > // Storage order of the target sparse matrix
557  friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
559  {
561 
562  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
563  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
564 
565  assign( ~lhs, rhs.matrix_ );
566  (~lhs) /= rhs.scalar_;
567  }
569  //**********************************************************************************************
570 
571  //**Addition assignment to dense matrices*******************************************************
585  template< typename MT2 // Type of the target dense matrix
586  , bool SO2 > // Storage order of the target dense matrix
587  friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
588  -> EnableIf_t< UseAssign_v<MT2> >
589  {
591 
594 
595  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
596  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
597 
598  const ResultType tmp( serial( rhs ) );
599  addAssign( ~lhs, tmp );
600  }
602  //**********************************************************************************************
603 
604  //**Addition assignment to sparse matrices******************************************************
605  // No special implementation for the addition assignment to sparse matrices.
606  //**********************************************************************************************
607 
608  //**Subtraction assignment to dense matrices****************************************************
622  template< typename MT2 // Type of the target dense matrix
623  , bool SO2 > // Storage order of the target dense matrix
624  friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
625  -> EnableIf_t< UseAssign_v<MT2> >
626  {
628 
631 
632  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
633  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
634 
635  const ResultType tmp( serial( rhs ) );
636  subAssign( ~lhs, tmp );
637  }
639  //**********************************************************************************************
640 
641  //**Subtraction assignment to sparse matrices***************************************************
642  // No special implementation for the subtraction assignment to sparse matrices.
643  //**********************************************************************************************
644 
645  //**Schur product assignment to dense matrices**************************************************
659  template< typename MT2 // Type of the target dense matrix
660  , bool SO2 > // Storage order of the target dense matrix
661  friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
662  -> EnableIf_t< UseAssign_v<MT2> >
663  {
665 
668 
669  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
670  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
671 
672  const ResultType tmp( serial( rhs ) );
673  schurAssign( ~lhs, tmp );
674  }
676  //**********************************************************************************************
677 
678  //**Schur product assignment to sparse matrices*************************************************
679  // No special implementation for the Schur product assignment to sparse matrices.
680  //**********************************************************************************************
681 
682  //**Multiplication assignment to dense matrices*************************************************
683  // No special implementation for the multiplication assignment to dense matrices.
684  //**********************************************************************************************
685 
686  //**Multiplication assignment to sparse matrices************************************************
687  // No special implementation for the multiplication assignment to sparse matrices.
688  //**********************************************************************************************
689 
690  //**SMP assignment to dense matrices************************************************************
691  // No special implementation for the SMP assignment to dense matrices.
692  //**********************************************************************************************
693 
694  //**SMP assignment to sparse matrices***********************************************************
695  // No special implementation for the SMP assignment to sparse matrices.
696  //**********************************************************************************************
697 
698  //**SMP addition assignment to dense matrices***************************************************
712  template< typename MT2 // Type of the target dense matrix
713  , bool SO2 > // Storage order of the target dense matrix
714  friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
715  -> EnableIf_t< UseSMPAssign_v<MT2> >
716  {
718 
721 
722  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
723  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
724 
725  const ResultType tmp( rhs );
726  smpAddAssign( ~lhs, tmp );
727  }
729  //**********************************************************************************************
730 
731  //**SMP addition assignment to sparse matrices**************************************************
732  // No special implementation for the SMP addition assignment to sparse matrices.
733  //**********************************************************************************************
734 
735  //**SMP subtraction assignment to dense matrices************************************************
749  template< typename MT2 // Type of the target dense matrix
750  , bool SO2 > // Storage order of the target dense matrix
751  friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
752  -> EnableIf_t< UseSMPAssign_v<MT2> >
753  {
755 
758 
759  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
760  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
761 
762  const ResultType tmp( rhs );
763  smpSubAssign( ~lhs, tmp );
764  }
766  //**********************************************************************************************
767 
768  //**SMP subtraction assignment to sparse matrices***********************************************
769  // No special implementation for the SMP subtraction assignment to sparse matrices.
770  //**********************************************************************************************
771 
772  //**SMP Schur product assignment to dense matrices**********************************************
786  template< typename MT2 // Type of the target dense matrix
787  , bool SO2 > // Storage order of the target dense matrix
788  friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
789  -> EnableIf_t< UseSMPAssign_v<MT2> >
790  {
792 
795 
796  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
797  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
798 
799  const ResultType tmp( rhs );
800  smpSchurAssign( ~lhs, tmp );
801  }
803  //**********************************************************************************************
804 
805  //**SMP Schur product assignment to sparse matrices*********************************************
806  // No special implementation for the SMP Schur product assignment to sparse matrices.
807  //**********************************************************************************************
808 
809  //**Multiplication assignment to dense matrices*************************************************
810  // No special implementation for the SMP multiplication assignment to dense matrices.
811  //**********************************************************************************************
812 
813  //**SMP multiplication assignment to sparse matrices********************************************
814  // No special implementation for the SMP multiplication assignment to sparse matrices.
815  //**********************************************************************************************
816 
817  //**Compile time checks*************************************************************************
827  //**********************************************************************************************
828 };
829 //*************************************************************************************************
830 
831 
832 
833 
834 //=================================================================================================
835 //
836 // GLOBAL BINARY ARITHMETIC OPERATORS
837 //
838 //=================================================================================================
839 
840 //*************************************************************************************************
845 template< typename MT // Type of the left-hand side sparse matrix
846  , typename ST // Type of the right-hand side scalar
847  , bool SO > // Storage order
848 struct SMatScalarDivExprHelper
849 {
850  private:
851  //**********************************************************************************************
852  using ScalarType = If_t< IsFloatingPoint_v< UnderlyingBuiltin_t<MT> > ||
853  IsFloatingPoint_v< UnderlyingBuiltin_t<ST> >
854  , If_t< IsComplex_v< UnderlyingNumeric_t<MT> > && IsBuiltin_v<ST>
855  , DivTrait_t< UnderlyingBuiltin_t<MT>, ST >
856  , DivTrait_t< UnderlyingNumeric_t<MT>, ST > >
857  , ST >;
858  //**********************************************************************************************
859 
860  public:
861  //**********************************************************************************************
862  using Type = If_t< IsInvertible_v<ScalarType>
863  , SMatScalarMultExpr<MT,ScalarType,SO>
864  , SMatScalarDivExpr<MT,ScalarType,SO> >;
865  //**********************************************************************************************
866 };
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
884 template< typename MT // Type of the left-hand side sparse matrix
885  , bool SO // Storage order of the left-hand side sparse matrix
886  , typename ST // Type of the right-hand side scalar
887  , DisableIf_t< IsZero_v<MT> >* = nullptr >
888 inline const typename SMatScalarDivExprHelper<MT,ST,SO>::Type
889  smatscalardiv( const SparseMatrix<MT,SO>& mat, ST scalar )
890 {
892 
893  using ReturnType = typename SMatScalarDivExprHelper<MT,ST,SO>::Type;
894  using ScalarType = RightOperand_t<ReturnType>;
895 
896  if( IsMultExpr_v<ReturnType> ) {
897  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
898  }
899  else {
900  return ReturnType( ~mat, scalar );
901  }
902 }
904 //*************************************************************************************************
905 
906 
907 //*************************************************************************************************
920 template< typename MT // Type of the left-hand side sparse matrix
921  , bool SO // Storage order of the left-hand side zero matrix
922  , typename ST // Type of the right-hand side scalar
923  , EnableIf_t< IsZero_v<MT> >* = nullptr >
924 inline decltype(auto)
925  smatscalardiv( const SparseMatrix<MT,SO>& mat, ST scalar )
926 {
928 
929  UNUSED_PARAMETER( scalar );
930 
931  using ReturnType = const DivTrait_t< ResultType_t<MT>, ST >;
932 
935 
936  return ReturnType( (~mat).rows(), (~mat).columns() );
937 }
939 //*************************************************************************************************
940 
941 
942 //*************************************************************************************************
964 template< typename MT // Type of the left-hand side sparse matrix
965  , bool SO // Storage order of the left-hand side sparse matrix
966  , typename ST // Type of the right-hand side scalar
967  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
968 inline decltype(auto) operator/( const SparseMatrix<MT,SO>& mat, ST scalar )
969 {
971 
972  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
973 
974  return smatscalardiv( ~mat, scalar );
975 }
976 //*************************************************************************************************
977 
978 
979 
980 
981 //=================================================================================================
982 //
983 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
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  , EnableIf_t< IsNumeric_v<ST2> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
1005 inline decltype(auto) operator*( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1006 {
1008 
1009  return mat.leftOperand() * ( scalar / mat.rightOperand() );
1010 }
1012 //*************************************************************************************************
1013 
1014 
1015 //*************************************************************************************************
1028 template< typename ST1 // Type of the left-hand side scalar
1029  , typename MT // Type of the sparse matrix of the right-hand side expression
1030  , typename ST2 // Type of the scalar of the right-hand side expression
1031  , bool SO // Storage order of the sparse matrix
1032  , EnableIf_t< IsNumeric_v<ST1> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
1033 inline decltype(auto) operator*( ST1 scalar, const SMatScalarDivExpr<MT,ST2,SO>& mat )
1034 {
1036 
1037  return mat.leftOperand() * ( scalar / mat.rightOperand() );
1038 }
1040 //*************************************************************************************************
1041 
1042 
1043 //*************************************************************************************************
1056 template< typename MT // Type of the sparse matrix of the left-hand side expression
1057  , typename ST1 // Type of the scalar of the left-hand side expression
1058  , bool SO // Storage order of the sparse matrix
1059  , typename ST2 // Type of the right-hand side scalar
1060  , EnableIf_t< IsNumeric_v<ST2> >* = nullptr >
1061 inline decltype(auto) operator/( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1062 {
1064 
1065  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1066 
1067  using MultType = MultTrait_t<ST1,ST2>;
1068  using ReturnType = typename SMatScalarDivExprHelper<MT,MultType,SO>::Type;
1069  using ScalarType = RightOperand_t<ReturnType>;
1070 
1071  if( IsMultExpr_v<ReturnType> ) {
1072  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
1073  }
1074  else {
1075  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
1076  }
1077 }
1079 //*************************************************************************************************
1080 
1081 } // namespace blaze
1082 
1083 #endif
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarDivExpr.h:303
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:211
Constraint on the data type.
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:110
#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
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:243
Header file for the UNUSED_PARAMETER function template.
ReturnType_t< MT > RN
Return type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:111
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarDivExpr.h:500
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatScalarDivExpr.h:348
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
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
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarDivExpr.h:164
Constraint on the data type.
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SMatScalarDivExpr.h:169
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatScalarDivExpr.h:396
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarDivExpr.h:178
Header file for the Computation base class.
MultTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SMatScalarDivExpr.h:163
Header file for the UnderlyingElement type trait.
ConstIterator_t< RemoveReference_t< LeftOperand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:192
Header file for the RequiresEvaluation type trait.
If_t< IsExpression_v< MT >, const MT, const MT &> LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:175
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
CompositeType_t< MT > CT
Composite type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:112
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:137
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
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:488
ValueType * PointerType
Pointer return type.
Definition: SMatScalarDivExpr.h:196
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the ValueIndexPair class.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarDivExpr.h:253
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarDivExpr.h:455
Header file for the DisableIf class template.
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
Iterator over the elements of the sparse matrix/scalar division expression.
Definition: SMatScalarDivExpr.h:184
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:274
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarDivExpr.h:476
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is not a zero vector or matrix type...
Definition: Zero.h:61
Header file for the UnderlyingBuiltin type trait.
Header file for the IsMultExpr type trait class.
#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
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarDivExpr.h:165
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
#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
LeftOperand matrix_
Left-hand side sparse matrix of the division expression.
Definition: SMatScalarDivExpr.h:507
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatScalarDivExpr.h:376
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:189
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:233
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:304
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
If_t< useAssign, const ResultType, const SMatScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatScalarDivExpr.h:172
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarDivExpr.h:417
Element ValueType
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:195
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatScalarDivExpr.h:166
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
Header file for the IsNumeric type trait.
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SMatScalarDivExpr.h:122
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatScalarDivExpr.h:429
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:285
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the division trait.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarDivExpr.h:406
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarDivExpr.h:222
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatScalarDivExpr.h:198
Expression object for sparse matrix-scalar divisions.The SMatScalarMult class represents the compile ...
Definition: Forward.h:121
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the division expression. ...
Definition: SMatScalarDivExpr.h:136
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatScalarDivExpr.h:365
SMatScalarDivExpr(const MT &matrix, ST scalar) noexcept
Constructor for the SMatScalarDivExpr class.
Definition: SMatScalarDivExpr.h:320
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
Header file for the IsZero type trait.
#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
ValueType & ReferenceType
Reference return type.
Definition: SMatScalarDivExpr.h:197
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatScalarDivExpr.h:311
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarDivExpr.h:201
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#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
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
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:442
Header file for the RemoveReference type trait.
Header file for the IsInvertible type trait.
#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
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(std::declval< RN >()/std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarDivExpr.h:125
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:386
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:466
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarDivExpr.h:333
Header file for the IsComplex type trait.
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:508
Header file for the MatScalarDivExpr base class.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarDivExpr.h:263
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarDivExpr.h:296
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is a zero vector or matrix type...
Definition: Zero.h:81
#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:194
Header file for the IsExpression type trait class.
Header file for the function trace functionality.