Blaze 3.9
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 <blaze/math/Aliases.h>
76#include <blaze/util/Assert.h>
77#include <blaze/util/EnableIf.h>
80#include <blaze/util/mpl/If.h>
81#include <blaze/util/Types.h>
82
83
84namespace blaze {
85
86//=================================================================================================
87//
88// CLASS TSVECSMATMULTEXPR
89//
90//=================================================================================================
91
92//*************************************************************************************************
99template< typename VT // Type of the left-hand side sparse vector
100 , typename MT > // Type of the right-hand side sparse matrix
102 : public TVecMatMultExpr< SparseVector< TSVecSMatMultExpr<VT,MT>, true > >
103 , private Computation
104{
105 private:
106 //**Type definitions****************************************************************************
111 //**********************************************************************************************
112
113 //**********************************************************************************************
115 static constexpr bool evaluateVector = IsComputation_v<VT>;
116 //**********************************************************************************************
117
118 //**********************************************************************************************
120 static constexpr bool evaluateMatrix = RequiresEvaluation_v<MT>;
121 //**********************************************************************************************
122
123 //**********************************************************************************************
125
129 template< typename T1 >
130 static constexpr bool UseSMPAssign_v = ( evaluateVector || evaluateMatrix );
132 //**********************************************************************************************
133
134 public:
135 //**Type definitions****************************************************************************
138
141
145 using ReturnType = const ElementType;
146 using CompositeType = const ResultType;
147
149 using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
150
152 using RightOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
153
156
159 //**********************************************************************************************
160
161 //**Compilation flags***************************************************************************
163 static constexpr bool smpAssignable =
164 ( !evaluateVector && VT::smpAssignable && !evaluateMatrix && MT::smpAssignable );
165 //**********************************************************************************************
166
167 //**Constructor*********************************************************************************
173 inline TSVecSMatMultExpr( const VT& vec, const MT& mat ) noexcept
174 : vec_( vec ) // Left-hand side sparse vector of the multiplication expression
175 , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
176 {
177 BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
178 }
179 //**********************************************************************************************
180
181 //**Subscript operator**************************************************************************
187 inline ReturnType operator[]( size_t index ) const {
188 BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
189
190 if( IsDiagonal_v<MT> )
191 {
192 return vec_[index] * mat_(index,index);
193 }
194 else if( IsLower_v<MT> )
195 {
196 const size_t begin( IsStrictlyLower_v<MT> ? index+1UL : index );
197 const size_t n ( mat_.rows() - begin );
198 return subvector( vec_, begin, n, unchecked ) *
199 subvector( column( mat_, index, unchecked ), begin, n, unchecked );
200 }
201 else if( IsUpper_v<MT> )
202 {
203 const size_t n( IsStrictlyUpper_v<MT> ? index : index+1UL );
204 return subvector( vec_, 0UL, n, unchecked ) *
205 subvector( column( mat_, index, unchecked ), 0UL, n, unchecked );
206 }
207 else
208 {
209 return vec_ * column( mat_, index, unchecked );
210 }
211 }
212 //**********************************************************************************************
213
214 //**At function*********************************************************************************
221 inline ReturnType at( size_t index ) const {
222 if( index >= mat_.columns() ) {
223 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
224 }
225 return (*this)[index];
226 }
227 //**********************************************************************************************
228
229 //**Size function*******************************************************************************
234 inline size_t size() const noexcept {
235 return mat_.columns();
236 }
237 //**********************************************************************************************
238
239 //**NonZeros function***************************************************************************
244 inline size_t nonZeros() const {
245 return mat_.columns();
246 }
247 //**********************************************************************************************
248
249 //**Left operand access*************************************************************************
254 inline LeftOperand leftOperand() const noexcept {
255 return vec_;
256 }
257 //**********************************************************************************************
258
259 //**Right operand access************************************************************************
264 inline RightOperand rightOperand() const noexcept {
265 return mat_;
266 }
267 //**********************************************************************************************
268
269 //**********************************************************************************************
275 template< typename T >
276 inline bool canAlias( const T* alias ) const noexcept {
277 return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
278 }
279 //**********************************************************************************************
280
281 //**********************************************************************************************
287 template< typename T >
288 inline bool isAliased( const T* alias ) const noexcept {
289 return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
290 }
291 //**********************************************************************************************
292
293 //**********************************************************************************************
298 inline bool canSMPAssign() const noexcept {
299 return ( size() > SMP_TSVECSMATMULT_THRESHOLD );
300 }
301 //**********************************************************************************************
302
303 private:
304 //**Member variables****************************************************************************
307 //**********************************************************************************************
308
309 //**Assignment to dense vectors*****************************************************************
322 template< typename VT1 > // Type of the target dense vector
323 friend inline void assign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
324 {
326
327 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
328
329 // Resetting the left-hand side target dense vector
330 reset( *lhs );
331
332 // Evaluation of the left-hand side sparse vector operand
333 LT x( serial( rhs.vec_ ) );
334 if( x.nonZeros() == 0UL ) return;
335
336 // Evaluation of the right-hand side sparse matrix operand
337 RT A( serial( rhs.mat_ ) );
338
339 // Checking the evaluated operands
340 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
341 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
342 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
343 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
344
345 // Performing the sparse vector-sparse matrix multiplication
346 TSVecSMatMultExpr::selectAssignKernel( *lhs, x, A );
347 }
349 //**********************************************************************************************
350
351 //**Default assignment to dense vectors*********************************************************
365 template< typename VT1 // Type of the left-hand side target vector
366 , typename VT2 // Type of the left-hand side vector operand
367 , typename MT1 > // Type of the right-hand side matrix operand
368 static inline void selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
369 {
370 const auto vend( x.end() );
371 auto velem( x.begin() );
372
373 for( ; velem!=vend; ++velem )
374 {
375 const auto mend( A.end( velem->index() ) );
376 auto melem( A.begin( velem->index() ) );
377
378 for( ; melem!=mend; ++melem ) {
380 isDefault( y[melem->index()] ) )
381 y[melem->index()] = velem->value() * melem->value();
382 else
383 y[melem->index()] += velem->value() * melem->value();
384 }
385 }
386 }
388 //**********************************************************************************************
389
390 //**Assignment to sparse vectors****************************************************************
402 template< typename VT1 > // Type of the target sparse vector
403 friend inline void assign( SparseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
404 {
406
407 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
408
409 const DynamicVector<ElementType_t<VT1>,true> tmp( serial( rhs ) );
410 assign( *lhs, tmp );
411 }
413 //**********************************************************************************************
414
415 //**Addition assignment to dense vectors********************************************************
428 template< typename VT1 > // Type of the target dense vector
429 friend inline void addAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
430 {
432
433 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
434
435 // Evaluation of the left-hand side sparse vector operand
436 LT x( serial( rhs.vec_ ) );
437 if( x.nonZeros() == 0UL ) return;
438
439 // Evaluation of the right-hand side sparse matrix operand
440 RT A( serial( rhs.mat_ ) );
441
442 // Checking the evaluated operands
443 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
444 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
445 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
446 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
447
448 // Performing the sparse vector-sparse matrix multiplication
449 TSVecSMatMultExpr::selectAddAssignKernel( *lhs, x, A );
450 }
452 //**********************************************************************************************
453
454 //**Default addition assignment to dense vectors************************************************
468 template< typename VT1 // Type of the left-hand side target vector
469 , typename VT2 // Type of the left-hand side vector operand
470 , typename MT1 > // Type of the right-hand side matrix operand
471 static inline void selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
472 {
473 const auto vend( x.end() );
474 auto velem( x.begin() );
475
476 for( ; velem!=vend; ++velem )
477 {
478 const auto mend( A.end( velem->index() ) );
479 auto melem( A.begin( velem->index() ) );
480
481 for( ; melem!=mend; ++melem ) {
482 y[melem->index()] += velem->value() * melem->value();
483 }
484 }
485 }
487 //**********************************************************************************************
488
489 //**Addition assignment to sparse vectors*******************************************************
490 // No special implementation for the addition assignment to sparse vectors.
491 //**********************************************************************************************
492
493 //**Subtraction assignment to dense vectors*****************************************************
506 template< typename VT1 > // Type of the target dense vector
507 friend inline void subAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
508 {
510
511 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
512
513 // Evaluation of the left-hand side sparse vector operand
514 LT x( serial( rhs.vec_ ) );
515 if( x.nonZeros() == 0UL ) return;
516
517 // Evaluation of the right-hand side sparse matrix operand
518 RT A( serial( rhs.mat_ ) );
519
520 // Checking the evaluated operands
521 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
522 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
523 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
524 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
525
526 // Performing the sparse vector-sparse matrix multiplication
527 TSVecSMatMultExpr::selectSubAssignKernel( *lhs, x, A );
528 }
530 //**********************************************************************************************
531
532 //**Default subtraction assignment to dense vectors*********************************************
546 template< typename VT1 // Type of the left-hand side target vector
547 , typename VT2 // Type of the left-hand side vector operand
548 , typename MT1 > // Type of the right-hand side matrix operand
549 static inline void selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
550 {
551 const auto vend( x.end() );
552 auto velem( x.begin() );
553
554 for( ; velem!=vend; ++velem )
555 {
556 const auto mend( A.end( velem->index() ) );
557 auto melem( A.begin( velem->index() ) );
558
559 for( ; melem!=mend; ++melem ) {
560 y[melem->index()] -= velem->value() * melem->value();
561 }
562 }
563 }
565 //**********************************************************************************************
566
567 //**Subtraction assignment to sparse vectors****************************************************
568 // No special implementation for the subtraction assignment to sparse vectors.
569 //**********************************************************************************************
570
571 //**Multiplication assignment to dense vectors**************************************************
584 template< typename VT1 > // Type of the target dense vector
585 friend inline void multAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
586 {
588
592
593 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
594
595 const ResultType tmp( serial( rhs ) );
596 multAssign( *lhs, tmp );
597 }
599 //**********************************************************************************************
600
601 //**Multiplication assignment to sparse vectors*************************************************
602 // No special implementation for the multiplication assignment to sparse vectors.
603 //**********************************************************************************************
604
605 //**SMP assignment to dense vectors*************************************************************
620 template< typename VT1 > // Type of the target dense vector
621 friend inline auto smpAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
622 -> EnableIf_t< UseSMPAssign_v<VT1> >
623 {
625
626 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
627
628 // Resetting the left-hand side target dense vector
629 reset( *lhs );
630
631 // Evaluation of the left-hand side sparse vector operand
632 LT x( rhs.vec_ );
633 if( x.nonZeros() == 0UL ) return;
634
635 // Evaluation of the right-hand side sparse matrix operand
636 RT A( rhs.mat_ );
637
638 // Checking the evaluated operands
639 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
640 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
641 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
642 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
643
644 // Performing the sparse vector-sparse matrix multiplication
645 smpAssign( *lhs, x * A );
646 }
648 //**********************************************************************************************
649
650 //**SMP assignment to sparse vectors************************************************************
651 // No special implementation for the SMP assignment to sparse vectors.
652 //**********************************************************************************************
653
654 //**SMP addition assignment to dense vectors****************************************************
669 template< typename VT1 > // Type of the target dense vector
670 friend inline auto smpAddAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
671 -> EnableIf_t< UseSMPAssign_v<VT1> >
672 {
674
675 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
676
677 // Evaluation of the left-hand side sparse vector operand
678 LT x( rhs.vec_ );
679 if( x.nonZeros() == 0UL ) return;
680
681 // Evaluation of the right-hand side sparse matrix operand
682 RT A( rhs.mat_ );
683
684 // Checking the evaluated operands
685 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
686 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
687 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
688 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
689
690 // Performing the sparse vector-sparse matrix multiplication
691 smpAddAssign( *lhs, x * A );
692 }
694 //**********************************************************************************************
695
696 //**SMP addition assignment to sparse vectors***************************************************
697 // No special implementation for the SMP addition assignment to sparse vectors.
698 //**********************************************************************************************
699
700 //**SMP subtraction assignment to dense vectors*************************************************
715 template< typename VT1 > // Type of the target dense vector
716 friend inline auto smpSubAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
717 -> EnableIf_t< UseSMPAssign_v<VT1> >
718 {
720
721 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
722
723 // Evaluation of the left-hand side sparse vector operand
724 LT x( rhs.vec_ );
725 if( x.nonZeros() == 0UL ) return;
726
727 // Evaluation of the right-hand side sparse matrix operand
728 RT A( rhs.mat_ );
729
730 // Checking the evaluated operands
731 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
732 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
733 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
734 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
735
736 // Performing the sparse vector-sparse matrix multiplication
737 smpSubAssign( *lhs, x * A );
738 }
740 //**********************************************************************************************
741
742 //**SMP subtraction assignment to sparse vectors************************************************
743 // No special implementation for the SMP subtraction assignment to sparse vectors.
744 //**********************************************************************************************
745
746 //**SMP multiplication assignment to dense vectors**********************************************
761 template< typename VT1 > // Type of the target dense vector
762 friend inline auto smpMultAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
763 -> EnableIf_t< UseSMPAssign_v<VT1> >
764 {
766
770
771 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
772
773 const ResultType tmp( rhs );
774 smpMultAssign( *lhs, tmp );
775 }
777 //**********************************************************************************************
778
779 //**SMP multiplication assignment to sparse vectors*********************************************
780 // No special implementation for the SMP multiplication assignment to sparse vectors.
781 //**********************************************************************************************
782
783 //**Compile time checks*************************************************************************
793 //**********************************************************************************************
794};
795//*************************************************************************************************
796
797
798
799
800//=================================================================================================
801//
802// GLOBAL BINARY ARITHMETIC OPERATORS
803//
804//=================================================================================================
805
806//*************************************************************************************************
819template< typename VT // Type of the left-hand side sparse vector
820 , typename MT // Type of the right-hand side sparse matrix
821 , DisableIf_t< ( IsIdentity_v<MT> &&
822 IsSame_v< ElementType_t<VT>, ElementType_t<MT> > ) ||
823 ( IsZero_v<MT> || IsZero_v<VT> ) >* = nullptr >
824inline const TSVecSMatMultExpr<VT,MT>
825 tsvecsmatmult( const SparseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
826{
828
829 BLAZE_INTERNAL_ASSERT( (*vec).size() == (*mat).rows(), "Invalid vector and matrix sizes" );
830
831 return TSVecSMatMultExpr<VT,MT>( *vec, *mat );
832}
834//*************************************************************************************************
835
836
837//*************************************************************************************************
851template< typename VT // Type of the left-hand side sparse vector
852 , typename MT // Type of the right-hand side sparse matrix
853 , EnableIf_t< ( IsIdentity_v<MT> &&
854 IsSame_v< ElementType_t<VT>, ElementType_t<MT> > ) &&
855 !IsZero_v<VT> >* = nullptr >
856inline const VT&
857 tsvecsmatmult( const SparseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
858{
860
861 MAYBE_UNUSED( mat );
862
863 BLAZE_INTERNAL_ASSERT( (*vec).size() == (*mat).rows(), "Invalid vector and matrix sizes" );
864
865 return (*vec);
866}
868//*************************************************************************************************
869
870
871//*************************************************************************************************
885template< typename VT // Type of the left-hand side sparse vector
886 , typename MT // Type of the right-hand side sparse matrix
887 , EnableIf_t< IsZero_v<MT> || IsZero_v<VT> >* = nullptr >
888inline decltype(auto)
889 tsvecsmatmult( const SparseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
890{
892
893 MAYBE_UNUSED( vec );
894
895 BLAZE_INTERNAL_ASSERT( (*vec).size() == (*mat).rows(), "Invalid vector and matrix sizes" );
896
897 using ReturnType = const MultTrait_t< ResultType_t<VT>, ResultType_t<MT> >;
898
901
902 return ReturnType( (*mat).columns() );
903}
905//*************************************************************************************************
906
907
908//*************************************************************************************************
939template< typename VT // Type of the left-hand side sparse vector
940 , typename MT > // Type of the right-hand side sparse matrix
941inline decltype(auto)
942 operator*( const SparseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
943{
945
947
948 if( (*vec).size() != (*mat).rows() ) {
949 BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
950 }
951
952 return tsvecsmatmult( *vec, *mat );
953}
954//*************************************************************************************************
955
956} // namespace blaze
957
958#endif
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsComputation type trait class.
Header file for the isDefault shim.
Header file for the IsDiagonal type trait.
Header file for the IsExpression type trait class.
Header file for the IsIdentity type trait.
Header file for the IsLower type trait.
Header file for the IsResizable type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsUpper type trait.
Deactivation of problematic macros.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
Constraint on the data type.
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Base class for sparse vectors.
Definition: SparseVector.h:72
Expression object for sparse vector-sparse matrix multiplications.
Definition: TSVecSMatMultExpr.h:104
ResultType_t< MT > MRT
Result type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:108
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:120
TSVecSMatMultExpr(const VT &vec, const MT &mat) noexcept
Constructor for the TSVecSMatMultExpr class.
Definition: TSVecSMatMultExpr.h:173
static constexpr bool evaluateVector
Compilation switch for the composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:115
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:149
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSVecSMatMultExpr.h:163
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSVecSMatMultExpr.h:144
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSVecSMatMultExpr.h:221
If_t< IsExpression_v< MT >, const MT, const MT & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:152
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSVecSMatMultExpr.h:306
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSVecSMatMultExpr.h:146
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSVecSMatMultExpr.h:276
CompositeType_t< MT > MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:110
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSVecSMatMultExpr.h:234
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSVecSMatMultExpr.h:298
If_t< evaluateVector, const VRT, VCT > LT
Type for the assignment of the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:155
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:143
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:254
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSVecSMatMultExpr.h:288
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSVecSMatMultExpr.h:244
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSVecSMatMultExpr.h:187
MultTrait_t< VRT, MRT > ResultType
Result type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:142
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:264
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:145
CompositeType_t< VT > VCT
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:109
If_t< evaluateMatrix, const MRT, MCT > RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:158
LeftOperand vec_
Left-hand side sparse vector of the multiplication expression.
Definition: TSVecSMatMultExpr.h:305
ResultType_t< VT > VRT
Result type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:107
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of an arbitrarily sized vector.
Header file for the Computation base class.
Header file for the SparseVector base class.
Header file for the TVecMatMultExpr base class.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition: DiagonalMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: RowMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_TVECMATMULTEXPR(T1, T2)
Constraint on the data type.
Definition: TVecMatMultExpr.h:104
#define BLAZE_CONSTRAINT_MUST_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.
Definition: MatMatMultExpr.h:83
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.
Definition: RowVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:61
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
constexpr bool IsResizable_v
Auxiliary variable template for the IsResizable type trait.
Definition: IsResizable.h:136
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:518
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:192
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:158
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
constexpr Unchecked unchecked
Global Unchecked instance.
Definition: Check.h:146
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
Header file for the reset shim.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all vector/matrix multiplication expression templates.
Definition: TVecMatMultExpr.h:69
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the IsZero type trait.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.