Blaze 3.9
DMatDMatMapExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATMAPEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATDMATMAPEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
45#include <blaze/math/Aliases.h>
69#include <blaze/math/SIMD.h>
80#include <blaze/system/Inline.h>
81#include <blaze/util/Assert.h>
82#include <blaze/util/EnableIf.h>
85#include <blaze/util/mpl/If.h>
86#include <blaze/util/Types.h>
88
89
90namespace blaze {
91
92//=================================================================================================
93//
94// CLASS DMATDMATMAPEXPR
95//
96//=================================================================================================
97
98//*************************************************************************************************
106template< typename MT1 // Type of the left-hand side dense matrix
107 , typename MT2 // Type of the right-hand side dense matrix
108 , typename OP // Type of the custom operation
109 , bool SO > // Storage order
111 : public MatMatMapExpr< DenseMatrix< DMatDMatMapExpr<MT1,MT2,OP,SO>, SO > >
112 , private Computation
113{
114 private:
115 //**Type definitions****************************************************************************
124 //**********************************************************************************************
125
126 //**Serial evaluation strategy******************************************************************
128
134 static constexpr bool useAssign = ( RequiresEvaluation_v<MT1> || RequiresEvaluation_v<MT2> );
135
138 template< typename MT >
139 static constexpr bool UseAssign_v = useAssign;
141 //**********************************************************************************************
142
143 //**Parallel evaluation strategy****************************************************************
145
151 template< typename MT >
152 static constexpr bool UseSMPAssign_v =
153 ( ( !MT1::smpAssignable || !MT2::smpAssignable ) && useAssign );
155 //**********************************************************************************************
156
157 public:
158 //**Type definitions****************************************************************************
161
164
169
171 using ReturnType = decltype( std::declval<OP>()( std::declval<RN1>(), std::declval<RN2>() ) );
172
175
177 using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
178
180 using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
181
183 using Operation = OP;
184
187
190 //**********************************************************************************************
191
192 //**ConstIterator class definition**************************************************************
196 {
197 public:
198 //**Type definitions*************************************************************************
199 using IteratorCategory = std::random_access_iterator_tag;
203 using DifferenceType = ptrdiff_t;
204
205 // STL iterator requirements
211
214
217 //*******************************************************************************************
218
219 //**Constructor******************************************************************************
227 : left_ ( left ) // Iterator to the current left-hand side element
228 , right_( right ) // Iterator to the current right-hand side element
229 , op_ ( std::move(op) ) // The custom binary operation
230 {}
231 //*******************************************************************************************
232
233 //**Addition assignment operator*************************************************************
240 left_ += inc;
241 right_ += inc;
242 return *this;
243 }
244 //*******************************************************************************************
245
246 //**Subtraction assignment operator**********************************************************
253 left_ -= dec;
254 right_ -= dec;
255 return *this;
256 }
257 //*******************************************************************************************
258
259 //**Prefix increment operator****************************************************************
265 ++left_;
266 ++right_;
267 return *this;
268 }
269 //*******************************************************************************************
270
271 //**Postfix increment operator***************************************************************
277 return ConstIterator( left_++, right_++, op_ );
278 }
279 //*******************************************************************************************
280
281 //**Prefix decrement operator****************************************************************
287 --left_;
288 --right_;
289 return *this;
290 }
291 //*******************************************************************************************
292
293 //**Postfix decrement operator***************************************************************
299 return ConstIterator( left_--, right_--, op_ );
300 }
301 //*******************************************************************************************
302
303 //**Element access operator******************************************************************
308 inline ReturnType operator*() const {
309 return op_( *left_, *right_ );
310 }
311 //*******************************************************************************************
312
313 //**Load function****************************************************************************
318 inline auto load() const noexcept {
319 return op_.load( left_.load(), right_.load() );
320 }
321 //*******************************************************************************************
322
323 //**Equality operator************************************************************************
329 inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
330 return left_ == rhs.left_;
331 }
332 //*******************************************************************************************
333
334 //**Inequality operator**********************************************************************
340 inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
341 return left_ != rhs.left_;
342 }
343 //*******************************************************************************************
344
345 //**Less-than operator***********************************************************************
351 inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
352 return left_ < rhs.left_;
353 }
354 //*******************************************************************************************
355
356 //**Greater-than operator********************************************************************
362 inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
363 return left_ > rhs.left_;
364 }
365 //*******************************************************************************************
366
367 //**Less-or-equal-than operator**************************************************************
373 inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
374 return left_ <= rhs.left_;
375 }
376 //*******************************************************************************************
377
378 //**Greater-or-equal-than operator***********************************************************
384 inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
385 return left_ >= rhs.left_;
386 }
387 //*******************************************************************************************
388
389 //**Subtraction operator*********************************************************************
396 return left_ - rhs.left_;
397 }
398 //*******************************************************************************************
399
400 //**Addition operator************************************************************************
407 friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
408 return ConstIterator( it.left_ + inc, it.right_ + inc, it.op_ );
409 }
410 //*******************************************************************************************
411
412 //**Addition operator************************************************************************
419 friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
420 return ConstIterator( it.left_ + inc, it.right_ + inc, it.op_ );
421 }
422 //*******************************************************************************************
423
424 //**Subtraction operator*********************************************************************
431 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
432 return ConstIterator( it.left_ - dec, it.right_ - dec, it.op_ );
433 }
434 //*******************************************************************************************
435
436 private:
437 //**Member variables*************************************************************************
440 OP op_;
441 //*******************************************************************************************
442 };
443 //**********************************************************************************************
444
445 //**Compilation flags***************************************************************************
447 static constexpr bool simdEnabled =
448 ( MT1::simdEnabled && MT2::simdEnabled &&
449 If_t< HasSIMDEnabled_v<OP>, GetSIMDEnabled<OP,ET1,ET2>, HasLoad<OP> >::value );
450
452 static constexpr bool smpAssignable = ( MT1::smpAssignable && MT2::smpAssignable );
453 //**********************************************************************************************
454
455 //**SIMD properties*****************************************************************************
457 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
458 //**********************************************************************************************
459
460 //**Constructor*********************************************************************************
467 inline DMatDMatMapExpr( const MT1& lhs, const MT2& rhs, OP op ) noexcept
468 : lhs_( lhs ) // Left-hand side dense matrix of the map expression
469 , rhs_( rhs ) // Right-hand side dense matrix of the map expression
470 , op_ ( std::move(op) ) // The custom binary operation
471 {}
472 //**********************************************************************************************
473
474 //**Access operator*****************************************************************************
481 inline ReturnType operator()( size_t i, size_t j ) const {
482 BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
483 BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
484 return op_( lhs_(i,j), rhs_(i,j) );
485 }
486 //**********************************************************************************************
487
488 //**At function*********************************************************************************
496 inline ReturnType at( size_t i, size_t j ) const {
497 if( i >= lhs_.rows() ) {
498 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
499 }
500 if( j >= lhs_.columns() ) {
501 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
502 }
503 return (*this)(i,j);
504 }
505 //**********************************************************************************************
506
507 //**Load function*******************************************************************************
514 BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
515 BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
516 BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
517 BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
518 BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
519 return op_.load( lhs_.load(i,j), rhs_.load(i,j) );
520 }
521 //**********************************************************************************************
522
523 //**Begin function******************************************************************************
529 inline ConstIterator begin( size_t i ) const {
530 return ConstIterator( lhs_.begin(i), rhs_.begin(i), op_ );
531 }
532 //**********************************************************************************************
533
534 //**End function********************************************************************************
540 inline ConstIterator end( size_t i ) const {
541 return ConstIterator( lhs_.end(i), rhs_.end(i), op_ );
542 }
543 //**********************************************************************************************
544
545 //**Rows function*******************************************************************************
550 inline size_t rows() const noexcept {
551 return lhs_.rows();
552 }
553 //**********************************************************************************************
554
555 //**Columns function****************************************************************************
560 inline size_t columns() const noexcept {
561 return lhs_.columns();
562 }
563 //**********************************************************************************************
564
565 //**Left operand access*************************************************************************
570 inline LeftOperand leftOperand() const noexcept {
571 return lhs_;
572 }
573 //**********************************************************************************************
574
575 //**Right operand access************************************************************************
580 inline RightOperand rightOperand() const noexcept {
581 return rhs_;
582 }
583 //**********************************************************************************************
584
585 //**Operation access****************************************************************************
590 inline Operation operation() const {
591 return op_;
592 }
593 //**********************************************************************************************
594
595 //**********************************************************************************************
601 template< typename T >
602 inline bool canAlias( const T* alias ) const noexcept {
603 return ( IsExpression_v<MT1> && lhs_.canAlias( alias ) ) ||
604 ( IsExpression_v<MT2> && rhs_.canAlias( alias ) );
605 }
606 //**********************************************************************************************
607
608 //**********************************************************************************************
614 template< typename T >
615 inline bool isAliased( const T* alias ) const noexcept {
616 return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
617 }
618 //**********************************************************************************************
619
620 //**********************************************************************************************
625 inline bool isAligned() const noexcept {
626 return lhs_.isAligned() && rhs_.isAligned();
627 }
628 //**********************************************************************************************
629
630 //**********************************************************************************************
635 inline bool canSMPAssign() const noexcept {
636 return lhs_.canSMPAssign() && rhs_.canSMPAssign();
637 }
638 //**********************************************************************************************
639
640 private:
641 //**Member variables****************************************************************************
645 //**********************************************************************************************
646
647 //**Assignment to dense matrices****************************************************************
661 template< typename MT // Type of the target dense matrix
662 , bool SO2 > // Storage order of the target dense matrix
663 friend inline auto assign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
665 {
667
668 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
669 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
670
671 LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
672 RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
673
674 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
675 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
676 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
677 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
678 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
679 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
680 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
681 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
682
683 assign( *lhs, map( A, B, rhs.op_ ) );
684 }
686 //**********************************************************************************************
687
688 //**Assignment to sparse matrices***************************************************************
702 template< typename MT // Type of the target sparse matrix
703 , bool SO2 > // Storage order of the target sparse matrix
704 friend inline auto assign( SparseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
706 {
708
710
717
718 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
719 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
720
721 const TmpType tmp( serial( rhs ) );
722 assign( *lhs, tmp );
723 }
725 //**********************************************************************************************
726
727 //**Addition assignment to dense matrices*******************************************************
741 template< typename MT // Type of the target dense matrix
742 , bool SO2 > // Storage order of the target dense matrix
743 friend inline auto addAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
744 -> EnableIf_t< UseAssign_v<MT> >
745 {
747
748 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
749 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
750
751 LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
752 RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
753
754 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
755 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
756 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
757 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
758 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
759 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
760 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
761 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
762
763 addAssign( *lhs, map( A, B, rhs.op_ ) );
764 }
766 //**********************************************************************************************
767
768 //**Addition assignment to sparse matrices******************************************************
769 // No special implementation for the addition assignment to sparse matrices.
770 //**********************************************************************************************
771
772 //**Subtraction assignment to dense matrices****************************************************
786 template< typename MT // Type of the target dense matrix
787 , bool SO2 > // Storage order of the target dense matrix
788 friend inline auto subAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
789 -> EnableIf_t< UseAssign_v<MT> >
790 {
792
793 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
794 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
795
796 LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
797 RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
798
799 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
800 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
801 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
802 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
803 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
804 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
805 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
806 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
807
808 subAssign( *lhs, map( A, B, rhs.op_ ) );
809 }
811 //**********************************************************************************************
812
813 //**Subtraction assignment to sparse matrices***************************************************
814 // No special implementation for the subtraction assignment to sparse matrices.
815 //**********************************************************************************************
816
817 //**Schur product assignment to dense matrices**************************************************
831 template< typename MT // Type of the target dense matrix
832 , bool SO2 > // Storage order of the target dense matrix
833 friend inline auto schurAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
834 -> EnableIf_t< UseAssign_v<MT> >
835 {
837
838 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
839 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
840
841 LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
842 RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
843
844 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
845 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
846 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
847 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
848 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
849 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
850 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
851 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
852
853 schurAssign( *lhs, map( A, B, rhs.op_ ) );
854 }
856 //**********************************************************************************************
857
858 //**Schur product assignment to sparse matrices*************************************************
859 // No special implementation for the Schur product assignment to sparse matrices.
860 //**********************************************************************************************
861
862 //**Multiplication assignment to dense matrices*************************************************
863 // No special implementation for the multiplication assignment to dense matrices.
864 //**********************************************************************************************
865
866 //**Multiplication assignment to sparse matrices************************************************
867 // No special implementation for the multiplication assignment to sparse matrices.
868 //**********************************************************************************************
869
870 //**SMP assignment to dense matrices************************************************************
884 template< typename MT // Type of the target dense matrix
885 , bool SO2 > // Storage order of the target dense matrix
886 friend inline auto smpAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
887 -> EnableIf_t< UseSMPAssign_v<MT> >
888 {
890
891 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
892 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
893
894 LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
895 RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
896
897 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
898 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
899 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
900 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
901 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
902 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
903 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
904 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
905
906 smpAssign( *lhs, map( A, B, rhs.op_ ) );
907 }
909 //**********************************************************************************************
910
911 //**SMP assignment to sparse matrices***********************************************************
925 template< typename MT // Type of the target sparse matrix
926 , bool SO2 > // Storage order of the target sparse matrix
927 friend inline auto smpAssign( SparseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
928 -> EnableIf_t< UseSMPAssign_v<MT> >
929 {
931
932 using TmpType = If_t< SO == SO2, ResultType, OppositeType >;
933
940
941 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
942 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
943
944 const TmpType tmp( rhs );
945 smpAssign( *lhs, tmp );
946 }
948 //**********************************************************************************************
949
950 //**SMP addition 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 smpAddAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& 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 LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
976 RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
977
978 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
979 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
980 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
981 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
982 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
983 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
984 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
985 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
986
987 smpAddAssign( *lhs, map( A, B, rhs.op_ ) );
988 }
990 //**********************************************************************************************
991
992 //**SMP addition assignment to sparse matrices**************************************************
993 // No special implementation for the SMP addition assignment to sparse matrices.
994 //**********************************************************************************************
995
996 //**SMP subtraction assignment to dense matrices************************************************
1011 template< typename MT // Type of the target dense matrix
1012 , bool SO2 > // Storage order of the target dense matrix
1013 friend inline auto smpSubAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
1014 -> EnableIf_t< UseSMPAssign_v<MT> >
1015 {
1017
1018 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1019 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1020
1021 LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
1022 RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
1023
1024 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1025 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1026 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1027 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1028 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
1029 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
1030 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
1031 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
1032
1033 smpSubAssign( *lhs, map( A, B, rhs.op_ ) );
1034 }
1036 //**********************************************************************************************
1037
1038 //**SMP subtraction assignment to sparse matrices***********************************************
1039 // No special implementation for the SMP subtraction assignment to sparse matrices.
1040 //**********************************************************************************************
1041
1042 //**SMP Schur product assignment to dense matrices**********************************************
1057 template< typename MT // Type of the target dense matrix
1058 , bool SO2 > // Storage order of the target dense matrix
1059 friend inline auto smpSchurAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
1060 -> EnableIf_t< UseSMPAssign_v<MT> >
1061 {
1063
1064 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
1065 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
1066
1067 LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
1068 RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
1069
1070 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1071 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1072 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1073 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1074 BLAZE_INTERNAL_ASSERT( A.rows() == (*lhs).rows() , "Invalid number of rows" );
1075 BLAZE_INTERNAL_ASSERT( A.columns() == (*lhs).columns() , "Invalid number of columns" );
1076 BLAZE_INTERNAL_ASSERT( B.rows() == (*lhs).rows() , "Invalid number of rows" );
1077 BLAZE_INTERNAL_ASSERT( B.columns() == (*lhs).columns() , "Invalid number of columns" );
1078
1079 smpSchurAssign( *lhs, map( A, B, rhs.op_ ) );
1080 }
1082 //**********************************************************************************************
1083
1084 //**SMP Schur product assignment to sparse matrices*********************************************
1085 // No special implementation for the SMP Schur product assignment to sparse matrices.
1086 //**********************************************************************************************
1087
1088 //**SMP multiplication assignment to dense matrices*********************************************
1089 // No special implementation for the SMP multiplication assignment to dense matrices.
1090 //**********************************************************************************************
1091
1092 //**SMP multiplication assignment to sparse matrices********************************************
1093 // No special implementation for the SMP multiplication assignment to sparse matrices.
1094 //**********************************************************************************************
1095
1096 //**Compile time checks*************************************************************************
1102 //**********************************************************************************************
1103};
1104//*************************************************************************************************
1105
1106
1107
1108
1109//=================================================================================================
1110//
1111// GLOBAL FUNCTIONS
1112//
1113//=================================================================================================
1114
1115//*************************************************************************************************
1139template< typename MT1 // Type of the left-hand side dense matrix
1140 , typename MT2 // Type of the right-hand side dense matrix
1141 , bool SO // Storage order
1142 , typename OP > // Type of the custom operation
1143inline decltype(auto)
1144 map( const DenseMatrix<MT1,SO>& lhs, const DenseMatrix<MT2,SO>& rhs, OP op )
1145{
1147
1148 if( (*lhs).rows() != (*rhs).rows() || (*lhs).columns() != (*rhs).columns() ) {
1149 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1150 }
1151
1152 using ReturnType = const DMatDMatMapExpr<MT1,MT2,OP,SO>;
1153 return ReturnType( *lhs, *rhs, std::move(op) );
1154}
1155//*************************************************************************************************
1156
1157
1158//*************************************************************************************************
1176template< typename MT1 // Type of the first dense matrix
1177 , typename MT2 // Type of the second dense matrix
1178 , typename MT3 // Type of the third dense matrix
1179 , bool SO // Storage order
1180 , typename OP > // Type of the custom operation
1181inline decltype(auto)
1183 const DenseMatrix<MT3,SO>& dm3, OP op )
1184{
1186
1187 const MakePair mp{};
1188 return map( map( map( *dm1, *dm2, mp ), *dm3, mp ), join( std::move(op) ) );
1189}
1190//*************************************************************************************************
1191
1192
1193//*************************************************************************************************
1212template< typename MT1 // Type of the first dense matrix
1213 , typename MT2 // Type of the second dense matrix
1214 , typename MT3 // Type of the third dense matrix
1215 , typename MT4 // Type of the fourth dense matrix
1216 , bool SO // Storage order
1217 , typename OP > // Type of the custom operation
1218inline decltype(auto)
1220 const DenseMatrix<MT3,SO>& dm3, const DenseMatrix<MT4,SO>& dm4, OP op )
1221{
1223
1224 const MakePair mp{};
1225 return map( map( map( map( *dm1, *dm2, mp ), *dm3, mp ), *dm4, mp ), join( std::move(op) ) );
1226}
1227//*************************************************************************************************
1228
1229
1230//*************************************************************************************************
1250template< typename MT1 // Type of the first dense matrix
1251 , typename MT2 // Type of the second dense matrix
1252 , typename MT3 // Type of the third dense matrix
1253 , typename MT4 // Type of the fourth dense matrix
1254 , typename MT5 // Type of the fifth dense matrix
1255 , bool SO // Storage order
1256 , typename OP > // Type of the custom operation
1257inline decltype(auto)
1259 const DenseMatrix<MT3,SO>& dm3, const DenseMatrix<MT4,SO>& dm4,
1260 const DenseMatrix<MT5,SO>& dm5, OP op )
1261{
1263
1264 const MakePair mp{};
1265 return map( map( map( map( map( *dm1, *dm2, mp ), *dm3, mp ), *dm4, mp ), *dm5, mp ), join( std::move(op) ) );
1266}
1267//*************************************************************************************************
1268
1269
1270//*************************************************************************************************
1291template< typename MT1 // Type of the first dense matrix
1292 , typename MT2 // Type of the second dense matrix
1293 , typename MT3 // Type of the third dense matrix
1294 , typename MT4 // Type of the fourth dense matrix
1295 , typename MT5 // Type of the fifth dense matrix
1296 , typename MT6 // Type of the sixth dense matrix
1297 , bool SO // Storage order
1298 , typename OP > // Type of the custom operation
1299inline decltype(auto)
1301 const DenseMatrix<MT3,SO>& dm3, const DenseMatrix<MT4,SO>& dm4,
1302 const DenseMatrix<MT5,SO>& dm5, const DenseMatrix<MT6,SO>& dm6, OP op )
1303{
1305
1306 const MakePair mp{};
1307 return map( map( map( map( map( map( *dm1, *dm2, mp ), *dm3, mp ), *dm4, mp ), *dm5, mp ), *dm6, mp ), join( std::move(op) ) );
1308}
1309//*************************************************************************************************
1310
1311
1312//*************************************************************************************************
1334template< typename MT1 // Type of the left-hand side dense matrix
1335 , bool SO1 // Storage order of the left-hand side dense matrix
1336 , typename MT2 // Type of the right-hand side dense matrix
1337 , bool SO2 > // Storage order of the right-hand side dense matrix
1338inline decltype(auto)
1340{
1342
1343 return map( *lhs, *rhs, Min() );
1344}
1345//*************************************************************************************************
1346
1347
1348//*************************************************************************************************
1370template< typename MT1 // Type of the left-hand side dense matrix
1371 , bool SO1 // Storage order of the left-hand side dense matrix
1372 , typename MT2 // Type of the right-hand side dense matrix
1373 , bool SO2 > // Storage order of the right-hand side dense matrix
1374inline decltype(auto)
1376{
1378
1379 return map( *lhs, *rhs, Max() );
1380}
1381//*************************************************************************************************
1382
1383
1384//*************************************************************************************************
1407template< typename MT1 // Type of the left-hand side dense matrix
1408 , bool SO1 // Storage order of the left-hand side dense matrix
1409 , typename MT2 // Type of the right-hand side dense matrix
1410 , bool SO2 > // Storage order of the right-hand side dense matrix
1411inline decltype(auto)
1413{
1415
1416 return map( *lhs, *rhs, Hypot() );
1417}
1418//*************************************************************************************************
1419
1420
1421//*************************************************************************************************
1443template< typename MT1 // Type of the left-hand side dense matrix
1444 , bool SO1 // Storage order of the left-hand side dense matrix
1445 , typename MT2 // Type of the right-hand side dense matrix
1446 , bool SO2 > // Storage order of the right-hand side dense matrix
1447inline decltype(auto)
1449{
1451
1452 return map( *lhs, *rhs, Pow() );
1453}
1454//*************************************************************************************************
1455
1456
1457//*************************************************************************************************
1479template< typename MT1 // Type of the left-hand side dense matrix
1480 , bool SO1 // Storage order of the left-hand side dense matrix
1481 , typename MT2 // Type of the right-hand side dense matrix
1482 , bool SO2 > // Storage order of the right-hand side dense matrix
1483inline decltype(auto)
1485{
1487
1488 return map( *lhs, *rhs, Atan2() );
1489}
1490//*************************************************************************************************
1491
1492
1493//*************************************************************************************************
1523template< typename MT1 // Type of the conditional dense matrix
1524 , typename MT2 // Type of the true-case dense matrix
1525 , typename MT3 // Type of the false-case dense matrix
1526 , bool SO > // Storage order
1527inline decltype(auto)
1529{
1531
1532 return map( cond, lhs, rhs, []( bool c, const auto& a, const auto& b ) { return c ? a : b; } );
1533}
1534//*************************************************************************************************
1535
1536
1537
1538
1539//=================================================================================================
1540//
1541// GLOBAL BINARY ARITHMETIC OPERATORS
1542//
1543//=================================================================================================
1544
1545//*************************************************************************************************
1565template< typename MT1 // Type of the left-hand side dense matrix
1566 , bool SO1 // Storage order of the left-hand side dense matrix
1567 , typename MT2 // Type of the right-hand side dense matrix
1568 , bool SO2 > // Storage order of the right-hand side dense matrix
1569inline decltype(auto)
1570 operator<<( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1571{
1573
1574 return map( *lhs, *rhs, ShiftLV() );
1575}
1576//*************************************************************************************************
1577
1578
1579//*************************************************************************************************
1599template< typename MT1 // Type of the left-hand side dense matrix
1600 , bool SO1 // Storage order of the left-hand side dense matrix
1601 , typename MT2 // Type of the right-hand side dense matrix
1602 , bool SO2 > // Storage order of the right-hand side dense matrix
1603inline decltype(auto)
1604 operator>>( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1605{
1607
1608 return map( *lhs, *rhs, ShiftRV() );
1609}
1610//*************************************************************************************************
1611
1612
1613//*************************************************************************************************
1633template< typename MT1 // Type of the left-hand side dense matrix
1634 , bool SO1 // Storage order of the left-hand side dense matrix
1635 , typename MT2 // Type of the right-hand side dense matrix
1636 , bool SO2 > // Storage order of the right-hand side dense matrix
1637inline decltype(auto)
1638 operator&( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1639{
1641
1642 return map( *lhs, *rhs, Bitand() );
1643}
1644//*************************************************************************************************
1645
1646
1647//*************************************************************************************************
1667template< typename MT1 // Type of the left-hand side dense matrix
1668 , bool SO1 // Storage order of the left-hand side dense matrix
1669 , typename MT2 // Type of the right-hand side dense matrix
1670 , bool SO2 > // Storage order of the right-hand side dense matrix
1671inline decltype(auto)
1672 operator|( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1673{
1675
1676 return map( *lhs, *rhs, Bitor() );
1677}
1678//*************************************************************************************************
1679
1680
1681//*************************************************************************************************
1701template< typename MT1 // Type of the left-hand side dense matrix
1702 , bool SO1 // Storage order of the left-hand side dense matrix
1703 , typename MT2 // Type of the right-hand side dense matrix
1704 , bool SO2 > // Storage order of the right-hand side dense matrix
1705inline decltype(auto)
1706 operator^( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1707{
1709
1710 return map( *lhs, *rhs, Bitxor() );
1711}
1712//*************************************************************************************************
1713
1714
1715
1716
1717//=================================================================================================
1718//
1719// GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
1720//
1721//=================================================================================================
1722
1723//*************************************************************************************************
1737template< typename MT1 // Type of the left-hand side dense matrix
1738 , typename MT2 // Type of the middle dense matrix
1739 , bool SO1 // Storage order of the left-hand side left-shift expression
1740 , typename MT3 // Type of the right-hand side dense matrix
1741 , bool SO2 > // Storage order of the right-hand side dense matrix
1742inline decltype(auto)
1743 operator<<( const DMatDMatMapExpr<MT1,MT2,ShiftLV,SO1>& lhs, const DenseMatrix<MT3,SO2>& rhs )
1744{
1746
1747 return map( lhs.leftOperand(), lhs.rightOperand() + (*rhs), lhs.operation() );
1748}
1750//*************************************************************************************************
1751
1752
1753//*************************************************************************************************
1767template< typename MT1 // Type of the left-hand side dense matrix
1768 , typename MT2 // Type of the middle dense matrix
1769 , bool SO1 // Storage order of the left-hand side right-shift expression
1770 , typename MT3 // Type of the right-hand side dense matrix
1771 , bool SO2 > // Storage order of the right-hand side dense matrix
1772inline decltype(auto)
1773 operator>>( const DMatDMatMapExpr<MT1,MT2,ShiftRV,SO1>& lhs, const DenseMatrix<MT3,SO2>& rhs )
1774{
1776
1777 return map( lhs.leftOperand(), lhs.rightOperand() + (*rhs), lhs.operation() );
1778}
1780//*************************************************************************************************
1781
1782
1783
1784
1785//=================================================================================================
1786//
1787// GLOBAL LOGICAL ARITHMETIC OPERATORS
1788//
1789//=================================================================================================
1790
1791//*************************************************************************************************
1811template< typename MT1 // Type of the left-hand side dense matrix
1812 , bool SO1 // Storage order of the left-hand side dense matrix
1813 , typename MT2 // Type of the right-hand side dense matrix
1814 , bool SO2 > // Storage order of the right-hand side dense matrix
1815inline decltype(auto)
1816 operator&&( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1817{
1819
1820 return map( *lhs, *rhs, And{} );
1821}
1822//*************************************************************************************************
1823
1824
1825//*************************************************************************************************
1845template< typename MT1 // Type of the left-hand side dense matrix
1846 , bool SO1 // Storage order of the left-hand side dense matrix
1847 , typename MT2 // Type of the right-hand side dense matrix
1848 , bool SO2 > // Storage order of the right-hand side dense matrix
1849inline decltype(auto)
1850 operator||( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1851{
1853
1854 return map( *lhs, *rhs, Or{} );
1855}
1856//*************************************************************************************************
1857
1858
1859
1860
1861//=================================================================================================
1862//
1863// ISALIGNED SPECIALIZATIONS
1864//
1865//=================================================================================================
1866
1867//*************************************************************************************************
1869template< typename MT1, typename MT2, typename OP, bool SO >
1870struct IsAligned< DMatDMatMapExpr<MT1,MT2,OP,SO> >
1871 : public BoolConstant< IsAligned_v<MT1> && IsAligned_v<MT2> >
1872{};
1874//*************************************************************************************************
1875
1876
1877
1878
1879//=================================================================================================
1880//
1881// ISPADDED SPECIALIZATIONS
1882//
1883//=================================================================================================
1884
1885//*************************************************************************************************
1887template< typename MT1, typename MT2, typename OP, bool SO >
1888struct IsPadded< DMatDMatMapExpr<MT1,MT2,OP,SO> >
1889 : public BoolConstant< IsPadded_v<MT1> && IsPadded_v<MT2> && IsPaddingEnabled_v<OP> >
1890{};
1892//*************************************************************************************************
1893
1894} // namespace blaze
1895
1896#endif
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition: Aliases.h:310
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition: Aliases.h:130
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the HasLoad type trait.
Header file for the HasMember type traits.
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 IsMatrix type trait.
Header file for the IsPadded type trait.
Header file for the IsPaddingEnabled type trait.
Header file for the IsSIMDEnabled type trait.
Header file for the Join functor.
Header file for the MakePair functor.
Header file for the map trait.
Header file for all SIMD functionality.
Iterator over the elements of the dense matrix map expression.
Definition: DMatDMatMapExpr.h:196
IteratorCategory iterator_category
The iterator category.
Definition: DMatDMatMapExpr.h:206
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatDMatMapExpr.h:395
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:373
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatMapExpr.h:318
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatDMatMapExpr.h:239
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DMatDMatMapExpr.h:438
ConstIterator_t< MT1 > LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:213
ReferenceType reference
Reference return type.
Definition: DMatDMatMapExpr.h:209
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatDMatMapExpr.h:203
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatDMatMapExpr.h:199
ConstIterator(LeftIteratorType left, RightIteratorType right, OP op)
Constructor for the ConstIterator class.
Definition: DMatDMatMapExpr.h:226
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatDMatMapExpr.h:308
ElementType * PointerType
Pointer return type.
Definition: DMatDMatMapExpr.h:201
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DMatDMatMapExpr.h:264
PointerType pointer
Pointer return type.
Definition: DMatDMatMapExpr.h:208
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:351
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatDMatMapExpr.h:407
ValueType value_type
Type of the underlying elements.
Definition: DMatDMatMapExpr.h:207
OP op_
The custom binary operation.
Definition: DMatDMatMapExpr.h:440
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatDMatMapExpr.h:298
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:362
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatDMatMapExpr.h:286
ElementType ValueType
Type of the underlying elements.
Definition: DMatDMatMapExpr.h:200
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatDMatMapExpr.h:419
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DMatDMatMapExpr.h:439
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:340
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:384
DifferenceType difference_type
Difference between two iterators.
Definition: DMatDMatMapExpr.h:210
ElementType & ReferenceType
Reference return type.
Definition: DMatDMatMapExpr.h:202
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatDMatMapExpr.h:252
ConstIterator_t< MT2 > RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:216
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatDMatMapExpr.h:276
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatDMatMapExpr.h:431
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:329
Expression object for the dense matrix-dense matrix map() function.
Definition: DMatDMatMapExpr.h:113
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDMatMapExpr.h:602
MapTrait_t< RT1, RT2, OP > ResultType
Result type for expression template evaluations.
Definition: DMatDMatMapExpr.h:165
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatDMatMapExpr.h:447
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatDMatMapExpr.h:529
ResultType_t< MT1 > RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:116
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDMatMapExpr.h:615
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDMatMapExpr.h:560
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDMatMapExpr.h:625
Operation op_
The custom binary operation.
Definition: DMatDMatMapExpr.h:644
ElementType_t< MT2 > ET2
Element type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:119
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDMatMapExpr.h:635
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:180
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDMatMapExpr.h:166
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatDMatMapExpr.h:457
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:177
If_t< RequiresEvaluation_v< MT1 >, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:186
CompositeType_t< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:123
ResultType_t< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:117
LeftOperand lhs_
Left-hand side dense matrix of the map expression.
Definition: DMatDMatMapExpr.h:642
DMatDMatMapExpr(const MT1 &lhs, const MT2 &rhs, OP op) noexcept
Constructor for the DMatDMatMapExpr class.
Definition: DMatDMatMapExpr.h:467
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: DMatDMatMapExpr.h:134
ReturnType_t< MT1 > RN1
Return type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:120
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDMatMapExpr.h:167
If_t< useAssign, const ResultType, const DMatDMatMapExpr & > CompositeType
Data type for composite expression templates.
Definition: DMatDMatMapExpr.h:174
Operation operation() const
Returns a copy of the custom operation.
Definition: DMatDMatMapExpr.h:590
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:570
RightOperand rhs_
Right-hand side dense matrix of the map expression.
Definition: DMatDMatMapExpr.h:643
RightOperand rightOperand() const noexcept
Returns the right-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:580
ReturnType_t< MT2 > RN2
Return type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:121
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatDMatMapExpr.h:540
CompositeType_t< MT1 > CT1
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:122
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatDMatMapExpr.h:168
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDMatMapExpr.h:496
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatDMatMapExpr.h:452
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDMatMapExpr.h:550
OP Operation
Data type of the custom binary operation.
Definition: DMatDMatMapExpr.h:183
If_t< RequiresEvaluation_v< MT2 >, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:189
decltype(std::declval< OP >()(std::declval< RN1 >(), std::declval< RN2 >())) ReturnType
Return type for expression template evaluations.
Definition: DMatDMatMapExpr.h:171
ElementType_t< MT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:118
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatMapExpr.h:514
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDMatMapExpr.h:481
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.
Header file for the Computation base class.
Header file for the DenseMatrix base class.
Header file for the MatMatMapExpr base class.
Header file for the Atan2 functor.
Header file for the Bitand functor.
Header file for the Bitor functor.
Header file for the Bitxor functor.
Header file for the Hypot functor.
Header file for the Pow functor.
Header file for the ShiftLV functor.
Header file for the ShiftRV functor.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) map(const DenseMatrix< MT1, SO > &dm1, const DenseMatrix< MT2, SO > &dm2, const DenseMatrix< MT3, SO > &dm3, const DenseMatrix< MT4, SO > &dm4, const DenseMatrix< MT5, SO > &dm5, const DenseMatrix< MT6, SO > &dm6, OP op)
Elementwise evaluation of the given 6-ary operation on each single element of the dense matrices dm1,...
Definition: DMatDMatMapExpr.h:1300
decltype(auto) select(const DenseMatrix< MT1, SO > &cond, const DenseMatrix< MT2, SO > &lhs, const DenseMatrix< MT3, SO > &rhs)
Elementwise conditional selection of values from the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1528
decltype(auto) hypot(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise hypotenous for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1412
decltype(auto) pow(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise exponential value for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1448
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) atan2(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the multi-valued inverse tangent of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1484
constexpr Join< OP > join(const OP &op)
Wraps the given operation to unpack paired arguments.
Definition: Join.h:183
#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_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition: MapTrait.h:131
#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 And functor.
Header file for the Max functor.
Header file for the Min functor.
Header file for the Or functor.
Header file for the serial shim.
Generic wrapper for the logical AND operator.
Definition: And.h:60
Generic wrapper for the atan2() function.
Definition: Atan2.h:80
Generic wrapper for the bitwise AND ('&') operator.
Definition: Bitand.h:82
Generic wrapper for the bitwise OR ('|') operator.
Definition: Bitor.h:82
Generic wrapper for the bitwise XOR ('^') operator.
Definition: Bitxor.h:68
Base class for all compute expression templates.
Definition: Computation.h:68
Generic wrapper for the hypot() function.
Definition: Hypot.h:80
Generic wrapper for the make_pair() function.
Definition: MakePair.h:82
Base class for all binary matrix map expression templates.
Definition: MatMatMapExpr.h:68
Generic wrapper for the max() function.
Definition: Max.h:82
Generic wrapper for the min() function.
Definition: Min.h:82
Generic wrapper for the logical OR operator.
Definition: Or.h:60
Generic wrapper for the pow() function.
Definition: Pow.h:65
Generic wrapper for the elementwise left-shift operation.
Definition: ShiftLV.h:77
Generic wrapper for the elementwise right-shift operation.
Definition: ShiftRV.h:77
System settings for the inline keywords.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.