SVecDVecOuterExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECDVECOUTEREXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECDVECOUTEREXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
53 #include <blaze/math/Exception.h>
59 #include <blaze/math/shims/Reset.h>
61 #include <blaze/math/SIMD.h>
73 #include <blaze/util/Assert.h>
74 #include <blaze/util/EnableIf.h>
76 #include <blaze/util/mpl/If.h>
77 #include <blaze/util/Types.h>
81 #include <blaze/util/Unused.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS SVECDVECOUTEREXPR
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< typename VT1 // Type of the left-hand side sparse vector
100  , typename VT2 > // Type of the right-hand side dense vector
101 class SVecDVecOuterExpr
102  : public VecTVecMultExpr< SparseMatrix< SVecDVecOuterExpr<VT1,VT2>, true > >
103  , private Computation
104 {
105  private:
106  //**Type definitions****************************************************************************
115  //**********************************************************************************************
116 
117  //**Return type evaluation**********************************************************************
119 
124  enum : bool { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
125 
128  //**********************************************************************************************
129 
130  //**Evaluation strategy*************************************************************************
132 
138  enum : bool { useAssign = ( IsComputation<VT1>::value || !IsNumeric<ET1>::value ||
140 
142  template< typename MT >
144  struct UseAssign {
145  enum : bool { value = useAssign };
146  };
148  //**********************************************************************************************
149 
150  //**********************************************************************************************
152 
155  template< typename T1, typename T2, typename T3 >
156  struct UseVectorizedKernel {
157  enum : bool { value = useOptimizedKernels &&
158  T1::simdEnabled && T3::simdEnabled &&
160  IsSame< ElementType_<T1>, ElementType_<T3> >::value &&
162  };
164  //**********************************************************************************************
165 
166  //**********************************************************************************************
168 
171  template< typename T1, typename T2, typename T3 >
172  struct UseDefaultKernel {
173  enum : bool { value = !UseVectorizedKernel<T1,T2,T3>::value };
174  };
176  //**********************************************************************************************
177 
178  public:
179  //**Type definitions****************************************************************************
185 
188 
191 
193  using LeftOperand = If_< IsExpression<VT1>, const VT1, const VT1& >;
194 
196  using RightOperand = If_< IsExpression<VT2>, const VT2, const VT2& >;
197 
199  using LT = If_< IsComputation<VT1>, const RT1, CT1 >;
200 
202  using RT = If_< IsComputation<VT2>, const RT2, CT2 >;
203  //**********************************************************************************************
204 
205  //**ConstIterator class definition**************************************************************
209  {
210  public:
211  //**Type definitions*************************************************************************
214 
217 
219  using RightElement = ET2;
220 
221  using IteratorCategory = std::forward_iterator_tag;
222  using ValueType = Element;
226 
227  // STL iterator requirements
233  //*******************************************************************************************
234 
235  //**Constructor******************************************************************************
239  : it_( it ) // Iterator over the elements of the left-hand side sparse vector expression
240  , v_ ( v ) // Element of the right-hand side dense vector expression.
241  {}
242  //*******************************************************************************************
243 
244  //**Prefix increment operator****************************************************************
250  ++it_;
251  return *this;
252  }
253  //*******************************************************************************************
254 
255  //**Element access operator******************************************************************
260  inline const Element operator*() const {
261  return Element( it_->value() * v_, it_->index() );
262  }
263  //*******************************************************************************************
264 
265  //**Element access operator******************************************************************
270  inline const ConstIterator* operator->() const {
271  return this;
272  }
273  //*******************************************************************************************
274 
275  //**Value function***************************************************************************
280  inline ReturnType value() const {
281  return it_->value() * v_;
282  }
283  //*******************************************************************************************
284 
285  //**Index function***************************************************************************
290  inline size_t index() const {
291  return it_->index();
292  }
293  //*******************************************************************************************
294 
295  //**Equality operator************************************************************************
301  inline bool operator==( const ConstIterator& rhs ) const {
302  return it_ == rhs.it_;
303  }
304  //*******************************************************************************************
305 
306  //**Inequality operator**********************************************************************
312  inline bool operator!=( const ConstIterator& rhs ) const {
313  return it_ != rhs.it_;
314  }
315  //*******************************************************************************************
316 
317  //**Subtraction operator*********************************************************************
323  inline DifferenceType operator-( const ConstIterator& rhs ) const {
324  return it_ - rhs.it_;
325  }
326  //*******************************************************************************************
327 
328  private:
329  //**Member variables*************************************************************************
332  //*******************************************************************************************
333  };
334  //**********************************************************************************************
335 
336  //**Compilation flags***************************************************************************
338  enum : bool { smpAssignable = false };
339  //**********************************************************************************************
340 
341  //**SIMD properties*****************************************************************************
343  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
344  //**********************************************************************************************
345 
346  //**Constructor*********************************************************************************
352  explicit inline SVecDVecOuterExpr( const VT1& lhs, const VT2& rhs ) noexcept
353  : lhs_( lhs ) // Left-hand side sparse vector of the multiplication expression
354  , rhs_( rhs ) // Right-hand side dense vector of the multiplication expression
355  {}
356  //**********************************************************************************************
357 
358  //**Access operator*****************************************************************************
365  inline ReturnType operator()( size_t i, size_t j ) const {
366  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
367  BLAZE_INTERNAL_ASSERT( j < rhs_.size(), "Invalid column access index" );
368 
369  return lhs_[i] * rhs_[j];
370  }
371  //**********************************************************************************************
372 
373  //**At function*********************************************************************************
381  inline ReturnType at( size_t i, size_t j ) const {
382  if( i >= lhs_.size() ) {
383  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
384  }
385  if( j >= rhs_.size() ) {
386  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
387  }
388  return (*this)(i,j);
389  }
390  //**********************************************************************************************
391 
392  //**Begin function******************************************************************************
398  inline ConstIterator begin( size_t i ) const {
399  return ConstIterator( lhs_.begin(), rhs_[i] );
400  }
401  //**********************************************************************************************
402 
403  //**End function********************************************************************************
409  inline ConstIterator end( size_t i ) const {
410  return ConstIterator( lhs_.end(), rhs_[i] );
411  }
412  //**********************************************************************************************
413 
414  //**Rows function*******************************************************************************
419  inline size_t rows() const noexcept {
420  return lhs_.size();
421  }
422  //**********************************************************************************************
423 
424  //**Columns function****************************************************************************
429  inline size_t columns() const noexcept {
430  return rhs_.size();
431  }
432  //**********************************************************************************************
433 
434  //**NonZeros function***************************************************************************
439  inline size_t nonZeros() const {
440  return lhs_.nonZeros() * rhs_.size();
441  }
442  //**********************************************************************************************
443 
444  //**NonZeros function***************************************************************************
450  inline size_t nonZeros( size_t i ) const {
451  UNUSED_PARAMETER( i );
452  return lhs_.nonZeros();
453  }
454  //**********************************************************************************************
455 
456  //**Find function*******************************************************************************
463  inline ConstIterator find( size_t i, size_t j ) const {
465  return ConstIterator( lhs_.find( i ), rhs_[j] );
466  }
467  //**********************************************************************************************
468 
469  //**LowerBound function*************************************************************************
476  inline ConstIterator lowerBound( size_t i, size_t j ) const {
478  return ConstIterator( lhs_.lowerBound( i ), rhs_[j] );
479  }
480  //**********************************************************************************************
481 
482  //**UpperBound function*************************************************************************
489  inline ConstIterator upperBound( size_t i, size_t j ) const {
491  return ConstIterator( lhs_.upperBound( i ), rhs_[j] );
492  }
493  //**********************************************************************************************
494 
495  //**Left operand access*************************************************************************
500  inline LeftOperand leftOperand() const noexcept {
501  return lhs_;
502  }
503  //**********************************************************************************************
504 
505  //**Right operand access************************************************************************
510  inline RightOperand rightOperand() const noexcept {
511  return rhs_;
512  }
513  //**********************************************************************************************
514 
515  //**********************************************************************************************
521  template< typename T >
522  inline bool canAlias( const T* alias ) const noexcept {
523  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
524  }
525  //**********************************************************************************************
526 
527  //**********************************************************************************************
533  template< typename T >
534  inline bool isAliased( const T* alias ) const noexcept {
535  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
536  }
537  //**********************************************************************************************
538 
539  private:
540  //**Member variables****************************************************************************
543  //**********************************************************************************************
544 
545  //**Assignment to row-major dense matrices******************************************************
557  template< typename MT > // Type of the target dense matrix
558  friend inline void assign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
559  {
561 
563 
564  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
565  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
566 
567  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
568  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
569 
570  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
571  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
572  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
573  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
574 
575  SVecDVecOuterExpr::selectAssignKernel( ~lhs, x, y );
576  }
578  //**********************************************************************************************
579 
580  //**Default assignment to row-major dense matrices**********************************************
594  template< typename MT // Type of the left-hand side target matrix
595  , typename VT3 // Type of the left-hand side vector operand
596  , typename VT4 > // Type of the right-hand side vector operand
598  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
599  {
601 
602  const ConstIterator end( x.end() );
603 
604  for( ConstIterator element=x.begin(); element!=end; ++element ) {
605  if( !isDefault( element->value() ) ) {
606  for( size_t j=0UL; j<y.size(); ++j ) {
607  (~A)(element->index(),j) = element->value() * y[j];
608  }
609  }
610  }
611  }
613  //**********************************************************************************************
614 
615  //**Vectorized assignment to row-major dense matrices*******************************************
629  template< typename MT // Type of the left-hand side target matrix
630  , typename VT3 // Type of the left-hand side vector operand
631  , typename VT4 > // Type of the right-hand side vector operand
633  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
634  {
636 
637  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
638 
639  const size_t N( (~A).columns() );
640 
641  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
642  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
643 
644  const ConstIterator begin( x.begin() );
645  const ConstIterator end ( x.end() );
646 
647  for( ConstIterator element=begin; element!=end; ++element )
648  {
649  const SIMDTrait_<ElementType> x1( set( element->value() ) );
650 
651  size_t j( 0UL );
652 
653  for( ; j<jpos; j+=SIMDSIZE ) {
654  (~A).store( element->index(), j, x1 * y.load(j) );
655  }
656  for( ; remainder && j<N; ++j ) {
657  (~A)(element->index(),j) = element->value() * y[j];
658  }
659  }
660  }
662  //**********************************************************************************************
663 
664  //**Assignment to column-major dense matrices***************************************************
680  template< typename MT > // Type of the target dense matrix
681  friend inline EnableIf_< UseAssign<MT> >
682  assign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
683  {
685 
686  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
687  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
688 
690 
691  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
692  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
693 
694  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
695  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
696  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
697  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
698 
699  const ConstIterator end( x.end() );
700 
701  for( size_t i=0UL; i<y.size(); ++i ) {
702  if( !isDefault( y[i] ) ) {
703  for( ConstIterator element=x.begin(); element!=end; ++element ) {
704  (~lhs)(element->index(),i) = element->value() * y[i];
705  }
706  }
707  }
708  }
710  //**********************************************************************************************
711 
712  //**Assignment to row-major sparse matrices*****************************************************
724  template< typename MT > // Type of the target sparse matrix
725  friend inline void assign( SparseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
726  {
728 
730 
731  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
732  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns() , "Invalid number of columns" );
733 
735 
736  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
737  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
738 
739  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
740  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
741  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
742  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
743 
744  const ConstIterator begin( x.begin() );
745  const ConstIterator end ( x.end() );
746 
747  if( begin == end )
748  return;
749 
750  (~lhs).reserve( begin->index(), rhs.nonZeros() );
751 
752  size_t index( 0UL );
753 
754  for( ConstIterator element=begin; element!=end; ++element ) {
755  if( !isDefault( element->value() ) ) {
756  for( ; index < element->index(); ++index ) {
757  (~lhs).finalize( index );
758  }
759  for( size_t i=0UL; i<y.size(); ++i ) {
760  (~lhs).append( element->index(), i, element->value() * y[i] );
761  }
762  (~lhs).finalize( index++ );
763  }
764  }
765 
766  for( ; index < x.size(); ++index ) {
767  (~lhs).finalize( index );
768  }
769  }
771  //**********************************************************************************************
772 
773  //**Assignment to column-major sparse matrices**************************************************
789  template< typename MT > // Type of the target sparse matrix
790  friend inline EnableIf_< UseAssign<MT> >
791  assign( SparseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
792  {
794 
795  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
796  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns() , "Invalid number of columns" );
797  BLAZE_INTERNAL_ASSERT( (~lhs).capacity() >= rhs.nonZeros(), "Insufficient capacity" );
798 
800 
801  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
802  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
803 
804  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
805  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
806  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
807  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
808 
809  const ConstIterator begin( x.begin() );
810  const ConstIterator end ( x.end() );
811 
812  if( begin == end )
813  return;
814 
815  for( size_t i=0UL; i<y.size(); ++i ) {
816  if( !isDefault( y[i] ) ) {
817  for( ConstIterator element=begin; element!=end; ++element ) {
818  (~lhs).append( element->index(), i, element->value() * y[i] );
819  }
820  }
821  (~lhs).finalize( i );
822  }
823  }
825  //**********************************************************************************************
826 
827  //**Addition assignment to row-major dense matrices*********************************************
840  template< typename MT > // Type of the target dense matrix
841  friend inline void addAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
842  {
844 
846 
847  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
848  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
849 
850  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
851  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
852 
853  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
854  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
855  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
856  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
857 
858  SVecDVecOuterExpr::selectAddAssignKernel( ~lhs, x, y );
859  }
861  //**********************************************************************************************
862 
863  //**Default addition assignment to row-major dense matrices*************************************
877  template< typename MT // Type of the left-hand side target matrix
878  , typename VT3 // Type of the left-hand side vector operand
879  , typename VT4 > // Type of the right-hand side vector operand
881  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
882  {
884 
885  const ConstIterator end( x.end() );
886 
887  for( ConstIterator element=x.begin(); element!=end; ++element ) {
888  if( !isDefault( element->value() ) ) {
889  for( size_t i=0UL; i<y.size(); ++i ) {
890  (~A)(element->index(),i) += element->value() * y[i];
891  }
892  }
893  }
894  }
896  //**********************************************************************************************
897 
898  //**Vectorized addition assignment to row-major dense matrices**********************************
912  template< typename MT // Type of the left-hand side target matrix
913  , typename VT3 // Type of the left-hand side vector operand
914  , typename VT4 > // Type of the right-hand side vector operand
916  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
917  {
919 
920  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
921 
922  const size_t N( (~A).columns() );
923 
924  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
925  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
926 
927  const ConstIterator begin( x.begin() );
928  const ConstIterator end ( x.end() );
929 
930  for( ConstIterator element=begin; element!=end; ++element )
931  {
932  if( isDefault( element->value() ) ) continue;
933 
934  const SIMDTrait_<ElementType> x1( set( element->value() ) );
935 
936  size_t j( 0UL );
937 
938  for( ; j<jpos; j+=SIMDSIZE ) {
939  (~A).store( element->index(), j, (~A).load(element->index(),j) + x1 * y.load(j) );
940  }
941  for( ; remainder && j<N; ++j ) {
942  (~A)(element->index(),j) += element->value() * y[j];
943  }
944  }
945  }
947  //**********************************************************************************************
948 
949  //**Addition assignment to column-major dense matrices******************************************
965  template< typename MT > // Type of the target dense matrix
966  friend inline EnableIf_< UseAssign<MT> >
967  addAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
968  {
970 
971  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
972  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
973 
975 
976  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
977  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
978 
979  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
980  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
981  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
982  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
983 
984  const ConstIterator end( x.end() );
985 
986  for( size_t i=0UL; i<y.size(); ++i ) {
987  if( !isDefault( y[i] ) ) {
988  for( ConstIterator element=x.begin(); element!=end; ++element ) {
989  (~lhs)(element->index(),i) += element->value() * y[i];
990  }
991  }
992  }
993  }
995  //**********************************************************************************************
996 
997  //**Addition assignment to sparse matrices******************************************************
998  // No special implementation for the addition assignment to sparse matrices.
999  //**********************************************************************************************
1000 
1001  //**Subtraction assignment to row-major dense matrices******************************************
1014  template< typename MT > // Type of the target dense matrix
1015  friend inline void subAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
1016  {
1018 
1020 
1021  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1022  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1023 
1024  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1025  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1026 
1027  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1028  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1029  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1030  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1031 
1032  SVecDVecOuterExpr::selectSubAssignKernel( ~lhs, x, y );
1033  }
1035  //**********************************************************************************************
1036 
1037  //**Default subtraction assignment to row-major dense matrices**********************************
1051  template< typename MT // Type of the left-hand side target matrix
1052  , typename VT3 // Type of the left-hand side vector operand
1053  , typename VT4 > // Type of the right-hand side vector operand
1055  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1056  {
1058 
1059  const ConstIterator end( x.end() );
1060 
1061  for( ConstIterator element=x.begin(); element!=end; ++element ) {
1062  if( !isDefault( element->value() ) ) {
1063  for( size_t i=0UL; i<y.size(); ++i ) {
1064  (~A)(element->index(),i) -= element->value() * y[i];
1065  }
1066  }
1067  }
1068  }
1070  //**********************************************************************************************
1071 
1072  //**Vectorized subtraction assignment to row-major dense matrices*******************************
1086  template< typename MT // Type of the left-hand side target matrix
1087  , typename VT3 // Type of the left-hand side vector operand
1088  , typename VT4 > // Type of the right-hand side vector operand
1090  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1091  {
1093 
1094  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
1095 
1096  const size_t N( (~A).columns() );
1097 
1098  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
1099  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
1100 
1101  const ConstIterator begin( x.begin() );
1102  const ConstIterator end ( x.end() );
1103 
1104  for( ConstIterator element=begin; element!=end; ++element )
1105  {
1106  if( isDefault( element->value() ) ) continue;
1107 
1108  const SIMDTrait_<ElementType> x1( set( element->value() ) );
1109 
1110  size_t j( 0UL );
1111 
1112  for( ; j<jpos; j+=SIMDSIZE ) {
1113  (~A).store( element->index(), j, (~A).load(element->index(),j) - x1 * y.load(j) );
1114  }
1115  for( ; remainder && j<N; ++j ) {
1116  (~A)(element->index(),j) -= element->value() * y[j];
1117  }
1118  }
1119  }
1121  //**********************************************************************************************
1122 
1123  //**Subtraction assignment to column-major dense matrices***************************************
1139  template< typename MT > // Type of the target dense matrix
1140  friend inline EnableIf_< UseAssign<MT> >
1141  subAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
1142  {
1144 
1145  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1146  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1147 
1149 
1150  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1151  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1152 
1153  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1154  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1155  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1156  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1157 
1158  const ConstIterator end( x.end() );
1159 
1160  for( size_t i=0UL; i<y.size(); ++i ) {
1161  if( !isDefault( y[i] ) ) {
1162  for( ConstIterator element=x.begin(); element!=end; ++element ) {
1163  (~lhs)(element->index(),i) -= element->value() * y[i];
1164  }
1165  }
1166  }
1167  }
1169  //**********************************************************************************************
1170 
1171  //**Subtraction assignment to sparse matrices***************************************************
1172  // No special implementation for the subtraction assignment to sparse matrices.
1173  //**********************************************************************************************
1174 
1175  //**Schur product assignment to row-major dense matrices****************************************
1188  template< typename MT > // Type of the target dense matrix
1189  friend inline void schurAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
1190  {
1192 
1194 
1195  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1196  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1197 
1198  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1199  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1200 
1201  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1202  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1203  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1204  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1205 
1206  SVecDVecOuterExpr::selectSchurAssignKernel( ~lhs, x, y );
1207  }
1209  //**********************************************************************************************
1210 
1211  //**Default Schur product assignment to row-major dense matrices********************************
1225  template< typename MT // Type of the left-hand side target matrix
1226  , typename VT3 // Type of the left-hand side vector operand
1227  , typename VT4 > // Type of the right-hand side vector operand
1229  selectSchurAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1230  {
1232 
1233  const ConstIterator end( x.end() );
1234 
1235  size_t i( 0UL );
1236 
1237  for( ConstIterator element=x.begin(); element!=end; ++element )
1238  {
1239  if( isDefault( element->value() ) ) continue;
1240 
1241  for( ; i<element->index(); ++i ) {
1242  for( size_t j=0UL; j<y.size(); ++j )
1243  reset( (~A)(i,j) );
1244  }
1245 
1246  for( size_t j=0UL; j<y.size(); ++j ) {
1247  (~A)(element->index(),j) *= element->value() * y[j];
1248  }
1249 
1250  ++i;
1251  }
1252 
1253  for( ; i<x.size(); ++i ) {
1254  for( size_t j=0UL; j<y.size(); ++j )
1255  reset( (~A)(i,j) );
1256  }
1257  }
1259  //**********************************************************************************************
1260 
1261  //**Vectorized Schur product assignment to row-major dense matrices*****************************
1275  template< typename MT // Type of the left-hand side target matrix
1276  , typename VT3 // Type of the left-hand side vector operand
1277  , typename VT4 > // Type of the right-hand side vector operand
1279  selectSchurAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1280  {
1282 
1283  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
1284 
1285  const size_t M( (~A).rows() );
1286  const size_t N( (~A).columns() );
1287 
1288  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
1289  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
1290 
1291  const ConstIterator begin( x.begin() );
1292  const ConstIterator end ( x.end() );
1293 
1294  size_t i( 0UL );
1295 
1296  for( ConstIterator element=begin; element!=end; ++element )
1297  {
1298  if( isDefault( element->value() ) ) continue;
1299 
1300  for( ; i<element->index(); ++i ) {
1301  for( size_t j=0UL; j<N; ++j )
1302  reset( (~A)(i,j) );
1303  }
1304 
1305  const SIMDTrait_<ElementType> x1( set( element->value() ) );
1306 
1307  size_t j( 0UL );
1308 
1309  for( ; j<jpos; j+=SIMDSIZE ) {
1310  (~A).store( element->index(), j, (~A).load(element->index(),j) * ( x1 * y.load(j) ) );
1311  }
1312  for( ; remainder && j<N; ++j ) {
1313  (~A)(element->index(),j) *= element->value() * y[j];
1314  }
1315 
1316  ++i;
1317  }
1318 
1319  for( ; i<M; ++i ) {
1320  for( size_t j=0UL; j<N; ++j )
1321  reset( (~A)(i,j) );
1322  }
1323  }
1325  //**********************************************************************************************
1326 
1327  //**Schur product assignment to column-major dense matrices*************************************
1343  template< typename MT > // Type of the target dense matrix
1344  friend inline EnableIf_< UseAssign<MT> >
1345  schurAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
1346  {
1348 
1349  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1350  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1351 
1353 
1354  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1355  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1356 
1357  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1358  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1359  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1360  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1361 
1362  const ConstIterator end( x.end() );
1363 
1364  for( size_t j=0UL; j<y.size(); ++j )
1365  {
1366  size_t i( 0UL );
1367 
1368  for( ConstIterator element=x.begin(); element!=end; ++element, ++i ) {
1369  for( ; i<element->index(); ++i )
1370  reset( (~lhs)(i,j) );
1371  (~lhs)(element->index(),j) *= element->value() * y[j];
1372  }
1373 
1374  for( ; i<x.size(); ++i ) {
1375  reset( (~lhs)(i,j) );
1376  }
1377  }
1378  }
1380  //**********************************************************************************************
1381 
1382  //**Addition assignment to sparse matrices******************************************************
1383  // No special implementation for the addition assignment to sparse matrices.
1384  //**********************************************************************************************
1385 
1386  //**Multiplication assignment to dense matrices*************************************************
1387  // No special implementation for the multiplication assignment to dense matrices.
1388  //**********************************************************************************************
1389 
1390  //**Multiplication assignment to sparse matrices************************************************
1391  // No special implementation for the multiplication assignment to sparse matrices.
1392  //**********************************************************************************************
1393 
1394  //**Compile time checks*************************************************************************
1402  //**********************************************************************************************
1403 };
1404 //*************************************************************************************************
1405 
1406 
1407 
1408 
1409 //=================================================================================================
1410 //
1411 // GLOBAL BINARY ARITHMETIC OPERATORS
1412 //
1413 //=================================================================================================
1414 
1415 //*************************************************************************************************
1444 template< typename VT1 // Type of the left-hand side sparse vector
1445  , typename VT2 > // Type of the right-hand side dense vector
1446 inline decltype(auto)
1447  operator*( const SparseVector<VT1,false>& lhs, const DenseVector<VT2,true>& rhs )
1448 {
1450 
1451  using ReturnType = const SVecDVecOuterExpr<VT1,VT2>;
1452  return ReturnType( ~lhs, ~rhs );
1453 }
1454 //*************************************************************************************************
1455 
1456 
1457 
1458 
1459 //=================================================================================================
1460 //
1461 // ROWS SPECIALIZATIONS
1462 //
1463 //=================================================================================================
1464 
1465 //*************************************************************************************************
1467 template< typename VT1, typename VT2 >
1468 struct Rows< SVecDVecOuterExpr<VT1,VT2> >
1469  : public Size<VT1>
1470 {};
1472 //*************************************************************************************************
1473 
1474 
1475 
1476 
1477 //=================================================================================================
1478 //
1479 // COLUMNS SPECIALIZATIONS
1480 //
1481 //=================================================================================================
1482 
1483 //*************************************************************************************************
1485 template< typename VT1, typename VT2 >
1486 struct Columns< SVecDVecOuterExpr<VT1,VT2> >
1487  : public Size<VT2>
1488 {};
1490 //*************************************************************************************************
1491 
1492 } // namespace blaze
1493 
1494 #endif
If_< IsExpression< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:196
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SVecDVecOuterExpr.h:381
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
MultTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:181
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
SVecDVecOuterExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the SVecDVecOuterExpr class.
Definition: SVecDVecOuterExpr.h:352
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecDVecOuterExpr.h:534
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified column.
Definition: SVecDVecOuterExpr.h:450
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: SVecDVecOuterExpr.h:542
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
Header file for the serial shim.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SVecDVecOuterExpr.h:429
Header file for the IsSame and IsStrictlySame type traits.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecDVecOuterExpr.h:221
Availability of a SIMD multiplication for the given data types.Depending on the available instruction...
Definition: HasSIMDMult.h:172
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:316
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecDVecOuterExpr.h:249
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
IteratorType it_
Iterator over the elements of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:330
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
Header file for the Computation base class.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then 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: IsSame.h:140
System settings for performance optimizations.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
ET2 RightElement
Element type of the dense vector expression.
Definition: SVecDVecOuterExpr.h:219
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:112
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:78
RightElement v_
Element of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:331
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
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.
If_< IsExpression< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:193
Constraint on the transpose flag of vector types.
Constraint on the data type.
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SVecDVecOuterExpr.h:463
typename MultExprTrait< T1, T2 >::Type MultExprTrait_
Auxiliary alias declaration for the MultExprTrait class template.The MultExprTrait_ alias declaration...
Definition: MultExprTrait.h:112
Header file for the MultExprTrait class template.
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: SVecDVecOuterExpr.h:510
Header file for the ValueIndexPair class.
ReturnType_< VT1 > RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:109
Header file for the IsTemporary type trait class.
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:187
Header file for the multiplication trait.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecDVecOuterExpr.h:301
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SVecDVecOuterExpr.h:260
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECTVECMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecTVecMultExpr.h:104
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the Columns type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SVecDVecOuterExpr.h:182
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecDVecOuterExpr.h:500
LeftOperand lhs_
Left-hand side sparse vector of the multiplication expression.
Definition: SVecDVecOuterExpr.h:541
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
ConstIterator(IteratorType it, RightElement v)
Constructor for the ConstIterator class.
Definition: SVecDVecOuterExpr.h:238
size_t index() const
Access to the current index of the sparse element.
Definition: SVecDVecOuterExpr.h:290
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SVecDVecOuterExpr.h:184
Constraint on the data type.
Header file for the exception macros of the math module.
IteratorCategory iterator_category
The iterator category.
Definition: SVecDVecOuterExpr.h:228
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecDVecOuterExpr.h:323
CompositeType_< VT1 > CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:111
ElementType_< VT1 > ET1
Element type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:113
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the VecTVecMultExpr base class.
Iterator over the elements of the sparse vector-dense vector outer product expression.
Definition: SVecDVecOuterExpr.h:208
Header file for the EnableIf class template.
ResultType_< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:108
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:114
Header file for the IsNumeric type trait.
IfTrue_< useAssign, const ResultType, const SVecDVecOuterExpr &> CompositeType
Data type for composite expression templates.
Definition: SVecDVecOuterExpr.h:190
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
Header file for the HasSIMDMult type trait.
Expression object for sparse vector-dense vector outer products.The SVecDVecOuterExpr class represent...
Definition: Forward.h:134
Header file for run time assertion macros.
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SVecDVecOuterExpr.h:270
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of column i.
Definition: SVecDVecOuterExpr.h:409
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecDVecOuterExpr.h:280
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:183
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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecDVecOuterExpr.h:522
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecDVecOuterExpr.h:312
Header file for the reset shim.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SVecDVecOuterExpr.h:419
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
#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
Header file for the isDefault shim.
Constraint on the data type.
ResultType_< VT1 > RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:107
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:110
Constraint on the data type.
Header file for the RemoveReference 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
If_< IsComputation< VT1 >, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense vector operand.
Definition: SVecDVecOuterExpr.h:199
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
If_< IsComputation< VT2 >, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense vector operand.
Definition: SVecDVecOuterExpr.h:202
Header file for the IsComputation type trait class.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of column i.
Definition: SVecDVecOuterExpr.h:398
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:74
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
Compile time evaluation of the number of columns of a matrix.The Columns type trait evaluates the num...
Definition: Columns.h:75
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecDVecOuterExpr.h:216
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:75
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SVecDVecOuterExpr.h:439
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SVecDVecOuterExpr.h:489
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
MultExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: SVecDVecOuterExpr.h:127
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SVecDVecOuterExpr.h:476
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SVecDVecOuterExpr.h:365
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Header file for the function trace functionality.