All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
68 #include <blaze/util/Assert.h>
73 #include <blaze/util/EnableIf.h>
74 #include <blaze/util/InvalidType.h>
76 #include <blaze/util/SelectType.h>
77 #include <blaze/util/Types.h>
81 
82 
83 namespace blaze {
84 
85 //=================================================================================================
86 //
87 // CLASS SMATSCALARDIVEXPR
88 //
89 //=================================================================================================
90 
91 //*************************************************************************************************
98 template< typename MT // Type of the left-hand side sparse matrix
99  , typename ST // Type of the right-hand side scalar value
100  , bool SO > // Storage order
101 class SMatScalarDivExpr : public SparseMatrix< SMatScalarDivExpr<MT,ST,SO>, SO >
102  , private MatScalarDivExpr
103  , private Computation
104 {
105  private:
106  //**Type definitions****************************************************************************
107  typedef typename MT::ResultType RT;
108  typedef typename MT::ReturnType RN;
109  typedef typename MT::CompositeType CT;
110  //**********************************************************************************************
111 
112  //**Return type evaluation**********************************************************************
114 
119  enum { returnExpr = !IsTemporary<RN>::value };
120 
123  //**********************************************************************************************
124 
125  //**Serial evaluation strategy******************************************************************
127 
133  enum { useAssign = RequiresEvaluation<MT>::value };
134 
136  template< typename MT2 >
138  struct UseAssign {
139  enum { value = useAssign };
140  };
142  //**********************************************************************************************
143 
144  //**Parallel evaluation strategy****************************************************************
146 
152  template< typename MT2 >
153  struct UseSMPAssign {
154  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
155  };
157  //**********************************************************************************************
158 
159  public:
160  //**Type definitions****************************************************************************
166 
169 
172 
174  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
175 
177  typedef ST RightOperand;
178  //**********************************************************************************************
179 
180  //**ConstIterator class definition**************************************************************
184  {
185  public:
186  //**Type definitions*************************************************************************
189 
192 
193  typedef std::forward_iterator_tag IteratorCategory;
194  typedef Element ValueType;
198 
199  // STL iterator requirements
205  //*******************************************************************************************
206 
207  //**Constructor******************************************************************************
210  inline ConstIterator( IteratorType matrix, RightOperand scalar )
211  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
212  , scalar_( scalar ) // Right-hand side scalar of the division expression
213  {}
214  //*******************************************************************************************
215 
216  //**Prefix increment operator****************************************************************
222  ++matrix_;
223  return *this;
224  }
225  //*******************************************************************************************
226 
227  //**Element access operator******************************************************************
232  inline const Element operator*() const {
233  return Element( matrix_->value() / scalar_, matrix_->index() );
234  }
235  //*******************************************************************************************
236 
237  //**Element access operator******************************************************************
242  inline const ConstIterator* operator->() const {
243  return this;
244  }
245  //*******************************************************************************************
246 
247  //**Value function***************************************************************************
252  inline ReturnType value() const {
253  return matrix_->value() / scalar_;
254  }
255  //*******************************************************************************************
256 
257  //**Index function***************************************************************************
262  inline size_t index() const {
263  return matrix_->index();
264  }
265  //*******************************************************************************************
266 
267  //**Equality operator************************************************************************
273  inline bool operator==( const ConstIterator& rhs ) const {
274  return matrix_ == rhs.matrix_;
275  }
276  //*******************************************************************************************
277 
278  //**Inequality operator**********************************************************************
284  inline bool operator!=( const ConstIterator& rhs ) const {
285  return matrix_ != rhs.matrix_;
286  }
287  //*******************************************************************************************
288 
289  //**Subtraction operator*********************************************************************
295  inline DifferenceType operator-( const ConstIterator& rhs ) const {
296  return matrix_ - rhs.matrix_;
297  }
298  //*******************************************************************************************
299 
300  private:
301  //**Member variables*************************************************************************
304  //*******************************************************************************************
305  };
306  //**********************************************************************************************
307 
308  //**Compilation flags***************************************************************************
310  enum { smpAssignable = 0 };
311  //**********************************************************************************************
312 
313  //**Constructor*********************************************************************************
319  explicit inline SMatScalarDivExpr( const MT& matrix, ST scalar )
320  : matrix_( matrix ) // Left-hand side sparse matrix of the division expression
321  , scalar_( scalar ) // Right-hand side scalar of the division expression
322  {}
323  //**********************************************************************************************
324 
325  //**Access operator*****************************************************************************
332  inline ReturnType operator()( size_t i, size_t j ) const {
333  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
334  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
335  return matrix_(i,j) / scalar_;
336  }
337  //**********************************************************************************************
338 
339  //**Begin function******************************************************************************
345  inline ConstIterator begin( size_t i ) const {
346  return ConstIterator( matrix_.begin(i), scalar_ );
347  }
348  //**********************************************************************************************
349 
350  //**End function********************************************************************************
356  inline ConstIterator end( size_t i ) const {
357  return ConstIterator( matrix_.end(i), scalar_ );
358  }
359  //**********************************************************************************************
360 
361  //**Rows function*******************************************************************************
366  inline size_t rows() const {
367  return matrix_.rows();
368  }
369  //**********************************************************************************************
370 
371  //**Columns function****************************************************************************
376  inline size_t columns() const {
377  return matrix_.columns();
378  }
379  //**********************************************************************************************
380 
381  //**NonZeros function***************************************************************************
386  inline size_t nonZeros() const {
387  return matrix_.nonZeros();
388  }
389  //**********************************************************************************************
390 
391  //**NonZeros function***************************************************************************
397  inline size_t nonZeros( size_t i ) const {
398  return matrix_.nonZeros(i);
399  }
400  //**********************************************************************************************
401 
402  //**Left operand access*************************************************************************
407  inline LeftOperand leftOperand() const {
408  return matrix_;
409  }
410  //**********************************************************************************************
411 
412  //**Right operand access************************************************************************
417  inline RightOperand rightOperand() const {
418  return scalar_;
419  }
420  //**********************************************************************************************
421 
422  //**********************************************************************************************
428  template< typename T >
429  inline bool canAlias( const T* alias ) const {
430  return matrix_.canAlias( alias );
431  }
432  //**********************************************************************************************
433 
434  //**********************************************************************************************
440  template< typename T >
441  inline bool isAliased( const T* alias ) const {
442  return matrix_.isAliased( alias );
443  }
444  //**********************************************************************************************
445 
446  private:
447  //**Member variables****************************************************************************
450  //**********************************************************************************************
451 
452  //**Assignment to dense matrices****************************************************************
466  template< typename MT2 // Type of the target dense matrix
467  , bool SO2 > // Storage order of the target dense matrix
468  friend inline typename EnableIf< UseAssign<MT2> >::Type
469  assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
470  {
472 
473  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
474  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
475 
476  assign( ~lhs, rhs.matrix_ );
477  (~lhs) /= rhs.scalar_;
478  }
480  //**********************************************************************************************
481 
482  //**Assignment to sparse matrices***************************************************************
496  template< typename MT2 // Type of the target sparse matrix
497  , bool SO2 > // Storage order of the target sparse matrix
498  friend inline typename EnableIf< UseAssign<MT2> >::Type
500  {
502 
503  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
504  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
505 
506  assign( ~lhs, rhs.matrix_ );
507  (~lhs) /= rhs.scalar_;
508  }
510  //**********************************************************************************************
511 
512  //**Addition assignment to dense matrices*******************************************************
526  template< typename MT2 // Type of the target dense matrix
527  , bool SO2 > // Storage order of the target dense matrix
528  friend inline typename EnableIf< UseAssign<MT2> >::Type
529  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
530  {
532 
535 
536  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
537  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
538 
539  const ResultType tmp( serial( rhs ) );
540  addAssign( ~lhs, tmp );
541  }
543  //**********************************************************************************************
544 
545  //**Addition assignment to sparse matrices******************************************************
546  // No special implementation for the addition assignment to sparse matrices.
547  //**********************************************************************************************
548 
549  //**Subtraction assignment to dense matrices****************************************************
563  template< typename MT2 // Type of the target dense matrix
564  , bool SO2 > // Storage order of the target dense matrix
565  friend inline typename EnableIf< UseAssign<MT2> >::Type
566  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
567  {
569 
572 
573  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
574  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
575 
576  const ResultType tmp( serial( rhs ) );
577  subAssign( ~lhs, tmp );
578  }
580  //**********************************************************************************************
581 
582  //**Subtraction assignment to sparse matrices***************************************************
583  // No special implementation for the subtraction assignment to sparse matrices.
584  //**********************************************************************************************
585 
586  //**Multiplication assignment to dense matrices*************************************************
587  // No special implementation for the multiplication assignment to dense matrices.
588  //**********************************************************************************************
589 
590  //**Multiplication assignment to sparse matrices************************************************
591  // No special implementation for the multiplication assignment to sparse matrices.
592  //**********************************************************************************************
593 
594  //**SMP assignment to dense matrices************************************************************
595  // No special implementation for the SMP assignment to dense matrices.
596  //**********************************************************************************************
597 
598  //**SMP assignment to sparse matrices***********************************************************
599  // No special implementation for the SMP assignment to sparse matrices.
600  //**********************************************************************************************
601 
602  //**SMP addition assignment to dense matrices***************************************************
616  template< typename MT2 // Type of the target dense matrix
617  , bool SO2 > // Storage order of the target dense matrix
618  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
619  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
620  {
622 
625 
626  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
627  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
628 
629  const ResultType tmp( rhs );
630  smpAddAssign( ~lhs, tmp );
631  }
633  //**********************************************************************************************
634 
635  //**SMP addition assignment to sparse matrices**************************************************
636  // No special implementation for the SMP addition assignment to sparse matrices.
637  //**********************************************************************************************
638 
639  //**SMP subtraction assignment to dense matrices************************************************
653  template< typename MT2 // Type of the target dense matrix
654  , bool SO2 > // Storage order of the target dense matrix
655  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
656  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
657  {
659 
662 
663  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
664  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
665 
666  const ResultType tmp( rhs );
667  smpSubAssign( ~lhs, tmp );
668  }
670  //**********************************************************************************************
671 
672  //**SMP subtraction assignment to sparse matrices***********************************************
673  // No special implementation for the SMP subtraction assignment to sparse matrices.
674  //**********************************************************************************************
675 
676  //**Multiplication assignment to dense matrices*************************************************
677  // No special implementation for the SMP multiplication assignment to dense matrices.
678  //**********************************************************************************************
679 
680  //**SMP multiplication assignment to sparse matrices********************************************
681  // No special implementation for the SMP multiplication assignment to sparse matrices.
682  //**********************************************************************************************
683 
684  //**Compile time checks*************************************************************************
693  //**********************************************************************************************
694 };
695 //*************************************************************************************************
696 
697 
698 
699 
700 //=================================================================================================
701 //
702 // GLOBAL BINARY ARITHMETIC OPERATORS
703 //
704 //=================================================================================================
705 
706 //*************************************************************************************************
728 template< typename T1 // Type of the left-hand side sparse matrix
729  , bool SO // Storage order of the left-hand side sparse matrix
730  , typename T2 > // Type of the right-hand side scalar
731 inline const typename EnableIf< IsNumeric<T2>, typename DivExprTrait<T1,T2>::Type >::Type
732  operator/( const SparseMatrix<T1,SO>& mat, T2 scalar )
733 {
735 
736  BLAZE_USER_ASSERT( scalar != T2(0), "Division by zero detected" );
737 
738  typedef typename DivExprTrait<T1,T2>::Type ReturnType;
739  typedef typename ReturnType::RightOperand ScalarType;
740 
742  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
743  }
744  else {
745  return ReturnType( ~mat, scalar );
746  }
747 }
748 //*************************************************************************************************
749 
750 
751 
752 
753 //=================================================================================================
754 //
755 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
756 //
757 //=================================================================================================
758 
759 //*************************************************************************************************
772 template< typename MT // Type of the sparse matrix of the left-hand side expression
773  , typename ST1 // Type of the scalar of the left-hand side expression
774  , bool SO // Storage order of the sparse matrix
775  , typename ST2 > // Type of the right-hand side scalar
776 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST2,ST1>::Type >
777  , typename MultExprTrait< SMatScalarDivExpr<MT,ST1,SO>, ST2 >::Type >::Type
778  operator*( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
779 {
781 
782  return mat.leftOperand() * ( scalar / mat.rightOperand() );
783 }
785 //*************************************************************************************************
786 
787 
788 //*************************************************************************************************
801 template< typename ST1 // Type of the left-hand side scalar
802  , typename MT // Type of the sparse matrix of the right-hand side expression
803  , typename ST2 // Type of the scalar of the right-hand side expression
804  , bool SO > // Storage order of the sparse matrix
805 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST1,ST2>::Type >
806  , typename MultExprTrait< ST1, SMatScalarDivExpr<MT,ST2,SO> >::Type >::Type
807  operator*( ST1 scalar, const SMatScalarDivExpr<MT,ST2,SO>& mat )
808 {
810 
811  return mat.leftOperand() * ( scalar / mat.rightOperand() );
812 }
814 //*************************************************************************************************
815 
816 
817 //*************************************************************************************************
830 template< typename MT // Type of the sparse matrix of the left-hand side expression
831  , typename ST1 // Type of the scalar of the left-hand side expression
832  , bool SO // Storage order of the sparse matrix
833  , typename ST2 > // Type of the right-hand side scalar
834 inline const typename EnableIf< IsNumeric<ST2>
835  , typename DivExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type >::Type
836  operator/( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
837 {
839 
840  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
841 
842  typedef typename MultTrait<ST1,ST2>::Type MultType;
843  typedef typename DivExprTrait<MT,MultType>::Type ReturnType;
844  typedef typename ReturnType::RightOperand ScalarType;
845 
846  if( IsMultExpr<ReturnType>::value ) {
847  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
848  }
849  else {
850  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
851  }
852 }
854 //*************************************************************************************************
855 
856 
857 
858 
859 //=================================================================================================
860 //
861 // SMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
862 //
863 //=================================================================================================
864 
865 //*************************************************************************************************
867 template< typename MT, typename ST1, typename ST2 >
868 struct SMatScalarMultExprTrait< SMatScalarDivExpr<MT,ST1,false>, ST2 >
869 {
870  private:
871  //**********************************************************************************************
872  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
873  //**********************************************************************************************
874 
875  //**********************************************************************************************
876  typedef typename SMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
877  typedef SMatScalarMultExpr< SMatScalarDivExpr<MT,ST1,false>, ST2, false > T2;
878  //**********************************************************************************************
879 
880  public:
881  //**********************************************************************************************
882  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
883  IsNumeric<ST1>::value && IsNumeric<ST2>::value
884  , typename SelectType<condition,T1,T2>::Type
885  , INVALID_TYPE >::Type Type;
886  //**********************************************************************************************
887 };
889 //*************************************************************************************************
890 
891 
892 
893 
894 //=================================================================================================
895 //
896 // TSMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
897 //
898 //=================================================================================================
899 
900 //*************************************************************************************************
902 template< typename MT, typename ST1, typename ST2 >
903 struct TSMatScalarMultExprTrait< SMatScalarDivExpr<MT,ST1,true>, ST2 >
904 {
905  private:
906  //**********************************************************************************************
907  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
908  //**********************************************************************************************
909 
910  //**********************************************************************************************
911  typedef typename SMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
912  typedef SMatScalarMultExpr< SMatScalarDivExpr<MT,ST1,true>, ST2, true > T2;
913  //**********************************************************************************************
914 
915  public:
916  //**********************************************************************************************
917  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
918  IsNumeric<ST1>::value && IsNumeric<ST2>::value
919  , typename SelectType<condition,T1,T2>::Type
920  , INVALID_TYPE >::Type Type;
921  //**********************************************************************************************
922 };
924 //*************************************************************************************************
925 
926 
927 
928 
929 //=================================================================================================
930 //
931 // SUBMATRIXEXPRTRAIT SPECIALIZATIONS
932 //
933 //=================================================================================================
934 
935 //*************************************************************************************************
937 template< typename MT, typename ST, bool SO, bool AF >
938 struct SubmatrixExprTrait< SMatScalarDivExpr<MT,ST,SO>, AF >
939 {
940  public:
941  //**********************************************************************************************
942  typedef typename DivExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type, ST >::Type Type;
943  //**********************************************************************************************
944 };
946 //*************************************************************************************************
947 
948 
949 
950 
951 //=================================================================================================
952 //
953 // ROWEXPRTRAIT SPECIALIZATIONS
954 //
955 //=================================================================================================
956 
957 //*************************************************************************************************
959 template< typename MT, typename ST, bool SO >
960 struct RowExprTrait< SMatScalarDivExpr<MT,ST,SO> >
961 {
962  public:
963  //**********************************************************************************************
964  typedef typename DivExprTrait< typename RowExprTrait<const MT>::Type, ST >::Type Type;
965  //**********************************************************************************************
966 };
968 //*************************************************************************************************
969 
970 
971 
972 
973 //=================================================================================================
974 //
975 // COLUMNEXPRTRAIT SPECIALIZATIONS
976 //
977 //=================================================================================================
978 
979 //*************************************************************************************************
981 template< typename MT, typename ST, bool SO >
982 struct ColumnExprTrait< SMatScalarDivExpr<MT,ST,SO> >
983 {
984  public:
985  //**********************************************************************************************
986  typedef typename DivExprTrait< typename ColumnExprTrait<const MT>::Type, ST >::Type Type;
987  //**********************************************************************************************
988 };
990 //*************************************************************************************************
991 
992 } // namespace blaze
993 
994 #endif
Pointer difference type of the Blaze library.
Data type constraint.
Constraint on the data type.
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:174
#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:87
DivExprTrait< RN, ST >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarDivExpr.h:122
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4329
const EnableIf< IsNumeric< T2 >, typename DivExprTrait< T1, T2 >::Type >::Type operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:930
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 or privately) from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:90
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
PointerType pointer
Pointer return type.
Definition: SMatScalarDivExpr.h:202
Header file for the IsSparseMatrix type trait.
#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:242
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
Header file for the ColumnExprTrait class template.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatScalarDivExpr.h:345
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarDivExpr.h:332
Header file for the IsColumnMajorMatrix type trait.
ValueType value_type
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:201
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:232
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarDivExpr.h:164
Header file for the RequiresEvaluation type trait.
MT::ResultType RT
Result type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:107
ConstIterator(IteratorType matrix, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SMatScalarDivExpr.h:210
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarDivExpr.h:252
ValueType * PointerType
Pointer return type.
Definition: SMatScalarDivExpr.h:195
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatScalarDivExpr.h:429
Constraint on the data type.
Header file for the SparseMatrix base class.
SMatScalarDivExpr(const MT &matrix, ST scalar)
Constructor for the SMatScalarDivExpr class.
Definition: SMatScalarDivExpr.h:319
Header file for the DivExprTrait class template.
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:449
Evaluation of the resulting expression type of a division.Via this type trait it is possible to evalu...
Definition: DivExprTrait.h:87
Constraint on the data type.
Header file for the MultExprTrait class template.
void smpAddAssign(DenseMatrix< 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:122
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarDivExpr.h:163
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:253
Header file for the ValueIndexPair class.
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarDivExpr.h:177
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarDivExpr.h:193
Header file for the IsFloatingPoint type trait.
Iterator over the elements of the sparse matrix/scalar division expression.
Definition: SMatScalarDivExpr.h:183
RemoveReference< LeftOperand >::Type::ConstIterator IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:191
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarDivExpr.h:441
Header file for the IsMultExpr type trait class.
MultTrait< RT, ST >::Type ResultType
Result type for expression template evaluations.
Definition: SMatScalarDivExpr.h:162
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarDivExpr.h:200
MT::CompositeType CT
Composite type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:109
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatScalarDivExpr.h:366
ReferenceType reference
Reference return type.
Definition: SMatScalarDivExpr.h:203
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:271
DifferenceType difference_type
Difference between two iterators.
Definition: SMatScalarDivExpr.h:204
LeftOperand leftOperand() const
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarDivExpr.h:407
#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:89
ResultType::ElementType ElementType
Resulting element type.
Definition: SMatScalarDivExpr.h:165
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:273
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
Constraints on the storage order of matrix types.
SMatScalarDivExpr< MT, ST, SO > This
Type of this SMatScalarDivExpr instance.
Definition: SMatScalarDivExpr.h:161
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatScalarDivExpr.h:376
SelectType< useAssign, const ResultType, const SMatScalarDivExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SMatScalarDivExpr.h:171
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SMatScalarDivExpr.h:168
Header file for the EnableIf class template.
Header file for the serial shim.
Header file for the BaseElementType type trait.
RightOperand rightOperand() const
Returns the right-hand side scalar operand.
Definition: SMatScalarDivExpr.h:417
Header file for the IsNumeric type trait.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:284
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
ValueType & ReferenceType
Reference return type.
Definition: SMatScalarDivExpr.h:196
Header file for run time assertion macros.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarDivExpr.h:262
Utility type for generic codes.
Base template for the MultTrait class.
Definition: MultTrait.h:141
Header file for the division trait.
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:301
Expression object for sparse matrix-scalar divisions.The SMatScalarMult class represents the compile ...
Definition: Forward.h:93
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarDivExpr.h:295
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarDivExpr.h:397
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarDivExpr.h:221
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:79
Element ValueType
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:194
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:331
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:303
Header file for the RemoveReference type trait.
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarDivExpr.h:302
#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:118
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:242
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:69
Header file for the IsRowMajorMatrix type trait.
Header file for the IsComputation type trait class.
LeftOperand matrix_
Left-hand side sparse matrix of the division expression.
Definition: SMatScalarDivExpr.h:448
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatScalarDivExpr.h:197
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
Header file for basic type definitions.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarDivExpr.h:386
Header file for the MatScalarDivExpr base class.
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:188
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatScalarDivExpr.h:356
#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:79
MT::ReturnType RN
Return type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:108
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.