All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSVecSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSVECSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSVECSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
44 #include <vector>
57 #include <blaze/math/shims/Reset.h>
69 #include <blaze/util/Assert.h>
70 #include <blaze/util/Byte.h>
72 #include <blaze/util/DisableIf.h>
73 #include <blaze/util/EnableIf.h>
75 #include <blaze/util/SelectType.h>
76 #include <blaze/util/Types.h>
78 
79 
80 namespace blaze {
81 
82 //=================================================================================================
83 //
84 // CLASS TSVECSMATMULTEXPR
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
95 template< typename VT // Type of the left-hand side sparse vector
96  , typename MT > // Type of the right-hand side sparse matrix
97 class TSVecSMatMultExpr : public SparseVector< TSVecSMatMultExpr<VT,MT>, true >
98  , private TVecMatMultExpr
99  , private Computation
100 {
101  private:
102  //**Type definitions****************************************************************************
103  typedef typename VT::ResultType VRT;
104  typedef typename MT::ResultType MRT;
105  typedef typename VT::CompositeType VCT;
106  typedef typename MT::CompositeType MCT;
107  //**********************************************************************************************
108 
109  //**********************************************************************************************
111  enum { evaluateVector = IsComputation<VT>::value };
112  //**********************************************************************************************
113 
114  //**********************************************************************************************
116  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
121 
125  template< typename T1 >
126  struct UseSMPAssign {
127  enum { value = ( evaluateVector || evaluateMatrix ) };
128  };
130  //**********************************************************************************************
131 
132  public:
133  //**Type definitions****************************************************************************
138  typedef const ElementType ReturnType;
139  typedef const ResultType CompositeType;
140 
142  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
143 
145  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type RightOperand;
146 
149 
152  //**********************************************************************************************
153 
154  //**Compilation flags***************************************************************************
156  enum { smpAssignable = !evaluateVector && VT::smpAssignable &&
157  !evaluateMatrix && MT::smpAssignable };
158  //**********************************************************************************************
159 
160  //**Constructor*********************************************************************************
166  explicit inline TSVecSMatMultExpr( const VT& vec, const MT& mat )
167  : vec_( vec ) // Left-hand side sparse vector of the multiplication expression
168  , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
169  {
170  BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
171  }
172  //**********************************************************************************************
173 
174  //**Subscript operator**************************************************************************
180  inline ReturnType operator[]( size_t index ) const {
181  BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
182 
183  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
184 
185  VCT x( vec_ ); // Evaluation of the left-hand side sparse vector operand
186  MCT A( mat_ ); // Evaluation of the right-hand side sparse matrix operand
187 
188  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size() , "Invalid vector size" );
189  BLAZE_INTERNAL_ASSERT( A.rows() == mat_.rows() , "Invalid number of rows" );
190  BLAZE_INTERNAL_ASSERT( A.columns() == mat_.columns(), "Invalid number of columns" );
191 
192  const VectorIterator vend( x.end() );
193  VectorIterator velem( x.begin() );
194  ElementType res;
195 
196  if( velem != vend ) {
197  res = velem->value() * A(velem->index(),index);
198  ++velem;
199  for( ; velem!=vend; ++velem ) {
200  res += velem->value() * A(velem->index(),index);
201  }
202  }
203  else {
204  reset( res );
205  }
206 
207  return res;
208  }
209  //**********************************************************************************************
210 
211  //**Size function*******************************************************************************
216  inline size_t size() const {
217  return mat_.columns();
218  }
219  //**********************************************************************************************
220 
221  //**NonZeros function***************************************************************************
226  inline size_t nonZeros() const {
227  return mat_.columns();
228  }
229  //**********************************************************************************************
230 
231  //**Left operand access*************************************************************************
236  inline LeftOperand leftOperand() const {
237  return vec_;
238  }
239  //**********************************************************************************************
240 
241  //**Right operand access************************************************************************
246  inline RightOperand rightOperand() const {
247  return mat_;
248  }
249  //**********************************************************************************************
250 
251  //**********************************************************************************************
257  template< typename T >
258  inline bool canAlias( const T* alias ) const {
259  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
260  }
261  //**********************************************************************************************
262 
263  //**********************************************************************************************
269  template< typename T >
270  inline bool isAliased( const T* alias ) const {
271  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
272  }
273  //**********************************************************************************************
274 
275  //**********************************************************************************************
280  inline bool canSMPAssign() const {
281  return ( size() > SMP_TSVECSMATMULT_THRESHOLD );
282  }
283  //**********************************************************************************************
284 
285  private:
286  //**Member variables****************************************************************************
289  //**********************************************************************************************
290 
291  //**Assignment to dense vectors*****************************************************************
304  template< typename VT1 > // Type of the target dense vector
305  friend inline void assign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
306  {
308 
309  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
310 
311  // Resetting the left-hand side target dense vector
312  reset( ~lhs );
313 
314  // Evaluation of the left-hand side sparse vector operand
315  LT x( serial( rhs.vec_ ) );
316  if( x.nonZeros() == 0UL ) return;
317 
318  // Evaluation of the right-hand side sparse matrix operand
319  RT A( serial( rhs.mat_ ) );
320 
321  // Checking the evaluated operands
322  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
323  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
324  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
325  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
326 
327  // Performing the sparse vector-sparse matrix multiplication
328  TSVecSMatMultExpr::selectAssignKernel( ~lhs, x, A );
329  }
331  //**********************************************************************************************
332 
333  //**Default assignment to dense vectors*********************************************************
347  template< typename VT1 // Type of the left-hand side target vector
348  , typename VT2 // Type of the left-hand side vector operand
349  , typename MT1 > // Type of the right-hand side matrix operand
350  static inline void selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
351  {
352  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
353  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
354 
355  const VectorIterator vend( x.end() );
356  VectorIterator velem( x.begin() );
357 
358  for( ; velem!=vend; ++velem )
359  {
360  const MatrixIterator mend( A.end( velem->index() ) );
361  MatrixIterator melem( A.begin( velem->index() ) );
362 
363  for( ; melem!=mend; ++melem ) {
365  isDefault( y[melem->index()] ) )
366  y[melem->index()] = velem->value() * melem->value();
367  else
368  y[melem->index()] += velem->value() * melem->value();
369  }
370  }
371  }
373  //**********************************************************************************************
374 
375  //**Assignment to sparse vectors****************************************************************
387  template< typename VT1 > // Type of the target sparse vector
388  friend inline void assign( SparseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
389  {
391 
392  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
393 
394  typedef typename RemoveReference<LT>::Type::ConstIterator VectorIterator;
395  typedef typename RemoveReference<RT>::Type::ConstIterator MatrixIterator;
396 
397  // Evaluation of the left-hand side sparse vector operand
398  LT x( serial( rhs.vec_ ) );
399  if( x.nonZeros() == 0UL ) return;
400 
401  // Evaluation of the right-hand side sparse matrix operand
402  RT A( serial( rhs.mat_ ) );
403 
404  // Checking the evaluated operands
405  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
406  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
407  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
408  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
409 
410  // Performing the sparse vector-sparse matrix multiplication
411  DynamicVector<ElementType> tmp( (~lhs).size() );
412  std::vector<byte> indices( (~lhs).size(), 0 );
413  size_t nonzeros( 0UL );
414 
415  const VectorIterator vend( x.end() );
416  VectorIterator velem( x.begin() );
417 
418  for( ; velem!=vend; ++velem )
419  {
420  const MatrixIterator mend ( A.end ( velem->index() ) );
421  MatrixIterator melem( A.begin( velem->index() ) );
422 
423  for( ; melem!=mend; ++melem ) {
424  if( !indices[melem->index()] ) {
425  indices[melem->index()] = 1;
426  ++nonzeros;
427  tmp[melem->index()] = velem->value() * melem->value();
428  }
429  else {
430  tmp[melem->index()] += velem->value() * melem->value();
431  }
432  }
433  }
434 
435  (~lhs).reserve( nonzeros );
436 
437  for( size_t i=0UL; i<(~lhs).size(); ++i ) {
438  if( indices[i] ) {
439  (~lhs).append( i, tmp[i] );
440  }
441  }
442  }
444  //**********************************************************************************************
445 
446  //**Addition assignment to dense vectors********************************************************
459  template< typename VT1 > // Type of the target dense vector
460  friend inline void addAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
461  {
463 
464  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
465 
466  // Evaluation of the left-hand side sparse vector operand
467  LT x( serial( rhs.vec_ ) );
468  if( x.nonZeros() == 0UL ) return;
469 
470  // Evaluation of the right-hand side sparse matrix operand
471  RT A( serial( rhs.mat_ ) );
472 
473  // Checking the evaluated operands
474  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
475  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
476  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
477  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
478 
479  // Performing the sparse vector-sparse matrix multiplication
480  TSVecSMatMultExpr::selectAddAssignKernel( ~lhs, x, A );
481  }
483  //**********************************************************************************************
484 
485  //**Default addition assignment to dense vectors************************************************
499  template< typename VT1 // Type of the left-hand side target vector
500  , typename VT2 // Type of the left-hand side vector operand
501  , typename MT1 > // Type of the right-hand side matrix operand
502  static inline void selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
503  {
504  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
505  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
506 
507  const VectorIterator vend( x.end() );
508  VectorIterator velem( x.begin() );
509 
510  for( ; velem!=vend; ++velem )
511  {
512  const MatrixIterator mend( A.end( velem->index() ) );
513  MatrixIterator melem( A.begin( velem->index() ) );
514 
515  for( ; melem!=mend; ++melem ) {
516  y[melem->index()] += velem->value() * melem->value();
517  }
518  }
519  }
521  //**********************************************************************************************
522 
523  //**Addition assignment to sparse vectors*******************************************************
524  // No special implementation for the addition assignment to sparse vectors.
525  //**********************************************************************************************
526 
527  //**Subtraction assignment to dense vectors*****************************************************
540  template< typename VT1 > // Type of the target dense vector
541  friend inline void subAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
542  {
544 
545  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
546 
547  // Evaluation of the left-hand side sparse vector operand
548  LT x( serial( rhs.vec_ ) );
549  if( x.nonZeros() == 0UL ) return;
550 
551  // Evaluation of the right-hand side sparse matrix operand
552  RT A( serial( rhs.mat_ ) );
553 
554  // Checking the evaluated operands
555  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
556  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
557  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
558  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
559 
560  // Performing the sparse vector-sparse matrix multiplication
561  TSVecSMatMultExpr::selectSubAssignKernel( ~lhs, x, A );
562  }
564  //**********************************************************************************************
565 
566  //**Default subtraction assignment to dense vectors*********************************************
580  template< typename VT1 // Type of the left-hand side target vector
581  , typename VT2 // Type of the left-hand side vector operand
582  , typename MT1 > // Type of the right-hand side matrix operand
583  static inline void selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
584  {
585  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
586  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
587 
588  const VectorIterator vend( x.end() );
589  VectorIterator velem( x.begin() );
590 
591  for( ; velem!=vend; ++velem )
592  {
593  const MatrixIterator mend( A.end( velem->index() ) );
594  MatrixIterator melem( A.begin( velem->index() ) );
595 
596  for( ; melem!=mend; ++melem ) {
597  y[melem->index()] -= velem->value() * melem->value();
598  }
599  }
600  }
602  //**********************************************************************************************
603 
604  //**Subtraction assignment to sparse vectors****************************************************
605  // No special implementation for the subtraction assignment to sparse vectors.
606  //**********************************************************************************************
607 
608  //**Multiplication assignment to dense vectors**************************************************
621  template< typename VT1 > // Type of the target dense vector
622  friend inline void multAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
623  {
625 
629 
630  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
631 
632  const ResultType tmp( serial( rhs ) );
633  multAssign( ~lhs, tmp );
634  }
636  //**********************************************************************************************
637 
638  //**Multiplication assignment to sparse vectors*************************************************
639  // No special implementation for the multiplication assignment to sparse vectors.
640  //**********************************************************************************************
641 
642  //**SMP assignment to dense vectors*************************************************************
657  template< typename VT1 > // Type of the target dense vector
658  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
659  smpAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
660  {
662 
663  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
664 
665  // Resetting the left-hand side target dense vector
666  reset( ~lhs );
667 
668  // Evaluation of the left-hand side sparse vector operand
669  LT x( rhs.vec_ );
670  if( x.nonZeros() == 0UL ) return;
671 
672  // Evaluation of the right-hand side sparse matrix operand
673  RT A( rhs.mat_ );
674 
675  // Checking the evaluated operands
676  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
677  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
678  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
679  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
680 
681  // Performing the sparse vector-sparse matrix multiplication
682  smpAssign( ~lhs, x * A );
683  }
685  //**********************************************************************************************
686 
687  //**SMP assignment to sparse vectors************************************************************
688  // No special implementation for the SMP assignment to sparse vectors.
689  //**********************************************************************************************
690 
691  //**SMP addition assignment to dense vectors****************************************************
706  template< typename VT1 > // Type of the target dense vector
707  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
708  smpAddAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
709  {
711 
712  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
713 
714  // Evaluation of the left-hand side sparse vector operand
715  LT x( rhs.vec_ );
716  if( x.nonZeros() == 0UL ) return;
717 
718  // Evaluation of the right-hand side sparse matrix operand
719  RT A( rhs.mat_ );
720 
721  // Checking the evaluated operands
722  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
723  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
724  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
725  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
726 
727  // Performing the sparse vector-sparse matrix multiplication
728  smpAddAssign( ~lhs, x * A );
729  }
731  //**********************************************************************************************
732 
733  //**SMP addition assignment to sparse vectors***************************************************
734  // No special implementation for the SMP addition assignment to sparse vectors.
735  //**********************************************************************************************
736 
737  //**SMP subtraction assignment to dense vectors*************************************************
752  template< typename VT1 > // Type of the target dense vector
753  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
754  smpSubAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
755  {
757 
758  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
759 
760  // Evaluation of the left-hand side sparse vector operand
761  LT x( rhs.vec_ );
762  if( x.nonZeros() == 0UL ) return;
763 
764  // Evaluation of the right-hand side sparse matrix operand
765  RT A( rhs.mat_ );
766 
767  // Checking the evaluated operands
768  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
769  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
770  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
771  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
772 
773  // Performing the sparse vector-sparse matrix multiplication
774  smpSubAssign( ~lhs, x * A );
775  }
777  //**********************************************************************************************
778 
779  //**SMP subtraction assignment to sparse vectors************************************************
780  // No special implementation for the SMP subtraction assignment to sparse vectors.
781  //**********************************************************************************************
782 
783  //**SMP multiplication assignment to dense vectors**********************************************
798  template< typename VT1 > // Type of the target dense vector
799  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
800  smpMultAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
801  {
803 
807 
808  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
809 
810  const ResultType tmp( rhs );
811  smpMultAssign( ~lhs, tmp );
812  }
814  //**********************************************************************************************
815 
816  //**SMP multiplication assignment to sparse vectors*********************************************
817  // No special implementation for the SMP multiplication assignment to sparse vectors.
818  //**********************************************************************************************
819 
820  //**Compile time checks*************************************************************************
828  //**********************************************************************************************
829 };
830 //*************************************************************************************************
831 
832 
833 
834 
835 //=================================================================================================
836 //
837 // GLOBAL BINARY ARITHMETIC OPERATORS
838 //
839 //=================================================================================================
840 
841 //*************************************************************************************************
872 template< typename T1 // Type of the left-hand side sparse vector
873  , typename T2 > // Type of the right-hand side sparse matrix
874 inline const typename DisableIf< IsMatMatMultExpr<T2>, TSVecSMatMultExpr<T1,T2> >::Type
876 {
878 
879  if( (~vec).size() != (~mat).rows() )
880  throw std::invalid_argument( "Vector and matrix sizes do not match" );
881 
882  return TSVecSMatMultExpr<T1,T2>( ~vec, ~mat );
883 }
884 //*************************************************************************************************
885 
886 
887 
888 
889 //=================================================================================================
890 //
891 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
892 //
893 //=================================================================================================
894 
895 //*************************************************************************************************
908 template< typename T1 // Type of the left-hand side sparse vector
909  , typename T2 // Type of the right-hand side sparse matrix
910  , bool SO > // Storage order of the right-hand side sparse matrix
911 inline const typename EnableIf< IsMatMatMultExpr<T2>, typename MultExprTrait<T1,T2>::Type >::Type
913 {
915 
917 
918  return ( vec * (~mat).leftOperand() ) * (~mat).rightOperand();
919 }
920 //*************************************************************************************************
921 
922 
923 
924 
925 //=================================================================================================
926 //
927 // SIZE SPECIALIZATIONS
928 //
929 //=================================================================================================
930 
931 //*************************************************************************************************
933 template< typename MT, typename VT >
934 struct Size< TSVecSMatMultExpr<MT,VT> >
935  : public Columns<MT>
936 {};
938 //*************************************************************************************************
939 
940 
941 
942 
943 //=================================================================================================
944 //
945 // EXPRESSION TRAIT SPECIALIZATIONS
946 //
947 //=================================================================================================
948 
949 //*************************************************************************************************
951 template< typename VT, typename MT, bool AF >
952 struct SubvectorExprTrait< TSVecSMatMultExpr<VT,MT>, AF >
953 {
954  public:
955  //**********************************************************************************************
956  typedef typename MultExprTrait< VT, typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
957  //**********************************************************************************************
958 };
960 //*************************************************************************************************
961 
962 } // namespace blaze
963 
964 #endif
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
BLAZE_ALWAYS_INLINE void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:879
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:136
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4838
Header file for the SparseVector base class.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSVecSMatMultExpr.h:139
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:205
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2478
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:145
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:257
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:695
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
VT::CompositeType VCT
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:105
MultTrait< VRT, MRT >::Type ResultType
Result type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:135
Header file for the implementation of an arbitrarily sized vector.
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
Constraint on the data type.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSVecSMatMultExpr.h:180
Constraint on the data type.
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:259
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
Header file for the multiplication trait.
RightOperand rightOperand() const
Returns the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:246
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
Expression object for sparse vector-sparse matrix multiplications.The TSVecSMatMultExpr class represe...
Definition: Forward.h:148
TSVecSMatMultExpr< VT, MT > This
Type of this TSVecSMatMultExpr instance.
Definition: TSVecSMatMultExpr.h:134
Header file for the IsMatMatMultExpr type trait class.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the Columns type trait.
SelectType< evaluateMatrix, const MRT, MCT >::Type RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:151
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:79
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
Constraints on the storage order of matrix types.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:138
LeftOperand vec_
Left-hand side sparse vector of the multiplication expression.
Definition: TSVecSMatMultExpr.h:287
ResultType::ElementType ElementType
Resulting element type.
Definition: TSVecSMatMultExpr.h:137
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
VT::ResultType VRT
Result type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:103
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSVecSMatMultExpr.h:226
Header file for the EnableIf class template.
Header file for the serial shim.
Header file for the byte type.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSVecSMatMultExpr.h:288
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
#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:116
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Base template for the MultTrait class.
Definition: MultTrait.h:142
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: TSVecSMatMultExpr.h:280
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
size_t size() const
Returns the current size/dimension of the vector.
Definition: TSVecSMatMultExpr.h:216
Header file for the reset shim.
Constraint on the data type.
Header file for the isDefault shim.
Header file for the TVecMatMultExpr base class.
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
BLAZE_ALWAYS_INLINE void reset(const NonNumericProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: NonNumericProxy.h:833
TSVecSMatMultExpr(const VT &vec, const MT &mat)
Constructor for the TSVecSMatMultExpr class.
Definition: TSVecSMatMultExpr.h:166
Header file for the RemoveReference type trait.
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_TVECMATMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/matrix ...
Definition: TVecMatMultExpr.h:166
const size_t SMP_TSVECSMATMULT_THRESHOLD
SMP sparse vector/row-major sparse matrix multiplication threshold.This threshold specifies when a sp...
Definition: Thresholds.h:644
SelectType< evaluateVector, const VRT, VCT >::Type LT
Type for the assignment of the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:148
Header file for the IsComputation type trait class.
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:236
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2473
Header file for basic type definitions.
#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: TransposeFlag.h:81
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:142
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: TSVecSMatMultExpr.h:258
MT::CompositeType MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:106
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TSVecSMatMultExpr.h:270
Header file for the IsResizable type trait.
MT::ResultType MRT
Result type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:104
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the Size type trait.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849