SMatEvalExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATEVALEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATEVALEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <cmath>
44 #include <blaze/math/Aliases.h>
47 #include <blaze/math/Exception.h>
72 #include <blaze/util/Assert.h>
75 #include <blaze/util/InvalidType.h>
77 #include <blaze/util/mpl/And.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS SMATEVALEXPR
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
97 template< typename MT // Type of the sparse matrix
98  , bool SO > // Storage order
99 class SMatEvalExpr : public SparseMatrix< SMatEvalExpr<MT,SO>, SO >
100  , private MatEvalExpr
101  , private Computation
102 {
103  public:
104  //**Type definitions****************************************************************************
111 
113  typedef const ResultType CompositeType;
114 
116  typedef If_< IsExpression<MT>, const MT, const MT& > Operand;
117  //**********************************************************************************************
118 
119  //**Compilation flags***************************************************************************
121  enum : bool { smpAssignable = MT::smpAssignable };
122  //**********************************************************************************************
123 
124  //**Constructor*********************************************************************************
129  explicit inline SMatEvalExpr( const MT& sm ) noexcept
130  : sm_( sm ) // Sparse matrix of the evaluation expression
131  {}
132  //**********************************************************************************************
133 
134  //**Access operator*****************************************************************************
141  inline ReturnType operator()( size_t i, size_t j ) const {
142  BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
143  BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
144  return sm_(i,j);
145  }
146  //**********************************************************************************************
147 
148  //**At function*********************************************************************************
156  inline ReturnType at( size_t i, size_t j ) const {
157  if( i >= sm_.rows() ) {
158  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
159  }
160  if( j >= sm_.columns() ) {
161  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
162  }
163  return (*this)(i,j);
164  }
165  //**********************************************************************************************
166 
167  //**Rows function*******************************************************************************
172  inline size_t rows() const noexcept {
173  return sm_.rows();
174  }
175  //**********************************************************************************************
176 
177  //**Columns function****************************************************************************
182  inline size_t columns() const noexcept {
183  return sm_.columns();
184  }
185  //**********************************************************************************************
186 
187  //**NonZeros function***************************************************************************
192  inline size_t nonZeros() const {
193  return sm_.nonZeros();
194  }
195  //**********************************************************************************************
196 
197  //**NonZeros function***************************************************************************
203  inline size_t nonZeros( size_t i ) const {
204  return sm_.nonZeros(i);
205  }
206  //**********************************************************************************************
207 
208  //**Operand access******************************************************************************
213  inline Operand operand() const noexcept {
214  return sm_;
215  }
216  //**********************************************************************************************
217 
218  //**********************************************************************************************
224  template< typename T >
225  inline bool canAlias( const T* alias ) const noexcept {
226  return sm_.canAlias( alias );
227  }
228  //**********************************************************************************************
229 
230  //**********************************************************************************************
236  template< typename T >
237  inline bool isAliased( const T* alias ) const noexcept {
238  return sm_.isAliased( alias );
239  }
240  //**********************************************************************************************
241 
242  //**********************************************************************************************
247  inline bool canSMPAssign() const noexcept {
248  return sm_.canSMPAssign();
249  }
250  //**********************************************************************************************
251 
252  private:
253  //**Member variables****************************************************************************
254  Operand sm_;
255  //**********************************************************************************************
256 
257  //**Assignment to dense matrices****************************************************************
269  template< typename MT2 // Type of the target dense matrix
270  , bool SO2 > // Storage order of the target dense matrix
271  friend inline void assign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
272  {
274 
275  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
276  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
277 
278  assign( ~lhs, rhs.sm_ );
279  }
281  //**********************************************************************************************
282 
283  //**Assignment to sparse matrices***************************************************************
295  template< typename MT2 // Type of the target sparse matrix
296  , bool SO2 > // Storage order of the target sparse matrix
297  friend inline void assign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
298  {
300 
301  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
302  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
303 
304  assign( ~lhs, rhs.sm_ );
305  }
307  //**********************************************************************************************
308 
309  //**Addition assignment to dense matrices*******************************************************
321  template< typename MT2 // Type of the target dense matrix
322  , bool SO2 > // Storage order of the target dense matrix
323  friend inline void addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
324  {
326 
327  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
328  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
329 
330  addAssign( ~lhs, rhs.sm_ );
331  }
333  //**********************************************************************************************
334 
335  //**Addition assignment to sparse matrices******************************************************
347  template< typename MT2 // Type of the target sparse matrix
348  , bool SO2 > // Storage order of the target sparse matrix
349  friend inline void addAssign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
350  {
352 
353  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
354  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
355 
356  addAssign( ~lhs, rhs.sm_ );
357  }
359  //**********************************************************************************************
360 
361  //**Subtraction assignment to dense matrices****************************************************
373  template< typename MT2 // Type of the target dense matrix
374  , bool SO2 > // Storage order of the target dense matrix
375  friend inline void subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
376  {
378 
379  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
380  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
381 
382  subAssign( ~lhs, rhs.sm_ );
383  }
385  //**********************************************************************************************
386 
387  //**Subtraction assignment to sparse matrices***************************************************
399  template< typename MT2 // Type of the target sparse matrix
400  , bool SO2 > // Storage order of the target sparse matrix
401  friend inline void subAssign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
402  {
404 
405  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
406  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
407 
408  subAssign( ~lhs, rhs.sm_ );
409  }
411  //**********************************************************************************************
412 
413  //**Multiplication assignment to dense matrices*************************************************
425  template< typename MT2 // Type of the target dense matrix
426  , bool SO2 > // Storage order of the target dense matrix
427  friend inline void multAssign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
428  {
430 
431  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
432  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
433 
434  multAssign( ~lhs, rhs.sm_ );
435  }
437  //**********************************************************************************************
438 
439  //**Multiplication assignment to sparse matrices************************************************
451  template< typename MT2 // Type of the target sparse matrix
452  , bool SO2 > // Storage order of the target sparse matrix
453  friend inline void multAssign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
454  {
456 
457  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
458  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
459 
460  multAssign( ~lhs, rhs.sm_ );
461  }
463  //**********************************************************************************************
464 
465  //**SMP assignment to dense matrices************************************************************
477  template< typename MT2 // Type of the target dense matrix
478  , bool SO2 > // Storage order of the target dense matrix
479  friend inline void smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
480  {
482 
483  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
484  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
485 
486  smpAssign( ~lhs, rhs.sm_ );
487  }
489  //**********************************************************************************************
490 
491  //**SMP assignment to sparse matrices***********************************************************
503  template< typename MT2 // Type of the target sparse matrix
504  , bool SO2 > // Storage order of the target sparse matrix
505  friend inline void smpAssign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
506  {
508 
509  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
510  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
511 
512  smpAssign( ~lhs, rhs.sm_ );
513  }
515  //**********************************************************************************************
516 
517  //**SMP addition assignment to dense matrices***************************************************
529  template< typename MT2 // Type of the target dense matrix
530  , bool SO2 > // Storage order of the target dense matrix
531  friend inline void smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
532  {
534 
535  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
536  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
537 
538  smpAddAssign( ~lhs, rhs.sm_ );
539  }
541  //**********************************************************************************************
542 
543  //**SMP addition assignment to sparse matrices**************************************************
555  template< typename MT2 // Type of the target sparse matrix
556  , bool SO2 > // Storage order of the target sparse matrix
557  friend inline void smpAddAssign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
558  {
560 
561  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
562  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
563 
564  smpAddAssign( ~lhs, rhs.sm_ );
565  }
567  //**********************************************************************************************
568 
569  //**SMP subtraction assignment to dense matrices************************************************
581  template< typename MT2 // Type of the target dense matrix
582  , bool SO2 > // Storage order of the target dense matrix
583  friend inline void smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
584  {
586 
587  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
588  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
589 
590  smpSubAssign( ~lhs, rhs.sm_ );
591  }
593  //**********************************************************************************************
594 
595  //**SMP subtraction assignment to sparse matrices***********************************************
607  template< typename MT2 // Type of the target sparse matrix
608  , bool SO2 > // Storage order of the target sparse matrix
609  friend inline void smpSubAssign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
610  {
612 
613  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
614  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
615 
616  smpSubAssign( ~lhs, rhs.sm_ );
617  }
619  //**********************************************************************************************
620 
621  //**SMP multiplication assignment to dense matrices*********************************************
634  template< typename MT2 // Type of the target dense matrix
635  , bool SO2 > // Storage order of the target dense matrix
636  friend inline void smpMultAssign( DenseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
637  {
639 
640  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
641  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
642 
643  smpMultAssign( ~lhs, rhs.sm_ );
644  }
646  //**********************************************************************************************
647 
648  //**SMP multiplication assignment to sparse matrices********************************************
661  template< typename MT2 // Type of the target sparse matrix
662  , bool SO2 > // Storage order of the target sparse matrix
663  friend inline void smpMultAssign( SparseMatrix<MT2,SO2>& lhs, const SMatEvalExpr& rhs )
664  {
666 
667  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
668  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
669 
670  smpMultAssign( ~lhs, rhs.sm_ );
671  }
673  //**********************************************************************************************
674 
675  //**Compile time checks*************************************************************************
680  //**********************************************************************************************
681 };
682 //*************************************************************************************************
683 
684 
685 
686 
687 //=================================================================================================
688 //
689 // GLOBAL FUNCTIONS
690 //
691 //=================================================================================================
692 
693 //*************************************************************************************************
710 template< typename MT // Type of the sparse matrix
711  , bool SO > // Storage order
713 {
715 
716  return SMatEvalExpr<MT,SO>( ~sm );
717 }
718 //*************************************************************************************************
719 
720 
721 
722 
723 //=================================================================================================
724 //
725 // GLOBAL RESTRUCTURING FUNCTIONS
726 //
727 //=================================================================================================
728 
729 //*************************************************************************************************
740 template< typename MT // Type of the sparse matrix
741  , bool SO > // Storage order
742 inline const SMatEvalExpr<MT,SO> eval( const SMatEvalExpr<MT,SO>& sm )
743 {
744  return sm;
745 }
747 //*************************************************************************************************
748 
749 
750 
751 
752 //=================================================================================================
753 //
754 // ROWS SPECIALIZATIONS
755 //
756 //=================================================================================================
757 
758 //*************************************************************************************************
760 template< typename MT, bool SO >
761 struct Rows< SMatEvalExpr<MT,SO> > : public Rows<MT>
762 {};
764 //*************************************************************************************************
765 
766 
767 
768 
769 //=================================================================================================
770 //
771 // COLUMNS SPECIALIZATIONS
772 //
773 //=================================================================================================
774 
775 //*************************************************************************************************
777 template< typename MT, bool SO >
778 struct Columns< SMatEvalExpr<MT,SO> > : public Columns<MT>
779 {};
781 //*************************************************************************************************
782 
783 
784 
785 
786 //=================================================================================================
787 //
788 // ISSYMMETRIC SPECIALIZATIONS
789 //
790 //=================================================================================================
791 
792 //*************************************************************************************************
794 template< typename MT, bool SO >
795 struct IsSymmetric< SMatEvalExpr<MT,SO> >
796  : public BoolConstant< IsSymmetric<MT>::value >
797 {};
799 //*************************************************************************************************
800 
801 
802 
803 
804 //=================================================================================================
805 //
806 // ISHERMITIAN SPECIALIZATIONS
807 //
808 //=================================================================================================
809 
810 //*************************************************************************************************
812 template< typename MT, bool SO >
813 struct IsHermitian< SMatEvalExpr<MT,SO> >
814  : public BoolConstant< IsHermitian<MT>::value >
815 {};
817 //*************************************************************************************************
818 
819 
820 
821 
822 //=================================================================================================
823 //
824 // ISLOWER SPECIALIZATIONS
825 //
826 //=================================================================================================
827 
828 //*************************************************************************************************
830 template< typename MT, bool SO >
831 struct IsLower< SMatEvalExpr<MT,SO> >
832  : public BoolConstant< IsLower<MT>::value >
833 {};
835 //*************************************************************************************************
836 
837 
838 
839 
840 //=================================================================================================
841 //
842 // ISUNILOWER SPECIALIZATIONS
843 //
844 //=================================================================================================
845 
846 //*************************************************************************************************
848 template< typename MT, bool SO >
849 struct IsUniLower< SMatEvalExpr<MT,SO> >
850  : public BoolConstant< IsUniLower<MT>::value >
851 {};
853 //*************************************************************************************************
854 
855 
856 
857 
858 //=================================================================================================
859 //
860 // ISSTRICTLYLOWER SPECIALIZATIONS
861 //
862 //=================================================================================================
863 
864 //*************************************************************************************************
866 template< typename MT, bool SO >
867 struct IsStrictlyLower< SMatEvalExpr<MT,SO> >
868  : public BoolConstant< IsStrictlyLower<MT>::value >
869 {};
871 //*************************************************************************************************
872 
873 
874 
875 
876 //=================================================================================================
877 //
878 // ISUPPER SPECIALIZATIONS
879 //
880 //=================================================================================================
881 
882 //*************************************************************************************************
884 template< typename MT, bool SO >
885 struct IsUpper< SMatEvalExpr<MT,SO> >
886  : public BoolConstant< IsUpper<MT>::value >
887 {};
889 //*************************************************************************************************
890 
891 
892 
893 
894 //=================================================================================================
895 //
896 // ISUNIUPPER SPECIALIZATIONS
897 //
898 //=================================================================================================
899 
900 //*************************************************************************************************
902 template< typename MT, bool SO >
903 struct IsUniUpper< SMatEvalExpr<MT,SO> >
904  : public BoolConstant< IsUniUpper<MT>::value >
905 {};
907 //*************************************************************************************************
908 
909 
910 
911 
912 //=================================================================================================
913 //
914 // ISSTRICTLYUPPER SPECIALIZATIONS
915 //
916 //=================================================================================================
917 
918 //*************************************************************************************************
920 template< typename MT, bool SO >
921 struct IsStrictlyUpper< SMatEvalExpr<MT,SO> >
922  : public BoolConstant< IsStrictlyUpper<MT>::value >
923 {};
925 //*************************************************************************************************
926 
927 
928 
929 
930 //=================================================================================================
931 //
932 // EXPRESSION TRAIT SPECIALIZATIONS
933 //
934 //=================================================================================================
935 
936 //*************************************************************************************************
938 template< typename MT >
939 struct SMatEvalExprTrait< SMatEvalExpr<MT,false> >
940 {
941  public:
942  //**********************************************************************************************
943  using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT> >
944  , SMatEvalExpr<MT,false>
945  , INVALID_TYPE >;
946  //**********************************************************************************************
947 };
949 //*************************************************************************************************
950 
951 
952 //*************************************************************************************************
954 template< typename MT >
955 struct TSMatEvalExprTrait< SMatEvalExpr<MT,true> >
956 {
957  public:
958  //**********************************************************************************************
959  using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT> >
960  , SMatEvalExpr<MT,true>
961  , INVALID_TYPE >;
962  //**********************************************************************************************
963 };
965 //*************************************************************************************************
966 
967 
968 //*************************************************************************************************
970 template< typename MT, bool SO, bool AF >
971 struct SubmatrixExprTrait< SMatEvalExpr<MT,SO>, AF >
972 {
973  public:
974  //**********************************************************************************************
975  using Type = EvalExprTrait_< SubmatrixExprTrait_<const MT,AF> >;
976  //**********************************************************************************************
977 };
979 //*************************************************************************************************
980 
981 
982 //*************************************************************************************************
984 template< typename MT, bool SO >
985 struct RowExprTrait< SMatEvalExpr<MT,SO> >
986 {
987  public:
988  //**********************************************************************************************
989  using Type = EvalExprTrait_< RowExprTrait_<const MT> >;
990  //**********************************************************************************************
991 };
993 //*************************************************************************************************
994 
995 
996 //*************************************************************************************************
998 template< typename MT, bool SO >
999 struct ColumnExprTrait< SMatEvalExpr<MT,SO> >
1000 {
1001  public:
1002  //**********************************************************************************************
1003  using Type = EvalExprTrait_< ColumnExprTrait_<const MT> >;
1004  //**********************************************************************************************
1005 };
1007 //*************************************************************************************************
1008 
1009 } // namespace blaze
1010 
1011 #endif
Header file for auxiliary alias declarations.
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
Header file for basic type definitions.
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseMatrix type trait.
#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
Header file for the ColumnExprTrait class template.
Header file for the TSMatEvalExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
Header file for the And class template.
Header file for the MatEvalExpr base class.
Header file for the Computation base class.
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
Constraint on the data type.
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
SMatEvalExpr< MT, SO > This
Type of this SMatEvalExpr instance.
Definition: SMatEvalExpr.h:105
Header file for the SparseMatrix base class.
SMatEvalExpr(const MT &sm) noexcept
Constructor for the SMatEvalExpr class.
Definition: SMatEvalExpr.h:129
Constraint on the data type.
Header file for the SMatEvalExprTrait class template.
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatEvalExpr.h:213
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatEvalExpr.h:172
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
#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 Columns type trait.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for the IsLower type trait.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatEvalExpr.h:141
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatEvalExpr.h:203
Header file for the RowExprTrait class template.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatEvalExpr.h:182
Header file for all forward declarations for expression class templates.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatEvalExpr.h:156
Header file for the IsStrictlyLower type trait.
Operand sm_
Sparse matrix of the evaluation expression.
Definition: SMatEvalExpr.h:254
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatEvalExpr.h:192
Header file for the SubmatrixExprTrait class template.
Header file for run time assertion macros.
TransposeType_< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SMatEvalExpr.h:108
Utility type for generic codes.
ElementType_< MT > ElementType
Resulting element type.
Definition: SMatEvalExpr.h:109
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatEvalExpr.h:110
Header file for the EvalExprTrait class template.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatEvalExpr.h:247
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatEvalExpr.h:237
ResultType_< MT > ResultType
Result type for expression template evaluations.
Definition: SMatEvalExpr.h:106
If_< IsExpression< MT >, const MT, const MT & > Operand
Composite data type of the sparse matrix expression.
Definition: SMatEvalExpr.h:116
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:705
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatEvalExpr.h:113
Header file for the IsRowMajorMatrix type 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:157
Header file for the IntegralConstant class template.
Expression object for the forced evaluation of sparse matrices.The SMatEvalExpr class represents the ...
Definition: Forward.h:93
OppositeType_< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatEvalExpr.h:107
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsUpper type trait.
Header file for the IsHermitian type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#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 FunctionTrace class.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatEvalExpr.h:225