Blaze  3.6
SMatDeclSymExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDECLSYMEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATDECLSYMEXPR_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 SMATDECLSYMEXPR
77 //
78 //=================================================================================================
79 
80 //*************************************************************************************************
87 template< typename MT // Type of the sparse matrix
88  , bool SO > // Storage order
89 class SMatDeclSymExpr
90  : public DeclSymExpr< SparseMatrix< SMatDeclSymExpr<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 SMatDeclSymExpr( const MT& sm ) noexcept
162  : sm_( sm ) // Sparse matrix of the declsym 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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 SMatDeclSymExpr& 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< IsSymmetric_v<MT> || IsUniTriangular_v<MT> >* = nullptr >
889 inline const SMatDeclSymExpr<MT,SO> declsym_backend( const SparseMatrix<MT,SO>& sm )
890 {
892 
893  BLAZE_INTERNAL_ASSERT( isSquare( ~sm ), "Non-square matrix detected" );
894 
895  return SMatDeclSymExpr<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< !IsSymmetric_v<MT> && IsUniTriangular_v<MT> >* = nullptr >
915 inline const IdentityMatrix<ElementType_t<MT>,SO> declsym_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< IsSymmetric_v<MT> >* = nullptr >
941 inline const MT& declsym_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) declsym( const SparseMatrix<MT,SO>& sm )
975 {
977 
978  if( !isSquare( ~sm ) ) {
979  BLAZE_THROW_INVALID_ARGUMENT( "Invalid symmetric matrix specification" );
980  }
981 
982  return declsym_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< IsSymmetric_v<MT> >* = nullptr >
1013 inline decltype(auto) declsym( const SMatScalarMultExpr<MT,ST,SO>& sm )
1014 {
1016 
1017  if( !isSquare( ~sm ) ) {
1018  BLAZE_THROW_INVALID_ARGUMENT( "Invalid symmetric matrix specification" );
1019  }
1020 
1021  return declsym( sm.leftOperand() ) * sm.rightOperand();
1022 }
1024 //*************************************************************************************************
1025 
1026 
1027 
1028 
1029 //=================================================================================================
1030 //
1031 // ISSYMMETRIC SPECIALIZATIONS
1032 //
1033 //=================================================================================================
1034 
1035 //*************************************************************************************************
1037 template< typename MT, bool SO >
1038 struct IsSymmetric< SMatDeclSymExpr<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.
SMatDeclSymExpr(const MT &sm) noexcept
Constructor for the SMatDeclSymExpr class.
Definition: SMatDeclSymExpr.h:161
Header file for basic type definitions.
Header file for all forward declarations for sparse vectors and matrices.
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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDeclSymExpr.h:293
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
#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
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
Header file for the RequiresEvaluation type trait.
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatDeclSymExpr.h:136
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
Operand sm_
Sparse matrix of the declsym expression.
Definition: SMatDeclSymExpr.h:310
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatDeclSymExpr.h:218
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
Header file for the implementation of the base template of the SymmetricMatrix.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatDeclSymExpr.h:259
Header file for the SparseMatrix base class.
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatDeclSymExpr.h:190
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
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatDeclSymExpr.h:207
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDeclSymExpr.h:137
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatDeclSymExpr.h:228
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the symmetry declaration expression.
Definition: SMatDeclSymExpr.h:109
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDeclSymExpr.h:303
#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
Header file for the GetMemberType type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatDeclSymExpr.h:281
Header file for the IsUniTriangular type trait.
Constraints on the storage order of matrix types.
GetConstIterator_t< MT > ConstIterator
Iterator over the elements of the dense matrix.
Definition: SMatDeclSymExpr.h:145
Header file for the exception macros of the math module.
Header file for the EnableIf class template.
Header file for the DeclSymExpr base class.
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.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatDeclSymExpr.h:175
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type,...
Definition: Symmetric.h:79
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.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatDeclSymExpr.h:153
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatDeclSymExpr.h:269
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
typename DeclSymTrait< MT >::Type DeclSymTrait_t
Auxiliary alias declaration for the DeclSymTrait type trait.The DeclSymTrait_t alias declaration prov...
Definition: DeclSymTrait.h:160
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatDeclSymExpr.h:248
Header file for the declsym trait.
#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.
decltype(auto) declsym(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as symmetric.
Definition: DMatDeclSymExpr.h:1002
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
Constraint on the data type.
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
ElementType_t< MT > ElementType
Resulting element type.
Definition: SMatDeclSymExpr.h:138
DeclSymTrait_t< RT > ResultType
Result type for expression template evaluations.
Definition: SMatDeclSymExpr.h:135
Expression object for the explicit symmetry declaration of sparse matrices.The SMatDeclSymExpr class ...
Definition: Forward.h:118
If_t< RequiresEvaluation_v< MT >, const ResultType, const SMatDeclSymExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatDeclSymExpr.h:142
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
Header file for the IntegralConstant class template.
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatDeclSymExpr.h:139
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatDeclSymExpr.h:238
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite data type of the sparse matrix expression.
Definition: SMatDeclSymExpr.h:148
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatDeclSymExpr.h:95
#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
Header file for the IsExpression type trait class.
Header file for the function trace functionality.