Blaze 3.9
DMatDeclDiagExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATDECLDIAGEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATDECLDIAGEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
45#include <blaze/math/Aliases.h>
66#include <blaze/util/Assert.h>
67#include <blaze/util/EnableIf.h>
71#include <blaze/util/mpl/If.h>
72#include <blaze/util/Types.h>
74
75
76namespace blaze {
77
78//=================================================================================================
79//
80// CLASS DMATDECLDIAGEXPR
81//
82//=================================================================================================
83
84//*************************************************************************************************
91template< typename MT // Type of the dense matrix
92 , bool SO > // Storage order
94 : public DeclDiagExpr< DenseMatrix< DMatDeclDiagExpr<MT,SO>, SO > >
95 , public Declaration<MT>
96{
97 private:
98 //**Type definitions****************************************************************************
100
102 BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT( GetConstIterator, ConstIterator, INVALID_TYPE );
103 //**********************************************************************************************
104
105 //**Serial evaluation strategy******************************************************************
107
113 static constexpr bool useAssign = RequiresEvaluation_v<MT>;
114
117 template< typename MT2 >
118 static constexpr bool UseAssign_v = useAssign;
120 //**********************************************************************************************
121
122 //**Parallel evaluation strategy****************************************************************
124
130 template< typename MT2 >
131 static constexpr bool UseSMPAssign_v = ( MT2::smpAssignable && useAssign );
133 //**********************************************************************************************
134
135 public:
136 //**Type definitions****************************************************************************
139
142
148
151
153 using ConstIterator = GetConstIterator_t<MT>;
154
156 using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
157 //**********************************************************************************************
158
159 //**Compilation flags***************************************************************************
161 static constexpr bool simdEnabled = MT::simdEnabled;
162
164 static constexpr bool smpAssignable = MT::smpAssignable;
165 //**********************************************************************************************
166
167 //**SIMD properties*****************************************************************************
169 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
170 //**********************************************************************************************
171
172 //**Constructor*********************************************************************************
177 explicit inline DMatDeclDiagExpr( const MT& dm ) noexcept
178 : dm_( dm ) // Dense matrix of the decldiag expression
179 {
180 BLAZE_INTERNAL_ASSERT( isSquare( *dm ), "Non-square matrix detected" );
181 }
182 //**********************************************************************************************
183
184 //**Access operator*****************************************************************************
191 inline ReturnType operator()( size_t i, size_t j ) const {
192 BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
193 BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
194 return dm_(i,j);
195 }
196 //**********************************************************************************************
197
198 //**At function*********************************************************************************
206 inline ReturnType at( size_t i, size_t j ) const {
207 if( i >= dm_.rows() ) {
208 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
209 }
210 if( j >= dm_.columns() ) {
211 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
212 }
213 return (*this)(i,j);
214 }
215 //**********************************************************************************************
216
217 //**Load function*******************************************************************************
224 BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
225 BLAZE_INTERNAL_ASSERT( i < dm_.columns(), "Invalid row access index" );
226 BLAZE_INTERNAL_ASSERT( j < dm_.rows() , "Invalid column access index" );
227 BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
228 BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
229 return dm_.load(i,j);
230 }
231 //**********************************************************************************************
232
233 //**Low-level data access***********************************************************************
238 inline const ElementType* data() const noexcept {
239 return dm_.data();
240 }
241 //**********************************************************************************************
242
243 //**Begin function******************************************************************************
249 inline ConstIterator begin( size_t i ) const {
250 return ConstIterator( dm_.begin(i) );
251 }
252 //**********************************************************************************************
253
254 //**End function********************************************************************************
260 inline ConstIterator end( size_t i ) const {
261 return ConstIterator( dm_.end(i) );
262 }
263 //**********************************************************************************************
264
265 //**Rows function*******************************************************************************
270 inline size_t rows() const noexcept {
271 return dm_.rows();
272 }
273 //**********************************************************************************************
274
275 //**Columns function****************************************************************************
280 inline size_t columns() const noexcept {
281 return dm_.columns();
282 }
283 //**********************************************************************************************
284
285 //**Operand access******************************************************************************
290 inline Operand operand() const noexcept {
291 return dm_;
292 }
293 //**********************************************************************************************
294
295 //**********************************************************************************************
301 template< typename T >
302 inline bool canAlias( const T* alias ) const noexcept {
303 return dm_.canAlias( alias );
304 }
305 //**********************************************************************************************
306
307 //**********************************************************************************************
313 template< typename T >
314 inline bool isAliased( const T* alias ) const noexcept {
315 return dm_.isAliased( alias );
316 }
317 //**********************************************************************************************
318
319 //**********************************************************************************************
324 inline bool isAligned() const noexcept {
325 return dm_.isAligned();
326 }
327 //**********************************************************************************************
328
329 //**********************************************************************************************
334 inline bool canSMPAssign() const noexcept {
335 return dm_.canSMPAssign();
336 }
337 //**********************************************************************************************
338
339 private:
340 //**Member variables****************************************************************************
342 //**********************************************************************************************
343
344 //**Assignment to dense matrices****************************************************************
356 template< typename MT2 // Type of the target dense matrix
357 , bool SO2 > // Storage order of the target dense matrix
358 friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
360 {
362
363 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
364 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
365
366 assign( *lhs, rhs.dm_ );
367 }
369 //**********************************************************************************************
370
371 //**Assignment to sparse matrices***************************************************************
383 template< typename MT2 // Type of the target sparse matrix
384 , bool SO2 > // Storage order of the target dense matrix
385 friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
387 {
389
390 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
391 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
392
393 assign( *lhs, rhs.dm_ );
394 }
396 //**********************************************************************************************
397
398 //**Addition assignment to dense matrices*******************************************************
410 template< typename MT2 // Type of the target dense matrix
411 , bool SO2 > // Storage order of the target dense matrix
412 friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
413 -> EnableIf_t< UseAssign_v<MT2> >
414 {
416
417 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
418 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
419
420 addAssign( *lhs, rhs.dm_ );
421 }
423 //**********************************************************************************************
424
425 //**Addition assignment to sparse matrices******************************************************
437 template< typename MT2 // Type of the target sparse matrix
438 , bool SO2 > // Storage order of the target dense matrix
439 friend inline auto addAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
440 -> EnableIf_t< UseAssign_v<MT2> >
441 {
443
444 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
445 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
446
447 addAssign( *lhs, rhs.dm_ );
448 }
450 //**********************************************************************************************
451
452 //**Subtraction assignment to dense matrices****************************************************
464 template< typename MT2 // Type of the target dense matrix
465 , bool SO2 > // Storage order of the target dense matrix
466 friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
467 -> EnableIf_t< UseAssign_v<MT2> >
468 {
470
471 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
472 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
473
474 subAssign( *lhs, rhs.dm_ );
475 }
477 //**********************************************************************************************
478
479 //**Subtraction assignment to sparse matrices***************************************************
491 template< typename MT2 // Type of the target sparse matrix
492 , bool SO2 > // Storage order of the target dense matrix
493 friend inline auto subAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
494 -> EnableIf_t< UseAssign_v<MT2> >
495 {
497
498 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
499 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
500
501 subAssign( *lhs, rhs.dm_ );
502 }
504 //**********************************************************************************************
505
506 //**Schur product assignment to dense matrices**************************************************
518 template< typename MT2 // Type of the target dense matrix
519 , bool SO2 > // Storage order of the target dense matrix
520 friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
521 -> EnableIf_t< UseAssign_v<MT2> >
522 {
524
525 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
526 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
527
528 schurAssign( *lhs, rhs.dm_ );
529 }
531 //**********************************************************************************************
532
533 //**Schur product assignment to sparse matrices*************************************************
545 template< typename MT2 // Type of the target sparse matrix
546 , bool SO2 > // Storage order of the target dense matrix
547 friend inline auto schurAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
548 -> EnableIf_t< UseAssign_v<MT2> >
549 {
551
552 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
553 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
554
555 schurAssign( *lhs, rhs.dm_ );
556 }
558 //**********************************************************************************************
559
560 //**Multiplication assignment to dense matrices*************************************************
572 template< typename MT2 // Type of the target dense matrix
573 , bool SO2 > // Storage order of the target dense matrix
574 friend inline auto multAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
575 -> EnableIf_t< UseAssign_v<MT2> >
576 {
578
579 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
580 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
581
582 multAssign( *lhs, rhs.dm_ );
583 }
585 //**********************************************************************************************
586
587 //**Multiplication assignment to sparse matrices************************************************
599 template< typename MT2 // Type of the target sparse matrix
600 , bool SO2 > // Storage order of the target dense matrix
601 friend inline auto multAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
602 -> EnableIf_t< UseAssign_v<MT2> >
603 {
605
606 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
607 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
608
609 multAssign( *lhs, rhs.dm_ );
610 }
612 //**********************************************************************************************
613
614 //**SMP assignment to dense matrices************************************************************
626 template< typename MT2 // Type of the target dense matrix
627 , bool SO2 > // Storage order of the target dense matrix
628 friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
629 -> EnableIf_t< UseSMPAssign_v<MT2> >
630 {
632
633 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
634 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
635
636 smpAssign( *lhs, rhs.dm_ );
637 }
639 //**********************************************************************************************
640
641 //**SMP assignment to sparse matrices***********************************************************
653 template< typename MT2 // Type of the target sparse matrix
654 , bool SO2 > // Storage order of the target dense matrix
655 friend inline auto smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
656 -> EnableIf_t< UseSMPAssign_v<MT2> >
657 {
659
660 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
661 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
662
663 smpAssign( *lhs, rhs.dm_ );
664 }
666 //**********************************************************************************************
667
668 //**SMP addition assignment to dense matrices***************************************************
680 template< typename MT2 // Type of the target dense matrix
681 , bool SO2 > // Storage order of the target dense matrix
682 friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
683 -> EnableIf_t< UseSMPAssign_v<MT2> >
684 {
686
687 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
688 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
689
690 smpAddAssign( *lhs, rhs.dm_ );
691 }
693 //**********************************************************************************************
694
695 //**SMP addition assignment to sparse matrices**************************************************
707 template< typename MT2 // Type of the target sparse matrix
708 , bool SO2 > // Storage order of the target dense matrix
709 friend inline auto smpAddAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
710 -> EnableIf_t< UseSMPAssign_v<MT2> >
711 {
713
714 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
715 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
716
717 smpAddAssign( *lhs, rhs.dm_ );
718 }
720 //**********************************************************************************************
721
722 //**SMP subtraction assignment to dense matrices************************************************
734 template< typename MT2 // Type of the target dense matrix
735 , bool SO2 > // Storage order of the target dense matrix
736 friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
737 -> EnableIf_t< UseSMPAssign_v<MT2> >
738 {
740
741 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
742 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
743
744 smpSubAssign( *lhs, rhs.dm_ );
745 }
747 //**********************************************************************************************
748
749 //**SMP subtraction assignment to sparse matrices***********************************************
761 template< typename MT2 // Type of the target sparse matrix
762 , bool SO2 > // Storage order of the target dense matrix
763 friend inline auto smpSubAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
764 -> EnableIf_t< UseSMPAssign_v<MT2> >
765 {
767
768 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
769 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
770
771 smpSubAssign( *lhs, rhs.dm_ );
772 }
774 //**********************************************************************************************
775
776 //**SMP Schur product assignment to dense matrices**********************************************
788 template< typename MT2 // Type of the target dense matrix
789 , bool SO2 > // Storage order of the target dense matrix
790 friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
791 -> EnableIf_t< UseSMPAssign_v<MT2> >
792 {
794
795 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
796 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
797
798 smpSchurAssign( *lhs, rhs.dm_ );
799 }
801 //**********************************************************************************************
802
803 //**SMP Schur product assignment to sparse matrices*********************************************
815 template< typename MT2 // Type of the target sparse matrix
816 , bool SO2 > // Storage order of the target dense matrix
817 friend inline auto smpSchurAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
818 -> EnableIf_t< UseSMPAssign_v<MT2> >
819 {
821
822 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
823 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
824
825 smpSchurAssign( *lhs, rhs.dm_ );
826 }
828 //**********************************************************************************************
829
830 //**SMP multiplication assignment to dense matrices*********************************************
843 template< typename MT2 // Type of the target dense matrix
844 , bool SO2 > // Storage order of the target dense matrix
845 friend inline auto smpMultAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
846 -> EnableIf_t< UseSMPAssign_v<MT2> >
847 {
849
850 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
851 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
852
853 smpMultAssign( *lhs, rhs.dm_ );
854 }
856 //**********************************************************************************************
857
858 //**SMP multiplication assignment to sparse matrices********************************************
871 template< typename MT2 // Type of the target sparse matrix
872 , bool SO2 > // Storage order of the target dense matrix
873 friend inline auto smpMultAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
874 -> EnableIf_t< UseSMPAssign_v<MT2> >
875 {
877
878 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
879 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
880
881 smpMultAssign( *lhs, rhs.dm_ );
882 }
884 //**********************************************************************************************
885
886 //**Compile time checks*************************************************************************
893 //**********************************************************************************************
894};
895//*************************************************************************************************
896
897
898
899
900//=================================================================================================
901//
902// GLOBAL FUNCTIONS
903//
904//=================================================================================================
905
906//*************************************************************************************************
917template< typename MT // Type of the dense matrix
918 , bool SO // Storage order
919 , DisableIf_t< IsDiagonal_v<MT> >* = nullptr >
920inline const DMatDeclDiagExpr<MT,SO> decldiag_backend( const DenseMatrix<MT,SO>& dm )
921{
923
924 BLAZE_INTERNAL_ASSERT( isSquare( *dm ), "Non-square matrix detected" );
925
926 return DMatDeclDiagExpr<MT,SO>( *dm );
927}
929//*************************************************************************************************
930
931
932//*************************************************************************************************
943template< typename MT // Type of the dense matrix
944 , bool SO // Storage order
945 , EnableIf_t< IsDiagonal_v<MT> >* = nullptr >
946inline const MT& decldiag_backend( const DenseMatrix<MT,SO>& dm )
947{
949
950 BLAZE_INTERNAL_ASSERT( isSquare( *dm ), "Non-square matrix detected" );
951
952 return *dm;
953}
955//*************************************************************************************************
956
957
958//*************************************************************************************************
976template< typename MT // Type of the dense matrix
977 , bool SO > // Storage order
978inline decltype(auto) decldiag( const DenseMatrix<MT,SO>& dm )
979{
981
982 if( !isSquare( *dm ) ) {
983 BLAZE_THROW_INVALID_ARGUMENT( "Invalid diagonal matrix specification" );
984 }
985
986 return decldiag_backend( *dm );
987}
988//*************************************************************************************************
989
990
991
992
993//=================================================================================================
994//
995// HASCONSTDATAACCESS SPECIALIZATIONS
996//
997//=================================================================================================
998
999//*************************************************************************************************
1001template< typename MT, bool SO >
1002struct HasConstDataAccess< DMatDeclDiagExpr<MT,SO> >
1003 : public HasConstDataAccess<MT>
1004{};
1006//*************************************************************************************************
1007
1008
1009
1010
1011//=================================================================================================
1012//
1013// ISALIGNED SPECIALIZATIONS
1014//
1015//=================================================================================================
1016
1017//*************************************************************************************************
1019template< typename MT, bool SO >
1020struct IsAligned< DMatDeclDiagExpr<MT,SO> >
1021 : public IsAligned<MT>
1022{};
1024//*************************************************************************************************
1025
1026
1027
1028
1029//=================================================================================================
1030//
1031// ISSYMMETRIC SPECIALIZATIONS
1032//
1033//=================================================================================================
1034
1035//*************************************************************************************************
1037template< typename MT, bool SO >
1038struct IsSymmetric< DMatDeclDiagExpr<MT,SO> >
1039 : public TrueType
1040{};
1042//*************************************************************************************************
1043
1044
1045
1046
1047//=================================================================================================
1048//
1049// ISLOWER SPECIALIZATIONS
1050//
1051//=================================================================================================
1052
1053//*************************************************************************************************
1055template< typename MT, bool SO >
1056struct IsLower< DMatDeclDiagExpr<MT,SO> >
1057 : public TrueType
1058{};
1060//*************************************************************************************************
1061
1062
1063
1064
1065//=================================================================================================
1066//
1067// ISUPPER SPECIALIZATIONS
1068//
1069//=================================================================================================
1070
1071//*************************************************************************************************
1073template< typename MT, bool SO >
1074struct IsUpper< DMatDeclDiagExpr<MT,SO> >
1075 : public TrueType
1076{};
1078//*************************************************************************************************
1079
1080} // namespace blaze
1081
1082#endif
Header file for auxiliary alias declarations.
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::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 decldiag trait.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the GetMemberType type trait.
Header file for the HasConstDataAccess type trait.
Header file for the If class template.
Header file for the IntegralConstant class template.
Utility type for generic codes.
Header file for the IsAligned type trait.
Header file for the IsDiagonal type trait.
Header file for the IsExpression type trait class.
Header file for the IsLower type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUpper type trait.
Header file for the SIMD trait.
Header file for the implementation of the base template of the DiagonalMatrix.
Expression object for the explicit diagonal declaration of dense matrices.
Definition: DMatDeclDiagExpr.h:96
Operand dm_
Dense matrix of the decldiag expression.
Definition: DMatDeclDiagExpr.h:341
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDeclDiagExpr.h:144
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatDeclDiagExpr.h:161
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatDeclDiagExpr.h:99
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatDeclDiagExpr.h:260
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDeclDiagExpr.h:206
DMatDeclDiagExpr(const MT &dm) noexcept
Constructor for the DMatDeclDiagExpr class.
Definition: DMatDeclDiagExpr.h:177
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDeclDiagExpr.h:280
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the diagonal declaration expression.
Definition: DMatDeclDiagExpr.h:113
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: DMatDeclDiagExpr.h:147
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatDeclDiagExpr.h:249
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDeclDiagExpr.h:302
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDeclDiagExpr.h:224
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
ElementType_t< MT > ElementType
Resulting element type.
Definition: DMatDeclDiagExpr.h:146
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatDeclDiagExpr.h:164
If_t< RequiresEvaluation_v< MT >, const ResultType, const DMatDeclDiagExpr & > CompositeType
Data type for composite expression templates.
Definition: DMatDeclDiagExpr.h:150
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDeclDiagExpr.h:334
GetConstIterator_t< MT > ConstIterator
Iterator over the elements of the dense matrix.
Definition: DMatDeclDiagExpr.h:153
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDeclDiagExpr.h:314
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDeclDiagExpr.h:191
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite data type of the dense matrix expression.
Definition: DMatDeclDiagExpr.h:156
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDeclDiagExpr.h:270
const ElementType * data() const noexcept
Low-level data access to the matrix elements.
Definition: DMatDeclDiagExpr.h:238
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDeclDiagExpr.h:324
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDeclDiagExpr.h:145
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatDeclDiagExpr.h:290
DeclDiagTrait_t< RT > ResultType
Result type for expression template evaluations.
Definition: DMatDeclDiagExpr.h:143
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatDeclDiagExpr.h:169
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 DeclDiagExpr base class.
Header file for the Declaration base class.
Header file for the DenseMatrix base class.
decltype(auto) decldiag(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as diagonal.
Definition: DMatDeclDiagExpr.h:978
#define BLAZE_CONSTRAINT_MUST_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.
Definition: MatMatMultExpr.h:83
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_DIAGONAL_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Diagonal.h:79
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
typename DeclDiagTrait< MT >::Type DeclDiagTrait_t
Auxiliary alias declaration for the DeclDiagTrait type trait.
Definition: DeclDiagTrait.h:145
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
#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 smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:192
auto 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
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_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 all forward declarations for sparse vectors and matrices.
Base class for all decldiag expression templates.
Definition: DeclDiagExpr.h:68
Base class for all declaration expression templates.
Definition: Declaration.h:76
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.