Blaze 3.9
TDVecSMatMultExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_TDVECSMATMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_TDVECSMATMULTEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
78#include <blaze/util/Assert.h>
79#include <blaze/util/EnableIf.h>
82#include <blaze/util/mpl/If.h>
83#include <blaze/util/Types.h>
84
85
86namespace blaze {
87
88//=================================================================================================
89//
90// CLASS TDVECSMATMULTEXPR
91//
92//=================================================================================================
93
94//*************************************************************************************************
101template< typename VT // Type of the left-hand side dense vector
102 , typename MT > // Type of the right-hand side sparse matrix
104 : public TVecMatMultExpr< DenseVector< TDVecSMatMultExpr<VT,MT>, true > >
105 , private Computation
106{
107 private:
108 //**Type definitions****************************************************************************
113 //**********************************************************************************************
114
115 //**********************************************************************************************
117 static constexpr bool evaluateVector = ( IsComputation_v<VT> || RequiresEvaluation_v<VT> );
118 //**********************************************************************************************
119
120 //**********************************************************************************************
122 static constexpr bool evaluateMatrix = RequiresEvaluation_v<MT>;
123 //**********************************************************************************************
124
125 //**********************************************************************************************
127
131 template< typename T1 >
132 static constexpr bool UseSMPAssign_v = ( evaluateVector || evaluateMatrix );
134 //**********************************************************************************************
135
136 public:
137 //**Type definitions****************************************************************************
140
143
147 using ReturnType = const ElementType;
148 using CompositeType = const ResultType;
149
151 using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
152
154 using RightOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
155
158
161 //**********************************************************************************************
162
163 //**Compilation flags***************************************************************************
165 static constexpr bool simdEnabled = false;
166
168 static constexpr bool smpAssignable =
169 ( !evaluateVector && VT::smpAssignable && !evaluateMatrix && MT::smpAssignable );
170 //**********************************************************************************************
171
172 //**Constructor*********************************************************************************
175 inline TDVecSMatMultExpr( const VT& vec, const MT& mat ) noexcept
176 : vec_( vec ) // Left-hand side dense vector of the multiplication expression
177 , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
178 {
179 BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
180 }
181 //**********************************************************************************************
182
183 //**Subscript operator**************************************************************************
189 inline ReturnType operator[]( size_t index ) const {
190 BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
191
192 if( IsDiagonal_v<MT> )
193 {
194 return vec_[index] * mat_(index,index);
195 }
196 else if( IsLower_v<MT> )
197 {
198 const size_t begin( IsStrictlyLower_v<MT> ? index+1UL : index );
199 const size_t n ( mat_.rows() - begin );
200 return subvector( vec_, begin, n, unchecked ) *
201 subvector( column( mat_, index, unchecked ), begin, n, unchecked );
202 }
203 else if( IsUpper_v<MT> )
204 {
205 const size_t n( IsStrictlyUpper_v<MT> ? index : index+1UL );
206 return subvector( vec_, 0UL, n, unchecked ) *
207 subvector( column( mat_, index, unchecked ), 0UL, n, unchecked );
208 }
209 else
210 {
211 return vec_ * column( mat_, index, unchecked );
212 }
213 }
214 //**********************************************************************************************
215
216 //**At function*********************************************************************************
223 inline ReturnType at( size_t index ) const {
224 if( index >= mat_.columns() ) {
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_.columns();
238 }
239 //**********************************************************************************************
240
241 //**Left operand access*************************************************************************
246 inline LeftOperand leftOperand() const noexcept {
247 return vec_;
248 }
249 //**********************************************************************************************
250
251 //**Right operand access************************************************************************
256 inline RightOperand rightOperand() const noexcept {
257 return mat_;
258 }
259 //**********************************************************************************************
260
261 //**********************************************************************************************
267 template< typename T >
268 inline bool canAlias( const T* alias ) const noexcept {
269 return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
270 }
271 //**********************************************************************************************
272
273 //**********************************************************************************************
279 template< typename T >
280 inline bool isAliased( const T* alias ) const noexcept {
281 return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
282 }
283 //**********************************************************************************************
284
285 //**********************************************************************************************
290 inline bool isAligned() const noexcept {
291 return vec_.isAligned();
292 }
293 //**********************************************************************************************
294
295 //**********************************************************************************************
300 inline bool canSMPAssign() const noexcept {
301 return ( size() > SMP_TDVECSMATMULT_THRESHOLD );
302 }
303 //**********************************************************************************************
304
305 private:
306 //**Member variables****************************************************************************
309 //**********************************************************************************************
310
311 //**Assignment to dense vectors*****************************************************************
323 template< typename VT2 > // Type of the target dense vector
324 friend inline void assign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
325 {
327
328 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
329
330 reset( *lhs );
331
332 if( rhs.mat_.rows() == 0UL ) return;
333
334 LT x( serial( rhs.vec_ ) ); // Evaluation of the left-hand side dense vector operator
335 RT A( serial( rhs.mat_ ) ); // Evaluation of the right-hand side sparse matrix operator
336
337 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
338 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
339 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
340 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
341
342 TDVecSMatMultExpr::selectAssignKernel( *lhs, x, A );
343 }
344 //**********************************************************************************************
345
346 //**Optimized assignment to dense vectors*******************************************************
360 template< typename VT1 // Type of the left-hand side target vector
361 , typename VT2 // Type of the left-hand side vector operand
362 , typename MT1 > // Type of the right-hand side matrix operand
363 static inline void selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
364 {
365 for( size_t i=0UL; i<x.size(); ++i )
366 {
367 const auto end( A.end(i) );
368 auto element( A.begin(i) );
369
370 for( ; element!=end; ++element ) {
372 isDefault( y[element->index()] ) )
373 y[element->index()] = x[i] * element->value();
374 else
375 y[element->index()] += x[i] * element->value();
376 }
377 }
378 }
380 //**********************************************************************************************
381
382 //**Assignment to sparse vectors****************************************************************
394 template< typename VT2 > // Type of the target sparse vector
395 friend inline void assign( SparseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
396 {
398
402
403 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
404
405 const ResultType tmp( serial( rhs ) );
406 assign( *lhs, tmp );
407 }
408 //**********************************************************************************************
409
410 //**Addition assignment to dense vectors********************************************************
422 template< typename VT2 > // Type of the target dense vector
423 friend inline void addAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
424 {
426
427 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
428
429 if( rhs.mat_.rows() == 0UL ) {
430 return;
431 }
432
433 LT x( serial( rhs.vec_ ) ); // Evaluation of the left-hand side dense vector operator
434 RT A( serial( rhs.mat_ ) ); // Evaluation of the right-hand side sparse matrix operator
435
436 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
437 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
438 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
439 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
440
441 TDVecSMatMultExpr::selectAddAssignKernel( *lhs, x, A );
442 }
443 //**********************************************************************************************
444
445 //**Optimized addition assignment to dense vectors*************************************************
459 template< typename VT1 // Type of the left-hand side target vector
460 , typename VT2 // Type of the left-hand side vector operand
461 , typename MT1 > // Type of the right-hand side matrix operand
462 static inline void selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
463 {
464 for( size_t i=0UL; i<x.size(); ++i )
465 {
466 const auto end( A.end(i) );
467 auto element( A.begin(i) );
468
469 for( ; element!=end; ++element ) {
470 y[element->index()] += x[i] * element->value();
471 }
472 }
473 }
475 //**********************************************************************************************
476
477 //**Addition assignment to sparse vectors*******************************************************
478 // No special implementation for the addition assignment to sparse vectors.
479 //**********************************************************************************************
480
481 //**Subtraction assignment to dense vectors*****************************************************
493 template< typename VT2 > // Type of the target dense vector
494 friend inline void subAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
495 {
497
498 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
499
500 if( rhs.mat_.rows() == 0UL ) {
501 return;
502 }
503
504 LT x( serial( rhs.vec_ ) ); // Evaluation of the left-hand side dense vector operator
505 RT A( serial( rhs.mat_ ) ); // Evaluation of the right-hand side sparse matrix operator
506
507 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
508 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
509 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
510 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
511
512 TDVecSMatMultExpr::selectSubAssignKernel( *lhs, x, A );
513 }
514 //**********************************************************************************************
515
516 //**Optimized subtraction assignment to dense vectors**********************************************
530 template< typename VT1 // Type of the left-hand side target vector
531 , typename VT2 // Type of the left-hand side vector operand
532 , typename MT1 > // Type of the right-hand side matrix operand
533 static inline void selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
534 {
535 for( size_t i=0UL; i<x.size(); ++i )
536 {
537 const auto end( A.end(i) );
538 auto element( A.begin(i) );
539
540 for( ; element!=end; ++element ) {
541 y[element->index()] -= x[i] * element->value();
542 }
543 }
544 }
546 //**********************************************************************************************
547
548 //**Subtraction assignment to sparse vectors****************************************************
549 // No special implementation for the subtraction assignment to sparse vectors.
550 //**********************************************************************************************
551
552 //**Multiplication assignment to dense vectors**************************************************
564 template< typename VT2 > // Type of the target dense vector
565 friend inline void multAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
566 {
568
572
573 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
574
575 const ResultType tmp( serial( rhs ) );
576 multAssign( *lhs, tmp );
577 }
578 //**********************************************************************************************
579
580 //**Multiplication assignment to sparse vectors*************************************************
581 // No special implementation for the multiplication assignment to sparse vectors.
582 //**********************************************************************************************
583
584 //**Division assignment to dense vectors********************************************************
596 template< typename VT2 > // Type of the target dense vector
597 friend inline void divAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
598 {
600
604
605 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
606
607 const ResultType tmp( serial( rhs ) );
608 divAssign( *lhs, tmp );
609 }
610 //**********************************************************************************************
611
612 //**Division assignment to sparse vectors*******************************************************
613 // No special implementation for the division assignment to sparse vectors.
614 //**********************************************************************************************
615
616 //**SMP assignment to dense vectors*************************************************************
630 template< typename VT2 > // Type of the target dense vector
631 friend inline auto smpAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
633 {
635
636 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
637
638 reset( *lhs );
639
640 if( rhs.mat_.rows() == 0UL ) return;
641
642 LT x( rhs.vec_ ); // Evaluation of the left-hand side dense vector operator
643 RT A( rhs.mat_ ); // Evaluation of the right-hand side sparse matrix operator
644
645 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
646 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
647 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
648 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
649
650 smpAssign( *lhs, x * A );
651 }
652 //**********************************************************************************************
653
654 //**SMP assignment to sparse vectors************************************************************
668 template< typename VT2 > // Type of the target sparse vector
669 friend inline auto smpAssign( SparseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
671 {
673
677
678 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
679
680 const ResultType tmp( rhs );
681 smpAssign( *lhs, tmp );
682 }
683 //**********************************************************************************************
684
685 //**SMP addition assignment to dense vectors****************************************************
699 template< typename VT2 > // Type of the target dense vector
700 friend inline auto smpAddAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
702 {
704
705 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
706
707 if( rhs.mat_.rows() == 0UL ) {
708 return;
709 }
710
711 LT x( rhs.vec_ ); // Evaluation of the left-hand side dense vector operator
712 RT A( rhs.mat_ ); // Evaluation of the right-hand side sparse matrix operator
713
714 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
715 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
716 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
717 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
718
719 smpAddAssign( *lhs, x * A );
720 }
721 //**********************************************************************************************
722
723 //**SMP addition assignment to sparse vectors***************************************************
724 // No special implementation for the SMP addition assignment to sparse vectors.
725 //**********************************************************************************************
726
727 //**SMP subtraction assignment to dense vectors*************************************************
741 template< typename VT2 > // Type of the target dense vector
742 friend inline auto smpSubAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
744 {
746
747 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
748
749 if( rhs.mat_.rows() == 0UL ) {
750 return;
751 }
752
753 LT x( rhs.vec_ ); // Evaluation of the left-hand side dense vector operator
754 RT A( rhs.mat_ ); // Evaluation of the right-hand side sparse matrix operator
755
756 BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
757 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
758 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
759 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).size() , "Invalid vector size" );
760
761 smpSubAssign( *lhs, x * A );
762 }
763 //**********************************************************************************************
764
765 //**SMP subtraction assignment to sparse vectors************************************************
766 // No special implementation for the SMP subtraction assignment to sparse vectors.
767 //**********************************************************************************************
768
769 //**SMP multiplication assignment to dense vectors**********************************************
783 template< typename VT2 > // Type of the target dense vector
784 friend inline auto smpMultAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
786 {
788
792
793 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
794
795 const ResultType tmp( rhs );
796 smpMultAssign( *lhs, tmp );
797 }
798 //**********************************************************************************************
799
800 //**SMP multiplication assignment to sparse vectors*********************************************
801 // No special implementation for the SMP multiplication assignment to sparse vectors.
802 //**********************************************************************************************
803
804 //**SMP division assignment to dense vectors****************************************************
818 template< typename VT2 > // Type of the target dense vector
819 friend inline auto smpDivAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
821 {
823
827
828 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
829
830 const ResultType tmp( rhs );
831 smpDivAssign( *lhs, tmp );
832 }
833 //**********************************************************************************************
834
835 //**SMP division assignment to sparse vectors***************************************************
836 // No special implementation for the SMP division assignment to sparse vectors.
837 //**********************************************************************************************
838
839 //**Compile time checks*************************************************************************
849 //**********************************************************************************************
850};
851//*************************************************************************************************
852
853
854
855
856//=================================================================================================
857//
858// GLOBAL BINARY ARITHMETIC OPERATORS
859//
860//=================================================================================================
861
862//*************************************************************************************************
875template< typename VT // Type of the left-hand side dense vector
876 , typename MT // Type of the right-hand side sparse matrix
877 , DisableIf_t< IsSymmetric_v<MT> ||
878 ( IsIdentity_v<MT> &&
879 IsSame_v< ElementType_t<VT>, ElementType_t<MT> > ) ||
880 IsZero_v<MT> >* = nullptr >
881inline const TDVecSMatMultExpr<VT,MT>
882 tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
883{
885
886 BLAZE_INTERNAL_ASSERT( (*vec).size() == (*mat).rows(), "Invalid vector and matrix sizes" );
887
888 return TDVecSMatMultExpr<VT,MT>( *vec, *mat );
889}
891//*************************************************************************************************
892
893
894//*************************************************************************************************
908template< typename VT // Type of the left-hand side dense vector
909 , typename MT // Type of the right-hand side sparse matrix
910 , EnableIf_t< IsSymmetric_v<MT> &&
911 !( IsIdentity_v<MT> &&
912 IsSame_v< ElementType_t<VT>, ElementType_t<MT> > ) &&
913 !IsZero_v<MT> >* = nullptr >
914inline decltype(auto)
915 tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
916{
918
919 BLAZE_INTERNAL_ASSERT( (*vec).size() == (*mat).rows(), "Invalid vector and matrix sizes" );
920
921 return (*vec) * trans( *mat );
922}
924//*************************************************************************************************
925
926
927//*************************************************************************************************
941template< typename VT // Type of the left-hand side dense vector
942 , typename MT // Type of the right-hand side sparse matrix
943 , EnableIf_t< IsIdentity_v<MT> &&
944 IsSame_v< ElementType_t<VT>, ElementType_t<MT> > >* = nullptr >
945inline const VT&
946 tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
947{
949
950 MAYBE_UNUSED( mat );
951
952 BLAZE_INTERNAL_ASSERT( (*vec).size() == (*mat).rows(), "Invalid vector and matrix sizes" );
953
954 return (*vec);
955}
957//*************************************************************************************************
958
959
960//*************************************************************************************************
973template< typename VT // Type of the left-hand side dense vector
974 , typename MT // Type of the right-hand side sparse matrix
975 , EnableIf_t< IsZero_v<MT> >* = nullptr >
976inline decltype(auto)
977 tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
978{
980
981 MAYBE_UNUSED( vec );
982
983 BLAZE_INTERNAL_ASSERT( (*vec).size() == (*mat).rows(), "Invalid vector and matrix sizes" );
984
985 using ReturnType = const MultTrait_t< ResultType_t<VT>, ResultType_t<MT> >;
986
989
990 return ReturnType( (*mat).columns() );
991}
993//*************************************************************************************************
994
995
996//*************************************************************************************************
1027template< typename VT // Type of the left-hand side dense vector
1028 , typename MT > // Type of the right-hand side sparse matrix
1029inline decltype(auto)
1030 operator*( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
1031{
1033
1035
1036 if( (*vec).size() != (*mat).rows() ) {
1037 BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
1038 }
1039
1040 return tdvecsmatmult( *vec, *mat );
1041}
1042//*************************************************************************************************
1043
1044
1045
1046
1047//=================================================================================================
1048//
1049// ISALIGNED SPECIALIZATIONS
1050//
1051//=================================================================================================
1052
1053//*************************************************************************************************
1055template< typename VT, typename MT >
1056struct IsAligned< TDVecSMatMultExpr<VT,MT> >
1057 : public IsAligned<VT>
1058{};
1060//*************************************************************************************************
1061
1062} // namespace blaze
1063
1064#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 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.
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
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
Base class for sparse vectors.
Definition: SparseVector.h:72
Expression object for transpose dense vector-sparse matrix multiplications.
Definition: TDVecSMatMultExpr.h:106
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TDVecSMatMultExpr.h:168
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TDVecSMatMultExpr.h:236
const ResultType CompositeType
Data type for composite expression templates.
Definition: TDVecSMatMultExpr.h:148
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TDVecSMatMultExpr.h:145
If_t< evaluateMatrix, const MRT, MCT > RT
Composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:160
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: TDVecSMatMultExpr.h:246
ResultType_t< VT > VRT
Result type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:109
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:122
If_t< IsExpression_v< MT >, const MT, const MT & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:154
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TDVecSMatMultExpr.h:308
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TDVecSMatMultExpr.h:146
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: TDVecSMatMultExpr.h:165
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TDVecSMatMultExpr.h:290
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TDVecSMatMultExpr.h:256
CompositeType_t< MT > MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:112
static constexpr bool evaluateVector
Compilation switch for the composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:117
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TDVecSMatMultExpr.h:189
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TDVecSMatMultExpr.h:147
TDVecSMatMultExpr(const VT &vec, const MT &mat) noexcept
Constructor for the TDVecSMatMultExpr class.
Definition: TDVecSMatMultExpr.h:175
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:151
ResultType_t< MT > MRT
Result type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:110
If_t< evaluateVector, const VRT, VCT > LT
Composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:157
LeftOperand vec_
Left-hand side dense vector of the multiplication expression.
Definition: TDVecSMatMultExpr.h:307
MultTrait_t< VRT, MRT > ResultType
Result type for expression template evaluations.
Definition: TDVecSMatMultExpr.h:144
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TDVecSMatMultExpr.h:223
CompositeType_t< VT > VCT
Composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:111
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TDVecSMatMultExpr.h:280
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TDVecSMatMultExpr.h:300
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TDVecSMatMultExpr.h:268
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 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) 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
friend auto smpAssign(SparseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP assignment of a transpose dense vector-sparse matrix multiplication to a sparse vector ( ).
Definition: TDVecSMatMultExpr.h:669
friend void multAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Multiplication assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ...
Definition: TDVecSMatMultExpr.h:565
friend auto smpSubAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP subtraction assignment of a transpose dense vector-sparse matrix multiplication to a dense vector...
Definition: TDVecSMatMultExpr.h:742
friend auto smpDivAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP division assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ...
Definition: TDVecSMatMultExpr.h:819
friend auto smpMultAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP multiplication assignment of a transpose dense vector-sparse matrix multiplication to a dense vec...
Definition: TDVecSMatMultExpr.h:784
friend auto smpAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:631
friend auto smpAddAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
Addition assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:700
friend void subAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Subtraction assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( )...
Definition: TDVecSMatMultExpr.h:494
friend void addAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Addition assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:423
friend void assign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:324
friend void divAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Division assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:597
friend void assign(SparseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Assignment of a transpose dense vector-sparse matrix multiplication to a sparse vector ( ).
Definition: TDVecSMatMultExpr.h:395
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_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_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_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 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
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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
#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.