Blaze 3.9
SMatReduceExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_SMATREDUCEEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SMATREDUCEEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <blaze/math/Aliases.h>
70#include <blaze/util/Assert.h>
71#include <blaze/util/EnableIf.h>
73#include <blaze/util/mpl/If.h>
75#include <blaze/util/Types.h>
77
78
79namespace blaze {
80
81//=================================================================================================
82//
83// CLASS DEFINITION
84//
85//=================================================================================================
86
87//*************************************************************************************************
94template< typename MT // Type of the sparse matrix
95 , typename OP // Type of the reduction operation
96 , ReductionFlag RF > // Reduction flag
98{};
99//*************************************************************************************************
100
101
102
103
104//=================================================================================================
105//
106// CLASS TEMPLATE SPECIALIZATION FOR COLUMN-WISE REDUCTION OPERATIONS OF ROW-MAJOR MATRICES
107//
108//=================================================================================================
109
110//*************************************************************************************************
117template< typename MT // Type of the sparse matrix
118 , typename OP > // Type of the reduction operation
120 : public MatReduceExpr< DenseVector< SMatReduceExpr<MT,OP,columnwise>, true >, columnwise >
121 , private Computation
122{
123 private:
124 //**Type definitions****************************************************************************
128 //**********************************************************************************************
129
130 //**Parallel evaluation strategy****************************************************************
132
137 template< typename VT >
138 static constexpr bool UseSMPAssign_v = ( !MT::smpAssignable && RequiresEvaluation_v<MT> );
140 //**********************************************************************************************
141
142 public:
143 //**Type definitions****************************************************************************
146
149
154 using ReturnType = const ElementType;
155 using CompositeType = const ResultType;
156
158 using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
159
161 using Operation = OP;
162 //**********************************************************************************************
163
164 //**Compilation flags***************************************************************************
166 static constexpr bool simdEnabled = false;
167
169 static constexpr bool smpAssignable = MT::smpAssignable;
170 //**********************************************************************************************
171
172 //**Constructor*********************************************************************************
178 inline SMatReduceExpr( const MT& sm, OP op ) noexcept
179 : sm_( sm ) // Sparse matrix of the reduction expression
180 , op_( std::move(op) ) // The reduction operation
181 {}
182 //**********************************************************************************************
183
184 //**Subscript operator**************************************************************************
190 inline ReturnType operator[]( size_t index ) const {
191 BLAZE_INTERNAL_ASSERT( index < sm_.columns(), "Invalid vector access index" );
192 return reduce( column( sm_, index, unchecked ), op_ );
193 }
194 //**********************************************************************************************
195
196 //**At function*********************************************************************************
203 inline ReturnType at( size_t index ) const {
204 if( index >= sm_.columns() ) {
205 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
206 }
207 return (*this)[index];
208 }
209 //**********************************************************************************************
210
211 //**Size function*******************************************************************************
216 inline size_t size() const noexcept {
217 return sm_.columns();
218 }
219 //**********************************************************************************************
220
221 //**Operand access******************************************************************************
226 inline Operand operand() const noexcept {
227 return sm_;
228 }
229 //**********************************************************************************************
230
231 //**Operation access****************************************************************************
236 inline Operation operation() const {
237 return op_;
238 }
239 //**********************************************************************************************
240
241 //**********************************************************************************************
247 template< typename T >
248 inline bool canAlias( const T* alias ) const noexcept {
249 return ( sm_.isAliased( alias ) );
250 }
251 //**********************************************************************************************
252
253 //**********************************************************************************************
259 template< typename T >
260 inline bool isAliased( const T* alias ) const noexcept {
261 return ( sm_.isAliased( alias ) );
262 }
263 //**********************************************************************************************
264
265 //**********************************************************************************************
270 inline bool isAligned() const noexcept {
271 return false;
272 }
273 //**********************************************************************************************
274
275 //**********************************************************************************************
280 inline bool canSMPAssign() const noexcept {
281 return sm_.canSMPAssign() || ( size() > SMP_SMATREDUCE_THRESHOLD );
282 }
283 //**********************************************************************************************
284
285 private:
286 //**Member variables****************************************************************************
289 //**********************************************************************************************
290
291 //**Assignment to dense vectors*****************************************************************
303 template< typename VT1 > // Type of the target dense vector
304 friend inline void assign( DenseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
305 {
307
311
312 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
313
314 const OT tmp( serial( rhs.sm_ ) );
315 assign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
316 }
318 //**********************************************************************************************
319
320 //**Assignment to sparse vectors****************************************************************
333 template< typename VT1 > // Type of the target dense vector
334 friend inline void assign( SparseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
335 {
337
341
342 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
343
344 const ResultType tmp( serial( rhs ) );
345 assign( *lhs, tmp );
346 }
348 //**********************************************************************************************
349
350 //**Addition assignment to dense vectors********************************************************
363 template< typename VT1 > // Type of the target dense vector
364 friend inline void addAssign( DenseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
365 {
367
371
372 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
373
374 const OT tmp( serial( rhs.sm_ ) );
375 addAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
376 }
378 //**********************************************************************************************
379
380 //**Addition assignment to sparse vectors*******************************************************
393 template< typename VT1 > // Type of the target dense vector
394 friend inline void addAssign( SparseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
395 {
397
401
402 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
403
404 const ResultType tmp( serial( rhs ) );
405 addAssign( *lhs, tmp );
406 }
408 //**********************************************************************************************
409
410 //**Subtraction assignment to dense vectors*****************************************************
423 template< typename VT1 > // Type of the target dense vector
424 friend inline void subAssign( DenseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
425 {
427
431
432 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
433
434 const OT tmp( serial( rhs.sm_ ) );
435 subAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
436 }
438 //**********************************************************************************************
439
440 //**Subtraction assignment to sparse vectors****************************************************
453 template< typename VT1 > // Type of the target dense vector
454 friend inline void subAssign( SparseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
455 {
457
461
462 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
463
464 const ResultType tmp( serial( rhs ) );
465 subAssign( *lhs, tmp );
466 }
468 //**********************************************************************************************
469
470 //**Multiplication assignment to dense vectors**************************************************
483 template< typename VT1 > // Type of the target dense vector
484 friend inline void multAssign( DenseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
485 {
487
491
492 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
493
494 const OT tmp( serial( rhs.sm_ ) );
495 multAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
496 }
498 //**********************************************************************************************
499
500 //**Multiplication assignment to sparse vectors*************************************************
513 template< typename VT1 > // Type of the target dense vector
514 friend inline void multAssign( SparseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
515 {
517
521
522 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
523
524 const ResultType tmp( serial( rhs ) );
525 multAssign( *lhs, tmp );
526 }
528 //**********************************************************************************************
529
530 //**Division assignment to dense vectors********************************************************
543 template< typename VT1 > // Type of the target dense vector
544 friend inline void divAssign( DenseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
545 {
547
551
552 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
553
554 const OT tmp( serial( rhs.sm_ ) );
555 divAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
556 }
558 //**********************************************************************************************
559
560 //**Division assignment to sparse vectors*******************************************************
573 template< typename VT1 > // Type of the target dense vector
574 friend inline void divAssign( SparseVector<VT1,true>& lhs, const SMatReduceExpr& rhs )
575 {
577
581
582 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
583
584 const ResultType tmp( serial( rhs ) );
585 divAssign( *lhs, tmp );
586 }
588 //**********************************************************************************************
589
590 //**SMP assignment to vectors*******************************************************************
604 template< typename VT1 > // Type of the target vector
605 friend inline auto smpAssign( Vector<VT1,true>& lhs, const SMatReduceExpr& rhs )
606 -> EnableIf_t< UseSMPAssign_v<VT1> >
607 {
609
610 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
611
612 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
613 smpAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
614 }
616 //**********************************************************************************************
617
618 //**SMP addition assignment to vectors**********************************************************
633 template< typename VT1 > // Type of the target vector
634 friend inline auto smpAddAssign( Vector<VT1,true>& lhs, const SMatReduceExpr& rhs )
635 -> EnableIf_t< UseSMPAssign_v<VT1> >
636 {
638
639 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
640
641 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
642 smpAddAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
643 }
645 //**********************************************************************************************
646
647 //**SMP subtraction assignment to vectors*******************************************************
662 template< typename VT1 > // Type of the target vector
663 friend inline auto smpSubAssign( Vector<VT1,true>& lhs, const SMatReduceExpr& rhs )
664 -> EnableIf_t< UseSMPAssign_v<VT1> >
665 {
667
668 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
669
670 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
671 smpSubAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
672 }
674 //**********************************************************************************************
675
676 //**SMP multiplication assignment to vectors****************************************************
691 template< typename VT1 > // Type of the target vector
692 friend inline auto smpMultAssign( Vector<VT1,true>& lhs, const SMatReduceExpr& rhs )
693 -> EnableIf_t< UseSMPAssign_v<VT1> >
694 {
696
697 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
698
699 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
700 smpMultAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
701 }
703 //**********************************************************************************************
704
705 //**SMP division assignment to vectors**********************************************************
720 template< typename VT1 > // Type of the target vector
721 friend inline auto smpDivAssign( Vector<VT1,true>& lhs, const SMatReduceExpr& rhs )
722 -> EnableIf_t< UseSMPAssign_v<VT1> >
723 {
725
726 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
727
728 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
729 smpDivAssign( *lhs, reduce<columnwise>( tmp, rhs.op_ ) );
730 }
732 //**********************************************************************************************
733
734 //**Compile time checks*************************************************************************
739 //**********************************************************************************************
740};
741//*************************************************************************************************
742
743
744
745
746//=================================================================================================
747//
748// CLASS TEMPLATE SPECIALIZATION FOR ROW-WISE REDUCTION OPERATIONS OF ROW-MAJOR MATRICES
749//
750//=================================================================================================
751
752//*************************************************************************************************
759template< typename MT // Type of the sparse matrix
760 , typename OP > // Type of the reduction operation
762 : public MatReduceExpr< DenseVector< SMatReduceExpr<MT,OP,rowwise>, false >, rowwise >
763 , private Computation
764{
765 private:
766 //**Type definitions****************************************************************************
768 //**********************************************************************************************
769
770 //**Serial evaluation strategy******************************************************************
772
778 static constexpr bool useAssign = RequiresEvaluation_v<MT>;
779
782 template< typename VT >
783 static constexpr bool UseAssign_v = useAssign;
785 //**********************************************************************************************
786
787 //**Parallel evaluation strategy****************************************************************
789
794 template< typename VT >
795 static constexpr bool UseSMPAssign_v = ( !MT::smpAssignable && useAssign );
797 //**********************************************************************************************
798
799 public:
800 //**Type definitions****************************************************************************
803
806
811 using ReturnType = const ElementType;
812
815
817 using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
818
820 using Operation = OP;
821 //**********************************************************************************************
822
823 //**ConstIterator class definition**************************************************************
826 class ConstIterator
827 {
828 public:
829 //**Type definitions*************************************************************************
830 using IteratorCategory = std::random_access_iterator_tag;
834 using DifferenceType = ptrdiff_t;
835
836 // STL iterator requirements
842 //*******************************************************************************************
843
844 //**Constructor******************************************************************************
851 inline ConstIterator( Operand sm, size_t index, OP op )
852 : sm_ ( sm ) // Sparse matrix of the reduction expression
853 , index_( index ) // Index to the current matrix row
854 , op_ ( std::move(op) ) // The reduction operation
855 {}
856 //*******************************************************************************************
857
858 //**Addition assignment operator*************************************************************
864 inline ConstIterator& operator+=( size_t inc ) {
865 index_ += inc;
866 return *this;
867 }
868 //*******************************************************************************************
869
870 //**Subtraction assignment operator**********************************************************
876 inline ConstIterator& operator-=( size_t dec ) {
877 index_ -= dec;
878 return *this;
879 }
880 //*******************************************************************************************
881
882 //**Prefix increment operator****************************************************************
887 inline ConstIterator& operator++() {
888 ++index_;
889 return *this;
890 }
891 //*******************************************************************************************
892
893 //**Postfix increment operator***************************************************************
898 inline const ConstIterator operator++( int ) {
899 return ConstIterator( index_++ );
900 }
901 //*******************************************************************************************
902
903 //**Prefix decrement operator****************************************************************
908 inline ConstIterator& operator--() {
909 --index_;
910 return *this;
911 }
912 //*******************************************************************************************
913
914 //**Postfix decrement operator***************************************************************
919 inline const ConstIterator operator--( int ) {
920 return ConstIterator( index_-- );
921 }
922 //*******************************************************************************************
923
924 //**Element access operator******************************************************************
929 inline ReturnType operator*() const {
930 return reduce( row( sm_, index_, unchecked ), op_ );
931 }
932 //*******************************************************************************************
933
934 //**Equality operator************************************************************************
940 inline bool operator==( const ConstIterator& rhs ) const {
941 return index_ == rhs.index_;
942 }
943 //*******************************************************************************************
944
945 //**Inequality operator**********************************************************************
951 inline bool operator!=( const ConstIterator& rhs ) const {
952 return index_ != rhs.index_;
953 }
954 //*******************************************************************************************
955
956 //**Less-than operator***********************************************************************
962 inline bool operator<( const ConstIterator& rhs ) const {
963 return index_ < rhs.index_;
964 }
965 //*******************************************************************************************
966
967 //**Greater-than operator********************************************************************
973 inline bool operator>( const ConstIterator& rhs ) const {
974 return index_ > rhs.index_;
975 }
976 //*******************************************************************************************
977
978 //**Less-or-equal-than operator**************************************************************
984 inline bool operator<=( const ConstIterator& rhs ) const {
985 return index_ <= rhs.index_;
986 }
987 //*******************************************************************************************
988
989 //**Greater-or-equal-than operator***********************************************************
995 inline bool operator>=( const ConstIterator& rhs ) const {
996 return index_ >= rhs.index_;
997 }
998 //*******************************************************************************************
999
1000 //**Subtraction operator*********************************************************************
1006 inline DifferenceType operator-( const ConstIterator& rhs ) const {
1007 return index_ - rhs.index_;
1008 }
1009 //*******************************************************************************************
1010
1011 //**Addition operator************************************************************************
1018 friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
1019 return ConstIterator( it.index_ + inc );
1020 }
1021 //*******************************************************************************************
1022
1023 //**Addition operator************************************************************************
1030 friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
1031 return ConstIterator( it.index_ + inc );
1032 }
1033 //*******************************************************************************************
1034
1035 //**Subtraction operator*********************************************************************
1042 friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
1043 return ConstIterator( it.index_ - dec );
1044 }
1045 //*******************************************************************************************
1046
1047 private:
1048 //**Member variables*************************************************************************
1050 size_t index_;
1051 OP op_;
1052 //*******************************************************************************************
1053 };
1054 //**********************************************************************************************
1055
1056 //**Compilation flags***************************************************************************
1058 static constexpr bool simdEnabled = false;
1059
1061 static constexpr bool smpAssignable = MT::smpAssignable;
1062 //**********************************************************************************************
1063
1064 //**Constructor*********************************************************************************
1070 inline SMatReduceExpr( const MT& sm, OP op ) noexcept
1071 : sm_( sm ) // Sparse matrix of the reduction expression
1072 , op_( std::move(op) ) // The reduction operation
1073 {}
1074 //**********************************************************************************************
1075
1076 //**Subscript operator**************************************************************************
1082 inline ReturnType operator[]( size_t index ) const {
1083 BLAZE_INTERNAL_ASSERT( index < sm_.rows(), "Invalid vector access index" );
1084 return reduce( row( sm_, index, unchecked ), op_ );
1085 }
1086 //**********************************************************************************************
1087
1088 //**At function*********************************************************************************
1095 inline ReturnType at( size_t index ) const {
1096 if( index >= sm_.rows() ) {
1097 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
1098 }
1099 return (*this)[index];
1100 }
1101 //**********************************************************************************************
1102
1103 //**Begin function******************************************************************************
1108 inline ConstIterator begin() const {
1109 return ConstIterator( sm_, 0UL, op_ );
1110 }
1111 //**********************************************************************************************
1112
1113 //**End function********************************************************************************
1118 inline ConstIterator end() const {
1119 return ConstIterator( sm_, size(), op_ );
1120 }
1121 //**********************************************************************************************
1122
1123 //**Size function*******************************************************************************
1128 inline size_t size() const noexcept {
1129 return sm_.rows();
1130 }
1131 //**********************************************************************************************
1132
1133 //**Operand access******************************************************************************
1138 inline Operand operand() const noexcept {
1139 return sm_;
1140 }
1141 //**********************************************************************************************
1142
1143 //**Operation access****************************************************************************
1148 inline Operation operation() const {
1149 return op_;
1150 }
1151 //**********************************************************************************************
1152
1153 //**********************************************************************************************
1159 template< typename T >
1160 inline bool canAlias( const T* alias ) const noexcept {
1161 return ( sm_.isAliased( alias ) );
1162 }
1163 //**********************************************************************************************
1164
1165 //**********************************************************************************************
1171 template< typename T >
1172 inline bool isAliased( const T* alias ) const noexcept {
1173 return ( sm_.isAliased( alias ) );
1174 }
1175 //**********************************************************************************************
1176
1177 //**********************************************************************************************
1182 inline bool isAligned() const noexcept {
1183 return false;
1184 }
1185 //**********************************************************************************************
1186
1187 //**********************************************************************************************
1192 inline bool canSMPAssign() const noexcept {
1193 return sm_.canSMPAssign() || ( size() > SMP_SMATREDUCE_THRESHOLD );
1194 }
1195 //**********************************************************************************************
1196
1197 private:
1198 //**Member variables****************************************************************************
1201 //**********************************************************************************************
1202
1203 //**Assignment to vectors***********************************************************************
1217 template< typename VT1 > // Type of the target vector
1218 friend inline auto assign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1220 {
1222
1223 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1224
1225 const RT tmp( serial( rhs.sm_ ) ); // Evaluation of the sparse matrix operand
1226 assign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1227 }
1229 //**********************************************************************************************
1230
1231 //**Addition assignment to vectors**************************************************************
1245 template< typename VT1 > // Type of the target vector
1246 friend inline auto addAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1248 {
1250
1251 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1252
1253 const RT tmp( serial( rhs.sm_ ) ); // Evaluation of the sparse matrix operand
1254 addAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1255 }
1257 //**********************************************************************************************
1258
1259 //**Subtraction assignment to vectors***********************************************************
1274 template< typename VT1 > // Type of the target vector
1275 friend inline auto subAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1276 -> EnableIf_t< UseAssign_v<VT1> >
1277 {
1279
1280 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1281
1282 const RT tmp( serial( rhs.sm_ ) ); // Evaluation of the sparse matrix operand
1283 subAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1284 }
1286 //**********************************************************************************************
1287
1288 //**Multiplication assignment to vectors********************************************************
1303 template< typename VT1 > // Type of the target vector
1304 friend inline auto multAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1305 -> EnableIf_t< UseAssign_v<VT1> >
1306 {
1308
1309 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1310
1311 const RT tmp( serial( rhs.sm_ ) ); // Evaluation of the sparse matrix operand
1312 multAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1313 }
1315 //**********************************************************************************************
1316
1317 //**Division assignment to vectors**************************************************************
1331 template< typename VT1 > // Type of the target vector
1332 friend inline auto divAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1333 -> EnableIf_t< UseAssign_v<VT1> >
1334 {
1336
1337 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1338
1339 const RT tmp( serial( rhs.sm_ ) ); // Evaluation of the sparse matrix operand
1340 divAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1341 }
1343 //**********************************************************************************************
1344
1345 //**SMP assignment to vectors*******************************************************************
1359 template< typename VT1 > // Type of the target vector
1360 friend inline auto smpAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1361 -> EnableIf_t< UseSMPAssign_v<VT1> >
1362 {
1364
1365 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1366
1367 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
1368 smpAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1369 }
1371 //**********************************************************************************************
1372
1373 //**SMP addition assignment to vectors**********************************************************
1388 template< typename VT1 > // Type of the target vector
1389 friend inline auto smpAddAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1390 -> EnableIf_t< UseSMPAssign_v<VT1> >
1391 {
1393
1394 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1395
1396 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
1397 smpAddAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1398 }
1400 //**********************************************************************************************
1401
1402 //**SMP subtraction assignment to vectors*******************************************************
1417 template< typename VT1 > // Type of the target vector
1418 friend inline auto smpSubAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1419 -> EnableIf_t< UseSMPAssign_v<VT1> >
1420 {
1422
1423 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1424
1425 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
1426 smpSubAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1427 }
1429 //**********************************************************************************************
1430
1431 //**SMP multiplication assignment to vectors****************************************************
1446 template< typename VT1 > // Type of the target vector
1447 friend inline auto smpMultAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1448 -> EnableIf_t< UseSMPAssign_v<VT1> >
1449 {
1451
1452 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1453
1454 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
1455 smpMultAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1456 }
1458 //**********************************************************************************************
1459
1460 //**SMP division assignment to vectors**********************************************************
1475 template< typename VT1 > // Type of the target vector
1476 friend inline auto smpDivAssign( Vector<VT1,false>& lhs, const SMatReduceExpr& rhs )
1477 -> EnableIf_t< UseSMPAssign_v<VT1> >
1478 {
1480
1481 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1482
1483 const RT tmp( rhs.sm_ ); // Evaluation of the sparse matrix operand
1484 smpDivAssign( *lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1485 }
1487 //**********************************************************************************************
1488
1489 //**Compile time checks*************************************************************************
1494 //**********************************************************************************************
1495};
1496//*************************************************************************************************
1497
1498
1499
1500
1501//=================================================================================================
1502//
1503// GLOBAL FUNCTIONS
1504//
1505//=================================================================================================
1506
1507//*************************************************************************************************
1534template< typename MT // Type of the sparse matrix
1535 , bool SO // Storage order
1536 , typename OP > // Type of the reduction operation
1537inline decltype(auto) reduce( const SparseMatrix<MT,SO>& sm, OP op )
1538{
1540
1541 using CT = CompositeType_t<MT>;
1543
1544 const size_t M( (*sm).rows() );
1545 const size_t N( (*sm).columns() );
1546
1547 if( M == 0UL || N == 0UL ) return RT{};
1548
1549 const size_t iend( SO ? N : M );
1550
1551 CT tmp( *sm );
1552
1553 BLAZE_INTERNAL_ASSERT( tmp.rows() == M, "Invalid number of rows" );
1554 BLAZE_INTERNAL_ASSERT( tmp.columns() == N, "Invalid number of columns" );
1555
1556 RT redux0{};
1557
1558 for( size_t i=0UL; i<iend; ++i )
1559 {
1560 const auto end( tmp.end(i) );
1561 auto element( tmp.begin(i) );
1562
1563 if( element == end ) continue;
1564
1565 RT redux1( element->value() );
1566 ++element;
1567
1568 for( ; element!=end; ++element ) {
1569 redux1 = op( redux1, element->value() );
1570 }
1571
1572 if( i == 0UL ) redux0 = redux1;
1573 else redux0 = op( redux0, redux1 );
1574 }
1575
1576 return redux0;
1577}
1578//*************************************************************************************************
1579
1580
1581//*************************************************************************************************
1590template< ReductionFlag RF // Reduction flag
1591 , typename MT // Type of the sparse matrix
1592 , typename OP > // Type of the reduction operation
1593inline const SMatReduceExpr<MT,OP,RF> reduce_backend( const SparseMatrix<MT,false>& sm, OP op )
1594{
1595 using ReturnType = const SMatReduceExpr<MT,OP,RF>;
1596 return ReturnType( *sm, std::move(op) );
1597}
1599//*************************************************************************************************
1600
1601
1602//*************************************************************************************************
1611template< ReductionFlag RF // Reduction flag
1612 , typename MT // Type of the sparse matrix
1613 , typename OP > // Type of the reduction operation
1614inline decltype(auto) reduce_backend( const SparseMatrix<MT,true>& sm, OP op )
1615{
1616 constexpr ReductionFlag RF2( RF == rowwise ? columnwise : rowwise );
1617 return trans( reduce<RF2>( trans( *sm ), std::move(op) ) );
1618}
1620//*************************************************************************************************
1621
1622
1623//*************************************************************************************************
1663template< ReductionFlag RF // Reduction flag
1664 , typename MT // Type of the sparse matrix
1665 , bool SO // Storage order
1666 , typename OP > // Type of the reduction operation
1667inline decltype(auto) reduce( const SparseMatrix<MT,SO>& sm, OP op )
1668{
1670
1671 BLAZE_STATIC_ASSERT_MSG( RF < 2UL, "Invalid reduction flag" );
1672
1673 return reduce_backend<RF>( *sm, std::move(op) );
1674}
1675//*************************************************************************************************
1676
1677
1678//*************************************************************************************************
1696template< typename MT // Type of the sparse matrix
1697 , bool SO > // Storage order
1698inline decltype(auto) sum( const SparseMatrix<MT,SO>& sm )
1699{
1701
1702 return reduce( *sm, Add() );
1703}
1704//*************************************************************************************************
1705
1706
1707//*************************************************************************************************
1740template< ReductionFlag RF // Reduction flag
1741 , typename MT // Type of the sparse matrix
1742 , bool SO > // Storage order
1743inline decltype(auto) sum( const SparseMatrix<MT,SO>& sm )
1744{
1746
1747 return reduce<RF>( *sm, Add() );
1748}
1749//*************************************************************************************************
1750
1751
1752//*************************************************************************************************
1770template< typename MT // Type of the sparse matrix
1771 , bool SO > // Storage order
1772inline decltype(auto) prod( const SparseMatrix<MT,SO>& sm )
1773{
1775
1776 return reduce( *sm, Mult() );
1777}
1778//*************************************************************************************************
1779
1780
1781//*************************************************************************************************
1814template< ReductionFlag RF // Reduction flag
1815 , typename MT // Type of the sparse matrix
1816 , bool SO > // Storage order
1817inline decltype(auto) prod( const SparseMatrix<MT,SO>& sm )
1818{
1820
1821 return reduce<RF>( *sm, Mult() );
1822}
1823//*************************************************************************************************
1824
1825
1826//*************************************************************************************************
1848template< typename MT // Type of the sparse matrix
1849 , bool SO > // Storage order
1850inline decltype(auto) min( const SparseMatrix<MT,SO>& sm )
1851{
1853
1854 return reduce( *sm, Min() );
1855}
1856//*************************************************************************************************
1857
1858
1859//*************************************************************************************************
1892template< ReductionFlag RF // Reduction flag
1893 , typename MT // Type of the sparse matrix
1894 , bool SO > // Storage order
1895inline decltype(auto) min( const SparseMatrix<MT,SO>& sm )
1896{
1898
1899 return reduce<RF>( *sm, Min() );
1900}
1901//*************************************************************************************************
1902
1903
1904//*************************************************************************************************
1926template< typename MT // Type of the sparse matrix
1927 , bool SO > // Storage order
1928inline decltype(auto) max( const SparseMatrix<MT,SO>& sm )
1929{
1931
1932 return reduce( *sm, Max() );
1933}
1934//*************************************************************************************************
1935
1936
1937//*************************************************************************************************
1970template< ReductionFlag RF // Reduction flag
1971 , typename MT // Type of the sparse matrix
1972 , bool SO > // Storage order
1973inline decltype(auto) max( const SparseMatrix<MT,SO>& sm )
1974{
1976
1977 return reduce<RF>( *sm, Max() );
1978}
1979//*************************************************************************************************
1980
1981} // namespace blaze
1982
1983#endif
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition: Aliases.h:310
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the HasMember type traits.
Header file for the If class template.
Header file for the IsExpression type trait class.
Deactivation of problematic macros.
Header file for the reduce trait.
Header file for the reduction flags.
constexpr ReductionFlag columnwise
Reduction flag for column-wise reduction operations.
Definition: ReductionFlag.h:97
constexpr ReductionFlag rowwise
Reduction flag for row-wise reduction operations.
Definition: ReductionFlag.h:77
size_t ReductionFlag
Type of the reduction flags.
Definition: ReductionFlag.h:57
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
Compile time assertion.
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Expression object for column-wise row-major sparse matrix reduction operations.
Definition: SMatReduceExpr.h:122
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatReduceExpr.h:151
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatReduceExpr.h:226
SMatReduceExpr(const MT &sm, OP op) noexcept
Constructor for the SMatReduceExpr class.
Definition: SMatReduceExpr.h:178
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatReduceExpr.h:158
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatReduceExpr.h:260
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SMatReduceExpr.h:216
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatReduceExpr.h:154
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SMatReduceExpr.h:203
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatReduceExpr.h:248
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatReduceExpr.h:152
ReduceTrait_t< RT, OP, columnwise > ResultType
Result type for expression template evaluations.
Definition: SMatReduceExpr.h:150
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatReduceExpr.h:280
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatReduceExpr.h:125
Operand sm_
Sparse matrix of the reduction expression.
Definition: SMatReduceExpr.h:287
OP Operation
Data type of the custom unary operation.
Definition: SMatReduceExpr.h:161
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: SMatReduceExpr.h:270
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatReduceExpr.h:155
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SMatReduceExpr.h:190
Operation op_
The reduction operation.
Definition: SMatReduceExpr.h:288
SIMDTrait_t< ElementType > SIMDType
Resulting SIMD element type.
Definition: SMatReduceExpr.h:153
OppositeType_t< MT > OT
Opposite type of the sparse matrix expression.
Definition: SMatReduceExpr.h:126
Operation operation() const
Returns a copy of the reduction operation.
Definition: SMatReduceExpr.h:236
CompositeType_t< MT > CT
Composite type of the sparse matrix expression.
Definition: SMatReduceExpr.h:127
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: SMatReduceExpr.h:830
PointerType pointer
Pointer return type.
Definition: SMatReduceExpr.h:839
DifferenceType difference_type
Difference between two iterators.
Definition: SMatReduceExpr.h:841
ElementType ValueType
Type of the underlying elements.
Definition: SMatReduceExpr.h:831
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatReduceExpr.h:887
ElementType * PointerType
Pointer return type.
Definition: SMatReduceExpr.h:832
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatReduceExpr.h:834
ValueType value_type
Type of the underlying elements.
Definition: SMatReduceExpr.h:838
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: SMatReduceExpr.h:876
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: SMatReduceExpr.h:1018
size_t index_
Index to the current matrix row.
Definition: SMatReduceExpr.h:1050
OP op_
The reduction operation.
Definition: SMatReduceExpr.h:1051
IteratorCategory iterator_category
The iterator category.
Definition: SMatReduceExpr.h:837
ConstIterator(Operand sm, size_t index, OP op)
Constructor for the ConstIterator class.
Definition: SMatReduceExpr.h:851
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: SMatReduceExpr.h:1042
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: SMatReduceExpr.h:929
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: SMatReduceExpr.h:973
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: SMatReduceExpr.h:962
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: SMatReduceExpr.h:1030
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: SMatReduceExpr.h:995
ConstIterator & operator--()
Pre-decrement operator.
Definition: SMatReduceExpr.h:908
ReferenceType reference
Reference return type.
Definition: SMatReduceExpr.h:840
const ConstIterator operator++(int)
Post-increment operator.
Definition: SMatReduceExpr.h:898
Operand sm_
Sparse matrix of the reduction expression.
Definition: SMatReduceExpr.h:1049
const ConstIterator operator--(int)
Post-decrement operator.
Definition: SMatReduceExpr.h:919
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: SMatReduceExpr.h:984
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatReduceExpr.h:951
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: SMatReduceExpr.h:1006
ElementType & ReferenceType
Reference return type.
Definition: SMatReduceExpr.h:833
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: SMatReduceExpr.h:864
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatReduceExpr.h:940
Expression object for row-wise row-major sparse matrix reduction operations.
Definition: SMatReduceExpr.h:764
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatReduceExpr.h:808
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatReduceExpr.h:1192
If_t< useAssign, const ResultType, const SMatReduceExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatReduceExpr.h:814
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SMatReduceExpr.h:1128
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: SMatReduceExpr.h:1108
Operation op_
The reduction operation.
Definition: SMatReduceExpr.h:1200
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: SMatReduceExpr.h:1182
Operation operation() const
Returns a copy of the reduction operation.
Definition: SMatReduceExpr.h:1148
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatReduceExpr.h:817
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatReduceExpr.h:809
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SMatReduceExpr.h:1082
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatReduceExpr.h:767
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatReduceExpr.h:1138
SMatReduceExpr(const MT &sm, OP op) noexcept
Constructor for the SMatReduceExpr class.
Definition: SMatReduceExpr.h:1070
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: SMatReduceExpr.h:1118
ReduceTrait_t< RT, OP, rowwise > ResultType
Result type for expression template evaluations.
Definition: SMatReduceExpr.h:807
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatReduceExpr.h:1160
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatReduceExpr.h:1172
SIMDTrait_t< ElementType > SIMDType
Resulting SIMD element type.
Definition: SMatReduceExpr.h:810
Operand sm_
Sparse matrix of the reduction expression.
Definition: SMatReduceExpr.h:1199
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatReduceExpr.h:811
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SMatReduceExpr.h:1095
OP Operation
Data type of the custom unary operation.
Definition: SMatReduceExpr.h:820
Base template for row-major sparse matrix partial reduction operations.
Definition: SMatReduceExpr.h:98
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Base class for sparse vectors.
Definition: SparseVector.h:72
Base class for N-dimensional vectors.
Definition: Vector.h:82
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseVector base class.
Header file for the MatReduceExpr base class.
Header file for the SparseMatrix base class.
Header file for the Add functor.
Header file for the Mult functor.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
decltype(auto) reduce(const DenseMatrix< MT, SO > &dm, OP op)
Performs a custom reduction operation on the given dense matrix.
Definition: DMatReduceExpr.h:2025
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
#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_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.
Definition: RowVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.h:61
typename ReduceTrait< T, OP, RF... >::Type ReduceTrait_t
Auxiliary alias declaration for the ReduceTrait class template.
Definition: ReduceTrait.h:150
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:584
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.
Definition: SIMDTrait.h:315
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:221
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:192
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
decltype(auto) max(const SparseMatrix< MT, SO > &sm)
Returns the largest element of each row/columns of the sparse matrix.
Definition: SMatReduceExpr.h:1973
decltype(auto) prod(const SparseMatrix< MT, SO > &sm)
Reduces the given sparse matrix by means of multiplication.
Definition: SMatReduceExpr.h:1817
decltype(auto) min(const SparseMatrix< MT, SO > &sm)
Returns the smallest element of each row/columns of the sparse matrix.
Definition: SMatReduceExpr.h:1895
decltype(auto) sum(const SparseMatrix< MT, SO > &sm)
Reduces the given sparse matrix by means of addition.
Definition: SMatReduceExpr.h:1743
#define BLAZE_STATIC_ASSERT_MSG(expr, msg)
Compile time assertion macro.
Definition: StaticAssert.h:123
typename RemoveCV< T >::Type RemoveCV_t
Auxiliary alias declaration for the RemoveCV type trait.
Definition: RemoveCV.h:97
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
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
constexpr Unchecked unchecked
Global Unchecked instance.
Definition: Check.h:146
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
Header file for the Max functor.
Header file for the Min functor.
Header file for the serial shim.
Generic wrapper for the addition operator.
Definition: Add.h:85
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all matrix reduction expression templates.
Definition: MatReduceExpr.h:70
Generic wrapper for the max() function.
Definition: Max.h:82
Generic wrapper for the min() function.
Definition: Min.h:82
Generic wrapper for the multiplication operator.
Definition: Mult.h:82
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.