Blaze  3.6
SMatDeclHermExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDECLHERMEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATDECLHERMEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
61 #include <blaze/util/Assert.h>
62 #include <blaze/util/DisableIf.h>
63 #include <blaze/util/EnableIf.h>
66 #include <blaze/util/InvalidType.h>
67 #include <blaze/util/mpl/If.h>
68 #include <blaze/util/Types.h>
70 
71 
72 namespace blaze {
73 
74 //=================================================================================================
75 //
76 // CLASS SMATDECLHERMEXPR
77 //
78 //=================================================================================================
79 
80 //*************************************************************************************************
87 template< typename MT // Type of the sparse matrix
88  , bool SO > // Storage order
89 class SMatDeclHermExpr
90  : public DeclHermExpr< SparseMatrix< SMatDeclHermExpr<MT,SO>, SO > >
91  , public Declaration<MT>
92 {
93  private:
94  //**Type definitions****************************************************************************
95  using RT = ResultType_t<MT>;
96 
98  BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT( GetConstIterator, ConstIterator, INVALID_TYPE );
99  //**********************************************************************************************
100 
101  //**Serial evaluation strategy******************************************************************
103 
109  static constexpr bool useAssign = RequiresEvaluation_v<MT>;
110 
112  template< typename MT2 >
114  static constexpr bool UseAssign_v = useAssign;
116  //**********************************************************************************************
117 
118  //**Parallel evaluation strategy****************************************************************
120 
126  template< typename MT2 >
127  static constexpr bool UseSMPAssign_v = ( MT2::smpAssignable && useAssign );
129  //**********************************************************************************************
130 
131  public:
132  //**Type definitions****************************************************************************
140 
143 
145  using ConstIterator = GetConstIterator_t<MT>;
146 
148  using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
149  //**********************************************************************************************
150 
151  //**Compilation flags***************************************************************************
153  static constexpr bool smpAssignable = MT::smpAssignable;
154  //**********************************************************************************************
155 
156  //**Constructor*********************************************************************************
161  explicit inline SMatDeclHermExpr( const MT& sm ) noexcept
162  : sm_( sm ) // Sparse matrix of the declherm expression
163  {
164  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
165  }
166  //**********************************************************************************************
167 
168  //**Access operator*****************************************************************************
175  inline ReturnType operator()( size_t i, size_t j ) const {
176  BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
177  BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
178  return sm_(i,j);
179  }
180  //**********************************************************************************************
181 
182  //**At function*********************************************************************************
190  inline ReturnType at( size_t i, size_t j ) const {
191  if( i >= sm_.rows() ) {
192  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
193  }
194  if( j >= sm_.columns() ) {
195  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
196  }
197  return (*this)(i,j);
198  }
199  //**********************************************************************************************
200 
201  //**Begin function******************************************************************************
207  inline ConstIterator begin( size_t i ) const {
208  return ConstIterator( sm_.begin(i) );
209  }
210  //**********************************************************************************************
211 
212  //**End function********************************************************************************
218  inline ConstIterator end( size_t i ) const {
219  return ConstIterator( sm_.end(i) );
220  }
221  //**********************************************************************************************
222 
223  //**Rows function*******************************************************************************
228  inline size_t rows() const noexcept {
229  return sm_.rows();
230  }
231  //**********************************************************************************************
232 
233  //**Columns function****************************************************************************
238  inline size_t columns() const noexcept {
239  return sm_.columns();
240  }
241  //**********************************************************************************************
242 
243  //**NonZeros function***************************************************************************
248  inline size_t nonZeros() const {
249  return sm_.nonZeros();
250  }
251  //**********************************************************************************************
252 
253  //**NonZeros function***************************************************************************
259  inline size_t nonZeros( size_t i ) const {
260  return sm_.nonZeros(i);
261  }
262  //**********************************************************************************************
263 
264  //**Operand access******************************************************************************
269  inline Operand operand() const noexcept {
270  return sm_;
271  }
272  //**********************************************************************************************
273 
274  //**********************************************************************************************
280  template< typename T >
281  inline bool canAlias( const T* alias ) const noexcept {
282  return sm_.canAlias( alias );
283  }
284  //**********************************************************************************************
285 
286  //**********************************************************************************************
292  template< typename T >
293  inline bool isAliased( const T* alias ) const noexcept {
294  return sm_.isAliased( alias );
295  }
296  //**********************************************************************************************
297 
298  //**********************************************************************************************
303  inline bool canSMPAssign() const noexcept {
304  return sm_.canSMPAssign();
305  }
306  //**********************************************************************************************
307 
308  private:
309  //**Member variables****************************************************************************
311  //**********************************************************************************************
312 
313  //**Assignment to dense matrices****************************************************************
325  template< typename MT2 // Type of the target dense matrix
326  , bool SO2 > // Storage order of the target dense matrix
327  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
329  {
331 
332  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
333  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
334 
335  assign( ~lhs, rhs.sm_ );
336  }
338  //**********************************************************************************************
339 
340  //**Assignment to sparse matrices***************************************************************
352  template< typename MT2 // Type of the target sparse matrix
353  , bool SO2 > // Storage order of the target sparse matrix
354  friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
356  {
358 
359  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
360  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
361 
362  assign( ~lhs, rhs.sm_ );
363  }
365  //**********************************************************************************************
366 
367  //**Addition assignment to dense matrices*******************************************************
379  template< typename MT2 // Type of the target dense matrix
380  , bool SO2 > // Storage order of the target dense matrix
381  friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
382  -> EnableIf_t< UseAssign_v<MT2> >
383  {
385 
386  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
387  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
388 
389  addAssign( ~lhs, rhs.sm_ );
390  }
392  //**********************************************************************************************
393 
394  //**Addition assignment to sparse matrices******************************************************
406  template< typename MT2 // Type of the target sparse matrix
407  , bool SO2 > // Storage order of the target sparse matrix
408  friend inline auto addAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
409  -> EnableIf_t< UseAssign_v<MT2> >
410  {
412 
413  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
414  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
415 
416  addAssign( ~lhs, rhs.sm_ );
417  }
419  //**********************************************************************************************
420 
421  //**Subtraction assignment to dense matrices****************************************************
433  template< typename MT2 // Type of the target dense matrix
434  , bool SO2 > // Storage order of the target dense matrix
435  friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
436  -> EnableIf_t< UseAssign_v<MT2> >
437  {
439 
440  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
441  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
442 
443  subAssign( ~lhs, rhs.sm_ );
444  }
446  //**********************************************************************************************
447 
448  //**Subtraction assignment to sparse matrices***************************************************
460  template< typename MT2 // Type of the target sparse matrix
461  , bool SO2 > // Storage order of the target sparse matrix
462  friend inline auto subAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
463  -> EnableIf_t< UseAssign_v<MT2> >
464  {
466 
467  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
468  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
469 
470  subAssign( ~lhs, rhs.sm_ );
471  }
473  //**********************************************************************************************
474 
475  //**Schur product assignment to dense matrices**************************************************
487  template< typename MT2 // Type of the target dense matrix
488  , bool SO2 > // Storage order of the target dense matrix
489  friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
490  -> EnableIf_t< UseAssign_v<MT2> >
491  {
493 
494  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
495  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
496 
497  schurAssign( ~lhs, rhs.sm_ );
498  }
500  //**********************************************************************************************
501 
502  //**Schur product assignment to sparse matrices*************************************************
514  template< typename MT2 // Type of the target sparse matrix
515  , bool SO2 > // Storage order of the target sparse matrix
516  friend inline auto schurAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
517  -> EnableIf_t< UseAssign_v<MT2> >
518  {
520 
521  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
522  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
523 
524  schurAssign( ~lhs, rhs.sm_ );
525  }
527  //**********************************************************************************************
528 
529  //**Multiplication assignment to dense matrices*************************************************
541  template< typename MT2 // Type of the target dense matrix
542  , bool SO2 > // Storage order of the target dense matrix
543  friend inline auto multAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
544  -> EnableIf_t< UseAssign_v<MT2> >
545  {
547 
548  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
549  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
550 
551  multAssign( ~lhs, rhs.sm_ );
552  }
554  //**********************************************************************************************
555 
556  //**Multiplication assignment to sparse matrices************************************************
568  template< typename MT2 // Type of the target sparse matrix
569  , bool SO2 > // Storage order of the target sparse matrix
570  friend inline auto multAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
571  -> EnableIf_t< UseAssign_v<MT2> >
572  {
574 
575  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
576  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
577 
578  multAssign( ~lhs, rhs.sm_ );
579  }
581  //**********************************************************************************************
582 
583  //**SMP assignment to dense matrices************************************************************
595  template< typename MT2 // Type of the target dense matrix
596  , bool SO2 > // Storage order of the target dense matrix
597  friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
598  -> EnableIf_t< UseSMPAssign_v<MT2> >
599  {
601 
602  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
603  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
604 
605  smpAssign( ~lhs, rhs.sm_ );
606  }
608  //**********************************************************************************************
609 
610  //**SMP assignment to sparse matrices***********************************************************
622  template< typename MT2 // Type of the target sparse matrix
623  , bool SO2 > // Storage order of the target sparse matrix
624  friend inline auto smpAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
625  -> EnableIf_t< UseSMPAssign_v<MT2> >
626  {
628 
629  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
630  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
631 
632  smpAssign( ~lhs, rhs.sm_ );
633  }
635  //**********************************************************************************************
636 
637  //**SMP addition assignment to dense matrices***************************************************
649  template< typename MT2 // Type of the target dense matrix
650  , bool SO2 > // Storage order of the target dense matrix
651  friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
652  -> EnableIf_t< UseSMPAssign_v<MT2> >
653  {
655 
656  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
657  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
658 
659  smpAddAssign( ~lhs, rhs.sm_ );
660  }
662  //**********************************************************************************************
663 
664  //**SMP addition assignment to sparse matrices**************************************************
676  template< typename MT2 // Type of the target sparse matrix
677  , bool SO2 > // Storage order of the target sparse matrix
678  friend inline auto smpAddAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
679  -> EnableIf_t< UseSMPAssign_v<MT2> >
680  {
682 
683  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
684  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
685 
686  smpAddAssign( ~lhs, rhs.sm_ );
687  }
689  //**********************************************************************************************
690 
691  //**SMP subtraction assignment to dense matrices************************************************
703  template< typename MT2 // Type of the target dense matrix
704  , bool SO2 > // Storage order of the target dense matrix
705  friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
706  -> EnableIf_t< UseSMPAssign_v<MT2> >
707  {
709 
710  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
711  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
712 
713  smpSubAssign( ~lhs, rhs.sm_ );
714  }
716  //**********************************************************************************************
717 
718  //**SMP subtraction assignment to sparse matrices***********************************************
730  template< typename MT2 // Type of the target sparse matrix
731  , bool SO2 > // Storage order of the target sparse matrix
732  friend inline auto smpSubAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
733  -> EnableIf_t< UseSMPAssign_v<MT2> >
734  {
736 
737  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
738  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
739 
740  smpSubAssign( ~lhs, rhs.sm_ );
741  }
743  //**********************************************************************************************
744 
745  //**SMP Schur product assignment to dense matrices**********************************************
757  template< typename MT2 // Type of the target dense matrix
758  , bool SO2 > // Storage order of the target dense matrix
759  friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
760  -> EnableIf_t< UseSMPAssign_v<MT2> >
761  {
763 
764  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
765  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
766 
767  smpSchurAssign( ~lhs, rhs.sm_ );
768  }
770  //**********************************************************************************************
771 
772  //**SMP Schur product assignment to sparse matrices*********************************************
784  template< typename MT2 // Type of the target sparse matrix
785  , bool SO2 > // Storage order of the target sparse matrix
786  friend inline auto smpSchurAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
787  -> EnableIf_t< UseSMPAssign_v<MT2> >
788  {
790 
791  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
792  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
793 
794  smpSchurAssign( ~lhs, rhs.sm_ );
795  }
797  //**********************************************************************************************
798 
799  //**SMP multiplication assignment to dense matrices*********************************************
812  template< typename MT2 // Type of the target dense matrix
813  , bool SO2 > // Storage order of the target dense matrix
814  friend inline auto smpMultAssign( DenseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
815  -> EnableIf_t< UseSMPAssign_v<MT2> >
816  {
818 
819  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
820  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
821 
822  smpMultAssign( ~lhs, rhs.sm_ );
823  }
825  //**********************************************************************************************
826 
827  //**SMP multiplication assignment to sparse matrices********************************************
840  template< typename MT2 // Type of the target sparse matrix
841  , bool SO2 > // Storage order of the target sparse matrix
842  friend inline auto smpMultAssign( SparseMatrix<MT2,SO2>& lhs, const SMatDeclHermExpr& rhs )
843  -> EnableIf_t< UseSMPAssign_v<MT2> >
844  {
846 
847  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
848  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
849 
850  smpMultAssign( ~lhs, rhs.sm_ );
851  }
853  //**********************************************************************************************
854 
855  //**Compile time checks*************************************************************************
862  //**********************************************************************************************
863 };
864 //*************************************************************************************************
865 
866 
867 
868 
869 //=================================================================================================
870 //
871 // GLOBAL FUNCTIONS
872 //
873 //=================================================================================================
874 
875 //*************************************************************************************************
886 template< typename MT // Type of the sparse matrix
887  , bool SO // Storage order
888  , DisableIf_t< IsHermitian_v<MT> || IsUniTriangular_v<MT> >* = nullptr >
889 inline const SMatDeclHermExpr<MT,SO> declherm_backend( const SparseMatrix<MT,SO>& sm )
890 {
892 
893  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
894 
895  return SMatDeclHermExpr<MT,SO>( ~sm );
896 }
898 //*************************************************************************************************
899 
900 
901 //*************************************************************************************************
912 template< typename MT // Type of the sparse matrix
913  , bool SO // Storage order
914  , EnableIf_t< !IsHermitian_v<MT> && IsUniTriangular_v<MT> >* = nullptr >
915 inline const IdentityMatrix<ElementType_t<MT>,SO> declherm_backend( const SparseMatrix<MT,SO>& sm )
916 {
918 
919  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
920 
921  return IdentityMatrix<ElementType_t<MT>,SO>( (~sm).rows() );
922 }
924 //*************************************************************************************************
925 
926 
927 //*************************************************************************************************
938 template< typename MT // Type of the sparse matrix
939  , bool SO // Storage order
940  , EnableIf_t< IsHermitian_v<MT> >* = nullptr >
941 inline const MT& declherm_backend( const SparseMatrix<MT,SO>& sm )
942 {
944 
945  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
946 
947  return ~sm;
948 }
950 //*************************************************************************************************
951 
952 
953 //*************************************************************************************************
972 template< typename MT // Type of the sparse matrix
973  , bool SO > // Storage order
974 inline decltype(auto) declherm( const SparseMatrix<MT,SO>& sm )
975 {
977 
978  if( !isSquare( ~sm ) ) {
979  BLAZE_THROW_INVALID_ARGUMENT( "Invalid Hermitian matrix specification" );
980  }
981 
982  return declherm_backend( ~sm );
983 }
984 //*************************************************************************************************
985 
986 
987 
988 
989 //=================================================================================================
990 //
991 // GLOBAL RESTRUCTURING FUNCTIONS
992 //
993 //=================================================================================================
994 
995 //*************************************************************************************************
1009 template< typename MT // Type of the left-hand side sparse matrix
1010  , typename ST // Type of the right-hand side scalar value
1011  , bool SO // Storage order
1012  , DisableIf_t< IsHermitian_v<MT> >* = nullptr >
1013 inline decltype(auto) declherm( const SMatScalarMultExpr<MT,ST,SO>& sm )
1014 {
1016 
1017  if( !isSquare( ~sm ) ) {
1018  BLAZE_THROW_INVALID_ARGUMENT( "Invalid Hermitian matrix specification" );
1019  }
1020 
1021  return declherm( sm.leftOperand() ) * sm.rightOperand();
1022 }
1024 //*************************************************************************************************
1025 
1026 
1027 
1028 
1029 //=================================================================================================
1030 //
1031 // ISHERMITIAN SPECIALIZATIONS
1032 //
1033 //=================================================================================================
1034 
1035 //*************************************************************************************************
1037 template< typename MT, bool SO >
1038 struct IsHermitian< SMatDeclHermExpr<MT,SO> >
1039  : public TrueType
1040 {};
1042 //*************************************************************************************************
1043 
1044 } // namespace blaze
1045 
1046 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatDeclHermExpr.h:248
Header file for basic type definitions.
Header file for all forward declarations for sparse vectors and matrices.
typename DeclHermTrait< MT >::Type DeclHermTrait_t
Auxiliary alias declaration for the DeclHermTrait type trait.The DeclHermTrait_t alias declaration pr...
Definition: DeclHermTrait.h:160
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
Header file for the declherm trait.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDeclHermExpr.h:293
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDeclHermExpr.h:137
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatDeclHermExpr.h:153
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDeclHermExpr.h:303
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatDeclHermExpr.h:228
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
GetConstIterator_t< MT > ConstIterator
Iterator over the elements of the dense matrix.
Definition: SMatDeclHermExpr.h:145
Header file for the RequiresEvaluation type trait.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatDeclHermExpr.h:175
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes....
Definition: DenseMatrix.h:81
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes....
Definition: Forward.h:145
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Constraint on the data type.
Header file for the SparseMatrix base class.
Operand sm_
Sparse matrix of the declherm expression.
Definition: SMatDeclHermExpr.h:310
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatDeclHermExpr.h:190
SMatDeclHermExpr(const MT &sm) noexcept
Constructor for the SMatDeclHermExpr class.
Definition: SMatDeclHermExpr.h:161
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the DeclHermExpr base class.
Header file for the If class template.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatDeclHermExpr.h:281
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatDeclHermExpr.h:269
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
DeclHermTrait_t< RT > ResultType
Result type for expression template evaluations.
Definition: SMatDeclHermExpr.h:135
Header file for the GetMemberType type trait.
Header file for the IsUniTriangular type trait.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the Hermitian declaration expression.
Definition: SMatDeclHermExpr.h:109
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatDeclHermExpr.h:218
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatDeclHermExpr.h:95
Header file for the implementation of the base template of the HeritianMatrix.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatDeclHermExpr.h:238
Header file for the EnableIf class template.
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
Constraint on the data type.
Header file for the Declaration base class.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatDeclHermExpr.h:259
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
Utility type for generic codes.
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
If_t< RequiresEvaluation_v< MT >, const ResultType, const SMatDeclHermExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatDeclHermExpr.h:142
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatDeclHermExpr.h:136
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for all forward declarations for expression class templates.
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
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Expression object for the explicit Hermitian declaration of sparse matrices.The SMatDeclHermExpr clas...
Definition: Forward.h:116
ElementType_t< MT > ElementType
Resulting element type.
Definition: SMatDeclHermExpr.h:138
decltype(auto) declherm(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as Hermitian.
Definition: DMatDeclHermExpr.h:1002
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
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatDeclHermExpr.h:139
Header file for the IntegralConstant class template.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatDeclHermExpr.h:207
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type,...
Definition: Hermitian.h:79
Header file for the IsHermitian type trait.
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
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:191
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type,...
Definition: SparseMatrix.h:61
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite data type of the sparse matrix expression.
Definition: SMatDeclHermExpr.h:148
Header file for the IsExpression type trait class.
Header file for the function trace functionality.