Blaze 3.9
TSMatDVecMultExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_TSMATDVECMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_TSMATDVECMULTEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
79#include <blaze/util/Assert.h>
80#include <blaze/util/EnableIf.h>
83#include <blaze/util/mpl/If.h>
84#include <blaze/util/Types.h>
85
86
87namespace blaze {
88
89//=================================================================================================
90//
91// CLASS TSMATDVECMULTEXPR
92//
93//=================================================================================================
94
95//*************************************************************************************************
102template< typename MT // Type of the left-hand side sparse matrix
103 , typename VT > // Type of the right-hand side dense vector
105 : public MatVecMultExpr< DenseVector< TSMatDVecMultExpr<MT,VT>, false > >
106 , private Computation
107{
108 private:
109 //**Type definitions****************************************************************************
114 //**********************************************************************************************
115
116 //**********************************************************************************************
118 static constexpr bool evaluateMatrix = RequiresEvaluation_v<MT>;
119 //**********************************************************************************************
120
121 //**********************************************************************************************
123 static constexpr bool evaluateVector = ( IsComputation_v<VT> || RequiresEvaluation_v<VT> );
124 //**********************************************************************************************
125
126 //**********************************************************************************************
128
132 template< typename T1 >
133 static constexpr bool UseSMPAssign_v = ( evaluateMatrix || evaluateVector );
135 //**********************************************************************************************
136
137 public:
138 //**Type definitions****************************************************************************
141
144
148 using ReturnType = const ElementType;
149 using CompositeType = const ResultType;
150
152 using LeftOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
153
155 using RightOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
156
159
162 //**********************************************************************************************
163
164 //**Compilation flags***************************************************************************
166 static constexpr bool simdEnabled = false;
167
169 static constexpr bool smpAssignable =
170 ( !evaluateMatrix && MT::smpAssignable && !evaluateVector && VT::smpAssignable );
171 //**********************************************************************************************
172
173 //**Constructor*********************************************************************************
179 inline TSMatDVecMultExpr( const MT& mat, const VT& vec ) noexcept
180 : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
181 , vec_( vec ) // Right-hand side dense vector of the multiplication expression
182 {
183 BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
184 }
185 //**********************************************************************************************
186
187 //**Subscript operator**************************************************************************
193 inline ReturnType operator[]( size_t index ) const {
194 BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
195
196 if( IsDiagonal_v<MT> )
197 {
198 return mat_(index,index) * vec_[index];
199 }
200 else if( IsLower_v<MT> )
201 {
202 const size_t n( IsStrictlyLower_v<MT> ? index : index+1UL );
203 return subvector( row( mat_, index, unchecked ), 0UL, n, unchecked ) *
204 subvector( vec_, 0UL, n, unchecked );
205 }
206 else if( IsUpper_v<MT> )
207 {
208 const size_t begin( IsStrictlyUpper_v<MT> ? index+1UL : index );
209 const size_t n ( mat_.columns() - begin );
210 return subvector( row( mat_, index, unchecked ), begin, n, unchecked ) *
212 }
213 else
214 {
215 return row( mat_, index, unchecked ) * vec_;
216 }
217 }
218 //**********************************************************************************************
219
220 //**At function*********************************************************************************
227 inline ReturnType at( size_t index ) const {
228 if( index >= mat_.rows() ) {
229 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
230 }
231 return (*this)[index];
232 }
233 //**********************************************************************************************
234
235 //**Size function*******************************************************************************
240 inline size_t size() const noexcept {
241 return mat_.rows();
242 }
243 //**********************************************************************************************
244
245 //**Left operand access*************************************************************************
250 inline LeftOperand leftOperand() const noexcept {
251 return mat_;
252 }
253 //**********************************************************************************************
254
255 //**Right operand access************************************************************************
260 inline RightOperand rightOperand() const noexcept {
261 return vec_;
262 }
263 //**********************************************************************************************
264
265 //**********************************************************************************************
271 template< typename T >
272 inline bool canAlias( const T* alias ) const noexcept {
273 return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
274 }
275 //**********************************************************************************************
276
277 //**********************************************************************************************
283 template< typename T >
284 inline bool isAliased( const T* alias ) const noexcept {
285 return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
286 }
287 //**********************************************************************************************
288
289 //**********************************************************************************************
294 inline bool isAligned() const noexcept {
295 return vec_.isAligned();
296 }
297 //**********************************************************************************************
298
299 //**********************************************************************************************
304 inline bool canSMPAssign() const noexcept {
305 return ( size() > SMP_TSMATDVECMULT_THRESHOLD );
306 }
307 //**********************************************************************************************
308
309 private:
310 //**Member variables****************************************************************************
313 //**********************************************************************************************
314
315 //**Assignment to dense vectors*****************************************************************
328 template< typename VT2 > // Type of the target dense vector
329 friend inline void assign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
330 {
332
333 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
334
335 reset( *lhs );
336
337 if( rhs.mat_.columns() == 0UL ) return;
338
339 LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
340 RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
341
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 TSMatDVecMultExpr::selectAssignKernel( *lhs, A, x );
348 }
350 //**********************************************************************************************
351
352 //**Optimized assignment to dense vectors*******************************************************
366 template< typename VT1 // Type of the left-hand side target vector
367 , typename MT1 // Type of the left-hand side matrix operand
368 , typename VT2 > // Type of the right-hand side vector operand
369 static inline void selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
370 {
371 for( size_t j=0UL; j<A.columns(); ++j )
372 {
373 auto element( A.begin(j) );
374 const auto end( A.end(j) );
375
376 for( ; element!=end; ++element ) {
378 isDefault( y[element->index()] ) )
379 y[element->index()] = element->value() * x[j];
380 else
381 y[element->index()] += element->value() * x[j];
382 }
383 }
384 }
386 //**********************************************************************************************
387
388 //**Assignment to sparse vectors****************************************************************
401 template< typename VT2 > // Type of the target sparse vector
402 friend inline void assign( SparseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
403 {
405
409
410 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
411
412 const ResultType tmp( serial( rhs ) );
413 assign( *lhs, tmp );
414 }
416 //**********************************************************************************************
417
418 //**Addition assignment to dense vectors********************************************************
431 template< typename VT2 > // Type of the target dense vector
432 friend inline void addAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
433 {
435
436 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
437
438 if( rhs.mat_.columns() == 0UL ) return;
439
440 LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
441 RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
442
443 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
444 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
445 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
446 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
447
448 TSMatDVecMultExpr::selectAddAssignKernel( *lhs, A, x );
449 }
451 //**********************************************************************************************
452
453 //**Optimized addition assignment to dense vectors**********************************************
467 template< typename VT1 // Type of the left-hand side target vector
468 , typename MT1 // Type of the left-hand side matrix operand
469 , typename VT2 > // Type of the right-hand side vector operand
470 static inline void selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
471 {
472 for( size_t j=0UL; j<A.columns(); ++j )
473 {
474 auto element( A.begin(j) );
475 const auto end( A.end(j) );
476
477 for( ; element!=end; ++element ) {
478 y[element->index()] += element->value() * x[j];
479 }
480 }
481 }
483 //**********************************************************************************************
484
485 //**Addition assignment to sparse vectors*******************************************************
486 // No special implementation for the addition assignment to sparse vectors.
487 //**********************************************************************************************
488
489 //**Subtraction assignment to dense vectors*****************************************************
502 template< typename VT2 > // Type of the target dense vector
503 friend inline void subAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
504 {
506
507 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
508
509 if( rhs.mat_.columns() == 0UL ) return;
510
511 LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
512 RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
513
514 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
515 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
516 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
517 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
518
519 TSMatDVecMultExpr::selectSubAssignKernel( *lhs, A, x );
520 }
522 //**********************************************************************************************
523
524 //**Optimized subtraction assignment to dense vectors*******************************************
538 template< typename VT1 // Type of the left-hand side target vector
539 , typename MT1 // Type of the left-hand side matrix operand
540 , typename VT2 > // Type of the right-hand side vector operand
541 static inline void selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
542 {
543 for( size_t j=0UL; j<A.columns(); ++j )
544 {
545 auto element( A.begin(j) );
546 const auto end( A.end(j) );
547
548 for( ; element!=end; ++element ) {
549 y[element->index()] -= element->value() * x[j];
550 }
551 }
552 }
554 //**********************************************************************************************
555
556 //**Subtraction assignment to sparse vectors****************************************************
557 // No special implementation for the subtraction assignment to sparse vectors.
558 //**********************************************************************************************
559
560 //**Multiplication assignment to dense vectors**************************************************
573 template< typename VT2 > // Type of the target dense vector
574 friend inline void multAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
575 {
577
581
582 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
583
584 const ResultType tmp( serial( rhs ) );
585 multAssign( *lhs, tmp );
586 }
588 //**********************************************************************************************
589
590 //**Multiplication assignment to sparse vectors*************************************************
591 // No special implementation for the multiplication assignment to sparse vectors.
592 //**********************************************************************************************
593
594 //**Division assignment to dense vectors********************************************************
607 template< typename VT2 > // Type of the target dense vector
608 friend inline void divAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
609 {
611
615
616 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
617
618 const ResultType tmp( serial( rhs ) );
619 divAssign( *lhs, tmp );
620 }
622 //**********************************************************************************************
623
624 //**Division assignment to sparse vectors*******************************************************
625 // No special implementation for the division assignment to sparse vectors.
626 //**********************************************************************************************
627
628 //**SMP assignment to dense vectors*************************************************************
643 template< typename VT2 > // Type of the target dense vector
644 friend inline auto smpAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
645 -> EnableIf_t< UseSMPAssign_v<VT2> >
646 {
648
649 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
650
651 reset( *lhs );
652
653 if( rhs.mat_.columns() == 0UL ) return;
654
655 LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
656 RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
657
658 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
659 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
660 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
661 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
662
663 smpAssign( *lhs, A * x );
664 }
666 //**********************************************************************************************
667
668 //**SMP assignment to sparse vectors************************************************************
683 template< typename VT2 > // Type of the target sparse vector
684 friend inline auto smpAssign( SparseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
685 -> EnableIf_t< UseSMPAssign_v<VT2> >
686 {
688
692
693 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
694
695 const ResultType tmp( rhs );
696 smpAssign( *lhs, tmp );
697 }
699 //**********************************************************************************************
700
701 //**SMP addition assignment to dense vectors****************************************************
716 template< typename VT2 > // Type of the target dense vector
717 friend inline auto smpAddAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
718 -> EnableIf_t< UseSMPAssign_v<VT2> >
719 {
721
722 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
723
724 if( rhs.mat_.columns() == 0UL ) return;
725
726 LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
727 RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
728
729 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
730 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
731 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
732 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
733
734 smpAddAssign( *lhs, A * x );
735 }
737 //**********************************************************************************************
738
739 //**SMP addition assignment to sparse vectors***************************************************
740 // No special implementation for the SMP addition assignment to sparse vectors.
741 //**********************************************************************************************
742
743 //**SMP subtraction assignment to dense vectors*************************************************
758 template< typename VT2 > // Type of the target dense vector
759 friend inline auto smpSubAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
760 -> EnableIf_t< UseSMPAssign_v<VT2> >
761 {
763
764 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
765
766 if( rhs.mat_.columns() == 0UL ) return;
767
768 LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
769 RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
770
771 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
772 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
773 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
774 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).size() , "Invalid vector size" );
775
776 smpSubAssign( *lhs, A * x );
777 }
779 //**********************************************************************************************
780
781 //**SMP subtraction assignment to sparse vectors************************************************
782 // No special implementation for the SMP subtraction assignment to sparse vectors.
783 //**********************************************************************************************
784
785 //**SMP multiplication assignment to dense vectors**********************************************
800 template< typename VT2 > // Type of the target dense vector
801 friend inline auto smpMultAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
802 -> EnableIf_t< UseSMPAssign_v<VT2> >
803 {
805
809
810 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
811
812 const ResultType tmp( rhs );
813 smpMultAssign( *lhs, tmp );
814 }
816 //**********************************************************************************************
817
818 //**SMP multiplication assignment to sparse vectors*********************************************
819 // No special implementation for the SMP multiplication assignment to sparse vectors.
820 //**********************************************************************************************
821
822 //**SMP division assignment to dense vectors****************************************************
837 template< typename VT2 > // Type of the target dense vector
838 friend inline auto smpDivAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
839 -> EnableIf_t< UseSMPAssign_v<VT2> >
840 {
842
846
847 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
848
849 const ResultType tmp( rhs );
850 smpDivAssign( *lhs, tmp );
851 }
853 //**********************************************************************************************
854
855 //**SMP division assignment to sparse vectors***************************************************
856 // No special implementation for the SMP division assignment to sparse vectors.
857 //**********************************************************************************************
858
859 //**Compile time checks*************************************************************************
869 //**********************************************************************************************
870};
871//*************************************************************************************************
872
873
874
875
876//=================================================================================================
877//
878// GLOBAL BINARY ARITHMETIC OPERATORS
879//
880//=================================================================================================
881
882//*************************************************************************************************
895template< typename MT // Type of the left-hand side sparse matrix
896 , typename VT // Type of the right-hand side dense vector
897 , DisableIf_t< IsSymmetric_v<MT> ||
898 ( IsIdentity_v<MT> &&
899 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > ) ||
900 IsZero_v<MT> >* = nullptr >
901inline const TSMatDVecMultExpr<MT,VT>
902 tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
903{
905
906 BLAZE_INTERNAL_ASSERT( (*mat).columns() == (*vec).size(), "Invalid matrix and vector sizes" );
907
908 return TSMatDVecMultExpr<MT,VT>( *mat, *vec );
909}
911//*************************************************************************************************
912
913
914//*************************************************************************************************
928template< typename MT // Type of the left-hand side sparse matrix
929 , typename VT // Type of the right-hand side dense vector
930 , EnableIf_t< IsSymmetric_v<MT> &&
931 !( IsIdentity_v<MT> &&
932 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > ) &&
933 !IsZero_v<MT> >* = nullptr >
934inline decltype(auto)
935 tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
936{
938
939 BLAZE_INTERNAL_ASSERT( (*mat).columns() == (*vec).size(), "Invalid matrix and vector sizes" );
940
941 return trans( *mat ) * (*vec);
942}
944//*************************************************************************************************
945
946
947//*************************************************************************************************
961template< typename MT // Type of the left-hand side sparse matrix
962 , typename VT // Type of the right-hand side dense vector
963 , EnableIf_t< IsIdentity_v<MT> &&
964 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > >* = nullptr >
965inline const VT&
966 tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
967{
969
970 MAYBE_UNUSED( mat );
971
972 BLAZE_INTERNAL_ASSERT( (*mat).columns() == (*vec).size(), "Invalid matrix and vector sizes" );
973
974 return (*vec);
975}
977//*************************************************************************************************
978
979
980//*************************************************************************************************
993template< typename MT // Type of the left-hand side sparse matrix
994 , typename VT // Type of the right-hand side dense vector
995 , EnableIf_t< IsZero_v<MT> >* = nullptr >
996inline decltype(auto)
997 tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
998{
1000
1001 MAYBE_UNUSED( vec );
1002
1003 BLAZE_INTERNAL_ASSERT( (*mat).columns() == (*vec).size(), "Invalid matrix and vector sizes" );
1004
1005 using ReturnType = const MultTrait_t< ResultType_t<MT>, ResultType_t<VT> >;
1006
1009
1010 return ReturnType( (*mat).rows() );
1011}
1013//*************************************************************************************************
1014
1015
1016//*************************************************************************************************
1047template< typename MT // Type of the left-hand side sparse matrix
1048 , typename VT > // Type of the right-hand side dense vector
1049inline decltype(auto)
1050 operator*( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
1051{
1053
1055
1056 if( (*mat).columns() != (*vec).size() ) {
1057 BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
1058 }
1059
1060 return tsmatdvecmult( *mat, *vec );
1061}
1062//*************************************************************************************************
1063
1064
1065
1066
1067//=================================================================================================
1068//
1069// ISALIGNED SPECIALIZATIONS
1070//
1071//=================================================================================================
1072
1073//*************************************************************************************************
1075template< typename MT, typename VT >
1076struct IsAligned< TSMatDVecMultExpr<MT,VT> >
1077 : public IsAligned<VT>
1078{};
1080//*************************************************************************************************
1081
1082} // namespace blaze
1083
1084#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 IsAligned type trait.
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 IsSymmetric 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.
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
Expression object for transpose sparse matrix-dense vector multiplications.
Definition: TSMatDVecMultExpr.h:107
CompositeType_t< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:112
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:152
If_t< IsExpression_v< VT >, const VT, const VT & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:155
RightOperand vec_
Right-hand side dense vector of the multiplication expression.
Definition: TSMatDVecMultExpr.h:312
TSMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TSMatDVecMultExpr class.
Definition: TSMatDVecMultExpr.h:179
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatDVecMultExpr.h:147
ResultType_t< VT > VRT
Result type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:111
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:148
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatDVecMultExpr.h:149
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatDVecMultExpr.h:272
CompositeType_t< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:113
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:146
If_t< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: TSMatDVecMultExpr.h:158
If_t< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side dense vector operand.
Definition: TSMatDVecMultExpr.h:161
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: TSMatDVecMultExpr.h:166
MultTrait_t< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:145
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatDVecMultExpr.h:304
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSMatDVecMultExpr.h:240
ResultType_t< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:110
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSMatDVecMultExpr.h:193
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: TSMatDVecMultExpr.h:260
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TSMatDVecMultExpr.h:294
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatDVecMultExpr.h:169
static constexpr bool evaluateVector
Compilation switch for the composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:123
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatDVecMultExpr.h:250
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatDVecMultExpr.h:311
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatDVecMultExpr.h:284
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:118
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSMatDVecMultExpr.h:227
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.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseVector base class.
Header file for the MatVecMultExpr base class.
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
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_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#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_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.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 end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:584
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 smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:221
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
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
#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.