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>
71 #include <blaze/util/Assert.h>
72 #include <blaze/util/EnableIf.h>
74 #include <blaze/util/mpl/If.h>
75 #include <blaze/util/Types.h>
79 #include <blaze/util/Unused.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS SVECDVECOUTEREXPR
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
97 template< typename VT1 // Type of the left-hand side sparse vector
98  , typename VT2 > // Type of the right-hand side dense vector
99 class SVecDVecOuterExpr
100  : public VecTVecMultExpr< SparseMatrix< SVecDVecOuterExpr<VT1,VT2>, true > >
101  , private Computation
102 {
103  private:
104  //**Type definitions****************************************************************************
113  //**********************************************************************************************
114 
115  //**Return type evaluation**********************************************************************
117 
122  enum : bool { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
123 
126  //**********************************************************************************************
127 
128  //**Evaluation strategy*************************************************************************
130 
136  enum : bool { useAssign = ( IsComputation<VT1>::value || !IsNumeric<ET1>::value ||
138 
140  template< typename MT >
142  struct UseAssign {
143  enum : bool { value = useAssign };
144  };
146  //**********************************************************************************************
147 
148  //**********************************************************************************************
150 
153  template< typename T1, typename T2, typename T3 >
154  struct UseVectorizedKernel {
155  enum : bool { value = useOptimizedKernels &&
156  T1::simdEnabled && T3::simdEnabled &&
158  IsSame< ElementType_<T1>, ElementType_<T3> >::value &&
160  };
162  //**********************************************************************************************
163 
164  //**********************************************************************************************
166 
169  template< typename T1, typename T2, typename T3 >
170  struct UseDefaultKernel {
171  enum : bool { value = !UseVectorizedKernel<T1,T2,T3>::value };
172  };
174  //**********************************************************************************************
175 
176  public:
177  //**Type definitions****************************************************************************
183 
186 
189 
191  using LeftOperand = If_< IsExpression<VT1>, const VT1, const VT1& >;
192 
194  using RightOperand = If_< IsExpression<VT2>, const VT2, const VT2& >;
195 
197  using LT = If_< IsComputation<VT1>, const RT1, CT1 >;
198 
200  using RT = If_< IsComputation<VT2>, const RT2, CT2 >;
201  //**********************************************************************************************
202 
203  //**ConstIterator class definition**************************************************************
207  {
208  public:
209  //**Type definitions*************************************************************************
212 
215 
217  using RightElement = ET2;
218 
219  using IteratorCategory = std::forward_iterator_tag;
220  using ValueType = Element;
224 
225  // STL iterator requirements
231  //*******************************************************************************************
232 
233  //**Constructor******************************************************************************
237  : it_( it ) // Iterator over the elements of the left-hand side sparse vector expression
238  , v_ ( v ) // Element of the right-hand side dense vector expression.
239  {}
240  //*******************************************************************************************
241 
242  //**Prefix increment operator****************************************************************
248  ++it_;
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Element access operator******************************************************************
258  inline const Element operator*() const {
259  return Element( it_->value() * v_, it_->index() );
260  }
261  //*******************************************************************************************
262 
263  //**Element access operator******************************************************************
268  inline const ConstIterator* operator->() const {
269  return this;
270  }
271  //*******************************************************************************************
272 
273  //**Value function***************************************************************************
278  inline ReturnType value() const {
279  return it_->value() * v_;
280  }
281  //*******************************************************************************************
282 
283  //**Index function***************************************************************************
288  inline size_t index() const {
289  return it_->index();
290  }
291  //*******************************************************************************************
292 
293  //**Equality operator************************************************************************
299  inline bool operator==( const ConstIterator& rhs ) const {
300  return it_ == rhs.it_;
301  }
302  //*******************************************************************************************
303 
304  //**Inequality operator**********************************************************************
310  inline bool operator!=( const ConstIterator& rhs ) const {
311  return it_ != rhs.it_;
312  }
313  //*******************************************************************************************
314 
315  //**Subtraction operator*********************************************************************
321  inline DifferenceType operator-( const ConstIterator& rhs ) const {
322  return it_ - rhs.it_;
323  }
324  //*******************************************************************************************
325 
326  private:
327  //**Member variables*************************************************************************
330  //*******************************************************************************************
331  };
332  //**********************************************************************************************
333 
334  //**Compilation flags***************************************************************************
336  enum : bool { smpAssignable = false };
337  //**********************************************************************************************
338 
339  //**SIMD properties*****************************************************************************
341  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
342  //**********************************************************************************************
343 
344  //**Constructor*********************************************************************************
350  explicit inline SVecDVecOuterExpr( const VT1& lhs, const VT2& rhs ) noexcept
351  : lhs_( lhs ) // Left-hand side sparse vector of the multiplication expression
352  , rhs_( rhs ) // Right-hand side dense vector of the multiplication expression
353  {}
354  //**********************************************************************************************
355 
356  //**Access operator*****************************************************************************
363  inline ReturnType operator()( size_t i, size_t j ) const {
364  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
365  BLAZE_INTERNAL_ASSERT( j < rhs_.size(), "Invalid column access index" );
366 
367  return lhs_[i] * rhs_[j];
368  }
369  //**********************************************************************************************
370 
371  //**At function*********************************************************************************
379  inline ReturnType at( size_t i, size_t j ) const {
380  if( i >= lhs_.size() ) {
381  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
382  }
383  if( j >= rhs_.size() ) {
384  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
385  }
386  return (*this)(i,j);
387  }
388  //**********************************************************************************************
389 
390  //**Begin function******************************************************************************
396  inline ConstIterator begin( size_t i ) const {
397  return ConstIterator( lhs_.begin(), rhs_[i] );
398  }
399  //**********************************************************************************************
400 
401  //**End function********************************************************************************
407  inline ConstIterator end( size_t i ) const {
408  return ConstIterator( lhs_.end(), rhs_[i] );
409  }
410  //**********************************************************************************************
411 
412  //**Rows function*******************************************************************************
417  inline size_t rows() const noexcept {
418  return lhs_.size();
419  }
420  //**********************************************************************************************
421 
422  //**Columns function****************************************************************************
427  inline size_t columns() const noexcept {
428  return rhs_.size();
429  }
430  //**********************************************************************************************
431 
432  //**NonZeros function***************************************************************************
437  inline size_t nonZeros() const {
438  return lhs_.nonZeros() * rhs_.size();
439  }
440  //**********************************************************************************************
441 
442  //**NonZeros function***************************************************************************
448  inline size_t nonZeros( size_t i ) const {
449  UNUSED_PARAMETER( i );
450  return lhs_.nonZeros();
451  }
452  //**********************************************************************************************
453 
454  //**Find function*******************************************************************************
461  inline ConstIterator find( size_t i, size_t j ) const {
463  return ConstIterator( lhs_.find( i ), rhs_[j] );
464  }
465  //**********************************************************************************************
466 
467  //**LowerBound function*************************************************************************
474  inline ConstIterator lowerBound( size_t i, size_t j ) const {
476  return ConstIterator( lhs_.lowerBound( i ), rhs_[j] );
477  }
478  //**********************************************************************************************
479 
480  //**UpperBound function*************************************************************************
487  inline ConstIterator upperBound( size_t i, size_t j ) const {
489  return ConstIterator( lhs_.upperBound( i ), rhs_[j] );
490  }
491  //**********************************************************************************************
492 
493  //**Left operand access*************************************************************************
498  inline LeftOperand leftOperand() const noexcept {
499  return lhs_;
500  }
501  //**********************************************************************************************
502 
503  //**Right operand access************************************************************************
508  inline RightOperand rightOperand() const noexcept {
509  return rhs_;
510  }
511  //**********************************************************************************************
512 
513  //**********************************************************************************************
519  template< typename T >
520  inline bool canAlias( const T* alias ) const noexcept {
521  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
522  }
523  //**********************************************************************************************
524 
525  //**********************************************************************************************
531  template< typename T >
532  inline bool isAliased( const T* alias ) const noexcept {
533  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
534  }
535  //**********************************************************************************************
536 
537  private:
538  //**Member variables****************************************************************************
541  //**********************************************************************************************
542 
543  //**Assignment to row-major dense matrices******************************************************
555  template< typename MT > // Type of the target dense matrix
556  friend inline void assign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
557  {
559 
561 
562  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
563  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
564 
565  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
566  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
567 
568  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
569  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
570  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
571  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
572 
573  SVecDVecOuterExpr::selectAssignKernel( ~lhs, x, y );
574  }
576  //**********************************************************************************************
577 
578  //**Default assignment to row-major dense matrices**********************************************
592  template< typename MT // Type of the left-hand side target matrix
593  , typename VT3 // Type of the left-hand side vector operand
594  , typename VT4 > // Type of the right-hand side vector operand
596  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
597  {
599 
600  const ConstIterator end( x.end() );
601 
602  for( ConstIterator element=x.begin(); element!=end; ++element ) {
603  if( !isDefault( element->value() ) ) {
604  for( size_t j=0UL; j<y.size(); ++j ) {
605  (~A)(element->index(),j) = element->value() * y[j];
606  }
607  }
608  }
609  }
611  //**********************************************************************************************
612 
613  //**Vectorized assignment to row-major dense matrices*******************************************
627  template< typename MT // Type of the left-hand side target matrix
628  , typename VT3 // Type of the left-hand side vector operand
629  , typename VT4 > // Type of the right-hand side vector operand
631  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
632  {
634 
635  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
636 
637  const size_t N( (~A).columns() );
638 
639  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
640  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
641 
642  const ConstIterator begin( x.begin() );
643  const ConstIterator end ( x.end() );
644 
645  for( ConstIterator element=begin; element!=end; ++element )
646  {
647  const SIMDTrait_<ElementType> x1( set( element->value() ) );
648 
649  size_t j( 0UL );
650 
651  for( ; j<jpos; j+=SIMDSIZE ) {
652  (~A).store( element->index(), j, x1 * y.load(j) );
653  }
654  for( ; remainder && j<N; ++j ) {
655  (~A)(element->index(),j) = element->value() * y[j];
656  }
657  }
658  }
660  //**********************************************************************************************
661 
662  //**Assignment to column-major dense matrices***************************************************
678  template< typename MT > // Type of the target dense matrix
679  friend inline EnableIf_< UseAssign<MT> >
680  assign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
681  {
683 
684  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
685  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
686 
688 
689  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
690  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
691 
692  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
693  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
694  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
695  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
696 
697  const ConstIterator end( x.end() );
698 
699  for( size_t i=0UL; i<y.size(); ++i ) {
700  if( !isDefault( y[i] ) ) {
701  for( ConstIterator element=x.begin(); element!=end; ++element ) {
702  (~lhs)(element->index(),i) = element->value() * y[i];
703  }
704  }
705  }
706  }
708  //**********************************************************************************************
709 
710  //**Assignment to row-major sparse matrices*****************************************************
722  template< typename MT > // Type of the target sparse matrix
723  friend inline void assign( SparseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
724  {
726 
728 
729  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
730  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns() , "Invalid number of columns" );
731 
733 
734  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
735  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
736 
737  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
738  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
739  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
740  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
741 
742  // Final memory allocation (based on the evaluated operands)
743  (~lhs).reserve( x.nonZeros() * y.size() );
744 
745  // Performing the outer product
746  const ConstIterator begin( x.begin() );
747  const ConstIterator end ( x.end() );
748 
749  if( begin == end )
750  return;
751 
752  (~lhs).reserve( begin->index(), rhs.nonZeros() );
753 
754  size_t index( 0UL );
755 
756  for( ConstIterator element=begin; element!=end; ++element ) {
757  if( !isDefault( element->value() ) ) {
758  for( ; index < element->index(); ++index ) {
759  (~lhs).finalize( index );
760  }
761  for( size_t i=0UL; i<y.size(); ++i ) {
762  (~lhs).append( element->index(), i, element->value() * y[i] );
763  }
764  (~lhs).finalize( index++ );
765  }
766  }
767 
768  for( ; index < x.size(); ++index ) {
769  (~lhs).finalize( index );
770  }
771  }
773  //**********************************************************************************************
774 
775  //**Assignment to column-major sparse matrices**************************************************
791  template< typename MT > // Type of the target sparse matrix
792  friend inline EnableIf_< UseAssign<MT> >
793  assign( SparseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
794  {
796 
797  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
798  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns() , "Invalid number of columns" );
799  BLAZE_INTERNAL_ASSERT( (~lhs).capacity() >= rhs.nonZeros(), "Insufficient capacity" );
800 
802 
803  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
804  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
805 
806  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
807  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
808  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
809  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
810 
811  const ConstIterator begin( x.begin() );
812  const ConstIterator end ( x.end() );
813 
814  if( begin == end )
815  return;
816 
817  for( size_t i=0UL; i<y.size(); ++i ) {
818  if( !isDefault( y[i] ) ) {
819  for( ConstIterator element=begin; element!=end; ++element ) {
820  (~lhs).append( element->index(), i, element->value() * y[i] );
821  }
822  }
823  (~lhs).finalize( i );
824  }
825  }
827  //**********************************************************************************************
828 
829  //**Addition assignment to row-major dense matrices*********************************************
842  template< typename MT > // Type of the target dense matrix
843  friend inline void addAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
844  {
846 
848 
849  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
850  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
851 
852  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
853  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
854 
855  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
856  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
857  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
858  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
859 
860  SVecDVecOuterExpr::selectAddAssignKernel( ~lhs, x, y );
861  }
863  //**********************************************************************************************
864 
865  //**Default addition assignment to row-major dense matrices*************************************
879  template< typename MT // Type of the left-hand side target matrix
880  , typename VT3 // Type of the left-hand side vector operand
881  , typename VT4 > // Type of the right-hand side vector operand
883  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
884  {
886 
887  const ConstIterator end( x.end() );
888 
889  for( ConstIterator element=x.begin(); element!=end; ++element ) {
890  if( !isDefault( element->value() ) ) {
891  for( size_t i=0UL; i<y.size(); ++i ) {
892  (~A)(element->index(),i) += element->value() * y[i];
893  }
894  }
895  }
896  }
898  //**********************************************************************************************
899 
900  //**Vectorized addition assignment to row-major dense matrices**********************************
914  template< typename MT // Type of the left-hand side target matrix
915  , typename VT3 // Type of the left-hand side vector operand
916  , typename VT4 > // Type of the right-hand side vector operand
918  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
919  {
921 
922  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
923 
924  const size_t N( (~A).columns() );
925 
926  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
927  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
928 
929  const ConstIterator begin( x.begin() );
930  const ConstIterator end ( x.end() );
931 
932  for( ConstIterator element=begin; element!=end; ++element )
933  {
934  if( isDefault( element->value() ) ) continue;
935 
936  const SIMDTrait_<ElementType> x1( set( element->value() ) );
937 
938  size_t j( 0UL );
939 
940  for( ; j<jpos; j+=SIMDSIZE ) {
941  (~A).store( element->index(), j, (~A).load(element->index(),j) + x1 * y.load(j) );
942  }
943  for( ; remainder && j<N; ++j ) {
944  (~A)(element->index(),j) += element->value() * y[j];
945  }
946  }
947  }
949  //**********************************************************************************************
950 
951  //**Addition assignment to column-major dense matrices******************************************
967  template< typename MT > // Type of the target dense matrix
968  friend inline EnableIf_< UseAssign<MT> >
969  addAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
970  {
972 
973  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
974  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
975 
977 
978  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
979  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
980 
981  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
982  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
983  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
984  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
985 
986  const ConstIterator end( x.end() );
987 
988  for( size_t i=0UL; i<y.size(); ++i ) {
989  if( !isDefault( y[i] ) ) {
990  for( ConstIterator element=x.begin(); element!=end; ++element ) {
991  (~lhs)(element->index(),i) += element->value() * y[i];
992  }
993  }
994  }
995  }
997  //**********************************************************************************************
998 
999  //**Addition assignment to sparse matrices******************************************************
1000  // No special implementation for the addition assignment to sparse matrices.
1001  //**********************************************************************************************
1002 
1003  //**Subtraction assignment to row-major dense matrices******************************************
1016  template< typename MT > // Type of the target dense matrix
1017  friend inline void subAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
1018  {
1020 
1022 
1023  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1024  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1025 
1026  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1027  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1028 
1029  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1030  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1031  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1032  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1033 
1034  SVecDVecOuterExpr::selectSubAssignKernel( ~lhs, x, y );
1035  }
1037  //**********************************************************************************************
1038 
1039  //**Default subtraction assignment to row-major dense matrices**********************************
1053  template< typename MT // Type of the left-hand side target matrix
1054  , typename VT3 // Type of the left-hand side vector operand
1055  , typename VT4 > // Type of the right-hand side vector operand
1057  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1058  {
1060 
1061  const ConstIterator end( x.end() );
1062 
1063  for( ConstIterator element=x.begin(); element!=end; ++element ) {
1064  if( !isDefault( element->value() ) ) {
1065  for( size_t i=0UL; i<y.size(); ++i ) {
1066  (~A)(element->index(),i) -= element->value() * y[i];
1067  }
1068  }
1069  }
1070  }
1072  //**********************************************************************************************
1073 
1074  //**Vectorized subtraction assignment to row-major dense matrices*******************************
1088  template< typename MT // Type of the left-hand side target matrix
1089  , typename VT3 // Type of the left-hand side vector operand
1090  , typename VT4 > // Type of the right-hand side vector operand
1092  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1093  {
1095 
1096  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
1097 
1098  const size_t N( (~A).columns() );
1099 
1100  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
1101  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
1102 
1103  const ConstIterator begin( x.begin() );
1104  const ConstIterator end ( x.end() );
1105 
1106  for( ConstIterator element=begin; element!=end; ++element )
1107  {
1108  if( isDefault( element->value() ) ) continue;
1109 
1110  const SIMDTrait_<ElementType> x1( set( element->value() ) );
1111 
1112  size_t j( 0UL );
1113 
1114  for( ; j<jpos; j+=SIMDSIZE ) {
1115  (~A).store( element->index(), j, (~A).load(element->index(),j) - x1 * y.load(j) );
1116  }
1117  for( ; remainder && j<N; ++j ) {
1118  (~A)(element->index(),j) -= element->value() * y[j];
1119  }
1120  }
1121  }
1123  //**********************************************************************************************
1124 
1125  //**Subtraction assignment to column-major dense matrices***************************************
1141  template< typename MT > // Type of the target dense matrix
1142  friend inline EnableIf_< UseAssign<MT> >
1143  subAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
1144  {
1146 
1147  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1148  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1149 
1151 
1152  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1153  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1154 
1155  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1156  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1157  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1158  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1159 
1160  const ConstIterator end( x.end() );
1161 
1162  for( size_t i=0UL; i<y.size(); ++i ) {
1163  if( !isDefault( y[i] ) ) {
1164  for( ConstIterator element=x.begin(); element!=end; ++element ) {
1165  (~lhs)(element->index(),i) -= element->value() * y[i];
1166  }
1167  }
1168  }
1169  }
1171  //**********************************************************************************************
1172 
1173  //**Subtraction assignment to sparse matrices***************************************************
1174  // No special implementation for the subtraction assignment to sparse matrices.
1175  //**********************************************************************************************
1176 
1177  //**Schur product assignment to row-major dense matrices****************************************
1190  template< typename MT > // Type of the target dense matrix
1191  friend inline void schurAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
1192  {
1194 
1196 
1197  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1198  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1199 
1200  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1201  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1202 
1203  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1204  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1205  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1206  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1207 
1208  SVecDVecOuterExpr::selectSchurAssignKernel( ~lhs, x, y );
1209  }
1211  //**********************************************************************************************
1212 
1213  //**Default Schur product assignment to row-major dense matrices********************************
1227  template< typename MT // Type of the left-hand side target matrix
1228  , typename VT3 // Type of the left-hand side vector operand
1229  , typename VT4 > // Type of the right-hand side vector operand
1231  selectSchurAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1232  {
1234 
1235  const ConstIterator end( x.end() );
1236 
1237  size_t i( 0UL );
1238 
1239  for( ConstIterator element=x.begin(); element!=end; ++element )
1240  {
1241  if( isDefault( element->value() ) ) continue;
1242 
1243  for( ; i<element->index(); ++i ) {
1244  for( size_t j=0UL; j<y.size(); ++j )
1245  reset( (~A)(i,j) );
1246  }
1247 
1248  for( size_t j=0UL; j<y.size(); ++j ) {
1249  (~A)(element->index(),j) *= element->value() * y[j];
1250  }
1251 
1252  ++i;
1253  }
1254 
1255  for( ; i<x.size(); ++i ) {
1256  for( size_t j=0UL; j<y.size(); ++j )
1257  reset( (~A)(i,j) );
1258  }
1259  }
1261  //**********************************************************************************************
1262 
1263  //**Vectorized Schur product assignment to row-major dense matrices*****************************
1277  template< typename MT // Type of the left-hand side target matrix
1278  , typename VT3 // Type of the left-hand side vector operand
1279  , typename VT4 > // Type of the right-hand side vector operand
1281  selectSchurAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1282  {
1284 
1285  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
1286 
1287  const size_t M( (~A).rows() );
1288  const size_t N( (~A).columns() );
1289 
1290  const size_t jpos( remainder ? ( N & size_t(-SIMDSIZE) ) : N );
1291  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % SIMDSIZE ) ) == jpos, "Invalid end calculation" );
1292 
1293  const ConstIterator begin( x.begin() );
1294  const ConstIterator end ( x.end() );
1295 
1296  size_t i( 0UL );
1297 
1298  for( ConstIterator element=begin; element!=end; ++element )
1299  {
1300  if( isDefault( element->value() ) ) continue;
1301 
1302  for( ; i<element->index(); ++i ) {
1303  for( size_t j=0UL; j<N; ++j )
1304  reset( (~A)(i,j) );
1305  }
1306 
1307  const SIMDTrait_<ElementType> x1( set( element->value() ) );
1308 
1309  size_t j( 0UL );
1310 
1311  for( ; j<jpos; j+=SIMDSIZE ) {
1312  (~A).store( element->index(), j, (~A).load(element->index(),j) * ( x1 * y.load(j) ) );
1313  }
1314  for( ; remainder && j<N; ++j ) {
1315  (~A)(element->index(),j) *= element->value() * y[j];
1316  }
1317 
1318  ++i;
1319  }
1320 
1321  for( ; i<M; ++i ) {
1322  for( size_t j=0UL; j<N; ++j )
1323  reset( (~A)(i,j) );
1324  }
1325  }
1327  //**********************************************************************************************
1328 
1329  //**Schur product assignment to column-major dense matrices*************************************
1345  template< typename MT > // Type of the target dense matrix
1346  friend inline EnableIf_< UseAssign<MT> >
1347  schurAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
1348  {
1350 
1351  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1352  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1353 
1355 
1356  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1357  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1358 
1359  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1360  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1361  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1362  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1363 
1364  const ConstIterator end( x.end() );
1365 
1366  for( size_t j=0UL; j<y.size(); ++j )
1367  {
1368  size_t i( 0UL );
1369 
1370  for( ConstIterator element=x.begin(); element!=end; ++element, ++i ) {
1371  for( ; i<element->index(); ++i )
1372  reset( (~lhs)(i,j) );
1373  (~lhs)(element->index(),j) *= element->value() * y[j];
1374  }
1375 
1376  for( ; i<x.size(); ++i ) {
1377  reset( (~lhs)(i,j) );
1378  }
1379  }
1380  }
1382  //**********************************************************************************************
1383 
1384  //**Addition assignment to sparse matrices******************************************************
1385  // No special implementation for the addition assignment to sparse matrices.
1386  //**********************************************************************************************
1387 
1388  //**Multiplication assignment to dense matrices*************************************************
1389  // No special implementation for the multiplication assignment to dense matrices.
1390  //**********************************************************************************************
1391 
1392  //**Multiplication assignment to sparse matrices************************************************
1393  // No special implementation for the multiplication assignment to sparse matrices.
1394  //**********************************************************************************************
1395 
1396  //**Compile time checks*************************************************************************
1404  //**********************************************************************************************
1405 };
1406 //*************************************************************************************************
1407 
1408 
1409 
1410 
1411 //=================================================================================================
1412 //
1413 // GLOBAL BINARY ARITHMETIC OPERATORS
1414 //
1415 //=================================================================================================
1416 
1417 //*************************************************************************************************
1446 template< typename VT1 // Type of the left-hand side sparse vector
1447  , typename VT2 > // Type of the right-hand side dense vector
1448 inline decltype(auto)
1449  operator*( const SparseVector<VT1,false>& lhs, const DenseVector<VT2,true>& rhs )
1450 {
1452 
1453  using ReturnType = const SVecDVecOuterExpr<VT1,VT2>;
1454  return ReturnType( ~lhs, ~rhs );
1455 }
1456 //*************************************************************************************************
1457 
1458 
1459 
1460 
1461 //=================================================================================================
1462 //
1463 // SIZE SPECIALIZATIONS
1464 //
1465 //=================================================================================================
1466 
1467 //*************************************************************************************************
1469 template< typename VT1, typename VT2 >
1470 struct Size< SVecDVecOuterExpr<VT1,VT2>, 0UL >
1471  : public Size<VT1,0UL>
1472 {};
1473 
1474 template< typename VT1, typename VT2 >
1475 struct Size< SVecDVecOuterExpr<VT1,VT2>, 1UL >
1476  : public Size<VT2,0UL>
1477 {};
1479 //*************************************************************************************************
1480 
1481 } // namespace blaze
1482 
1483 #endif
If_< IsExpression< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:194
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SVecDVecOuterExpr.h:379
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:71
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:179
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:69
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:522
Header file for basic type definitions.
SVecDVecOuterExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the SVecDVecOuterExpr class.
Definition: SVecDVecOuterExpr.h:350
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecDVecOuterExpr.h:532
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified column.
Definition: SVecDVecOuterExpr.h:448
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: SVecDVecOuterExpr.h:540
#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:427
Header file for the IsSame and IsStrictlySame type traits.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecDVecOuterExpr.h:219
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:247
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
IteratorType it_
Iterator over the elements of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:328
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
Header file for the Computation base class.
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:217
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:110
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
RightElement v_
Element of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:329
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:191
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:461
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:508
Header file for the ValueIndexPair class.
ReturnType_< VT1 > RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:107
Header file for the IsTemporary type trait class.
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:185
Header file for the multiplication trait.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecDVecOuterExpr.h:299
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SVecDVecOuterExpr.h:258
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SVecDVecOuterExpr.h:180
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecDVecOuterExpr.h:498
LeftOperand lhs_
Left-hand side sparse vector of the multiplication expression.
Definition: SVecDVecOuterExpr.h:539
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
#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:236
size_t index() const
Access to the current index of the sparse element.
Definition: SVecDVecOuterExpr.h:288
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SVecDVecOuterExpr.h:182
Constraint on the data type.
Header file for the exception macros of the math module.
IteratorCategory iterator_category
The iterator category.
Definition: SVecDVecOuterExpr.h:226
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecDVecOuterExpr.h:321
CompositeType_< VT1 > CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:109
ElementType_< VT1 > ET1
Element type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:111
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:206
Header file for the EnableIf class template.
ResultType_< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:106
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:112
Header file for the IsNumeric type trait.
IfTrue_< useAssign, const ResultType, const SVecDVecOuterExpr &> CompositeType
Data type for composite expression templates.
Definition: SVecDVecOuterExpr.h:188
#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:268
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of column i.
Definition: SVecDVecOuterExpr.h:407
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecDVecOuterExpr.h:278
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:181
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:520
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecDVecOuterExpr.h:310
Header file for the reset shim.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SVecDVecOuterExpr.h:417
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:105
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
#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:108
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:197
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#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:200
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:396
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecDVecOuterExpr.h:214
#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
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SVecDVecOuterExpr.h:437
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SVecDVecOuterExpr.h:487
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:125
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:474
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:363
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Header file for the function trace functionality.