Blaze 3.9
DVecSVecOuterExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_DVECSVECOUTEREXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DVECSVECOUTEREXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
45#include <blaze/math/Aliases.h>
65#include <blaze/math/SIMD.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>
86
87
88namespace blaze {
89
90//=================================================================================================
91//
92// CLASS DVECSVECOUTEREXPR
93//
94//=================================================================================================
95
96//*************************************************************************************************
103template< typename VT1 // Type of the left-hand side dense vector
104 , typename VT2 > // Type of the right-hand side sparse vector
106 : public VecTVecMultExpr< SparseMatrix< DVecSVecOuterExpr<VT1,VT2>, false > >
107 , private Computation
108{
109 private:
110 //**Type definitions****************************************************************************
119 //**********************************************************************************************
120
121 //**Return type evaluation**********************************************************************
123
128 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
129
131 using ExprReturnType = decltype( std::declval<RN1>() * std::declval<RN2>() );
132 //**********************************************************************************************
133
134 //**Evaluation strategy*************************************************************************
136
142 static constexpr bool useAssign = ( IsComputation_v<VT1> || IsComputation_v<VT2> );
143
146 template< typename MT >
147 static constexpr bool UseAssign_v = useAssign;
149 //**********************************************************************************************
150
151 //**********************************************************************************************
153
156 template< typename T1, typename T2, typename T3 >
157 static constexpr bool UseVectorizedKernel_v =
158 ( useOptimizedKernels &&
159 T1::simdEnabled && T2::simdEnabled &&
160 IsSame_v< ElementType_t<T1>, ElementType_t<T2> > &&
161 IsSame_v< ElementType_t<T1>, ElementType_t<T3> > &&
162 HasSIMDMult_v< ElementType_t<T1>, ElementType_t<T1> > );
164 //**********************************************************************************************
165
166 //**********************************************************************************************
168
171 template< typename T1, typename T2, typename T3 >
172 static constexpr bool UseDefaultKernel_v = !UseVectorizedKernel_v<T1,T2,T3>;
174 //**********************************************************************************************
175
176 public:
177 //**Type definitions****************************************************************************
180
183
188
191
194
196 using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
197
199 using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
200
203
206 //**********************************************************************************************
207
208 //**ConstIterator class definition**************************************************************
212 {
213 public:
214 //**Type definitions*************************************************************************
217
220
223
224 using IteratorCategory = std::forward_iterator_tag;
228 using DifferenceType = ptrdiff_t;
229
230 // STL iterator requirements
236 //*******************************************************************************************
237
238 //**Constructor******************************************************************************
242 : v_ ( v ) // Element of the left-hand side dense vector expression.
243 , it_( it ) // Iterator over the elements of the right-hand side sparse vector expression
244 {}
245 //*******************************************************************************************
246
247 //**Prefix increment operator****************************************************************
253 ++it_;
254 return *this;
255 }
256 //*******************************************************************************************
257
258 //**Element access operator******************************************************************
263 inline const Element operator*() const {
264 return Element( v_ * it_->value(), it_->index() );
265 }
266 //*******************************************************************************************
267
268 //**Element access operator******************************************************************
273 inline const ConstIterator* operator->() const {
274 return this;
275 }
276 //*******************************************************************************************
277
278 //**Value function***************************************************************************
283 inline ReturnType value() const {
284 return v_ * it_->value();
285 }
286 //*******************************************************************************************
287
288 //**Index function***************************************************************************
293 inline size_t index() const {
294 return it_->index();
295 }
296 //*******************************************************************************************
297
298 //**Equality operator************************************************************************
304 inline bool operator==( const ConstIterator& rhs ) const {
305 return it_ == rhs.it_;
306 }
307 //*******************************************************************************************
308
309 //**Inequality operator**********************************************************************
315 inline bool operator!=( const ConstIterator& rhs ) const {
316 return it_ != rhs.it_;
317 }
318 //*******************************************************************************************
319
320 //**Subtraction operator*********************************************************************
326 inline DifferenceType operator-( const ConstIterator& rhs ) const {
327 return it_ - rhs.it_;
328 }
329 //*******************************************************************************************
330
331 private:
332 //**Member variables*************************************************************************
335 //*******************************************************************************************
336 };
337 //**********************************************************************************************
338
339 //**Compilation flags***************************************************************************
341 static constexpr bool smpAssignable = false;
342 //**********************************************************************************************
343
344 //**SIMD properties*****************************************************************************
346 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
347 //**********************************************************************************************
348
349 //**Constructor*********************************************************************************
355 inline DVecSVecOuterExpr( const VT1& lhs, const VT2& rhs ) noexcept
356 : lhs_( lhs ) // Left-hand side dense vector of the multiplication expression
357 , rhs_( rhs ) // Right-hand side sparse vector of the multiplication expression
358 {}
359 //**********************************************************************************************
360
361 //**Access operator*****************************************************************************
368 inline ReturnType operator()( size_t i, size_t j ) const {
369 BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
370 BLAZE_INTERNAL_ASSERT( j < rhs_.size(), "Invalid column access index" );
371
372 return lhs_[i] * rhs_[j];
373 }
374 //**********************************************************************************************
375
376 //**At function*********************************************************************************
384 inline ReturnType at( size_t i, size_t j ) const {
385 if( i >= lhs_.size() ) {
386 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
387 }
388 if( j >= rhs_.size() ) {
389 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
390 }
391 return (*this)(i,j);
392 }
393 //**********************************************************************************************
394
395 //**Begin function******************************************************************************
401 inline ConstIterator begin( size_t i ) const {
402 return ConstIterator( lhs_[i], rhs_.begin() );
403 }
404 //**********************************************************************************************
405
406 //**End function********************************************************************************
412 inline ConstIterator end( size_t i ) const {
413 return ConstIterator( lhs_[i], rhs_.end() );
414 }
415 //**********************************************************************************************
416
417 //**Rows function*******************************************************************************
422 inline size_t rows() const noexcept {
423 return lhs_.size();
424 }
425 //**********************************************************************************************
426
427 //**Columns function****************************************************************************
432 inline size_t columns() const noexcept {
433 return rhs_.size();
434 }
435 //**********************************************************************************************
436
437 //**NonZeros function***************************************************************************
442 inline size_t nonZeros() const {
443 return lhs_.size() * rhs_.nonZeros();
444 }
445 //**********************************************************************************************
446
447 //**NonZeros function***************************************************************************
453 inline size_t nonZeros( size_t i ) const {
454 MAYBE_UNUSED( i );
455 return rhs_.nonZeros();
456 }
457 //**********************************************************************************************
458
459 //**Find function*******************************************************************************
466 inline ConstIterator find( size_t i, size_t j ) const {
468 return ConstIterator( lhs_[i], rhs_.find( j ) );
469 }
470 //**********************************************************************************************
471
472 //**LowerBound function*************************************************************************
479 inline ConstIterator lowerBound( size_t i, size_t j ) const {
481 return ConstIterator( lhs_[i], rhs_.lowerBound( j ) );
482 }
483 //**********************************************************************************************
484
485 //**UpperBound function*************************************************************************
492 inline ConstIterator upperBound( size_t i, size_t j ) const {
494 return ConstIterator( lhs_[i], rhs_.upperBound( j ) );
495 }
496 //**********************************************************************************************
497
498 //**Left operand access*************************************************************************
503 inline LeftOperand leftOperand() const noexcept {
504 return lhs_;
505 }
506 //**********************************************************************************************
507
508 //**Right operand access************************************************************************
513 inline RightOperand rightOperand() const noexcept {
514 return rhs_;
515 }
516 //**********************************************************************************************
517
518 //**********************************************************************************************
524 template< typename T >
525 inline bool canAlias( const T* alias ) const noexcept {
526 return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
527 }
528 //**********************************************************************************************
529
530 //**********************************************************************************************
536 template< typename T >
537 inline bool isAliased( const T* alias ) const noexcept {
538 return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
539 }
540 //**********************************************************************************************
541
542 private:
543 //**Member variables****************************************************************************
546 //**********************************************************************************************
547
548 //**Assignment to row-major dense matrices******************************************************
563 template< typename MT > // Type of the target dense matrix
564 friend inline auto assign( DenseMatrix<MT,false>& lhs, const DVecSVecOuterExpr& rhs )
566 {
568
569 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
570 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
571
572 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
573 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
574
575 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
576 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
577 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
578 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
579
580 const auto begin( y.begin() );
581 const auto end ( y.end() );
582
583 for( size_t i=0UL; i<x.size(); ++i ) {
584 for( auto element=begin; element!=end; ++element ) {
585 (*lhs)(i,element->index()) = x[i] * element->value();
586 }
587 }
588 }
590 //**********************************************************************************************
591
592 //**Assignment to column-major dense matrices***************************************************
605 template< typename MT > // Type of the target dense matrix
606 friend inline void assign( DenseMatrix<MT,true>& lhs, const DVecSVecOuterExpr& rhs )
607 {
609
611
612 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
613 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
614
615 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
616 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
617
618 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
619 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
620 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
621 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
622
623 DVecSVecOuterExpr::selectAssignKernel( *lhs, x, y );
624 }
626 //**********************************************************************************************
627
628 //**Default assignment to column-major dense matrices*******************************************
642 template< typename MT // Type of the left-hand side target matrix
643 , typename VT3 // Type of the left-hand side vector operand
644 , typename VT4 > // Type of the right-hand side vector operand
645 static inline auto selectAssignKernel( MT& A, const VT3& x, const VT4& y )
646 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
647 {
648 const auto begin( y.begin() );
649 const auto end ( y.end() );
650
651 for( auto element=begin; element!=end; ++element ) {
652 for( size_t i=0UL; i<x.size(); ++i ) {
653 A(i,element->index()) = x[i] * element->value();
654 }
655 }
656 }
658 //**********************************************************************************************
659
660 //**Vectorized assignment to column-major dense matrices****************************************
674 template< typename MT // Type of the left-hand side target matrix
675 , typename VT3 // Type of the left-hand side vector operand
676 , typename VT4 > // Type of the right-hand side vector operand
677 static inline auto selectAssignKernel( MT& A, const VT3& x, const VT4& y )
678 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
679 {
680 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT3> );
681
682 const size_t M( A.rows() );
683
684 const size_t ipos( remainder ? prevMultiple( M, SIMDSIZE ) : M );
685 BLAZE_INTERNAL_ASSERT( ipos <= M, "Invalid end calculation" );
686
687 const auto begin( y.begin() );
688 const auto end ( y.end() );
689
690 for( auto element=begin; element!=end; ++element )
691 {
692 const SIMDTrait_t<ElementType> y1( set( element->value() ) );
693
694 size_t i( 0UL );
695
696 for( ; i<ipos; i+=SIMDSIZE ) {
697 A.store( i, element->index(), x.load(i) * y1 );
698 }
699 for( ; remainder && i<M; ++i ) {
700 A(i,element->index()) = x[i] * element->value();
701 }
702 }
703 }
705 //**********************************************************************************************
706
707 //**Assignment to row-major sparse matrices*****************************************************
722 template< typename MT > // Type of the target sparse matrix
723 friend inline auto assign( SparseMatrix<MT,false>& lhs, const DVecSVecOuterExpr& rhs )
724 -> EnableIf_t< UseAssign_v<MT> >
725 {
727
728 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
729 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns() , "Invalid number of columns" );
730 BLAZE_INTERNAL_ASSERT( (*lhs).capacity() >= rhs.nonZeros(), "Insufficient capacity" );
731
732 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
733 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
734
735 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
736 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
737 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
738 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
739
740 // Final memory allocation (based on the evaluated operands)
741 (*lhs).reserve( x.size() * y.nonZeros() );
742
743 // Performing the outer product
744 const auto begin( y.begin() );
745 const auto end ( y.end() );
746
747 if( begin == end )
748 return;
749
750 for( size_t i=0UL; i<x.size(); ++i ) {
751 if( !isDefault( x[i] ) ) {
752 for( auto element=begin; element!=end; ++element ) {
753 (*lhs).append( i, element->index(), x[i] * element->value() );
754 }
755 }
756 (*lhs).finalize( i );
757 }
758 }
760 //**********************************************************************************************
761
762 //**Assignment to column-major sparse matrices*****************************************************
775 template< typename MT > // Type of the target sparse matrix
776 friend inline void assign( SparseMatrix<MT,true>& lhs, const DVecSVecOuterExpr& rhs )
777 {
779
781
782 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
783 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns() , "Invalid number of columns" );
784
785 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
786 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
787
788 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
789 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
790 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
791 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
792
793 const auto begin( y.begin() );
794 const auto end ( y.end() );
795
796 if( begin == end )
797 return;
798
799 (*lhs).reserve( begin->index(), rhs.nonZeros() );
800
801 size_t index( 0UL );
802
803 for( auto element=begin; element!=end; ++element ) {
804 if( !isDefault( element->value() ) ) {
805 for( ; index < element->index(); ++index ) {
806 (*lhs).finalize( index );
807 }
808 for( size_t i=0UL; i<x.size(); ++i ) {
809 (*lhs).append( i, element->index(), x[i] * element->value() );
810 }
811 (*lhs).finalize( index++ );
812 }
813 }
814
815 for( ; index < y.size(); ++index ) {
816 (*lhs).finalize( index );
817 }
818 }
820 //**********************************************************************************************
821
822 //**Addition assignment to row-major dense matrices*********************************************
838 template< typename MT > // Type of the target dense matrix
839 friend inline auto addAssign( DenseMatrix<MT,false>& lhs, const DVecSVecOuterExpr& rhs )
840 -> EnableIf_t< UseAssign_v<MT> >
841 {
843
844 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
845 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
846
847 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
848 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
849
850 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
851 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
852 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
853 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
854
855 const auto begin( y.begin() );
856 const auto end ( y.end() );
857
858 for( size_t i=0UL; i<x.size(); ++i ) {
859 if( !isDefault( x[i] ) ) {
860 for( auto element=begin; element!=end; ++element ) {
861 (*lhs)(i,element->index()) += x[i] * element->value();
862 }
863 }
864 }
865 }
867 //**********************************************************************************************
868
869 //**Addition assignment to column-major dense matrices******************************************
882 template< typename MT > // Type of the target dense matrix
883 friend inline void addAssign( DenseMatrix<MT,true>& lhs, const DVecSVecOuterExpr& rhs )
884 {
886
888
889 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
890 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
891
892 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
893 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
894
895 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
896 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
897 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
898 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
899
900 DVecSVecOuterExpr::selectAddAssignKernel( *lhs, x, y );
901 }
903 //**********************************************************************************************
904
905 //**Default addition assignment to column dense matrices****************************************
919 template< typename MT // Type of the left-hand side target matrix
920 , typename VT3 // Type of the left-hand side vector operand
921 , typename VT4 > // Type of the right-hand side vector operand
922 static inline auto selectAddAssignKernel( MT& A, const VT3& x, const VT4& y )
923 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
924 {
925 const auto begin( y.begin() );
926 const auto end ( y.end() );
927
928 for( auto element=begin; element!=end; ++element ) {
929 if( !isDefault( element->value() ) ) {
930 for( size_t i=0UL; i<x.size(); ++i ) {
931 A(i,element->index()) += x[i] * element->value();
932 }
933 }
934 }
935 }
937 //**********************************************************************************************
938
939 //**Vectorized addition assignment to column-major dense matrices*******************************
953 template< typename MT // Type of the left-hand side target matrix
954 , typename VT3 // Type of the left-hand side vector operand
955 , typename VT4 > // Type of the right-hand side vector operand
956 static inline auto selectAddAssignKernel( MT& A, const VT3& x, const VT4& y )
957 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
958 {
959 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT3> );
960
961 const size_t M( A.rows() );
962
963 const size_t ipos( remainder ? prevMultiple( M, SIMDSIZE ) : M );
964 BLAZE_INTERNAL_ASSERT( ipos <= M, "Invalid end calculation" );
965
966 const auto begin( y.begin() );
967 const auto end ( y.end() );
968
969 for( auto element=begin; element!=end; ++element )
970 {
971 if( isDefault( element->value() ) ) continue;
972
973 const SIMDTrait_t<ElementType> y1( set( element->value() ) );
974
975 size_t i( 0UL );
976
977 for( ; i<ipos; i+=SIMDSIZE ) {
978 A.store( i, element->index(), A.load(i,element->index()) + x.load(i) * y1 );
979 }
980 for( ; remainder && i<M; ++i ) {
981 A(i,element->index()) += x[i] * element->value();
982 }
983 }
984 }
986 //**********************************************************************************************
987
988 //**Addition assignment to sparse matrices******************************************************
989 // No special implementation for the addition assignment to sparse matrices.
990 //**********************************************************************************************
991
992 //**Subtraction assignment to row-major dense matrices******************************************
1008 template< typename MT > // Type of the target dense matrix
1009 friend inline auto subAssign( DenseMatrix<MT,false>& lhs, const DVecSVecOuterExpr& rhs )
1010 -> EnableIf_t< UseAssign_v<MT> >
1011 {
1013
1014 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1015 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1016
1017 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1018 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
1019
1020 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1021 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1022 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1023 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1024
1025 const auto begin( y.begin() );
1026 const auto end ( y.end() );
1027
1028 for( size_t i=0UL; i<x.size(); ++i ) {
1029 if( !isDefault( x[i] ) ) {
1030 for( auto element=begin; element!=end; ++element ) {
1031 (*lhs)(i,element->index()) -= x[i] * element->value();
1032 }
1033 }
1034 }
1035 }
1037 //**********************************************************************************************
1038
1039 //**Subtraction assignment to column-major dense matrices***************************************
1052 template< typename MT > // Type of the target dense matrix
1053 friend inline void subAssign( DenseMatrix<MT,true>& lhs, const DVecSVecOuterExpr& rhs )
1054 {
1056
1058
1059 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1060 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1061
1062 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1063 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
1064
1065 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1066 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1067 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1068 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1069
1070 DVecSVecOuterExpr::selectSubAssignKernel( *lhs, x, y );
1071 }
1073 //**********************************************************************************************
1074
1075 //**Default subtraction assignment to column dense matrices*************************************
1089 template< typename MT // Type of the left-hand side target matrix
1090 , typename VT3 // Type of the left-hand side vector operand
1091 , typename VT4 > // Type of the right-hand side vector operand
1092 static inline auto selectSubAssignKernel( MT& A, const VT3& x, const VT4& y )
1093 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
1094 {
1095 const auto begin( y.begin() );
1096 const auto end ( y.end() );
1097
1098 for( auto element=begin; element!=end; ++element ) {
1099 if( !isDefault( element->value() ) ) {
1100 for( size_t i=0UL; i<x.size(); ++i ) {
1101 A(i,element->index()) -= x[i] * element->value();
1102 }
1103 }
1104 }
1105 }
1107 //**********************************************************************************************
1108
1109 //**Vectorized subtraction assignment to column-major dense matrices****************************
1123 template< typename MT // Type of the left-hand side target matrix
1124 , typename VT3 // Type of the left-hand side vector operand
1125 , typename VT4 > // Type of the right-hand side vector operand
1126 static inline auto selectSubAssignKernel( MT& A, const VT3& x, const VT4& y )
1127 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
1128 {
1129 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT3> );
1130
1131 const size_t M( A.rows() );
1132
1133 const size_t ipos( remainder ? prevMultiple( M, SIMDSIZE ) : M );
1134 BLAZE_INTERNAL_ASSERT( ipos <= M, "Invalid end calculation" );
1135
1136 const auto begin( y.begin() );
1137 const auto end ( y.end() );
1138
1139 for( auto element=begin; element!=end; ++element )
1140 {
1141 if( isDefault( element->value() ) ) continue;
1142
1143 const SIMDTrait_t<ElementType> y1( set( element->value() ) );
1144
1145 size_t i( 0UL );
1146
1147 for( ; i<ipos; i+=SIMDSIZE ) {
1148 A.store( i, element->index(), A.load(i,element->index()) - x.load(i) * y1 );
1149 }
1150 for( ; remainder && i<M; ++i ) {
1151 A(i,element->index()) -= x[i] * element->value();
1152 }
1153 }
1154 }
1156 //**********************************************************************************************
1157
1158 //**Subtraction assignment to sparse matrices***************************************************
1159 // No special implementation for the subtraction assignment to sparse matrices.
1160 //**********************************************************************************************
1161
1162 //**Schur product assignment to row-major dense matrices****************************************
1178 template< typename MT > // Type of the target dense matrix
1179 friend inline auto schurAssign( DenseMatrix<MT,false>& lhs, const DVecSVecOuterExpr& rhs )
1180 -> EnableIf_t< UseAssign_v<MT> >
1181 {
1183
1184 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1185 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1186
1187 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1188 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
1189
1190 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1191 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1192 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1193 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1194
1195 const auto end( y.end() );
1196
1197 for( size_t i=0UL; i<x.size(); ++i )
1198 {
1199 size_t j( 0UL );
1200
1201 for( auto element=y.begin(); element!=end; ++element, ++j ) {
1202 for( ; j<element->index(); ++j )
1203 reset( (*lhs)(i,j) );
1204 (*lhs)(i,element->index()) *= x[i] * element->value();
1205 }
1206
1207 for( ; j<y.size(); ++j ) {
1208 reset( (*lhs)(i,j) );
1209 }
1210 }
1211 }
1213 //**********************************************************************************************
1214
1215 //**Schur product assignment to column-major dense matrices*************************************
1228 template< typename MT > // Type of the target dense matrix
1229 friend inline void schurAssign( DenseMatrix<MT,true>& lhs, const DVecSVecOuterExpr& rhs )
1230 {
1232
1234
1235 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1236 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1237
1238 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1239 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
1240
1241 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1242 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1243 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1244 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1245
1246 DVecSVecOuterExpr::selectSchurAssignKernel( *lhs, x, y );
1247 }
1249 //**********************************************************************************************
1250
1251 //**Default Schur product assignment to column dense matrices***********************************
1265 template< typename MT // Type of the left-hand side target matrix
1266 , typename VT3 // Type of the left-hand side vector operand
1267 , typename VT4 > // Type of the right-hand side vector operand
1268 static inline auto selectSchurAssignKernel( MT& A, const VT3& x, const VT4& y )
1269 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
1270 {
1271 const auto end( y.end() );
1272
1273 size_t j( 0UL );
1274
1275 for( auto element=y.begin(); element!=end; ++element )
1276 {
1277 if( isDefault( element->value() ) ) continue;
1278
1279 for( ; j<element->index(); ++j ) {
1280 for( size_t i=0UL; i<x.size(); ++i )
1281 reset( A(i,j) );
1282 }
1283
1284 for( size_t i=0UL; i<x.size(); ++i ) {
1285 A(i,element->index()) *= x[i] * element->value();
1286 }
1287
1288 ++j;
1289 }
1290
1291 for( ; j<y.size(); ++j ) {
1292 for( size_t i=0UL; i<x.size(); ++i )
1293 reset( A(i,j) );
1294 }
1295 }
1297 //**********************************************************************************************
1298
1299 //**Vectorized Schur product assignment to column-major dense matrices**************************
1313 template< typename MT // Type of the left-hand side target matrix
1314 , typename VT3 // Type of the left-hand side vector operand
1315 , typename VT4 > // Type of the right-hand side vector operand
1316 static inline auto selectSchurAssignKernel( MT& A, const VT3& x, const VT4& y )
1317 -> EnableIf_t< IsColumnMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
1318 {
1319 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT3> );
1320
1321 const size_t M( A.rows() );
1322 const size_t N( A.columns() );
1323
1324 const size_t ipos( remainder ? prevMultiple( M, SIMDSIZE ) : M );
1325 BLAZE_INTERNAL_ASSERT( ipos <= M, "Invalid end calculation" );
1326
1327 const auto begin( y.begin() );
1328 const auto end ( y.end() );
1329
1330 size_t j( 0UL );
1331
1332 for( auto element=begin; element!=end; ++element )
1333 {
1334 if( isDefault( element->value() ) ) continue;
1335
1336 for( ; j<element->index(); ++j ) {
1337 for( size_t i=0UL; i<M; ++i )
1338 reset( A(i,j) );
1339 }
1340
1341 const SIMDTrait_t<ElementType> y1( set( element->value() ) );
1342
1343 size_t i( 0UL );
1344
1345 for( ; i<ipos; i+=SIMDSIZE ) {
1346 A.store( i, element->index(), A.load(i,element->index()) * ( x.load(i) * y1 ) );
1347 }
1348 for( ; remainder && i<M; ++i ) {
1349 A(i,element->index()) *= x[i] * element->value();
1350 }
1351
1352 ++j;
1353 }
1354
1355 for( ; j<N; ++j ) {
1356 for( size_t i=0UL; i<M; ++i )
1357 reset( A(i,j) );
1358 }
1359 }
1361 //**********************************************************************************************
1362
1363 //**Schur product assignment to sparse matrices*************************************************
1364 // No special implementation for the Schur product assignment to sparse matrices.
1365 //**********************************************************************************************
1366
1367 //**Multiplication assignment to dense matrices*************************************************
1368 // No special implementation for the multiplication assignment to dense matrices.
1369 //**********************************************************************************************
1370
1371 //**Multiplication assignment to sparse matrices************************************************
1372 // No special implementation for the multiplication assignment to sparse matrices.
1373 //**********************************************************************************************
1374
1375 //**Compile time checks*************************************************************************
1384 //**********************************************************************************************
1385};
1386//*************************************************************************************************
1387
1388
1389
1390
1391//=================================================================================================
1392//
1393// GLOBAL BINARY ARITHMETIC OPERATORS
1394//
1395//=================================================================================================
1396
1397//*************************************************************************************************
1410template< typename VT1 // Type of the left-hand side dense vector
1411 , typename VT2 // Type of the right-hand side sparse vector
1412 , DisableIf_t< IsZero_v<VT2> >* = nullptr >
1413inline const DVecSVecOuterExpr<VT1,VT2>
1414 dvecsvecouter( const DenseVector<VT1,false>& lhs, const SparseVector<VT2,true>& rhs )
1415{
1417
1418 return DVecSVecOuterExpr<VT1,VT2>( *lhs, *rhs );
1419}
1421//*************************************************************************************************
1422
1423
1424//*************************************************************************************************
1437template< typename VT1 // Type of the left-hand side dense vector
1438 , typename VT2 // Type of the right-hand side sparse vector
1439 , EnableIf_t< IsZero_v<VT2> >* = nullptr >
1440inline decltype(auto)
1441 dvecsvecouter( const DenseVector<VT1,false>& lhs, const SparseVector<VT2,true>& rhs )
1442{
1444
1445 using ReturnType = const MultTrait_t< ResultType_t<VT1>, ResultType_t<VT2> >;
1446
1449
1450 return ReturnType( (*lhs).size(), (*rhs).size() );
1451}
1453//*************************************************************************************************
1454
1455
1456//*************************************************************************************************
1485template< typename VT1 // Type of the left-hand side dense vector
1486 , typename VT2 > // Type of the right-hand side sparse vector
1487inline decltype(auto)
1488 operator*( const DenseVector<VT1,false>& lhs, const SparseVector<VT2,true>& rhs )
1489{
1491
1492 return dvecsvecouter( *lhs, *rhs );
1493}
1494//*************************************************************************************************
1495
1496
1497
1498
1499//=================================================================================================
1500//
1501// SIZE SPECIALIZATIONS
1502//
1503//=================================================================================================
1504
1505//*************************************************************************************************
1507template< typename VT1, typename VT2 >
1508struct Size< DVecSVecOuterExpr<VT1,VT2>, 0UL >
1509 : public Size<VT1,0UL>
1510{};
1511
1512template< typename VT1, typename VT2 >
1513struct Size< DVecSVecOuterExpr<VT1,VT2>, 1UL >
1514 : public Size<VT2,0UL>
1515{};
1517//*************************************************************************************************
1518
1519} // namespace blaze
1520
1521#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::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
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::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition: Aliases.h:310
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition: Aliases.h:130
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
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 HasSIMDMult type trait.
Header file for the If class template.
Header file for the IsColumnMajorMatrix type trait.
Header file for the IsComputation type trait class.
Header file for the isDefault shim.
Header file for the IsExpression type trait class.
Header file for the IsPadded type trait.
Header file for the IsSame and IsStrictlySame type traits.
Header file for the IsTemporary type trait class.
Deactivation of problematic macros.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Header file for the prevMultiple shim.
Header file for the RemoveReference type trait.
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
Header file for all SIMD functionality.
Constraint on the data type.
Header file for the ValueIndexPair class.
Constraint on the data type.
Iterator over the elements of the dense vector-sparse vector outer product expression.
Definition: DVecSVecOuterExpr.h:212
DifferenceType difference_type
Difference between two iterators.
Definition: DVecSVecOuterExpr.h:235
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: DVecSVecOuterExpr.h:263
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: DVecSVecOuterExpr.h:273
size_t index() const
Access to the current index of the sparse element.
Definition: DVecSVecOuterExpr.h:293
IteratorType it_
Iterator over the elements of the right-hand side sparse vector expression.
Definition: DVecSVecOuterExpr.h:334
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: DVecSVecOuterExpr.h:216
ValueType * PointerType
Pointer return type.
Definition: DVecSVecOuterExpr.h:226
IteratorCategory iterator_category
The iterator category.
Definition: DVecSVecOuterExpr.h:231
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecSVecOuterExpr.h:304
ReturnType value() const
Access to the current value of the sparse element.
Definition: DVecSVecOuterExpr.h:283
ConstIterator_t< RemoveReference_t< RightOperand > > IteratorType
Iterator type of the sparse vector expression.
Definition: DVecSVecOuterExpr.h:222
Element ValueType
Type of the underlying pointers.
Definition: DVecSVecOuterExpr.h:225
ValueType & ReferenceType
Reference return type.
Definition: DVecSVecOuterExpr.h:227
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: DVecSVecOuterExpr.h:326
ET1 LeftElement
Element type of the dense vector expression.
Definition: DVecSVecOuterExpr.h:219
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: DVecSVecOuterExpr.h:224
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecSVecOuterExpr.h:252
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecSVecOuterExpr.h:315
LeftElement v_
Element of the left-hand side dense vector expression.
Definition: DVecSVecOuterExpr.h:333
ConstIterator(LeftElement v, IteratorType it)
Constructor for the ConstIterator class.
Definition: DVecSVecOuterExpr.h:241
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecSVecOuterExpr.h:228
Expression object for dense vector-sparse vector outer products.
Definition: DVecSVecOuterExpr.h:108
RightOperand rhs_
Right-hand side sparse vector of the multiplication expression.
Definition: DVecSVecOuterExpr.h:545
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecSVecOuterExpr.h:525
If_t< IsComputation_v< VT1 >, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense vector operand.
Definition: DVecSVecOuterExpr.h:202
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse vector operand.
Definition: DVecSVecOuterExpr.h:513
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecSVecOuterExpr.h:503
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecSVecOuterExpr.h:111
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecSVecOuterExpr.h:190
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecSVecOuterExpr.h:187
CompositeType_t< VT2 > CT2
Composite type of the right-hand side sparse vector expression.
Definition: DVecSVecOuterExpr.h:116
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecSVecOuterExpr.h:537
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecSVecOuterExpr.h:196
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecSVecOuterExpr.h:128
ReturnType_t< VT2 > RN2
Return type of the right-hand side sparse vector expression.
Definition: DVecSVecOuterExpr.h:114
If_t< useAssign, const ResultType, const DVecSVecOuterExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecSVecOuterExpr.h:193
LeftOperand lhs_
Left-hand side dense vector of the multiplication expression.
Definition: DVecSVecOuterExpr.h:544
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: DVecSVecOuterExpr.h:453
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecSVecOuterExpr.h:113
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecSVecOuterExpr.h:346
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DVecSVecOuterExpr.h:412
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecSVecOuterExpr.h:186
DVecSVecOuterExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecSVecOuterExpr class.
Definition: DVecSVecOuterExpr.h:355
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: DVecSVecOuterExpr.h:442
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DVecSVecOuterExpr.h:432
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: DVecSVecOuterExpr.h:492
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecSVecOuterExpr.h:115
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DVecSVecOuterExpr.h:422
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecSVecOuterExpr.h:184
static constexpr bool useAssign
Compilation switch for the evaluation strategy of the multiplication expression.
Definition: DVecSVecOuterExpr.h:142
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecSVecOuterExpr.h:131
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DVecSVecOuterExpr.h:185
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: DVecSVecOuterExpr.h:199
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecSVecOuterExpr.h:117
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: DVecSVecOuterExpr.h:466
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DVecSVecOuterExpr.h:384
ResultType_t< VT2 > RT2
Result type of the right-hand side sparse vector expression.
Definition: DVecSVecOuterExpr.h:112
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DVecSVecOuterExpr.h:401
ElementType_t< VT2 > ET2
Element type of the right-hand side sparse vector expression.
Definition: DVecSVecOuterExpr.h:118
If_t< IsComputation_v< VT2 >, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense vector operand.
Definition: DVecSVecOuterExpr.h:205
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: DVecSVecOuterExpr.h:479
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DVecSVecOuterExpr.h:368
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecSVecOuterExpr.h:341
Base class for dense matrices.
Definition: DenseMatrix.h:82
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse vectors.
Definition: SparseVector.h:72
Index-value-pair for sparse vectors and matrices.
Definition: ValueIndexPair.h:75
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 SparseMatrix base class.
Header file for the VecTVecMultExpr 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_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_VECTVECMULTEXPR(T1, T2)
Constraint on the data type.
Definition: VecTVecMultExpr.h:103
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_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_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
BLAZE_ALWAYS_INLINE constexpr auto prevMultiple(T1 value, T2 factor) noexcept
Rounds down an integral value to the previous multiple of a given factor.
Definition: PrevMultiple.h:68
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
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_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
Header file for the Size type trait.
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 outer product expression templates.
Definition: VecTVecMultExpr.h:69
System settings for performance optimizations.
Header file for the IsZero type trait.
Header file for basic type definitions.