Blaze 3.9
TSMatSVecMultExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_TSMATSVECMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_TSMATSVECMULTEXPR_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 SMATDVECMULTEXPR
89//
90//=================================================================================================
91
92//*************************************************************************************************
99template< typename MT // Type of the left-hand side sparse matrix
100 , typename VT > // Type of the right-hand side sparse vector
102 : public MatVecMultExpr< SparseVector< TSMatSVecMultExpr<MT,VT>, false > >
103 , private Computation
104{
105 private:
106 //**Type definitions****************************************************************************
111 //**********************************************************************************************
112
113 //**********************************************************************************************
115 static constexpr bool evaluateMatrix = RequiresEvaluation_v<MT>;
116 //**********************************************************************************************
117
118 //**********************************************************************************************
120 static constexpr bool evaluateVector = ( RequiresEvaluation_v<VT> || IsComputation_v<VT> );
121 //**********************************************************************************************
122
123 //**********************************************************************************************
125
129 template< typename T1 >
130 static constexpr bool UseSMPAssign_v = ( evaluateMatrix || evaluateVector );
132 //**********************************************************************************************
133
134 public:
135 //**Type definitions****************************************************************************
138
141
145 using ReturnType = const ElementType;
146
149
151 using LeftOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
152
154 using RightOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
155
158
161 //**********************************************************************************************
162
163 //**Compilation flags***************************************************************************
165 static constexpr bool smpAssignable =
166 ( !evaluateMatrix && MT::smpAssignable && !evaluateVector && VT::smpAssignable );
167 //**********************************************************************************************
168
169 //**Constructor*********************************************************************************
175 inline TSMatSVecMultExpr( const MT& mat, const VT& vec ) noexcept
176 : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
177 , vec_( vec ) // Right-hand side sparse vector of the multiplication expression
178 {
179 BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
180 }
181 //**********************************************************************************************
182
183 //**Subscript operator**************************************************************************
189 inline ReturnType operator[]( size_t index ) const {
190 BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
191
192 if( IsDiagonal_v<MT> )
193 {
194 return mat_(index,index) * vec_[index];
195 }
196 else if( IsLower_v<MT> )
197 {
198 const size_t n( IsStrictlyLower_v<MT> ? index : index+1UL );
199 return subvector( row( mat_, index, unchecked ), 0UL, n, unchecked ) *
200 subvector( vec_, 0UL, n, unchecked );
201 }
202 else if( IsUpper_v<MT> )
203 {
204 const size_t begin( IsStrictlyUpper_v<MT> ? index+1UL : index );
205 const size_t n ( mat_.columns() - begin );
206 return subvector( row( mat_, index, unchecked ), begin, n, unchecked ) *
208 }
209 else
210 {
211 return row( mat_, index, unchecked ) * vec_;
212 }
213 }
214 //**********************************************************************************************
215
216 //**At function*********************************************************************************
223 inline ReturnType at( size_t index ) const {
224 if( index >= mat_.rows() ) {
225 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
226 }
227 return (*this)[index];
228 }
229 //**********************************************************************************************
230
231 //**Size function*******************************************************************************
236 inline size_t size() const noexcept {
237 return mat_.rows();
238 }
239 //**********************************************************************************************
240
241 //**NonZeros function***************************************************************************
246 inline size_t nonZeros() const {
247 return mat_.rows();
248 }
249 //**********************************************************************************************
250
251 //**Left operand access*************************************************************************
256 inline LeftOperand leftOperand() const noexcept {
257 return mat_;
258 }
259 //**********************************************************************************************
260
261 //**Right operand function**********************************************************************
266 inline RightOperand rightOperand() const noexcept {
267 return vec_;
268 }
269 //**********************************************************************************************
270
271 //**********************************************************************************************
277 template< typename T >
278 inline bool canAlias( const T* alias ) const noexcept {
279 return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
280 }
281 //**********************************************************************************************
282
283 //**********************************************************************************************
289 template< typename T >
290 inline bool isAliased( const T* alias ) const noexcept {
291 return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
292 }
293 //**********************************************************************************************
294
295 //**********************************************************************************************
300 inline bool canSMPAssign() const noexcept {
301 return ( size() > SMP_SMATSVECMULT_THRESHOLD );
302 }
303 //**********************************************************************************************
304
305 private:
306 //**Member variables****************************************************************************
309 //**********************************************************************************************
310
311 //**Assignment to dense vectors*****************************************************************
324 template< typename VT1 > // Type of the target dense vector
325 friend inline void assign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
326 {
328
329 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
330
331 // Resetting the left-hand side target dense vector
332 reset( *lhs );
333
334 // Evaluation of the right-hand side sparse vector operand
335 RT x( serial( rhs.vec_ ) );
336 if( x.nonZeros() == 0UL ) return;
337
338 // Evaluation of the left-hand side sparse matrix operand
339 LT A( serial( rhs.mat_ ) );
340
341 // Checking the evaluated operators
342 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
343 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
344 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
345 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
346
347 // Performing the transpose sparse matrix-sparse vector multiplication
348 TSMatSVecMultExpr::selectAssignKernel( *lhs, A, x );
349 }
351 //**********************************************************************************************
352
353 //**Default assignment to dense vectors*********************************************************
367 template< typename VT1 // Type of the left-hand side target vector
368 , typename MT1 // Type of the left-hand side matrix operand
369 , typename VT2 > // Type of the right-hand side vector operand
370 static inline void selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
371 {
372 const auto vend ( x.end() );
373 auto velem( x.begin() );
374
375 for( ; velem!=vend; ++velem )
376 {
377 const auto mend ( A.end ( velem->index() ) );
378 auto melem( A.begin( velem->index() ) );
379
380 for( ; melem!=mend; ++melem ) {
382 isDefault( y[melem->index()] ) )
383 y[melem->index()] = melem->value() * velem->value();
384 else
385 y[melem->index()] += melem->value() * velem->value();
386 }
387 }
388 }
390 //**********************************************************************************************
391
392 //**Assignment to sparse vectors****************************************************************
404 template< typename VT1 > // Type of the target sparse vector
405 friend inline void assign( SparseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
406 {
408
409 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
410
411 const DynamicVector<ElementType_t<VT1>,false> tmp( serial( rhs ) );
412 assign( *lhs, tmp );
413 }
415 //**********************************************************************************************
416
417 //**Addition assignment to dense vectors********************************************************
430 template< typename VT1 > // Type of the target dense vector
431 friend inline void addAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
432 {
434
435 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
436
437 // Evaluation of the right-hand side sparse vector operand
438 RT x( serial( rhs.vec_ ) );
439 if( x.nonZeros() == 0UL ) return;
440
441 // Evaluation of the left-hand side sparse matrix operand
442 LT A( serial( rhs.mat_ ) );
443
444 // Checking the evaluated operators
445 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
446 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
447 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
448 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
449
450 // Performing the transpose sparse matrix-sparse vector multiplication
451 TSMatSVecMultExpr::selectAddAssignKernel( *lhs, A, x );
452 }
454 //**********************************************************************************************
455
456 //**Default addition assignment to dense vectors************************************************
470 template< typename VT1 // Type of the left-hand side target vector
471 , typename MT1 // Type of the left-hand side matrix operand
472 , typename VT2 > // Type of the right-hand side vector operand
473 static inline void selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
474 {
475 const auto vend ( x.end() );
476 auto velem( x.begin() );
477
478 for( ; velem!=vend; ++velem )
479 {
480 const auto mend ( A.end ( velem->index() ) );
481 auto melem( A.begin( velem->index() ) );
482
483 for( ; melem!=mend; ++melem ) {
484 y[melem->index()] += melem->value() * velem->value();
485 }
486 }
487 }
489 //**********************************************************************************************
490
491 //**Addition assignment to sparse vectors*******************************************************
492 // No special implementation for the addition assignment to sparse vectors.
493 //**********************************************************************************************
494
495 //**Subtraction assignment to dense vectors*****************************************************
508 template< typename VT1 > // Type of the target dense vector
509 friend inline void subAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
510 {
512
513 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
514
515 // Evaluation of the right-hand side sparse vector operand
516 RT x( serial( rhs.vec_ ) );
517 if( x.nonZeros() == 0UL ) return;
518
519 // Evaluation of the left-hand side sparse matrix operand
520 LT A( serial( rhs.mat_ ) );
521
522 // Checking the evaluated operators
523 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
524 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
525 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
526 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
527
528 // Performing the transpose sparse matrix-sparse vector multiplication
529 TSMatSVecMultExpr::selectSubAssignKernel( *lhs, A, x );
530 }
532 //**********************************************************************************************
533
534 //**Default subtraction assignment to dense vectors*********************************************
548 template< typename VT1 // Type of the left-hand side target vector
549 , typename MT1 // Type of the left-hand side matrix operand
550 , typename VT2 > // Type of the right-hand side vector operand
551 static inline void selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
552 {
553 const auto vend ( x.end() );
554 auto velem( x.begin() );
555
556 for( ; velem!=vend; ++velem )
557 {
558 const auto mend ( A.end ( velem->index() ) );
559 auto melem( A.begin( velem->index() ) );
560
561 for( ; melem!=mend; ++melem ) {
562 y[melem->index()] -= melem->value() * velem->value();
563 }
564 }
565 }
567 //**********************************************************************************************
568
569 //**Subtraction assignment to sparse vectors****************************************************
570 // No special implementation for the subtraction assignment to sparse vectors.
571 //**********************************************************************************************
572
573 //**Multiplication assignment to dense vectors**************************************************
586 template< typename VT1 > // Type of the target dense vector
587 friend inline void multAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
588 {
590
594
595 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
596
597 const ResultType tmp( serial( rhs ) );
598 multAssign( *lhs, tmp );
599 }
601 //**********************************************************************************************
602
603 //**Multiplication assignment to sparse vectors*************************************************
604 // No special implementation for the multiplication assignment to sparse vectors.
605 //**********************************************************************************************
606
607 //**SMP assignment to dense vectors*************************************************************
622 template< typename VT1 > // Type of the target dense vector
623 friend inline auto smpAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
624 -> EnableIf_t< UseSMPAssign_v<VT1> >
625 {
627
628 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
629
630 // Resetting the left-hand side target dense vector
631 reset( *lhs );
632
633 // Evaluation of the right-hand side sparse vector operand
634 RT x( rhs.vec_ );
635 if( x.nonZeros() == 0UL ) return;
636
637 // Evaluation of the left-hand side sparse matrix operand
638 LT A( rhs.mat_ );
639
640 // Checking the evaluated operators
641 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
642 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
643 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
644 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
645
646 // Performing the transpose sparse matrix-sparse vector multiplication
647 smpAssign( *lhs, A * x );
648 }
650 //**********************************************************************************************
651
652 //**SMP assignment to sparse vectors************************************************************
653 // No special implementation for the SMP assignment to sparse vectors.
654 //**********************************************************************************************
655
656 //**SMP addition assignment to dense vectors****************************************************
671 template< typename VT1 > // Type of the target dense vector
672 friend inline auto smpAddAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
673 -> EnableIf_t< UseSMPAssign_v<VT1> >
674 {
676
677 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
678
679 // Evaluation of the right-hand side sparse vector operand
680 RT x( rhs.vec_ );
681 if( x.nonZeros() == 0UL ) return;
682
683 // Evaluation of the left-hand side sparse matrix operand
684 LT A( rhs.mat_ );
685
686 // Checking the evaluated operators
687 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
688 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
689 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
690 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
691
692 // Performing the transpose sparse matrix-sparse vector multiplication
693 smpAddAssign( *lhs, A * x );
694 }
696 //**********************************************************************************************
697
698 //**SMP addition assignment to sparse vectors***************************************************
699 // No special implementation for the SMP addition assignment to sparse vectors.
700 //**********************************************************************************************
701
702 //**SMP subtraction assignment to dense vectors*************************************************
717 template< typename VT1 > // Type of the target dense vector
718 friend inline auto smpSubAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
719 -> EnableIf_t< UseSMPAssign_v<VT1> >
720 {
722
723 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
724
725 // Evaluation of the right-hand side sparse vector operand
726 RT x( rhs.vec_ );
727 if( x.nonZeros() == 0UL ) return;
728
729 // Evaluation of the left-hand side sparse matrix operand
730 LT A( rhs.mat_ );
731
732 // Checking the evaluated operators
733 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
734 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
735 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
736 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
737
738 // Performing the transpose sparse matrix-sparse vector multiplication
739 smpSubAssign( *lhs, A * x );
740 }
742 //**********************************************************************************************
743
744 //**SMP subtraction assignment to sparse vectors************************************************
745 // No special implementation for the SMP subtraction assignment to sparse vectors.
746 //**********************************************************************************************
747
748 //**SMP multiplication assignment to dense vectors**********************************************
763 template< typename VT1 > // Type of the target dense vector
764 friend inline auto smpMultAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
765 -> EnableIf_t< UseSMPAssign_v<VT1> >
766 {
768
772
773 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
774
775 const ResultType tmp( rhs );
776 smpMultAssign( *lhs, tmp );
777 }
779 //**********************************************************************************************
780
781 //**SMP multiplication assignment to sparse vectors*********************************************
782 // No special implementation for the SMP multiplication assignment to sparse vectors.
783 //**********************************************************************************************
784
785 //**Compile time checks*************************************************************************
795 //**********************************************************************************************
796};
797//*************************************************************************************************
798
799
800
801
802//=================================================================================================
803//
804// GLOBAL BINARY ARITHMETIC OPERATORS
805//
806//=================================================================================================
807
808//*************************************************************************************************
821template< typename MT // Type of the left-hand side sparse matrix
822 , typename VT // Type of the right-hand side sparse vector
823 , DisableIf_t< ( IsIdentity_v<MT> &&
824 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > ) ||
825 ( IsZero_v<MT> || IsZero_v<VT> ) >* = nullptr >
826inline const TSMatSVecMultExpr<MT,VT>
827 tsmatsvecmult( const SparseMatrix<MT,true>& mat, const SparseVector<VT,false>& vec )
828{
830
831 BLAZE_INTERNAL_ASSERT( (*mat).columns() == (*vec).size(), "Invalid matrix and vector sizes" );
832
833 return TSMatSVecMultExpr<MT,VT>( *mat, *vec );
834}
836//*************************************************************************************************
837
838
839//*************************************************************************************************
853template< typename MT // Type of the left-hand side sparse matrix
854 , typename VT // Type of the right-hand side sparse vector
855 , EnableIf_t< ( IsIdentity_v<MT> &&
856 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > ) &&
857 !IsZero_v<VT> >* = nullptr >
858inline const VT&
859 tsmatsvecmult( const SparseMatrix<MT,true>& mat, const SparseVector<VT,false>& vec )
860{
862
863 MAYBE_UNUSED( mat );
864
865 BLAZE_INTERNAL_ASSERT( (*mat).columns() == (*vec).size(), "Invalid matrix and vector sizes" );
866
867 return (*vec);
868}
870//*************************************************************************************************
871
872
873//*************************************************************************************************
886template< typename MT // Type of the left-hand side sparse matrix
887 , typename VT // Type of the right-hand side sparse vector
888 , EnableIf_t< IsZero_v<MT> || IsZero_v<VT> >* = nullptr >
889inline decltype(auto)
890 tsmatsvecmult( const SparseMatrix<MT,true>& mat, const SparseVector<VT,false>& vec )
891{
893
894 MAYBE_UNUSED( vec );
895
896 BLAZE_INTERNAL_ASSERT( (*mat).columns() == (*vec).size(), "Invalid matrix and vector sizes" );
897
898 using ReturnType = const MultTrait_t< ResultType_t<MT>, ResultType_t<VT> >;
899
902
903 return ReturnType( (*mat).rows() );
904}
906//*************************************************************************************************
907
908
909//*************************************************************************************************
940template< typename MT // Type of the left-hand side sparse matrix
941 , typename VT > // Type of the right-hand side sparse vector
942inline decltype(auto)
943 operator*( const SparseMatrix<MT,true>& mat, const SparseVector<VT,false>& vec )
944{
946
948
949 if( (*mat).columns() != (*vec).size() ) {
950 BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
951 }
952
953 return tsmatsvecmult( *mat, *vec );
954}
955//*************************************************************************************************
956
957} // namespace blaze
958
959#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.
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
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.
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 matrix-sparse vector multiplications.
Definition: TSMatSVecMultExpr.h:104
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatSVecMultExpr.h:148
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:151
static constexpr bool evaluateVector
Compilation switch for the composite type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:120
CompositeType_t< VT > VCT
Composite type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:110
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatSVecMultExpr.h:307
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatSVecMultExpr.h:256
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSMatSVecMultExpr.h:246
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatSVecMultExpr.h:144
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:115
If_t< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: TSMatSVecMultExpr.h:157
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSMatSVecMultExpr.h:223
TSMatSVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TSMatSVecMultExpr class.
Definition: TSMatSVecMultExpr.h:175
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSMatSVecMultExpr.h:189
ResultType_t< VT > VRT
Result type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:108
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:145
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse vector operand.
Definition: TSMatSVecMultExpr.h:266
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatSVecMultExpr.h:290
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSMatSVecMultExpr.h:236
MultTrait_t< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:142
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: TSMatSVecMultExpr.h:308
If_t< IsExpression_v< VT >, const VT, const VT & > RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:154
If_t< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side sparse vector operand.
Definition: TSMatSVecMultExpr.h:160
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatSVecMultExpr.h:278
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatSVecMultExpr.h:300
ResultType_t< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:107
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:143
CompositeType_t< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:109
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatSVecMultExpr.h:165
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 MatVecMultExpr base class.
Header file for the SparseVector base class.
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_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#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_FORM_VALID_MATVECMULTEXPR(T1, T2)
Constraint on the data type.
Definition: MatVecMultExpr.h:104
#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_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.
Definition: ColumnVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.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
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#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 matrix/vector multiplication expression templates.
Definition: MatVecMultExpr.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.