SMatRealExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATREALEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATREALEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <cmath>
44 #include <iterator>
52 #include <blaze/math/shims/Real.h>
80 #include <blaze/util/Assert.h>
83 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/Exception.h>
85 #include <blaze/util/InvalidType.h>
87 #include <blaze/util/SelectType.h>
88 #include <blaze/util/Types.h>
91 
92 
93 namespace blaze {
94 
95 //=================================================================================================
96 //
97 // CLASS SMATREALEXPR
98 //
99 //=================================================================================================
100 
101 //*************************************************************************************************
108 template< typename MT // Type of the sparse matrix
109  , bool SO > // Storage order
110 class SMatRealExpr : public SparseMatrix< SMatRealExpr<MT,SO>, SO >
111  , private MatRealExpr
112  , private Computation
113 {
114  private:
115  //**Type definitions****************************************************************************
116  typedef typename MT::ResultType RT;
117  typedef typename MT::ReturnType RN;
118  typedef typename MT::CompositeType CT;
119  //**********************************************************************************************
120 
121  //**Return type evaluation**********************************************************************
123 
128  enum { returnExpr = !IsTemporary<RN>::value };
129 
132  //**********************************************************************************************
133 
134  //**Serial evaluation strategy******************************************************************
136 
142  enum { useAssign = RequiresEvaluation<MT>::value };
143 
145  template< typename MT2 >
147  struct UseAssign {
148  enum { value = useAssign };
149  };
151  //**********************************************************************************************
152 
153  //**Parallel evaluation strategy****************************************************************
155 
161  template< typename MT2 >
162  struct UseSMPAssign {
163  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
164  };
166  //**********************************************************************************************
167 
168  public:
169  //**Type definitions****************************************************************************
171  typedef typename RealTrait<RT>::Type ResultType;
175 
178 
181 
183  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type Operand;
184  //**********************************************************************************************
185 
186  //**ConstIterator class definition**************************************************************
190  {
191  public:
192  //**Type definitions*************************************************************************
195 
198 
199  typedef std::forward_iterator_tag IteratorCategory;
200  typedef Element ValueType;
201  typedef ValueType* PointerType;
202  typedef ValueType& ReferenceType;
204 
205  // STL iterator requirements
206  typedef IteratorCategory iterator_category;
207  typedef ValueType value_type;
208  typedef PointerType pointer;
209  typedef ReferenceType reference;
210  typedef DifferenceType difference_type;
211  //*******************************************************************************************
212 
213  //**Constructor******************************************************************************
216  inline ConstIterator( IteratorType it )
217  : it_( it ) // Iterator over the elements of the sparse matrix expression
218  {}
219  //*******************************************************************************************
220 
221  //**Prefix increment operator****************************************************************
227  ++it_;
228  return *this;
229  }
230  //*******************************************************************************************
231 
232  //**Element access operator******************************************************************
237  inline const Element operator*() const {
238  return Element( real( it_->value() ), it_->index() );
239  }
240  //*******************************************************************************************
241 
242  //**Element access operator******************************************************************
247  inline const ConstIterator* operator->() const {
248  return this;
249  }
250  //*******************************************************************************************
251 
252  //**Value function***************************************************************************
257  inline ReturnType value() const {
258  return real( it_->value() );
259  }
260  //*******************************************************************************************
261 
262  //**Index function***************************************************************************
267  inline size_t index() const {
268  return it_->index();
269  }
270  //*******************************************************************************************
271 
272  //**Equality operator************************************************************************
278  inline bool operator==( const ConstIterator& rhs ) const {
279  return it_ == rhs.it_;
280  }
281  //*******************************************************************************************
282 
283  //**Inequality operator**********************************************************************
289  inline bool operator!=( const ConstIterator& rhs ) const {
290  return it_ != rhs.it_;
291  }
292  //*******************************************************************************************
293 
294  //**Subtraction operator*********************************************************************
300  inline DifferenceType operator-( const ConstIterator& rhs ) const {
301  return it_ - rhs.it_;
302  }
303  //*******************************************************************************************
304 
305  private:
306  //**Member variables*************************************************************************
307  IteratorType it_;
308  //*******************************************************************************************
309  };
310  //**********************************************************************************************
311 
312  //**Compilation flags***************************************************************************
314  enum { smpAssignable = MT::smpAssignable };
315  //**********************************************************************************************
316 
317  //**Constructor*********************************************************************************
322  explicit inline SMatRealExpr( const MT& sm )
323  : sm_( sm ) // Sparse matrix of the real part expression
324  {}
325  //**********************************************************************************************
326 
327  //**Access operator*****************************************************************************
334  inline ReturnType operator()( size_t i, size_t j ) const {
335  BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
336  BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
337  return real( sm_(i,j) );
338  }
339  //**********************************************************************************************
340 
341  //**At function*********************************************************************************
349  inline ReturnType at( size_t i, size_t j ) const {
350  if( i >= sm_.rows() ) {
351  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
352  }
353  if( j >= sm_.columns() ) {
354  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
355  }
356  return (*this)(i,j);
357  }
358  //**********************************************************************************************
359 
360  //**Begin function******************************************************************************
366  inline ConstIterator begin( size_t i ) const {
367  return ConstIterator( sm_.begin(i) );
368  }
369  //**********************************************************************************************
370 
371  //**End function********************************************************************************
377  inline ConstIterator end( size_t i ) const {
378  return ConstIterator( sm_.end(i) );
379  }
380  //**********************************************************************************************
381 
382  //**Rows function*******************************************************************************
387  inline size_t rows() const {
388  return sm_.rows();
389  }
390  //**********************************************************************************************
391 
392  //**Columns function****************************************************************************
397  inline size_t columns() const {
398  return sm_.columns();
399  }
400  //**********************************************************************************************
401 
402  //**NonZeros function***************************************************************************
407  inline size_t nonZeros() const {
408  return sm_.nonZeros();
409  }
410  //**********************************************************************************************
411 
412  //**NonZeros function***************************************************************************
418  inline size_t nonZeros( size_t i ) const {
419  return sm_.nonZeros(i);
420  }
421  //**********************************************************************************************
422 
423  //**Find function*******************************************************************************
430  inline ConstIterator find( size_t i, size_t j ) const {
432  return ConstIterator( sm_.find( i, j ) );
433  }
434  //**********************************************************************************************
435 
436  //**LowerBound function*************************************************************************
443  inline ConstIterator lowerBound( size_t i, size_t j ) const {
445  return ConstIterator( sm_.lowerBound( i, j ) );
446  }
447  //**********************************************************************************************
448 
449  //**UpperBound function*************************************************************************
456  inline ConstIterator upperBound( size_t i, size_t j ) const {
458  return ConstIterator( sm_.upperBound( i, j ) );
459  }
460  //**********************************************************************************************
461 
462  //**Operand access******************************************************************************
467  inline Operand operand() const {
468  return sm_;
469  }
470  //**********************************************************************************************
471 
472  //**********************************************************************************************
478  template< typename T >
479  inline bool canAlias( const T* alias ) const {
480  return sm_.canAlias( alias );
481  }
482  //**********************************************************************************************
483 
484  //**********************************************************************************************
490  template< typename T >
491  inline bool isAliased( const T* alias ) const {
492  return sm_.isAliased( alias );
493  }
494  //**********************************************************************************************
495 
496  //**********************************************************************************************
501  inline bool canSMPAssign() const {
502  return sm_.canSMPAssign();
503  }
504  //**********************************************************************************************
505 
506  private:
507  //**Member variables****************************************************************************
508  Operand sm_;
509  //**********************************************************************************************
510 
511  //**Assignment to dense matrices****************************************************************
526  template< typename MT2 // Type of the target dense matrix
527  , bool SO2 > // Storage order of the target dense matrix
528  friend inline typename EnableIf< UseAssign<MT2> >::Type
529  assign( DenseMatrix<MT2,SO2>& lhs, const SMatRealExpr& rhs )
530  {
532 
536 
537  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
538  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
539 
540  const RT tmp( serial( rhs.sm_ ) );
541  assign( ~lhs, real( tmp ) );
542  }
544  //**********************************************************************************************
545 
546  //**Assignment to sparse matrices***************************************************************
560  template< typename MT2 // Type of the target sparse matrix
561  , bool SO2 > // Storage order of the target sparse matrix
562  friend inline typename EnableIf< UseAssign<MT2> >::Type
563  assign( SparseMatrix<MT2,SO2>& lhs, const SMatRealExpr& rhs )
564  {
566 
570 
571  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
572  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
573 
574  const RT tmp( serial( rhs.sm_ ) );
575  (~lhs).reserve( tmp.nonZeros() );
576  assign( ~lhs, real( tmp ) );
577  }
579  //**********************************************************************************************
580 
581  //**Addition 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 typename EnableIf< UseAssign<MT2> >::Type
598  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatRealExpr& rhs )
599  {
601 
605 
606  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
607  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
608 
609  const RT tmp( serial( rhs.sm_ ) );
610  addAssign( ~lhs, real( tmp ) );
611  }
613  //**********************************************************************************************
614 
615  //**Addition assignment to sparse matrices******************************************************
616  // No special implementation for the addition assignment to sparse matrices.
617  //**********************************************************************************************
618 
619  //**Subtraction assignment to dense matrices****************************************************
633  template< typename MT2 // Type of the target dense matrix
634  , bool SO2 > // Storage order of the target sparse matrix
635  friend inline typename EnableIf< UseAssign<MT2> >::Type
636  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatRealExpr& rhs )
637  {
639 
643 
644  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
645  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
646 
647  const RT tmp( serial( rhs.sm_ ) );
648  subAssign( ~lhs, real( tmp ) );
649  }
651  //**********************************************************************************************
652 
653  //**Subtraction assignment to sparse matrices***************************************************
654  // No special implementation for the subtraction assignment to sparse matrices.
655  //**********************************************************************************************
656 
657  //**Multiplication assignment to dense matrices*************************************************
658  // No special implementation for the multiplication assignment to dense matrices.
659  //**********************************************************************************************
660 
661  //**Multiplication assignment to sparse matrices************************************************
662  // No special implementation for the multiplication assignment to sparse matrices.
663  //**********************************************************************************************
664 
665  //**SMP assignment to dense matrices************************************************************
680  template< typename MT2 // Type of the target dense matrix
681  , bool SO2 > // Storage order of the target dense matrix
682  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
683  smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatRealExpr& rhs )
684  {
686 
690 
691  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
692  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
693 
694  const RT tmp( rhs.sm_ );
695  smpAssign( ~lhs, real( tmp ) );
696  }
698  //**********************************************************************************************
699 
700  //**SMP assignment to sparse matrices***********************************************************
701  // No special implementation for the SMP assignment to sparse matrices.
702  //**********************************************************************************************
703 
704  //**SMP addition assignment to dense matrices***************************************************
718  template< typename MT2 // Type of the target dense matrix
719  , bool SO2 > // Storage order of the target dense matrix
720  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
721  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatRealExpr& rhs )
722  {
724 
728 
729  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
730  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
731 
732  const RT tmp( rhs.sm_ );
733  smpAddAssign( ~lhs, real( tmp ) );
734  }
736  //**********************************************************************************************
737 
738  //**SMP addition assignment to sparse matrices**************************************************
739  // No special implementation for the SMP addition assignment to sparse matrices.
740  //**********************************************************************************************
741 
742  //**SMP subtraction assignment to dense matrices************************************************
756  template< typename MT2 // Type of the target dense matrix
757  , bool SO2 > // Storage order of the target sparse matrix
758  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
759  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatRealExpr& rhs )
760  {
762 
766 
767  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
768  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
769 
770  const RT tmp( rhs.sm_ );
771  smpSubAssign( ~lhs, real( tmp ) );
772  }
774  //**********************************************************************************************
775 
776  //**SMP subtraction assignment to sparse matrices***********************************************
777  // No special implementation for the SMP subtraction assignment to sparse matrices.
778  //**********************************************************************************************
779 
780  //**SMP multiplication assignment to dense matrices*********************************************
781  // No special implementation for the SMP multiplication assignment to dense matrices.
782  //**********************************************************************************************
783 
784  //**SMP multiplication assignment to sparse matrices********************************************
785  // No special implementation for the SMP multiplication assignment to sparse matrices.
786  //**********************************************************************************************
787 
788  //**Compile time checks*************************************************************************
792  BLAZE_CONSTRAINT_MUST_NOT_BE_BUILTIN_TYPE( typename UnderlyingNumeric<MT>::Type );
794  //**********************************************************************************************
795 };
796 //*************************************************************************************************
797 
798 
799 
800 
801 //=================================================================================================
802 //
803 // GLOBAL FUNCTIONS
804 //
805 //=================================================================================================
806 
807 //*************************************************************************************************
824 template< typename MT // Type of the sparse matrix
825  , bool SO > // Storage order
826 inline const typename RealExprTrait<MT>::Type real( const SparseMatrix<MT,SO>& sm )
827 {
829 
830  return typename RealExprTrait<MT>::Type( ~sm );
831 }
832 //*************************************************************************************************
833 
834 
835 
836 
837 //=================================================================================================
838 //
839 // GLOBAL RESTRUCTURING FUNCTIONS
840 //
841 //=================================================================================================
842 
843 //*************************************************************************************************
854 template< typename MT // Type of the sparse matrix
855  , bool TF > // Transpose flag
856 inline const SMatRealExpr<MT,TF>& real( const SMatRealExpr<MT,TF>& sm )
857 {
859 
860  return sm;
861 }
863 //*************************************************************************************************
864 
865 
866 
867 
868 //=================================================================================================
869 //
870 // ROWS SPECIALIZATIONS
871 //
872 //=================================================================================================
873 
874 //*************************************************************************************************
876 template< typename MT, bool SO >
877 struct Rows< SMatRealExpr<MT,SO> > : public Rows<MT>
878 {};
880 //*************************************************************************************************
881 
882 
883 
884 
885 //=================================================================================================
886 //
887 // COLUMNS SPECIALIZATIONS
888 //
889 //=================================================================================================
890 
891 //*************************************************************************************************
893 template< typename MT, bool SO >
894 struct Columns< SMatRealExpr<MT,SO> > : public Columns<MT>
895 {};
897 //*************************************************************************************************
898 
899 
900 
901 
902 //=================================================================================================
903 //
904 // ISSYMMETRIC SPECIALIZATIONS
905 //
906 //=================================================================================================
907 
908 //*************************************************************************************************
910 template< typename MT, bool SO >
911 struct IsSymmetric< SMatRealExpr<MT,SO> > : public IsTrue< IsSymmetric<MT>::value >
912 {};
914 //*************************************************************************************************
915 
916 
917 
918 
919 //=================================================================================================
920 //
921 // ISHERMITIAN SPECIALIZATIONS
922 //
923 //=================================================================================================
924 
925 //*************************************************************************************************
927 template< typename MT, bool SO >
928 struct IsHermitian< SMatRealExpr<MT,SO> > : public IsTrue< IsHermitian<MT>::value >
929 {};
931 //*************************************************************************************************
932 
933 
934 
935 
936 //=================================================================================================
937 //
938 // ISLOWER SPECIALIZATIONS
939 //
940 //=================================================================================================
941 
942 //*************************************************************************************************
944 template< typename MT, bool SO >
945 struct IsLower< SMatRealExpr<MT,SO> > : public IsTrue< IsLower<MT>::value >
946 {};
948 //*************************************************************************************************
949 
950 
951 
952 
953 //=================================================================================================
954 //
955 // ISUNILOWER SPECIALIZATIONS
956 //
957 //=================================================================================================
958 
959 //*************************************************************************************************
961 template< typename MT, bool SO >
962 struct IsUniLower< SMatRealExpr<MT,SO> > : public IsTrue< IsUniLower<MT>::value >
963 {};
965 //*************************************************************************************************
966 
967 
968 
969 
970 //=================================================================================================
971 //
972 // ISSTRICTLYLOWER SPECIALIZATIONS
973 //
974 //=================================================================================================
975 
976 //*************************************************************************************************
978 template< typename MT, bool SO >
979 struct IsStrictlyLower< SMatRealExpr<MT,SO> > : public IsTrue< IsStrictlyLower<MT>::value >
980 {};
982 //*************************************************************************************************
983 
984 
985 
986 
987 //=================================================================================================
988 //
989 // ISUPPER SPECIALIZATIONS
990 //
991 //=================================================================================================
992 
993 //*************************************************************************************************
995 template< typename MT, bool SO >
996 struct IsUpper< SMatRealExpr<MT,SO> > : public IsTrue< IsUpper<MT>::value >
997 {};
999 //*************************************************************************************************
1000 
1001 
1002 
1003 
1004 //=================================================================================================
1005 //
1006 // ISUNIUPPER SPECIALIZATIONS
1007 //
1008 //=================================================================================================
1009 
1010 //*************************************************************************************************
1012 template< typename MT, bool SO >
1013 struct IsUniUpper< SMatRealExpr<MT,SO> > : public IsTrue< IsUniUpper<MT>::value >
1014 {};
1016 //*************************************************************************************************
1017 
1018 
1019 
1020 
1021 //=================================================================================================
1022 //
1023 // ISSTRICTLYUPPER SPECIALIZATIONS
1024 //
1025 //=================================================================================================
1026 
1027 //*************************************************************************************************
1029 template< typename MT, bool SO >
1030 struct IsStrictlyUpper< SMatRealExpr<MT,SO> > : public IsTrue< IsStrictlyUpper<MT>::value >
1031 {};
1033 //*************************************************************************************************
1034 
1035 
1036 
1037 
1038 //=================================================================================================
1039 //
1040 // EXPRESSION TRAIT SPECIALIZATIONS
1041 //
1042 //=================================================================================================
1043 
1044 //*************************************************************************************************
1046 template< typename MT >
1047 struct SMatRealExprTrait< SMatRealExpr<MT,false> >
1048 {
1049  public:
1050  //**********************************************************************************************
1051  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1052  , SMatRealExpr<MT,false>
1053  , INVALID_TYPE >::Type Type;
1054  //**********************************************************************************************
1055 };
1057 //*************************************************************************************************
1058 
1059 
1060 //*************************************************************************************************
1062 template< typename MT >
1063 struct TSMatRealExprTrait< SMatRealExpr<MT,true> >
1064 {
1065  public:
1066  //**********************************************************************************************
1067  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1068  , SMatRealExpr<MT,true>
1069  , INVALID_TYPE >::Type Type;
1070  //**********************************************************************************************
1071 };
1073 //*************************************************************************************************
1074 
1075 
1076 //*************************************************************************************************
1078 template< typename MT, bool SO, bool AF >
1079 struct SubmatrixExprTrait< SMatRealExpr<MT,SO>, AF >
1080 {
1081  public:
1082  //**********************************************************************************************
1083  typedef typename RealExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1084  //**********************************************************************************************
1085 };
1087 //*************************************************************************************************
1088 
1089 
1090 //*************************************************************************************************
1092 template< typename MT, bool SO >
1093 struct RowExprTrait< SMatRealExpr<MT,SO> >
1094 {
1095  public:
1096  //**********************************************************************************************
1097  typedef typename RealExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1098  //**********************************************************************************************
1099 };
1101 //*************************************************************************************************
1102 
1103 
1104 //*************************************************************************************************
1106 template< typename MT, bool SO >
1107 struct ColumnExprTrait< SMatRealExpr<MT,SO> >
1108 {
1109  public:
1110  //**********************************************************************************************
1111  typedef typename RealExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
1112  //**********************************************************************************************
1113 };
1115 //*************************************************************************************************
1116 
1117 } // namespace blaze
1118 
1119 #endif
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatRealExpr.h:247
Header file for the UnderlyingNumeric type trait.
Pointer difference type of the Blaze library.
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
Header file for the Rows type trait.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatRealExpr.h:397
Header file for the IsUniUpper type trait.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatRealExpr.h:377
Header file for basic type definitions.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatRealExpr.h:173
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatRealExpr.h:334
#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:81
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatRealExpr.h:172
PointerType pointer
Pointer return type.
Definition: SMatRealExpr.h:208
Header file for the ColumnExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatRealExpr.h:443
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatRealExpr.h:387
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
Header file for the RealExprTrait class template.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatRealExpr.h:479
Header file for the MatRealExpr base class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the Computation base class.
SMatRealExpr< MT, SO > This
Type of this SMatRealExpr instance.
Definition: SMatRealExpr.h:170
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatRealExpr.h:491
Header file for the RequiresEvaluation type trait.
Header file for the IsUniLower type trait.
RealExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SMatRealExpr.h:131
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatRealExpr.h:226
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:117
Constraint on the data type.
Header file for the SparseMatrix base class.
Constraint on the data type.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatRealExpr.h:257
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatRealExpr.h:430
ResultType::ElementType ElementType
Resulting element type.
Definition: SMatRealExpr.h:174
MT::CompositeType CT
Composite type of the sparse matrix expression.
Definition: SMatRealExpr.h:118
IteratorType it_
Iterator over the elements of the sparse matrix expression.
Definition: SMatRealExpr.h:307
Iterator over the elements of the sparse matrix real part expression.
Definition: SMatRealExpr.h:189
Header file for the ValueIndexPair class.
IteratorCategory iterator_category
The iterator category.
Definition: SMatRealExpr.h:206
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
Header file for the IsStrictlyUpper type trait.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatRealExpr.h:199
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
RemoveReference< Operand >::Type::ConstIterator IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatRealExpr.h:197
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatRealExpr.h:289
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the Columns type trait.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatRealExpr.h:418
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatRealExpr.h:349
const RealExprTrait< MT >::Type real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatRealExpr.h:920
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatRealExpr.h:456
RealTrait< RT >::Type ResultType
Result type for expression template evaluations.
Definition: SMatRealExpr.h:171
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatRealExpr.h:237
Header file for the IsLower type trait.
Header file for the real trait.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
Constraints on the storage order of matrix types.
Header file for the real shim.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatRealExpr.h:267
Constraint on the data type.
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatRealExpr.h:278
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the serial shim.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SMatRealExpr.h:177
SelectType< useAssign, const ResultType, const SMatRealExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SMatRealExpr.h:180
Element ValueType
Type of the underlying pointers.
Definition: SMatRealExpr.h:200
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SMatRealExpr.h:501
EnableIf< IsDenseMatrix< MT1 > >::Type 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 IsSparseVector type trait.
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Operand operand() const
Returns the sparse matrix operand.
Definition: SMatRealExpr.h:467
ReferenceType reference
Reference return type.
Definition: SMatRealExpr.h:209
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatRealExpr.h:300
Utility type for generic codes.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatRealExpr.h:407
Base template for the RealTrait class.The RealTrait class template offers the possibility to select t...
Definition: RealTrait.h:78
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
MT::ResultType RT
Result type of the sparse matrix expression.
Definition: SMatRealExpr.h:116
ValueType value_type
Type of the underlying pointers.
Definition: SMatRealExpr.h:207
#define BLAZE_CONSTRAINT_MUST_NOT_BE_BUILTIN_TYPE(T)
Constraint on the data type.In case the given data type T is a built-in data type, a compilation error is created.
Definition: Builtin.h:116
ValueType & ReferenceType
Reference return type.
Definition: SMatRealExpr.h:202
Expression object for the sparse matrix real() function.The SMatRealExpr class represents the compile...
Definition: Forward.h:102
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
Header file for the RemoveReference type trait.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatRealExpr.h:366
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
Header file for the IsRowMajorMatrix type trait.
Header file for the SMatRealExprTrait class template.
Header file for the IsComputation type trait class.
SMatRealExpr(const MT &sm)
Constructor for the SMatRealExpr class.
Definition: SMatRealExpr.h:322
Evaluation of the return type of a real part expression.Via this type trait it is possible to evaluat...
Definition: RealExprTrait.h:88
Header file for the TSMatRealExprTrait class template.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
Operand sm_
Sparse matrix of the real part expression.
Definition: SMatRealExpr.h:508
#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
ValueType * PointerType
Pointer return type.
Definition: SMatRealExpr.h:201
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatRealExpr.h:194
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
MT::ReturnType RN
Return type of the sparse matrix expression.
Definition: SMatRealExpr.h:117
Header file for the IsUpper type trait.
Header file for exception macros.
DifferenceType difference_type
Difference between two iterators.
Definition: SMatRealExpr.h:210
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatRealExpr.h:203
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
Constraint on the data type.
#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:79
Header file for the IsExpression type trait class.
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SMatRealExpr.h:216
Header file for the FunctionTrace class.
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type Operand
Composite data type of the sparse matrix expression.
Definition: SMatRealExpr.h:183