Blaze 3.9
DMatDMatAddExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATADDEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATDMATADDEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
45#include <blaze/math/Aliases.h>
56#include <blaze/math/SIMD.h>
66#include <blaze/system/Inline.h>
68#include <blaze/util/Assert.h>
69#include <blaze/util/EnableIf.h>
72#include <blaze/util/mpl/If.h>
73#include <blaze/util/Types.h>
74
75
76namespace blaze {
77
78//=================================================================================================
79//
80// CLASS DMATDMATADDEXPR
81//
82//=================================================================================================
83
84//*************************************************************************************************
91template< typename MT1 // Type of the left-hand side dense matrix
92 , typename MT2 // Type of the right-hand side dense matrix
93 , bool SO > // Storage order
95 : public MatMatAddExpr< DenseMatrix< DMatDMatAddExpr<MT1,MT2,SO>, SO > >
96 , private Computation
97{
98 private:
99 //**Type definitions****************************************************************************
108 //**********************************************************************************************
109
110 //**Return type evaluation**********************************************************************
112
117 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
118
120 using ExprReturnType = decltype( std::declval<RN1>() + std::declval<RN2>() );
121 //**********************************************************************************************
122
123 //**Serial evaluation strategy******************************************************************
125
131 static constexpr bool useAssign =
132 ( RequiresEvaluation_v<MT1> || RequiresEvaluation_v<MT2> || !returnExpr );
133
136 template< typename MT >
137 static constexpr bool UseAssign_v = useAssign;
139 //**********************************************************************************************
140
141 //**Parallel evaluation strategy****************************************************************
143
149 template< typename MT >
150 static constexpr bool UseSMPAssign_v =
151 ( ( !MT1::smpAssignable || !MT2::smpAssignable ) && useAssign );
153 //**********************************************************************************************
154
155 public:
156 //**Type definitions****************************************************************************
159
162
167
170
173
175 using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
176
178 using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
179 //**********************************************************************************************
180
181 //**ConstIterator class definition**************************************************************
185 {
186 public:
187 //**Type definitions*************************************************************************
188 using IteratorCategory = std::random_access_iterator_tag;
192 using DifferenceType = ptrdiff_t;
193
194 // STL iterator requirements
200
203
206 //*******************************************************************************************
207
208 //**Constructor******************************************************************************
215 : left_ ( left ) // Iterator to the current left-hand side element
216 , right_( right ) // Iterator to the current right-hand side element
217 {}
218 //*******************************************************************************************
219
220 //**Addition assignment operator*************************************************************
227 left_ += inc;
228 right_ += inc;
229 return *this;
230 }
231 //*******************************************************************************************
232
233 //**Subtraction assignment operator**********************************************************
240 left_ -= dec;
241 right_ -= dec;
242 return *this;
243 }
244 //*******************************************************************************************
245
246 //**Prefix increment operator****************************************************************
252 ++left_;
253 ++right_;
254 return *this;
255 }
256 //*******************************************************************************************
257
258 //**Postfix increment operator***************************************************************
264 return ConstIterator( left_++, right_++ );
265 }
266 //*******************************************************************************************
267
268 //**Prefix decrement operator****************************************************************
274 --left_;
275 --right_;
276 return *this;
277 }
278 //*******************************************************************************************
279
280 //**Postfix decrement operator***************************************************************
286 return ConstIterator( left_--, right_-- );
287 }
288 //*******************************************************************************************
289
290 //**Element access operator******************************************************************
296 return (*left_) + (*right_);
297 }
298 //*******************************************************************************************
299
300 //**Load function****************************************************************************
305 inline auto load() const noexcept {
306 return left_.load() + right_.load();
307 }
308 //*******************************************************************************************
309
310 //**Equality operator************************************************************************
316 inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
317 return left_ == rhs.left_;
318 }
319 //*******************************************************************************************
320
321 //**Inequality operator**********************************************************************
327 inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
328 return left_ != rhs.left_;
329 }
330 //*******************************************************************************************
331
332 //**Less-than operator***********************************************************************
338 inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
339 return left_ < rhs.left_;
340 }
341 //*******************************************************************************************
342
343 //**Greater-than operator********************************************************************
349 inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
350 return left_ > rhs.left_;
351 }
352 //*******************************************************************************************
353
354 //**Less-or-equal-than operator**************************************************************
360 inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
361 return left_ <= rhs.left_;
362 }
363 //*******************************************************************************************
364
365 //**Greater-or-equal-than operator***********************************************************
371 inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
372 return left_ >= rhs.left_;
373 }
374 //*******************************************************************************************
375
376 //**Subtraction operator*********************************************************************
383 return left_ - rhs.left_;
384 }
385 //*******************************************************************************************
386
387 //**Addition operator************************************************************************
394 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
395 return ConstIterator( it.left_ + inc, it.right_ + inc );
396 }
397 //*******************************************************************************************
398
399 //**Addition operator************************************************************************
406 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
407 return ConstIterator( it.left_ + inc, it.right_ + inc );
408 }
409 //*******************************************************************************************
410
411 //**Subtraction operator*********************************************************************
418 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
419 return ConstIterator( it.left_ - dec, it.right_ - dec );
420 }
421 //*******************************************************************************************
422
423 private:
424 //**Member variables*************************************************************************
427 //*******************************************************************************************
428 };
429 //**********************************************************************************************
430
431 //**Compilation flags***************************************************************************
433 static constexpr bool simdEnabled =
434 ( MT1::simdEnabled && MT2::simdEnabled && HasSIMDAdd_v<ET1,ET2> );
435
437 static constexpr bool smpAssignable = ( MT1::smpAssignable && MT2::smpAssignable );
438 //**********************************************************************************************
439
440 //**SIMD properties*****************************************************************************
442 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
443 //**********************************************************************************************
444
445 //**Constructor*********************************************************************************
451 inline DMatDMatAddExpr( const MT1& lhs, const MT2& rhs ) noexcept
452 : lhs_( lhs ) // Left-hand side dense matrix of the addition expression
453 , rhs_( rhs ) // Right-hand side dense matrix of the addition expression
454 {
455 BLAZE_INTERNAL_ASSERT( lhs.rows() == rhs.rows() , "Invalid number of rows" );
456 BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.columns(), "Invalid number of columns" );
457 }
458 //**********************************************************************************************
459
460 //**Access operator*****************************************************************************
467 inline ReturnType operator()( size_t i, size_t j ) const {
468 BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
469 BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
470 return lhs_(i,j) + rhs_(i,j);
471 }
472 //**********************************************************************************************
473
474 //**At function*********************************************************************************
482 inline ReturnType at( size_t i, size_t j ) const {
483 if( i >= lhs_.rows() ) {
484 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
485 }
486 if( j >= lhs_.columns() ) {
487 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
488 }
489 return (*this)(i,j);
490 }
491 //**********************************************************************************************
492
493 //**Load function*******************************************************************************
500 BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
501 BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
502 BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
503 BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
504 BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
505 return lhs_.load(i,j) + rhs_.load(i,j);
506 }
507 //**********************************************************************************************
508
509 //**Begin function******************************************************************************
515 inline ConstIterator begin( size_t i ) const {
516 return ConstIterator( lhs_.begin(i), rhs_.begin(i) );
517 }
518 //**********************************************************************************************
519
520 //**End function********************************************************************************
526 inline ConstIterator end( size_t i ) const {
527 return ConstIterator( lhs_.end(i), rhs_.end(i) );
528 }
529 //**********************************************************************************************
530
531 //**Rows function*******************************************************************************
536 inline size_t rows() const noexcept {
537 return lhs_.rows();
538 }
539 //**********************************************************************************************
540
541 //**Columns function****************************************************************************
546 inline size_t columns() const noexcept {
547 return lhs_.columns();
548 }
549 //**********************************************************************************************
550
551 //**Left operand access*************************************************************************
556 inline LeftOperand leftOperand() const noexcept {
557 return lhs_;
558 }
559 //**********************************************************************************************
560
561 //**Right operand access************************************************************************
566 inline RightOperand rightOperand() const noexcept {
567 return rhs_;
568 }
569 //**********************************************************************************************
570
571 //**********************************************************************************************
577 template< typename T >
578 inline bool canAlias( const T* alias ) const noexcept {
579 return ( IsExpression_v<MT1> && ( RequiresEvaluation_v<MT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
580 ( IsExpression_v<MT2> && ( RequiresEvaluation_v<MT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
581 }
582 //**********************************************************************************************
583
584 //**********************************************************************************************
590 template< typename T >
591 inline bool isAliased( const T* alias ) const noexcept {
592 return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
593 }
594 //**********************************************************************************************
595
596 //**********************************************************************************************
601 inline bool isAligned() const noexcept {
602 return lhs_.isAligned() && rhs_.isAligned();
603 }
604 //**********************************************************************************************
605
606 //**********************************************************************************************
611 inline bool canSMPAssign() const noexcept {
612 return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
613 ( rows() * columns() >= SMP_DMATDMATADD_THRESHOLD );
614 }
615 //**********************************************************************************************
616
617 private:
618 //**Member variables****************************************************************************
621 //**********************************************************************************************
622
623 //**Assignment to dense matrices****************************************************************
637 template< typename MT // Type of the target dense matrix
638 , bool SO2 > // Storage order of the target dense matrix
639 friend inline auto assign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
641 {
643
644 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
645 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
646
647 if( !IsOperation_v<MT1> && isSame( *lhs, rhs.lhs_ ) ) {
648 addAssign( *lhs, rhs.rhs_ );
649 }
650 else if( !IsOperation_v<MT2> && isSame( *lhs, rhs.rhs_ ) ) {
651 addAssign( *lhs, rhs.lhs_ );
652 }
653 else if( !RequiresEvaluation_v<MT2> ) {
654 assign ( *lhs, rhs.rhs_ );
655 addAssign( *lhs, rhs.lhs_ );
656 }
657 else {
658 assign ( *lhs, rhs.lhs_ );
659 addAssign( *lhs, rhs.rhs_ );
660 }
661 }
663 //**********************************************************************************************
664
665 //**Assignment to sparse matrices***************************************************************
679 template< typename MT // Type of the target sparse matrix
680 , bool SO2 > // Storage order of the target sparse matrix
681 friend inline auto assign( SparseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
683 {
685
687
694
695 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
696 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
697
698 const TmpType tmp( serial( rhs ) );
699 assign( *lhs, tmp );
700 }
702 //**********************************************************************************************
703
704 //**Addition assignment to dense matrices*******************************************************
718 template< typename MT // Type of the target dense matrix
719 , bool SO2 > // Storage order of the target dense matrix
720 friend inline auto addAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
721 -> EnableIf_t< UseAssign_v<MT> >
722 {
724
725 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
726 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
727
728 if( !RequiresEvaluation_v<MT2> ) {
729 addAssign( *lhs, rhs.rhs_ );
730 addAssign( *lhs, rhs.lhs_ );
731 }
732 else {
733 addAssign( *lhs, rhs.lhs_ );
734 addAssign( *lhs, rhs.rhs_ );
735 }
736 }
738 //**********************************************************************************************
739
740 //**Addition assignment to sparse matrices******************************************************
741 // No special implementation for the addition assignment to sparse matrices.
742 //**********************************************************************************************
743
744 //**Subtraction assignment to dense matrices****************************************************
758 template< typename MT // Type of the target dense matrix
759 , bool SO2 > // Storage order of the target dense matrix
760 friend inline auto subAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
761 -> EnableIf_t< UseAssign_v<MT> >
762 {
764
765 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
766 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
767
768 if( !RequiresEvaluation_v<MT2> ) {
769 subAssign( *lhs, rhs.rhs_ );
770 subAssign( *lhs, rhs.lhs_ );
771 }
772 else {
773 subAssign( *lhs, rhs.lhs_ );
774 subAssign( *lhs, rhs.rhs_ );
775 }
776 }
778 //**********************************************************************************************
779
780 //**Subtraction assignment to sparse matrices***************************************************
781 // No special implementation for the subtraction assignment to sparse matrices.
782 //**********************************************************************************************
783
784 //**Schur product assignment to dense matrices**************************************************
798 template< typename MT // Type of the target dense matrix
799 , bool SO2 > // Storage order of the target dense matrix
800 friend inline auto schurAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
801 -> EnableIf_t< UseAssign_v<MT> >
802 {
804
808
809 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
810 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
811
812 const ResultType tmp( serial( rhs ) );
813 schurAssign( *lhs, tmp );
814 }
816 //**********************************************************************************************
817
818 //**Schur product assignment to sparse matrices*************************************************
819 // No special implementation for the Schur product assignment to sparse matrices.
820 //**********************************************************************************************
821
822 //**Multiplication assignment to dense matrices*************************************************
823 // No special implementation for the multiplication assignment to dense matrices.
824 //**********************************************************************************************
825
826 //**Multiplication assignment to sparse matrices************************************************
827 // No special implementation for the multiplication assignment to sparse matrices.
828 //**********************************************************************************************
829
830 //**SMP assignment to dense matrices************************************************************
844 template< typename MT // Type of the target dense matrix
845 , bool SO2 > // Storage order of the target dense matrix
846 friend inline auto smpAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
847 -> EnableIf_t< UseSMPAssign_v<MT> >
848 {
850
851 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
852 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
853
854 if( !IsOperation_v<MT1> && isSame( *lhs, rhs.lhs_ ) ) {
855 smpAddAssign( *lhs, rhs.rhs_ );
856 }
857 else if( !IsOperation_v<MT2> && isSame( *lhs, rhs.rhs_ ) ) {
858 smpAddAssign( *lhs, rhs.lhs_ );
859 }
860 else if( !RequiresEvaluation_v<MT2> ) {
861 smpAssign ( *lhs, rhs.rhs_ );
862 smpAddAssign( *lhs, rhs.lhs_ );
863 }
864 else {
865 smpAssign ( *lhs, rhs.lhs_ );
866 smpAddAssign( *lhs, rhs.rhs_ );
867 }
868 }
870 //**********************************************************************************************
871
872 //**SMP assignment to sparse matrices***********************************************************
886 template< typename MT // Type of the target sparse matrix
887 , bool SO2 > // Storage order of the target sparse matrix
888 friend inline auto smpAssign( SparseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
889 -> EnableIf_t< UseSMPAssign_v<MT> >
890 {
892
893 using TmpType = If_t< SO == SO2, ResultType, OppositeType >;
894
901
902 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
903 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
904
905 const TmpType tmp( rhs );
906 smpAssign( *lhs, tmp );
907 }
909 //**********************************************************************************************
910
911 //**SMP addition assignment to dense matrices***************************************************
925 template< typename MT // Type of the target dense matrix
926 , bool SO2 > // Storage order of the target dense matrix
927 friend inline auto smpAddAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
928 -> EnableIf_t< UseSMPAssign_v<MT> >
929 {
931
932 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
933 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
934
935 if( !RequiresEvaluation_v<MT2> ) {
936 smpAddAssign( *lhs, rhs.rhs_ );
937 smpAddAssign( *lhs, rhs.lhs_ );
938 }
939 else {
940 smpAddAssign( *lhs, rhs.lhs_ );
941 smpAddAssign( *lhs, rhs.rhs_ );
942 }
943 }
945 //**********************************************************************************************
946
947 //**SMP addition assignment to sparse matrices**************************************************
948 // No special implementation for the SMP addition assignment to sparse matrices.
949 //**********************************************************************************************
950
951 //**SMP subtraction assignment to dense matrices************************************************
965 template< typename MT // Type of the target dense matrix
966 , bool SO2 > // Storage order of the target dense matrix
967 friend inline auto smpSubAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
968 -> EnableIf_t< UseSMPAssign_v<MT> >
969 {
971
972 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
973 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
974
975 if( !RequiresEvaluation_v<MT2> ) {
976 smpSubAssign( *lhs, rhs.rhs_ );
977 smpSubAssign( *lhs, rhs.lhs_ );
978 }
979 else {
980 smpSubAssign( *lhs, rhs.lhs_ );
981 smpSubAssign( *lhs, rhs.rhs_ );
982 }
983 }
985 //**********************************************************************************************
986
987 //**SMP subtraction assignment to sparse matrices***********************************************
988 // No special implementation for the SMP subtraction assignment to sparse matrices.
989 //**********************************************************************************************
990
991 //**SMP Schur product assignment to dense matrices**********************************************
1005 template< typename MT // Type of the target dense matrix
1006 , bool SO2 > // Storage order of the target dense matrix
1007 friend inline auto smpSchurAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
1008 -> EnableIf_t< UseSMPAssign_v<MT> >
1009 {
1011
1015
1016 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1017 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1018
1019 const ResultType tmp( rhs );
1020 smpSchurAssign( *lhs, tmp );
1021 }
1023 //**********************************************************************************************
1024
1025 //**SMP Schur product assignment to sparse matrices*********************************************
1026 // No special implementation for the SMP Schur product assignment to sparse matrices.
1027 //**********************************************************************************************
1028
1029 //**SMP multiplication assignment to dense matrices*********************************************
1030 // No special implementation for the SMP multiplication assignment to dense matrices.
1031 //**********************************************************************************************
1032
1033 //**SMP multiplication assignment to sparse matrices********************************************
1034 // No special implementation for the SMP multiplication assignment to sparse matrices.
1035 //**********************************************************************************************
1036
1037 //**Compile time checks*************************************************************************
1044 //**********************************************************************************************
1045};
1046//*************************************************************************************************
1047
1048
1049
1050
1051//=================================================================================================
1052//
1053// GLOBAL BINARY ARITHMETIC OPERATORS
1054//
1055//=================================================================================================
1056
1057//*************************************************************************************************
1084template< typename MT1 // Type of the left-hand side dense matrix
1085 , typename MT2 // Type of the right-hand side dense matrix
1086 , bool SO > // Storage order
1087inline decltype(auto)
1088 operator+( const DenseMatrix<MT1,SO>& lhs, const DenseMatrix<MT2,SO>& rhs )
1089{
1091
1092 if( (*lhs).rows() != (*rhs).rows() || (*lhs).columns() != (*rhs).columns() ) {
1093 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1094 }
1095
1096 using ReturnType = const DMatDMatAddExpr<MT1,MT2,SO>;
1097 return ReturnType( *lhs, *rhs );
1098}
1099//*************************************************************************************************
1100
1101
1102
1103
1104//=================================================================================================
1105//
1106// ISALIGNED SPECIALIZATIONS
1107//
1108//=================================================================================================
1109
1110//*************************************************************************************************
1112template< typename MT1, typename MT2, bool SO >
1113struct IsAligned< DMatDMatAddExpr<MT1,MT2,SO> >
1114 : public BoolConstant< IsAligned_v<MT1> && IsAligned_v<MT2> >
1115{};
1117//*************************************************************************************************
1118
1119
1120
1121
1122//=================================================================================================
1123//
1124// ISPADDED SPECIALIZATIONS
1125//
1126//=================================================================================================
1127
1128//*************************************************************************************************
1130template< typename MT1, typename MT2, bool SO >
1131struct IsPadded< DMatDMatAddExpr<MT1,MT2,SO> >
1132 : public BoolConstant< IsPadded_v<MT1> && IsPadded_v<MT2> >
1133{};
1135//*************************************************************************************************
1136
1137} // namespace blaze
1138
1139#endif
Header file for the addition trait.
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.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the HasSIMDAdd type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsExpression type trait class.
Header file for the IsOperation type trait class.
Header file for the IsPadded type trait.
Header file for the IsTemporary type trait class.
Header file for all SIMD functionality.
Iterator over the elements of the dense matrix.
Definition: DMatDMatAddExpr.h:185
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatDMatAddExpr.h:239
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:349
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatDMatAddExpr.h:382
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatDMatAddExpr.h:394
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatDMatAddExpr.h:226
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatDMatAddExpr.h:285
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatDMatAddExpr.h:273
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DMatDMatAddExpr.h:425
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatDMatAddExpr.h:192
ElementType * PointerType
Pointer return type.
Definition: DMatDMatAddExpr.h:190
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:360
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:327
ConstIterator_t< MT2 > RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:205
BLAZE_DEVICE_CALLABLE ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatDMatAddExpr.h:295
ReferenceType reference
Reference return type.
Definition: DMatDMatAddExpr.h:198
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DMatDMatAddExpr.h:426
ConstIterator_t< MT1 > LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:202
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:338
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatDMatAddExpr.h:188
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatDMatAddExpr.h:406
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:371
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DMatDMatAddExpr.h:214
ElementType & ReferenceType
Reference return type.
Definition: DMatDMatAddExpr.h:191
DifferenceType difference_type
Difference between two iterators.
Definition: DMatDMatAddExpr.h:199
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatDMatAddExpr.h:263
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DMatDMatAddExpr.h:251
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatAddExpr.h:305
ValueType value_type
Type of the underlying elements.
Definition: DMatDMatAddExpr.h:196
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:316
ElementType ValueType
Type of the underlying elements.
Definition: DMatDMatAddExpr.h:189
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatDMatAddExpr.h:418
PointerType pointer
Pointer return type.
Definition: DMatDMatAddExpr.h:197
IteratorCategory iterator_category
The iterator category.
Definition: DMatDMatAddExpr.h:195
Expression object for dense matrix-dense matrix additions.
Definition: DMatDMatAddExpr.h:97
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatDMatAddExpr.h:433
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDMatAddExpr.h:591
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatDMatAddExpr.h:526
decltype(std::declval< RN1 >()+std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DMatDMatAddExpr.h:120
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatDMatAddExpr.h:556
ElementType_t< MT2 > ET2
Element type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:107
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatDMatAddExpr.h:442
ReturnType_t< MT2 > RN2
Return type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:103
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:178
RightOperand rightOperand() const noexcept
Returns the right-hand side dense matrix operand.
Definition: DMatDMatAddExpr.h:566
AddTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DMatDMatAddExpr.h:163
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatDMatAddExpr.h:515
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDMatAddExpr.h:611
ResultType_t< MT1 > RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:100
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:175
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDMatAddExpr.h:164
ReturnType_t< MT1 > RN1
Return type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:102
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDMatAddExpr.h:578
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DMatDMatAddExpr.h:117
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatDMatAddExpr.h:166
ElementType_t< MT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:106
CompositeType_t< MT1 > CT1
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:104
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDMatAddExpr.h:165
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the addition expression.
Definition: DMatDMatAddExpr.h:131
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDMatAddExpr.h:536
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDMatAddExpr.h:601
ResultType_t< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:101
RightOperand rhs_
Right-hand side dense matrix of the addition expression.
Definition: DMatDMatAddExpr.h:620
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDMatAddExpr.h:546
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDMatAddExpr.h:467
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatAddExpr.h:500
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DMatDMatAddExpr.h:169
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDMatAddExpr.h:482
LeftOperand lhs_
Left-hand side dense matrix of the addition expression.
Definition: DMatDMatAddExpr.h:619
If_t< useAssign, const ResultType, const DMatDMatAddExpr & > CompositeType
Data type for composite expression templates.
Definition: DMatDMatAddExpr.h:172
CompositeType_t< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:105
DMatDMatAddExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the DMatDMatAddExpr class.
Definition: DMatDMatAddExpr.h:451
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatDMatAddExpr.h:437
Base class for dense matrices.
Definition: DenseMatrix.h:82
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse matrices.
Definition: SparseMatrix.h:77
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 DenseMatrix base class.
Header file for the MatMatAddExpr 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
#define BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.
Definition: StorageOrder.h:84
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATADDEXPR(T1, T2)
Constraint on the data type.
Definition: MatMatAddExpr.h:103
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition: AddTrait.h:163
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:1424
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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 smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
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
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
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
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraints on the storage order of matrix types.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all matrix/matrix addition expression templates.
Definition: MatMatAddExpr.h:68
System settings for the inline keywords.
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.