Blaze 3.9
SVecDVecOuterExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_SVECDVECOUTEREXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SVECDVECOUTEREXPR_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 SVECDVECOUTEREXPR
93//
94//=================================================================================================
95
96//*************************************************************************************************
103template< typename VT1 // Type of the left-hand side sparse vector
104 , typename VT2 > // Type of the right-hand side dense vector
106 : public VecTVecMultExpr< SparseMatrix< SVecDVecOuterExpr<VT1,VT2>, true > >
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 && T3::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 : it_( it ) // Iterator over the elements of the left-hand side sparse vector expression
243 , v_ ( v ) // Element of the right-hand side dense 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( it_->value() * v_, 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 it_->value() * v_;
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 SVecDVecOuterExpr( const VT1& lhs, const VT2& rhs ) noexcept
356 : lhs_( lhs ) // Left-hand side sparse vector of the multiplication expression
357 , rhs_( rhs ) // Right-hand side dense 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_.begin(), rhs_[i] );
403 }
404 //**********************************************************************************************
405
406 //**End function********************************************************************************
412 inline ConstIterator end( size_t i ) const {
413 return ConstIterator( lhs_.end(), rhs_[i] );
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_.nonZeros() * rhs_.size();
444 }
445 //**********************************************************************************************
446
447 //**NonZeros function***************************************************************************
453 inline size_t nonZeros( size_t i ) const {
454 MAYBE_UNUSED( i );
455 return lhs_.nonZeros();
456 }
457 //**********************************************************************************************
458
459 //**Find function*******************************************************************************
466 inline ConstIterator find( size_t i, size_t j ) const {
468 return ConstIterator( lhs_.find( i ), rhs_[j] );
469 }
470 //**********************************************************************************************
471
472 //**LowerBound function*************************************************************************
479 inline ConstIterator lowerBound( size_t i, size_t j ) const {
481 return ConstIterator( lhs_.lowerBound( i ), rhs_[j] );
482 }
483 //**********************************************************************************************
484
485 //**UpperBound function*************************************************************************
492 inline ConstIterator upperBound( size_t i, size_t j ) const {
494 return ConstIterator( lhs_.upperBound( i ), rhs_[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******************************************************
560 template< typename MT > // Type of the target dense matrix
561 friend inline void assign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
562 {
564
566
567 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
568 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
569
570 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
571 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
572
573 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
574 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
575 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
576 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
577
578 SVecDVecOuterExpr::selectAssignKernel( *lhs, x, y );
579 }
581 //**********************************************************************************************
582
583 //**Default assignment to row-major dense matrices**********************************************
597 template< typename MT // Type of the left-hand side target matrix
598 , typename VT3 // Type of the left-hand side vector operand
599 , typename VT4 > // Type of the right-hand side vector operand
600 static inline auto selectAssignKernel( MT& A, const VT3& x, const VT4& y )
601 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
602 {
603 const auto end( x.end() );
604
605 for( auto element=x.begin(); element!=end; ++element ) {
606 if( !isDefault( element->value() ) ) {
607 for( size_t j=0UL; j<y.size(); ++j ) {
608 A(element->index(),j) = element->value() * y[j];
609 }
610 }
611 }
612 }
614 //**********************************************************************************************
615
616 //**Vectorized assignment to row-major dense matrices*******************************************
630 template< typename MT // Type of the left-hand side target matrix
631 , typename VT3 // Type of the left-hand side vector operand
632 , typename VT4 > // Type of the right-hand side vector operand
633 static inline auto selectAssignKernel( MT& A, const VT3& x, const VT4& y )
634 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
635 {
636 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT4> );
637
638 const size_t N( A.columns() );
639
640 const size_t jpos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
641 BLAZE_INTERNAL_ASSERT( jpos <= N, "Invalid end calculation" );
642
643 const auto begin( x.begin() );
644 const auto end ( x.end() );
645
646 for( auto element=begin; element!=end; ++element )
647 {
648 const SIMDTrait_t<ElementType> x1( set( element->value() ) );
649
650 size_t j( 0UL );
651
652 for( ; j<jpos; j+=SIMDSIZE ) {
653 A.store( element->index(), j, x1 * y.load(j) );
654 }
655 for( ; remainder && j<N; ++j ) {
656 A(element->index(),j) = element->value() * y[j];
657 }
658 }
659 }
661 //**********************************************************************************************
662
663 //**Assignment to column-major dense matrices***************************************************
679 template< typename MT > // Type of the target dense matrix
680 friend inline auto assign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
681 -> EnableIf_t< UseAssign_v<MT> >
682 {
684
685 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
686 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
687
688 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
689 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
690
691 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
692 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
693 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
694 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
695
696 const auto end( x.end() );
697
698 for( size_t i=0UL; i<y.size(); ++i ) {
699 if( !isDefault( y[i] ) ) {
700 for( auto element=x.begin(); element!=end; ++element ) {
701 (*lhs)(element->index(),i) = element->value() * y[i];
702 }
703 }
704 }
705 }
707 //**********************************************************************************************
708
709 //**Assignment to row-major sparse matrices*****************************************************
721 template< typename MT > // Type of the target sparse matrix
722 friend inline void assign( SparseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
723 {
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
731 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
732 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
733
734 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
735 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
736 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
737 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
738
739 // Final memory allocation (based on the evaluated operands)
740 (*lhs).reserve( x.nonZeros() * y.size() );
741
742 // Performing the outer product
743 const auto begin( x.begin() );
744 const auto end ( x.end() );
745
746 if( begin == end )
747 return;
748
749 (*lhs).reserve( begin->index(), rhs.nonZeros() );
750
751 size_t index( 0UL );
752
753 for( auto element=begin; element!=end; ++element ) {
754 if( !isDefault( element->value() ) ) {
755 for( ; index < element->index(); ++index ) {
756 (*lhs).finalize( index );
757 }
758 for( size_t i=0UL; i<y.size(); ++i ) {
759 (*lhs).append( element->index(), i, element->value() * y[i] );
760 }
761 (*lhs).finalize( index++ );
762 }
763 }
764
765 for( ; index < x.size(); ++index ) {
766 (*lhs).finalize( index );
767 }
768 }
770 //**********************************************************************************************
771
772 //**Assignment to column-major sparse matrices**************************************************
788 template< typename MT > // Type of the target sparse matrix
789 friend inline auto assign( SparseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
790 -> EnableIf_t< UseAssign_v<MT> >
791 {
793
794 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
795 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns() , "Invalid number of columns" );
796 BLAZE_INTERNAL_ASSERT( (*lhs).capacity() >= rhs.nonZeros(), "Insufficient capacity" );
797
798 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
799 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
800
801 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
802 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
803 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
804 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
805
806 const auto begin( x.begin() );
807 const auto end ( x.end() );
808
809 if( begin == end )
810 return;
811
812 for( size_t i=0UL; i<y.size(); ++i ) {
813 if( !isDefault( y[i] ) ) {
814 for( auto element=begin; element!=end; ++element ) {
815 (*lhs).append( element->index(), i, element->value() * y[i] );
816 }
817 }
818 (*lhs).finalize( i );
819 }
820 }
822 //**********************************************************************************************
823
824 //**Addition assignment to row-major dense matrices*********************************************
837 template< typename MT > // Type of the target dense matrix
838 friend inline void addAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
839 {
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 sparse vector operand
848 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense 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 SVecDVecOuterExpr::selectAddAssignKernel( *lhs, x, y );
856 }
858 //**********************************************************************************************
859
860 //**Default addition assignment to row-major dense matrices*************************************
874 template< typename MT // Type of the left-hand side target matrix
875 , typename VT3 // Type of the left-hand side vector operand
876 , typename VT4 > // Type of the right-hand side vector operand
877 static inline auto selectAddAssignKernel( MT& A, const VT3& x, const VT4& y )
878 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
879 {
880 const auto end( x.end() );
881
882 for( auto element=x.begin(); element!=end; ++element ) {
883 if( !isDefault( element->value() ) ) {
884 for( size_t i=0UL; i<y.size(); ++i ) {
885 A(element->index(),i) += element->value() * y[i];
886 }
887 }
888 }
889 }
891 //**********************************************************************************************
892
893 //**Vectorized addition assignment to row-major dense matrices**********************************
907 template< typename MT // Type of the left-hand side target matrix
908 , typename VT3 // Type of the left-hand side vector operand
909 , typename VT4 > // Type of the right-hand side vector operand
910 static inline auto selectAddAssignKernel( MT& A, const VT3& x, const VT4& y )
911 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
912 {
913 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT4> );
914
915 const size_t N( A.columns() );
916
917 const size_t jpos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
918 BLAZE_INTERNAL_ASSERT( jpos <= N, "Invalid end calculation" );
919
920 const auto begin( x.begin() );
921 const auto end ( x.end() );
922
923 for( auto element=begin; element!=end; ++element )
924 {
925 if( isDefault( element->value() ) ) continue;
926
927 const SIMDTrait_t<ElementType> x1( set( element->value() ) );
928
929 size_t j( 0UL );
930
931 for( ; j<jpos; j+=SIMDSIZE ) {
932 A.store( element->index(), j, A.load(element->index(),j) + x1 * y.load(j) );
933 }
934 for( ; remainder && j<N; ++j ) {
935 A(element->index(),j) += element->value() * y[j];
936 }
937 }
938 }
940 //**********************************************************************************************
941
942 //**Addition assignment to column-major dense matrices******************************************
958 template< typename MT > // Type of the target dense matrix
959 friend inline auto addAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
960 -> EnableIf_t< UseAssign_v<MT> >
961 {
963
964 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
965 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
966
967 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
968 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
969
970 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
971 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
972 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
973 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
974
975 const auto end( x.end() );
976
977 for( size_t i=0UL; i<y.size(); ++i ) {
978 if( !isDefault( y[i] ) ) {
979 for( auto element=x.begin(); element!=end; ++element ) {
980 (*lhs)(element->index(),i) += element->value() * y[i];
981 }
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******************************************
1005 template< typename MT > // Type of the target dense matrix
1006 friend inline void subAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
1007 {
1009
1011
1012 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1013 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1014
1015 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1016 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1017
1018 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1019 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1020 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1021 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1022
1023 SVecDVecOuterExpr::selectSubAssignKernel( *lhs, x, y );
1024 }
1026 //**********************************************************************************************
1027
1028 //**Default subtraction assignment to row-major dense matrices**********************************
1042 template< typename MT // Type of the left-hand side target matrix
1043 , typename VT3 // Type of the left-hand side vector operand
1044 , typename VT4 > // Type of the right-hand side vector operand
1045 static inline auto selectSubAssignKernel( MT& A, const VT3& x, const VT4& y )
1046 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
1047 {
1048 const auto end( x.end() );
1049
1050 for( auto element=x.begin(); element!=end; ++element ) {
1051 if( !isDefault( element->value() ) ) {
1052 for( size_t i=0UL; i<y.size(); ++i ) {
1053 A(element->index(),i) -= element->value() * y[i];
1054 }
1055 }
1056 }
1057 }
1059 //**********************************************************************************************
1060
1061 //**Vectorized subtraction assignment to row-major dense matrices*******************************
1075 template< typename MT // Type of the left-hand side target matrix
1076 , typename VT3 // Type of the left-hand side vector operand
1077 , typename VT4 > // Type of the right-hand side vector operand
1078 static inline auto selectSubAssignKernel( MT& A, const VT3& x, const VT4& y )
1079 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
1080 {
1081 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT4> );
1082
1083 const size_t N( A.columns() );
1084
1085 const size_t jpos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
1086 BLAZE_INTERNAL_ASSERT( jpos <= N, "Invalid end calculation" );
1087
1088 const auto begin( x.begin() );
1089 const auto end ( x.end() );
1090
1091 for( auto element=begin; element!=end; ++element )
1092 {
1093 if( isDefault( element->value() ) ) continue;
1094
1095 const SIMDTrait_t<ElementType> x1( set( element->value() ) );
1096
1097 size_t j( 0UL );
1098
1099 for( ; j<jpos; j+=SIMDSIZE ) {
1100 A.store( element->index(), j, A.load(element->index(),j) - x1 * y.load(j) );
1101 }
1102 for( ; remainder && j<N; ++j ) {
1103 A(element->index(),j) -= element->value() * y[j];
1104 }
1105 }
1106 }
1108 //**********************************************************************************************
1109
1110 //**Subtraction assignment to column-major dense matrices***************************************
1126 template< typename MT > // Type of the target dense matrix
1127 friend inline auto subAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
1128 -> EnableIf_t< UseAssign_v<MT> >
1129 {
1131
1132 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1133 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1134
1135 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1136 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1137
1138 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1139 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1140 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1141 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1142
1143 const auto end( x.end() );
1144
1145 for( size_t i=0UL; i<y.size(); ++i ) {
1146 if( !isDefault( y[i] ) ) {
1147 for( auto element=x.begin(); element!=end; ++element ) {
1148 (*lhs)(element->index(),i) -= element->value() * y[i];
1149 }
1150 }
1151 }
1152 }
1154 //**********************************************************************************************
1155
1156 //**Subtraction assignment to sparse matrices***************************************************
1157 // No special implementation for the subtraction assignment to sparse matrices.
1158 //**********************************************************************************************
1159
1160 //**Schur product assignment to row-major dense matrices****************************************
1173 template< typename MT > // Type of the target dense matrix
1174 friend inline void schurAssign( DenseMatrix<MT,false>& lhs, const SVecDVecOuterExpr& rhs )
1175 {
1177
1179
1180 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1181 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1182
1183 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1184 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1185
1186 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1187 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1188 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1189 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1190
1191 SVecDVecOuterExpr::selectSchurAssignKernel( *lhs, x, y );
1192 }
1194 //**********************************************************************************************
1195
1196 //**Default Schur product assignment to row-major dense matrices********************************
1210 template< typename MT // Type of the left-hand side target matrix
1211 , typename VT3 // Type of the left-hand side vector operand
1212 , typename VT4 > // Type of the right-hand side vector operand
1213 static inline auto selectSchurAssignKernel( MT& A, const VT3& x, const VT4& y )
1214 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseDefaultKernel_v<MT,VT3,VT4> >
1215 {
1216 const auto end( x.end() );
1217
1218 size_t i( 0UL );
1219
1220 for( auto element=x.begin(); element!=end; ++element )
1221 {
1222 if( isDefault( element->value() ) ) continue;
1223
1224 for( ; i<element->index(); ++i ) {
1225 for( size_t j=0UL; j<y.size(); ++j )
1226 reset( A(i,j) );
1227 }
1228
1229 for( size_t j=0UL; j<y.size(); ++j ) {
1230 A(element->index(),j) *= element->value() * y[j];
1231 }
1232
1233 ++i;
1234 }
1235
1236 for( ; i<x.size(); ++i ) {
1237 for( size_t j=0UL; j<y.size(); ++j )
1238 reset( A(i,j) );
1239 }
1240 }
1242 //**********************************************************************************************
1243
1244 //**Vectorized Schur product assignment to row-major dense matrices*****************************
1258 template< typename MT // Type of the left-hand side target matrix
1259 , typename VT3 // Type of the left-hand side vector operand
1260 , typename VT4 > // Type of the right-hand side vector operand
1261 static inline auto selectSchurAssignKernel( MT& A, const VT3& x, const VT4& y )
1262 -> EnableIf_t< IsRowMajorMatrix_v<MT> && UseVectorizedKernel_v<MT,VT3,VT4> >
1263 {
1264 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT4> );
1265
1266 const size_t M( A.rows() );
1267 const size_t N( A.columns() );
1268
1269 const size_t jpos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
1270 BLAZE_INTERNAL_ASSERT( jpos <= N, "Invalid end calculation" );
1271
1272 const auto begin( x.begin() );
1273 const auto end ( x.end() );
1274
1275 size_t i( 0UL );
1276
1277 for( auto element=begin; element!=end; ++element )
1278 {
1279 if( isDefault( element->value() ) ) continue;
1280
1281 for( ; i<element->index(); ++i ) {
1282 for( size_t j=0UL; j<N; ++j )
1283 reset( A(i,j) );
1284 }
1285
1286 const SIMDTrait_t<ElementType> x1( set( element->value() ) );
1287
1288 size_t j( 0UL );
1289
1290 for( ; j<jpos; j+=SIMDSIZE ) {
1291 A.store( element->index(), j, A.load(element->index(),j) * ( x1 * y.load(j) ) );
1292 }
1293 for( ; remainder && j<N; ++j ) {
1294 A(element->index(),j) *= element->value() * y[j];
1295 }
1296
1297 ++i;
1298 }
1299
1300 for( ; i<M; ++i ) {
1301 for( size_t j=0UL; j<N; ++j )
1302 reset( A(i,j) );
1303 }
1304 }
1306 //**********************************************************************************************
1307
1308 //**Schur product assignment to column-major dense matrices*************************************
1324 template< typename MT > // Type of the target dense matrix
1325 friend inline auto schurAssign( DenseMatrix<MT,true>& lhs, const SVecDVecOuterExpr& rhs )
1326 -> EnableIf_t< UseAssign_v<MT> >
1327 {
1329
1330 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1331 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1332
1333 LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
1334 RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1335
1336 BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1337 BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1338 BLAZE_INTERNAL_ASSERT( x.size() == (*lhs).rows() , "Invalid vector size" );
1339 BLAZE_INTERNAL_ASSERT( y.size() == (*lhs).columns(), "Invalid vector size" );
1340
1341 const auto end( x.end() );
1342
1343 for( size_t j=0UL; j<y.size(); ++j )
1344 {
1345 size_t i( 0UL );
1346
1347 for( auto element=x.begin(); element!=end; ++element, ++i ) {
1348 for( ; i<element->index(); ++i )
1349 reset( (*lhs)(i,j) );
1350 (*lhs)(element->index(),j) *= element->value() * y[j];
1351 }
1352
1353 for( ; i<x.size(); ++i ) {
1354 reset( (*lhs)(i,j) );
1355 }
1356 }
1357 }
1359 //**********************************************************************************************
1360
1361 //**Addition assignment to sparse matrices******************************************************
1362 // No special implementation for the addition assignment to sparse matrices.
1363 //**********************************************************************************************
1364
1365 //**Multiplication assignment to dense matrices*************************************************
1366 // No special implementation for the multiplication assignment to dense matrices.
1367 //**********************************************************************************************
1368
1369 //**Multiplication assignment to sparse matrices************************************************
1370 // No special implementation for the multiplication assignment to sparse matrices.
1371 //**********************************************************************************************
1372
1373 //**Compile time checks*************************************************************************
1382 //**********************************************************************************************
1383};
1384//*************************************************************************************************
1385
1386
1387
1388
1389//=================================================================================================
1390//
1391// GLOBAL BINARY ARITHMETIC OPERATORS
1392//
1393//=================================================================================================
1394
1395//*************************************************************************************************
1408template< typename VT1 // Type of the left-hand side sparse vector
1409 , typename VT2 // Type of the right-hand side dense vector
1410 , DisableIf_t< IsZero_v<VT1> >* = nullptr >
1411inline const SVecDVecOuterExpr<VT1,VT2>
1412 svecdvecouter( const SparseVector<VT1,false>& lhs, const DenseVector<VT2,true>& rhs )
1413{
1415
1416 return SVecDVecOuterExpr<VT1,VT2>( *lhs, *rhs );
1417}
1419//*************************************************************************************************
1420
1421
1422//*************************************************************************************************
1435template< typename VT1 // Type of the left-hand side dense vector
1436 , typename VT2 // Type of the right-hand side sparse vector
1437 , EnableIf_t< IsZero_v<VT1> >* = nullptr >
1438inline decltype(auto)
1439 svecdvecouter( const SparseVector<VT1,false>& lhs, const DenseVector<VT2,true>& rhs )
1440{
1442
1443 using ReturnType = const MultTrait_t< ResultType_t<VT1>, ResultType_t<VT2> >;
1444
1447
1448 return ReturnType( (*lhs).size(), (*rhs).size() );
1449}
1451//*************************************************************************************************
1452
1453
1454//*************************************************************************************************
1483template< typename VT1 // Type of the left-hand side sparse vector
1484 , typename VT2 > // Type of the right-hand side dense vector
1485inline decltype(auto)
1486 operator*( const SparseVector<VT1,false>& lhs, const DenseVector<VT2,true>& rhs )
1487{
1489
1490 return svecdvecouter( *lhs, *rhs );
1491}
1492//*************************************************************************************************
1493
1494
1495
1496
1497//=================================================================================================
1498//
1499// SIZE SPECIALIZATIONS
1500//
1501//=================================================================================================
1502
1503//*************************************************************************************************
1505template< typename VT1, typename VT2 >
1506struct Size< SVecDVecOuterExpr<VT1,VT2>, 0UL >
1507 : public Size<VT1,0UL>
1508{};
1509
1510template< typename VT1, typename VT2 >
1511struct Size< SVecDVecOuterExpr<VT1,VT2>, 1UL >
1512 : public Size<VT2,0UL>
1513{};
1515//*************************************************************************************************
1516
1517} // namespace blaze
1518
1519#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.
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the HasSIMDMult type trait.
Header file for the If class template.
Header file for the IsComputation type trait class.
Header file for the isDefault shim.
Header file for the IsExpression type trait class.
Header file for the IsPadded type trait.
Header file for the IsRowMajorMatrix 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.
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.
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
Iterator over the elements of the sparse vector-dense vector outer product expression.
Definition: SVecDVecOuterExpr.h:212
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecDVecOuterExpr.h:224
IteratorCategory iterator_category
The iterator category.
Definition: SVecDVecOuterExpr.h:231
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecDVecOuterExpr.h:326
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SVecDVecOuterExpr.h:216
RightElement v_
Element of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:334
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecDVecOuterExpr.h:304
ConstIterator_t< RemoveReference_t< LeftOperand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecDVecOuterExpr.h:219
IteratorType it_
Iterator over the elements of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:333
ConstIterator(IteratorType it, RightElement v)
Constructor for the ConstIterator class.
Definition: SVecDVecOuterExpr.h:241
Element ValueType
Type of the underlying pointers.
Definition: SVecDVecOuterExpr.h:225
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SVecDVecOuterExpr.h:263
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecDVecOuterExpr.h:315
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecDVecOuterExpr.h:228
ET2 RightElement
Element type of the dense vector expression.
Definition: SVecDVecOuterExpr.h:222
ValueType & ReferenceType
Reference return type.
Definition: SVecDVecOuterExpr.h:227
DifferenceType difference_type
Difference between two iterators.
Definition: SVecDVecOuterExpr.h:235
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecDVecOuterExpr.h:252
ValueType * PointerType
Pointer return type.
Definition: SVecDVecOuterExpr.h:226
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecDVecOuterExpr.h:283
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SVecDVecOuterExpr.h:273
size_t index() const
Access to the current index of the sparse element.
Definition: SVecDVecOuterExpr.h:293
Expression object for sparse vector-dense vector outer products.
Definition: SVecDVecOuterExpr.h:108
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:116
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of column i.
Definition: SVecDVecOuterExpr.h:412
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:118
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: SVecDVecOuterExpr.h:513
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SVecDVecOuterExpr.h:128
SVecDVecOuterExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the SVecDVecOuterExpr class.
Definition: SVecDVecOuterExpr.h:355
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of column i.
Definition: SVecDVecOuterExpr.h:401
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecDVecOuterExpr.h:503
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: SVecDVecOuterExpr.h:545
ElementType_t< VT1 > ET1
Element type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:117
CompositeType_t< VT1 > CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:115
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:190
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SVecDVecOuterExpr.h:187
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SVecDVecOuterExpr.h:492
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified column.
Definition: SVecDVecOuterExpr.h:453
If_t< IsComputation_v< VT2 >, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense vector operand.
Definition: SVecDVecOuterExpr.h:205
ResultType_t< VT1 > RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:111
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecDVecOuterExpr.h:537
If_t< IsComputation_v< VT1 >, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense vector operand.
Definition: SVecDVecOuterExpr.h:202
static constexpr bool useAssign
Compilation switch for the evaluation strategy of the multiplication expression.
Definition: SVecDVecOuterExpr.h:142
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:196
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:112
LeftOperand lhs_
Left-hand side sparse vector of the multiplication expression.
Definition: SVecDVecOuterExpr.h:544
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:184
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecDVecOuterExpr.h:525
ReturnType_t< VT1 > RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecDVecOuterExpr.h:113
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SVecDVecOuterExpr.h:185
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SVecDVecOuterExpr.h:368
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SVecDVecOuterExpr.h:442
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SVecDVecOuterExpr.h:466
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SVecDVecOuterExpr.h:479
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: SVecDVecOuterExpr.h:346
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:114
If_t< useAssign, const ResultType, const SVecDVecOuterExpr & > CompositeType
Data type for composite expression templates.
Definition: SVecDVecOuterExpr.h:193
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SVecDVecOuterExpr.h:422
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecDVecOuterExpr.h:186
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecDVecOuterExpr.h:341
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: SVecDVecOuterExpr.h:131
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecOuterExpr.h:199
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SVecDVecOuterExpr.h:384
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SVecDVecOuterExpr.h:432
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_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_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:61
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
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.