SparseSubvector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_SPARSESUBVECTOR_H_
36 #define _BLAZE_MATH_VIEWS_SPARSESUBVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
68 #include <blaze/util/Assert.h>
69 #include <blaze/util/EnableIf.h>
70 #include <blaze/util/Exception.h>
72 #include <blaze/util/mpl/If.h>
73 #include <blaze/util/mpl/Or.h>
74 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS DEFINITION
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
387 template< typename VT // Type of the sparse vector
388  , bool AF = unaligned // Alignment flag
389  , bool TF = IsRowVector<VT>::value > // Transpose flag
390 class SparseSubvector : public SparseVector< SparseSubvector<VT,AF,TF>, TF >
391  , private Subvector
392 {
393  private:
394  //**Type definitions****************************************************************************
396  typedef typename If< IsExpression<VT>, VT, VT& >::Type Operand;
397  //**********************************************************************************************
398 
399  public:
400  //**Type definitions****************************************************************************
404  typedef typename VT::ElementType ElementType;
405  typedef typename VT::ReturnType ReturnType;
407 
410 
412  typedef typename If< IsConst<VT>, ConstReference, typename VT::Reference >::Type Reference;
413  //**********************************************************************************************
414 
415  //**SubvectorElement class definition***********************************************************
418  template< typename VectorType // Type of the sparse vector
419  , typename IteratorType > // Type of the sparse vector iterator
421  {
422  private:
423  //*******************************************************************************************
425 
430  enum { returnConst = IsConst<VectorType>::value };
431  //*******************************************************************************************
432 
433  //**Type definitions*************************************************************************
435  typedef typename std::iterator_traits<IteratorType>::value_type SET;
436 
437  typedef typename SET::Reference RT;
438  typedef typename SET::ConstReference CRT;
439  //*******************************************************************************************
440 
441  public:
442  //**Type definitions*************************************************************************
443  typedef typename SET::ValueType ValueType;
444  typedef size_t IndexType;
446  typedef CRT ConstReference;
447  //*******************************************************************************************
448 
449  //**Constructor******************************************************************************
455  inline SubvectorElement( IteratorType pos, size_t offset )
456  : pos_ ( pos ) // Iterator to the current position within the sparse subvector
457  , offset_( offset ) // Offset within the according sparse vector
458  {}
459  //*******************************************************************************************
460 
461  //**Assignment operator**********************************************************************
467  template< typename T > inline SubvectorElement& operator=( const T& v ) {
468  *pos_ = v;
469  return *this;
470  }
471  //*******************************************************************************************
472 
473  //**Addition assignment operator*************************************************************
479  template< typename T > inline SubvectorElement& operator+=( const T& v ) {
480  *pos_ += v;
481  return *this;
482  }
483  //*******************************************************************************************
484 
485  //**Subtraction assignment operator**********************************************************
491  template< typename T > inline SubvectorElement& operator-=( const T& v ) {
492  *pos_ -= v;
493  return *this;
494  }
495  //*******************************************************************************************
496 
497  //**Multiplication assignment operator*******************************************************
503  template< typename T > inline SubvectorElement& operator*=( const T& v ) {
504  *pos_ *= v;
505  return *this;
506  }
507  //*******************************************************************************************
508 
509  //**Division assignment operator*************************************************************
515  template< typename T > inline SubvectorElement& operator/=( const T& v ) {
516  *pos_ /= v;
517  return *this;
518  }
519  //*******************************************************************************************
520 
521  //**Element access operator******************************************************************
526  inline const SubvectorElement* operator->() const {
527  return this;
528  }
529  //*******************************************************************************************
530 
531  //**Value function***************************************************************************
536  inline Reference value() const {
537  return pos_->value();
538  }
539  //*******************************************************************************************
540 
541  //**Index function***************************************************************************
546  inline IndexType index() const {
547  return pos_->index() - offset_;
548  }
549  //*******************************************************************************************
550 
551  private:
552  //**Member variables*************************************************************************
553  IteratorType pos_;
554  size_t offset_;
555  //*******************************************************************************************
556  };
557  //**********************************************************************************************
558 
559  //**SubvectorIterator class definition**********************************************************
562  template< typename VectorType // Type of the sparse vector
563  , typename IteratorType > // Type of the sparse vector iterator
565  {
566  public:
567  //**Type definitions*************************************************************************
568  typedef std::forward_iterator_tag IteratorCategory;
570  typedef ValueType PointerType;
571  typedef ValueType ReferenceType;
573 
574  // STL iterator requirements
575  typedef IteratorCategory iterator_category;
576  typedef ValueType value_type;
577  typedef PointerType pointer;
578  typedef ReferenceType reference;
579  typedef DifferenceType difference_type;
580  //*******************************************************************************************
581 
582  //**Default constructor**********************************************************************
586  : pos_ () // Iterator to the current sparse element
587  , offset_() // The offset of the subvector within the sparse vector
588  {}
589  //*******************************************************************************************
590 
591  //**Constructor******************************************************************************
597  inline SubvectorIterator( IteratorType iterator, size_t index )
598  : pos_ ( iterator ) // Iterator to the current sparse element
599  , offset_( index ) // The offset of the subvector within the sparse vector
600  {}
601  //*******************************************************************************************
602 
603  //**Constructor******************************************************************************
608  template< typename VectorType2, typename IteratorType2 >
610  : pos_ ( it.base() ) // Iterator to the current sparse element.
611  , offset_( it.offset() ) // The offset of the subvector within the sparse vector
612  {}
613  //*******************************************************************************************
614 
615  //**Prefix increment operator****************************************************************
621  ++pos_;
622  return *this;
623  }
624  //*******************************************************************************************
625 
626  //**Postfix increment operator***************************************************************
631  inline const SubvectorIterator operator++( int ) {
632  const SubvectorIterator tmp( *this );
633  ++(*this);
634  return tmp;
635  }
636  //*******************************************************************************************
637 
638  //**Element access operator******************************************************************
643  inline ReferenceType operator*() const {
644  return ReferenceType( pos_, offset_ );
645  }
646  //*******************************************************************************************
647 
648  //**Element access operator******************************************************************
653  inline PointerType operator->() const {
654  return PointerType( pos_, offset_ );
655  }
656  //*******************************************************************************************
657 
658  //**Equality operator************************************************************************
664  template< typename VectorType2, typename IteratorType2 >
666  return base() == rhs.base();
667  }
668  //*******************************************************************************************
669 
670  //**Inequality operator**********************************************************************
676  template< typename VectorType2, typename IteratorType2 >
678  return !( *this == rhs );
679  }
680  //*******************************************************************************************
681 
682  //**Subtraction operator*********************************************************************
688  inline DifferenceType operator-( const SubvectorIterator& rhs ) const {
689  return pos_ - rhs.pos_;
690  }
691  //*******************************************************************************************
692 
693  //**Base function****************************************************************************
698  inline IteratorType base() const {
699  return pos_;
700  }
701  //*******************************************************************************************
702 
703  //**Offset function**************************************************************************
708  inline size_t offset() const {
709  return offset_;
710  }
711  //*******************************************************************************************
712 
713  private:
714  //**Member variables*************************************************************************
715  IteratorType pos_;
716  size_t offset_;
717  //*******************************************************************************************
718  };
719  //**********************************************************************************************
720 
721  //**Type definitions****************************************************************************
724 
726  typedef typename If< IsConst<VT>, ConstIterator, SubvectorIterator<VT,typename VT::Iterator> >::Type Iterator;
727  //**********************************************************************************************
728 
729  //**Compilation flags***************************************************************************
731  enum { smpAssignable = VT::smpAssignable };
732  //**********************************************************************************************
733 
734  //**Constructors********************************************************************************
737  explicit inline SparseSubvector( Operand vector, size_t index, size_t n );
738  // No explicitly declared copy constructor.
740  //**********************************************************************************************
741 
742  //**Destructor**********************************************************************************
743  // No explicitly declared destructor.
744  //**********************************************************************************************
745 
746  //**Data access functions***********************************************************************
749  inline Reference operator[]( size_t index );
750  inline ConstReference operator[]( size_t index ) const;
751  inline Reference at( size_t index );
752  inline ConstReference at( size_t index ) const;
753  inline Iterator begin ();
754  inline ConstIterator begin () const;
755  inline ConstIterator cbegin() const;
756  inline Iterator end ();
757  inline ConstIterator end () const;
758  inline ConstIterator cend () const;
760  //**********************************************************************************************
761 
762  //**Assignment operators************************************************************************
765  inline SparseSubvector& operator= ( const SparseSubvector& rhs );
766  template< typename VT2 > inline SparseSubvector& operator= ( const Vector<VT2,TF>& rhs );
767  template< typename VT2 > inline SparseSubvector& operator+=( const Vector<VT2,TF>& rhs );
768  template< typename VT2 > inline SparseSubvector& operator-=( const Vector<VT2,TF>& rhs );
769  template< typename VT2 > inline SparseSubvector& operator*=( const Vector<VT2,TF>& rhs );
770 
771  template< typename Other >
772  inline typename EnableIf< IsNumeric<Other>, SparseSubvector >::Type&
773  operator*=( Other rhs );
774 
775  template< typename Other >
776  inline typename EnableIf< IsNumeric<Other>, SparseSubvector >::Type&
777  operator/=( Other rhs );
779  //**********************************************************************************************
780 
781  //**Utility functions***************************************************************************
784  inline size_t size() const;
785  inline size_t capacity() const;
786  inline size_t nonZeros() const;
787  inline void reset();
788  inline Iterator set ( size_t index, const ElementType& value );
789  inline Iterator insert ( size_t index, const ElementType& value );
790  inline void erase ( size_t index );
791  inline Iterator erase ( Iterator pos );
792  inline Iterator erase ( Iterator first, Iterator last );
793  inline void reserve( size_t n );
794  template< typename Other > inline SparseSubvector& scale ( const Other& scalar );
796  //**********************************************************************************************
797 
798  //**Lookup functions****************************************************************************
801  inline Iterator find ( size_t index );
802  inline ConstIterator find ( size_t index ) const;
803  inline Iterator lowerBound( size_t index );
804  inline ConstIterator lowerBound( size_t index ) const;
805  inline Iterator upperBound( size_t index );
806  inline ConstIterator upperBound( size_t index ) const;
808  //**********************************************************************************************
809 
810  //**Low-level utility functions*****************************************************************
813  inline void append( size_t index, const ElementType& value, bool check=false );
815  //**********************************************************************************************
816 
817  //**Expression template evaluation functions****************************************************
820  template< typename Other > inline bool canAlias ( const Other* alias ) const;
821  template< typename Other > inline bool isAliased( const Other* alias ) const;
822 
823  inline bool canSMPAssign() const;
824 
825  template< typename VT2 > inline void assign ( const DenseVector <VT2,TF>& rhs );
826  template< typename VT2 > inline void assign ( const SparseVector<VT2,TF>& rhs );
827  template< typename VT2 > inline void addAssign( const DenseVector <VT2,TF>& rhs );
828  template< typename VT2 > inline void addAssign( const SparseVector<VT2,TF>& rhs );
829  template< typename VT2 > inline void subAssign( const DenseVector <VT2,TF>& rhs );
830  template< typename VT2 > inline void subAssign( const SparseVector<VT2,TF>& rhs );
832  //**********************************************************************************************
833 
834  private:
835  //**Member variables****************************************************************************
838  Operand vector_;
839  const size_t offset_;
840  const size_t size_;
841 
842  //**********************************************************************************************
843 
844  //**Friend declarations*************************************************************************
846  template< bool AF1, typename VT2, bool AF2, bool TF2 >
847  friend const SparseSubvector<VT2,AF1,TF2>
848  subvector( const SparseSubvector<VT2,AF2,TF2>& sv, size_t index, size_t size );
849 
850  template< typename VT2, bool AF2, bool TF2 >
851  friend bool isIntact( const SparseSubvector<VT2,AF2,TF2>& sv );
852 
853  template< typename VT2, bool AF2, bool TF2 >
854  friend bool isSame( const SparseSubvector<VT2,AF2,TF2>& a, const SparseVector<VT2,TF2>& b );
855 
856  template< typename VT2, bool AF2, bool TF2 >
857  friend bool isSame( const SparseVector<VT2,TF2>& a, const SparseSubvector<VT2,AF2,TF2>& b );
858 
859  template< typename VT2, bool AF2, bool TF2 >
860  friend bool isSame( const SparseSubvector<VT2,AF2,TF2>& a, const SparseSubvector<VT2,AF2,TF2>& b );
861 
862  template< typename VT2, bool AF2, bool TF2, typename VT3 >
863  friend bool tryAssign( const SparseSubvector<VT2,AF2,TF2>& lhs, const Vector<VT3,TF2>& rhs, size_t index );
864 
865  template< typename VT2, bool AF2, bool TF2, typename VT3 >
866  friend bool tryAddAssign( const SparseSubvector<VT2,AF2,TF2>& lhs, const Vector<VT3,TF2>& rhs, size_t index );
867 
868  template< typename VT2, bool AF2, bool TF2, typename VT3 >
869  friend bool trySubAssign( const SparseSubvector<VT2,AF2,TF2>& lhs, const Vector<VT3,TF2>& rhs, size_t index );
870 
871  template< typename VT2, bool AF2, bool TF2, typename VT3 >
872  friend bool tryMultAssign( const SparseSubvector<VT2,AF2,TF2>& lhs, const Vector<VT3,TF2>& rhs, size_t index );
873 
874  template< typename VT2, bool AF2, bool TF2 >
875  friend typename DerestrictTrait< SparseSubvector<VT2,AF2,TF2> >::Type
876  derestrict( SparseSubvector<VT2,AF2,TF2>& sv );
878  //**********************************************************************************************
879 
880  //**Compile time checks*************************************************************************
888  //**********************************************************************************************
889 };
890 //*************************************************************************************************
891 
892 
893 
894 
895 //=================================================================================================
896 //
897 // CONSTRUCTOR
898 //
899 //=================================================================================================
900 
901 //*************************************************************************************************
913 template< typename VT // Type of the sparse vector
914  , bool AF // Alignment flag
915  , bool TF > // Transpose flag
916 inline SparseSubvector<VT,AF,TF>::SparseSubvector( Operand vector, size_t index, size_t n )
917  : vector_( vector ) // The sparse vector containing the subvector
918  , offset_( index ) // The offset of the subvector within the sparse vector
919  , size_ ( n ) // The size of the subvector
920 {
921  if( index + n > vector.size() ) {
922  BLAZE_THROW_INVALID_ARGUMENT( "Invalid subvector specification" );
923  }
924 }
925 //*************************************************************************************************
926 
927 
928 
929 
930 //=================================================================================================
931 //
932 // DATA ACCESS FUNCTIONS
933 //
934 //=================================================================================================
935 
936 //*************************************************************************************************
945 template< typename VT // Type of the sparse vector
946  , bool AF // Alignment flag
947  , bool TF > // Transpose flag
950 {
951  BLAZE_USER_ASSERT( index < size(), "Invalid subvector access index" );
952  return vector_[offset_+index];
953 }
954 //*************************************************************************************************
955 
956 
957 //*************************************************************************************************
966 template< typename VT // Type of the sparse vector
967  , bool AF // Alignment flag
968  , bool TF > // Transpose flag
971 {
972  BLAZE_USER_ASSERT( index < size(), "Invalid subvector access index" );
973  return const_cast<const VT&>( vector_ )[offset_+index];
974 }
975 //*************************************************************************************************
976 
977 
978 //*************************************************************************************************
988 template< typename VT // Type of the sparse vector
989  , bool AF // Alignment flag
990  , bool TF > // Transpose flag
993 {
994  if( index >= size() ) {
995  BLAZE_THROW_OUT_OF_RANGE( "Invalid subvector access index" );
996  }
997  return (*this)[index];
998 }
999 //*************************************************************************************************
1000 
1001 
1002 //*************************************************************************************************
1012 template< typename VT // Type of the sparse vector
1013  , bool AF // Alignment flag
1014  , bool TF > // Transpose flag
1016  SparseSubvector<VT,AF,TF>::at( size_t index ) const
1017 {
1018  if( index >= size() ) {
1019  BLAZE_THROW_OUT_OF_RANGE( "Invalid subvector access index" );
1020  }
1021  return (*this)[index];
1022 }
1023 //*************************************************************************************************
1024 
1025 
1026 //*************************************************************************************************
1033 template< typename VT // Type of the sparse vector
1034  , bool AF // Alignment flag
1035  , bool TF > // Transpose flag
1037 {
1038  if( offset_ == 0UL )
1039  return Iterator( vector_.begin(), offset_ );
1040  else
1041  return Iterator( vector_.lowerBound( offset_ ), offset_ );
1042 }
1043 //*************************************************************************************************
1044 
1045 
1046 //*************************************************************************************************
1053 template< typename VT // Type of the sparse vector
1054  , bool AF // Alignment flag
1055  , bool TF > // Transpose flag
1057 {
1058  if( offset_ == 0UL )
1059  return ConstIterator( vector_.cbegin(), offset_ );
1060  else
1061  return ConstIterator( vector_.lowerBound( offset_ ), offset_ );
1062 }
1063 //*************************************************************************************************
1064 
1065 
1066 //*************************************************************************************************
1073 template< typename VT // Type of the sparse vector
1074  , bool AF // Alignment flag
1075  , bool TF > // Transpose flag
1077 {
1078  if( offset_ == 0UL )
1079  return ConstIterator( vector_.cbegin(), offset_ );
1080  else
1081  return ConstIterator( vector_.lowerBound( offset_ ), offset_ );
1082 }
1083 //*************************************************************************************************
1084 
1085 
1086 //*************************************************************************************************
1093 template< typename VT // Type of the sparse vector
1094  , bool AF // Alignment flag
1095  , bool TF > // Transpose flag
1097 {
1098  if( offset_ + size_ == vector_.size() )
1099  return Iterator( vector_.end(), offset_ );
1100  else
1101  return Iterator( vector_.lowerBound( offset_ + size_ ), offset_ );
1102 }
1103 //*************************************************************************************************
1104 
1105 
1106 //*************************************************************************************************
1113 template< typename VT // Type of the sparse vector
1114  , bool AF // Alignment flag
1115  , bool TF > // Transpose flag
1117 {
1118  if( offset_ + size_ == vector_.size() )
1119  return ConstIterator( vector_.cend(), offset_ );
1120  else
1121  return ConstIterator( vector_.lowerBound( offset_ + size_ ), offset_ );
1122 }
1123 //*************************************************************************************************
1124 
1125 
1126 //*************************************************************************************************
1133 template< typename VT // Type of the sparse vector
1134  , bool AF // Alignment flag
1135  , bool TF > // Transpose flag
1137 {
1138  if( offset_ + size_ == vector_.size() )
1139  return ConstIterator( vector_.cend(), offset_ );
1140  else
1141  return ConstIterator( vector_.lowerBound( offset_ + size_ ), offset_ );
1142 }
1143 //*************************************************************************************************
1144 
1145 
1146 
1147 
1148 //=================================================================================================
1149 //
1150 // ASSIGNMENT OPERATORS
1151 //
1152 //=================================================================================================
1153 
1154 //*************************************************************************************************
1165 template< typename VT // Type of the sparse vector
1166  , bool AF // Alignment flag
1167  , bool TF > // Transpose flag
1170 {
1171  using blaze::assign;
1172 
1175 
1176  if( this == &rhs || ( &vector_ == &rhs.vector_ && offset_ == rhs.offset_ ) )
1177  return *this;
1178 
1179  if( size() != rhs.size() ) {
1180  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1181  }
1182 
1183  if( !tryAssign( vector_, rhs, offset_ ) ) {
1184  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted vector" );
1185  }
1186 
1187  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1188 
1189  if( rhs.canAlias( &vector_ ) ) {
1190  const ResultType tmp( rhs );
1191  reset();
1192  assign( left, tmp );
1193  }
1194  else {
1195  reset();
1196  assign( left, rhs );
1197  }
1198 
1199  BLAZE_INTERNAL_ASSERT( isIntact( vector_ ), "Invariant violation detected" );
1200 
1201  return *this;
1202 }
1203 //*************************************************************************************************
1204 
1205 
1206 //*************************************************************************************************
1217 template< typename VT // Type of the sparse vector
1218  , bool AF // Alignment flag
1219  , bool TF > // Transpose flag
1220 template< typename VT2 > // Type of the right-hand side vector
1223 {
1224  using blaze::assign;
1225 
1228 
1229  if( size() != (~rhs).size() ) {
1230  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1231  }
1232 
1233  typedef typename If< IsRestricted<VT>, typename VT2::CompositeType, const VT2& >::Type Right;
1234  Right right( ~rhs );
1235 
1236  if( !tryAssign( vector_, right, offset_ ) ) {
1237  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted vector" );
1238  }
1239 
1240  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1241 
1242  if( IsReference<Right>::value || right.canAlias( &vector_ ) ) {
1243  const typename VT2::ResultType tmp( right );
1244  reset();
1245  assign( left, tmp );
1246  }
1247  else {
1248  reset();
1249  assign( left, right );
1250  }
1251 
1252  BLAZE_INTERNAL_ASSERT( isIntact( vector_ ), "Invariant violation detected" );
1253 
1254  return *this;
1255 }
1256 //*************************************************************************************************
1257 
1258 
1259 //*************************************************************************************************
1270 template< typename VT // Type of the sparse vector
1271  , bool AF // Alignment flag
1272  , bool TF > // Transpose flag
1273 template< typename VT2 > // Type of the right-hand side vector
1276 {
1277  using blaze::assign;
1278 
1282 
1283  typedef typename AddTrait<ResultType,typename VT2::ResultType>::Type AddType;
1284 
1287 
1288  if( size() != (~rhs).size() ) {
1289  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1290  }
1291 
1292  const AddType tmp( *this + (~rhs) );
1293 
1294  if( !tryAssign( vector_, tmp, offset_ ) ) {
1295  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted vector" );
1296  }
1297 
1298  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1299 
1300  left.reset();
1301  assign( left, tmp );
1302 
1303  BLAZE_INTERNAL_ASSERT( isIntact( vector_ ), "Invariant violation detected" );
1304 
1305  return *this;
1306 }
1307 //*************************************************************************************************
1308 
1309 
1310 //*************************************************************************************************
1321 template< typename VT // Type of the sparse vector
1322  , bool AF // Alignment flag
1323  , bool TF > // Transpose flag
1324 template< typename VT2 > // Type of the right-hand side vector
1327 {
1328  using blaze::assign;
1329 
1333 
1334  typedef typename SubTrait<ResultType,typename VT2::ResultType>::Type SubType;
1335 
1338 
1339  if( size() != (~rhs).size() ) {
1340  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1341  }
1342 
1343  const SubType tmp( *this - (~rhs) );
1344 
1345  if( !tryAssign( vector_, tmp, offset_ ) ) {
1346  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted vector" );
1347  }
1348 
1349  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1350 
1351  left.reset();
1352  assign( left, tmp );
1353 
1354  BLAZE_INTERNAL_ASSERT( isIntact( vector_ ), "Invariant violation detected" );
1355 
1356  return *this;
1357 }
1358 //*************************************************************************************************
1359 
1360 
1361 //*************************************************************************************************
1373 template< typename VT // Type of the sparse vector
1374  , bool AF // Alignment flag
1375  , bool TF > // Transpose flag
1376 template< typename VT2 > // Type of the right-hand side vector
1379 {
1380  using blaze::assign;
1381 
1385 
1386  typedef typename MultTrait<ResultType,typename VT2::ResultType>::Type MultType;
1387 
1390 
1391  if( size() != (~rhs).size() ) {
1392  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1393  }
1394 
1395  const MultType tmp( *this * (~rhs) );
1396 
1397  if( !tryAssign( vector_, tmp, offset_ ) ) {
1398  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted vector" );
1399  }
1400 
1401  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1402 
1403  left.reset();
1404  assign( left, tmp );
1405 
1406  BLAZE_INTERNAL_ASSERT( isIntact( vector_ ), "Invariant violation detected" );
1407 
1408  return *this;
1409 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1424 template< typename VT // Type of the sparse vector
1425  , bool AF // Alignment flag
1426  , bool TF > // Transpose flag
1427 template< typename Other > // Data type of the right-hand side scalar
1428 inline typename EnableIf< IsNumeric<Other>, SparseSubvector<VT,AF,TF> >::Type&
1430 {
1431  const Iterator last( end() );
1432  for( Iterator element=begin(); element!=last; ++element )
1433  element->value() *= rhs;
1434  return *this;
1435 }
1436 //*************************************************************************************************
1437 
1438 
1439 //*************************************************************************************************
1451 template< typename VT // Type of the sparse vector
1452  , bool AF // Alignment flag
1453  , bool TF > // Transpose flag
1454 template< typename Other > // Data type of the right-hand side scalar
1455 inline typename EnableIf< IsNumeric<Other>, SparseSubvector<VT,AF,TF> >::Type&
1457 {
1458  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1459 
1460  typedef typename DivTrait<ElementType,Other>::Type DT;
1461  typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
1462 
1463  const Iterator last( end() );
1464 
1465  // Depending on the two involved data types, an integer division is applied or a
1466  // floating point division is selected.
1468  const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1469  for( Iterator element=begin(); element!=last; ++element )
1470  element->value() *= tmp;
1471  }
1472  else {
1473  for( Iterator element=begin(); element!=last; ++element )
1474  element->value() /= rhs;
1475  }
1476 
1477  return *this;
1478 }
1479 //*************************************************************************************************
1480 
1481 
1482 
1483 
1484 //=================================================================================================
1485 //
1486 // UTILITY FUNCTIONS
1487 //
1488 //=================================================================================================
1489 
1490 //*************************************************************************************************
1495 template< typename VT // Type of the sparse vector
1496  , bool AF // Alignment flag
1497  , bool TF > // Transpose flag
1498 inline size_t SparseSubvector<VT,AF,TF>::size() const
1499 {
1500  return size_;
1501 }
1502 //*************************************************************************************************
1503 
1504 
1505 //*************************************************************************************************
1510 template< typename VT // Type of the sparse vector
1511  , bool AF // Alignment flag
1512  , bool TF > // Transpose flag
1514 {
1515  return nonZeros() + vector_.capacity() - vector_.nonZeros();
1516 }
1517 //*************************************************************************************************
1518 
1519 
1520 //*************************************************************************************************
1527 template< typename VT // Type of the sparse vector
1528  , bool AF // Alignment flag
1529  , bool TF > // Transpose flag
1531 {
1532  return end() - begin();
1533 }
1534 //*************************************************************************************************
1535 
1536 
1537 //*************************************************************************************************
1542 template< typename VT // Type of the sparse vector
1543  , bool AF // Alignment flag
1544  , bool TF > // Transpose flag
1546 {
1547  vector_.erase( vector_.lowerBound( offset_ ), vector_.lowerBound( offset_ + size_ ) );
1548 }
1549 //*************************************************************************************************
1550 
1551 
1552 //*************************************************************************************************
1563 template< typename VT // Type of the sparse vector
1564  , bool AF // Alignment flag
1565  , bool TF > // Transpose flag
1567  SparseSubvector<VT,AF,TF>::set( size_t index, const ElementType& value )
1568 {
1569  return Iterator( vector_.set( offset_ + index, value ), offset_ );
1570 }
1571 //*************************************************************************************************
1572 
1573 
1574 //*************************************************************************************************
1586 template< typename VT // Type of the sparse vector
1587  , bool AF // Alignment flag
1588  , bool TF > // Transpose flag
1590  SparseSubvector<VT,AF,TF>::insert( size_t index, const ElementType& value )
1591 {
1592  return Iterator( vector_.insert( offset_ + index, value ), offset_ );
1593 }
1594 //*************************************************************************************************
1595 
1596 
1597 //*************************************************************************************************
1605 template< typename VT // Type of the sparse vector
1606  , bool AF // Alignment flag
1607  , bool TF > // Transpose flag
1608 inline void SparseSubvector<VT,AF,TF>::erase( size_t index )
1609 {
1610  vector_.erase( offset_ + index );
1611 }
1612 //*************************************************************************************************
1613 
1614 
1615 //*************************************************************************************************
1623 template< typename VT // Type of the sparse vector
1624  , bool AF // Alignment flag
1625  , bool TF > // Transpose flag
1627 {
1628  return Iterator( vector_.erase( pos.base() ), offset_ );
1629 }
1630 //*************************************************************************************************
1631 
1632 
1633 //*************************************************************************************************
1642 template< typename VT // Type of the sparse vector
1643  , bool AF // Alignment flag
1644  , bool TF > // Transpose flag
1647 {
1648  return Iterator( vector_.erase( first.base(), last.base() ), offset_ );
1649 }
1650 //*************************************************************************************************
1651 
1652 
1653 //*************************************************************************************************
1662 template< typename VT // Type of the sparse vector
1663  , bool AF // Alignment flag
1664  , bool TF > // Transpose flag
1666 {
1667  const size_t current( capacity() );
1668 
1669  if( n > current ) {
1670  vector_.reserve( vector_.capacity() + n - current );
1671  }
1672 }
1673 //*************************************************************************************************
1674 
1675 
1676 //*************************************************************************************************
1682 template< typename VT // Type of the sparse vector
1683  , bool AF // Alignment flag
1684  , bool TF > // Transpose flag
1685 template< typename Other > // Data type of the scalar value
1687 {
1688  for( Iterator element=begin(); element!=end(); ++element )
1689  element->value() *= scalar;
1690  return *this;
1691 }
1692 //*************************************************************************************************
1693 
1694 
1695 
1696 
1697 //=================================================================================================
1698 //
1699 // LOOKUP FUNCTIONS
1700 //
1701 //=================================================================================================
1702 
1703 //*************************************************************************************************
1716 template< typename VT // Type of the sparse vector
1717  , bool AF // Alignment flag
1718  , bool TF > // Transpose flag
1721 {
1722  const typename VT::Iterator pos( vector_.find( offset_ + index ) );
1723 
1724  if( pos != vector_.end() )
1725  return Iterator( pos, offset_ );
1726  else
1727  return end();
1728 }
1729 //*************************************************************************************************
1730 
1731 
1732 //*************************************************************************************************
1745 template< typename VT // Type of the sparse vector
1746  , bool AF // Alignment flag
1747  , bool TF > // Transpose flag
1749  SparseSubvector<VT,AF,TF>::find( size_t index ) const
1750 {
1751  const typename VT::ConstIterator pos( vector_.find( offset_ + index ) );
1752 
1753  if( pos != vector_.end() )
1754  return Iterator( pos, offset_ );
1755  else
1756  return end();
1757 }
1758 //*************************************************************************************************
1759 
1760 
1761 //*************************************************************************************************
1773 template< typename VT // Type of the sparse vector
1774  , bool AF // Alignment flag
1775  , bool TF > // Transpose flag
1778 {
1779  return Iterator( vector_.lowerBound( offset_ + index ), offset_ );
1780 }
1781 //*************************************************************************************************
1782 
1783 
1784 //*************************************************************************************************
1796 template< typename VT // Type of the sparse vector
1797  , bool AF // Alignment flag
1798  , bool TF > // Transpose flag
1801 {
1802  return ConstIterator( vector_.lowerBound( offset_ + index ), offset_ );
1803 }
1804 //*************************************************************************************************
1805 
1806 
1807 //*************************************************************************************************
1819 template< typename VT // Type of the sparse vector
1820  , bool AF // Alignment flag
1821  , bool TF > // Transpose flag
1824 {
1825  return Iterator( vector_.upperBound( offset_ + index ), offset_ );
1826 }
1827 //*************************************************************************************************
1828 
1829 
1830 //*************************************************************************************************
1842 template< typename VT // Type of the sparse vector
1843  , bool AF // Alignment flag
1844  , bool TF > // Transpose flag
1847 {
1848  return ConstIterator( vector_.upperBound( offset_ + index ), offset_ );
1849 }
1850 //*************************************************************************************************
1851 
1852 
1853 
1854 
1855 //=================================================================================================
1856 //
1857 // LOW-LEVEL UTILITY FUNCTIONS
1858 //
1859 //=================================================================================================
1860 
1861 //*************************************************************************************************
1885 template< typename VT // Type of the sparse vector
1886  , bool AF // Alignment flag
1887  , bool TF > // Transpose flag
1888 inline void SparseSubvector<VT,AF,TF>::append( size_t index, const ElementType& value, bool check )
1889 {
1890  if( offset_ + size_ == vector_.size() )
1891  vector_.append( offset_ + index, value, check );
1892  else if( !check || !isDefault( value ) )
1893  vector_.insert( offset_ + index, value );
1894 }
1895 //*************************************************************************************************
1896 
1897 
1898 
1899 
1900 //=================================================================================================
1901 //
1902 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1903 //
1904 //=================================================================================================
1905 
1906 //*************************************************************************************************
1916 template< typename VT // Type of the sparse vector
1917  , bool AF // Alignment flag
1918  , bool TF > // Transpose flag
1919 template< typename Other > // Data type of the foreign expression
1920 inline bool SparseSubvector<VT,AF,TF>::canAlias( const Other* alias ) const
1921 {
1922  return vector_.isAliased( alias );
1923 }
1924 //*************************************************************************************************
1925 
1926 
1927 //*************************************************************************************************
1937 template< typename VT // Type of the sparse vector
1938  , bool AF // Alignment flag
1939  , bool TF > // Transpose flag
1940 template< typename Other > // Data type of the foreign expression
1941 inline bool SparseSubvector<VT,AF,TF>::isAliased( const Other* alias ) const
1942 {
1943  return vector_.isAliased( alias );
1944 }
1945 //*************************************************************************************************
1946 
1947 
1948 //*************************************************************************************************
1958 template< typename VT // Type of the sparse vector
1959  , bool AF // Alignment flag
1960  , bool TF > // Transpose flag
1962 {
1963  return false;
1964 }
1965 //*************************************************************************************************
1966 
1967 
1968 //*************************************************************************************************
1979 template< typename VT // Type of the sparse vector
1980  , bool AF // Alignment flag
1981  , bool TF > // Transpose flag
1982 template< typename VT2 > // Type of the right-hand side dense vector
1984 {
1985  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1986  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1987 
1988  reserve( (~rhs).size() );
1989 
1990  for( size_t i=0UL; i<size(); ++i ) {
1991  append( i, (~rhs)[i], true );
1992  }
1993 }
1994 //*************************************************************************************************
1995 
1996 
1997 //*************************************************************************************************
2008 template< typename VT // Type of the sparse vector
2009  , bool AF // Alignment flag
2010  , bool TF > // Transpose flag
2011 template< typename VT2 > // Type of the right-hand side sparse vector
2013 {
2014  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2015  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
2016 
2017  reserve( (~rhs).nonZeros() );
2018 
2019  for( typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2020  append( element->index(), element->value(), true );
2021  }
2022 }
2023 //*************************************************************************************************
2024 
2025 
2026 //*************************************************************************************************
2037 template< typename VT // Type of the sparse vector
2038  , bool AF // Alignment flag
2039  , bool TF > // Transpose flag
2040 template< typename VT2 > // Type of the right-hand side dense vector
2042 {
2043  typedef typename AddTrait<ResultType,typename VT2::ResultType>::Type AddType;
2044 
2048 
2049  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2050 
2051  const AddType tmp( serial( *this + (~rhs) ) );
2052  reset();
2053  assign( tmp );
2054 }
2055 //*************************************************************************************************
2056 
2057 
2058 //*************************************************************************************************
2069 template< typename VT // Type of the sparse vector
2070  , bool AF // Alignment flag
2071  , bool TF > // Transpose flag
2072 template< typename VT2 > // Type of the right-hand side sparse vector
2074 {
2075  typedef typename AddTrait<ResultType,typename VT2::ResultType>::Type AddType;
2076 
2080 
2081  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2082 
2083  const AddType tmp( serial( *this + (~rhs) ) );
2084  reset();
2085  assign( tmp );
2086 }
2087 //*************************************************************************************************
2088 
2089 
2090 //*************************************************************************************************
2101 template< typename VT // Type of the sparse vector
2102  , bool AF // Alignment flag
2103  , bool TF > // Transpose flag
2104 template< typename VT2 > // Type of the right-hand side dense vector
2106 {
2107  typedef typename SubTrait<ResultType,typename VT2::ResultType>::Type SubType;
2108 
2112 
2113  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2114 
2115  const SubType tmp( serial( *this - (~rhs) ) );
2116  reset();
2117  assign( tmp );
2118 }
2119 //*************************************************************************************************
2120 
2121 
2122 //*************************************************************************************************
2133 template< typename VT // Type of the sparse vector
2134  , bool AF // Alignment flag
2135  , bool TF > // Transpose flag
2136 template< typename VT2 > // Type of the right-hand side sparse vector
2138 {
2139  typedef typename SubTrait<ResultType,typename VT2::ResultType>::Type SubType;
2140 
2144 
2145  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2146 
2147  const SubType tmp( serial( *this - (~rhs) ) );
2148  reset();
2149  assign( tmp );
2150 }
2151 //*************************************************************************************************
2152 
2153 
2154 
2155 
2156 
2157 
2158 
2159 
2160 //=================================================================================================
2161 //
2162 // SPARSESUBVECTOR OPERATORS
2163 //
2164 //=================================================================================================
2165 
2166 //*************************************************************************************************
2169 template< typename VT, bool AF, bool TF >
2170 inline void reset( SparseSubvector<VT,AF,TF>& sv );
2171 
2172 template< typename VT, bool AF, bool TF >
2173 inline void clear( SparseSubvector<VT,AF,TF>& sv );
2174 
2175 template< typename VT, bool AF, bool TF >
2176 inline bool isDefault( const SparseSubvector<VT,AF,TF>& sv );
2177 
2178 template< typename VT, bool AF, bool TF >
2179 inline bool isIntact( const SparseSubvector<VT,AF,TF>& sv );
2180 
2181 template< typename VT, bool AF, bool TF >
2182 inline bool isSame( const SparseSubvector<VT,AF,TF>& a, const SparseVector<VT,TF>& b );
2183 
2184 template< typename VT, bool AF, bool TF >
2185 inline bool isSame( const SparseVector<VT,TF>& a, const SparseSubvector<VT,AF,TF>& b );
2186 
2187 template< typename VT, bool AF, bool TF >
2188 inline bool isSame( const SparseSubvector<VT,AF,TF>& a, const SparseSubvector<VT,AF,TF>& b );
2190 //*************************************************************************************************
2191 
2192 
2193 //*************************************************************************************************
2200 template< typename VT // Type of the sparse vector
2201  , bool AF // Alignment flag
2202  , bool TF > // Transpose flag
2204 {
2205  sv.reset();
2206 }
2207 //*************************************************************************************************
2208 
2209 
2210 //*************************************************************************************************
2219 template< typename VT // Type of the sparse vector
2220  , bool AF // Alignment flag
2221  , bool TF > // Transpose flag
2223 {
2224  sv.reset();
2225 }
2226 //*************************************************************************************************
2227 
2228 
2229 //*************************************************************************************************
2247 template< typename VT // Type of the sparse vector
2248  , bool AF // Alignment flag
2249  , bool TF > // Transpose flag
2250 inline bool isDefault( const SparseSubvector<VT,AF,TF>& sv )
2251 {
2253 
2254  const ConstIterator end( sv.end() );
2255  for( ConstIterator element=sv.begin(); element!=end; ++element )
2256  if( !isDefault( element->value() ) ) return false;
2257  return true;
2258 }
2259 //*************************************************************************************************
2260 
2261 
2262 //*************************************************************************************************
2280 template< typename VT // Type of the sparse vector
2281  , bool AF // Alignment flag
2282  , bool TF > // Transpose flag
2283 inline bool isIntact( const SparseSubvector<VT,AF,TF>& sv )
2284 {
2285  return ( sv.offset_ + sv.size_ <= sv.vector_.size() &&
2286  isIntact( sv.vector_ ) );
2287 }
2288 //*************************************************************************************************
2289 
2290 
2291 //*************************************************************************************************
2303 template< typename VT // Type of the sparse vector
2304  , bool AF // Alignment flag
2305  , bool TF > // Transpose flag
2306 inline bool isSame( const SparseSubvector<VT,AF,TF>& a, const SparseVector<VT,TF>& b )
2307 {
2308  return ( isSame( a.vector_, ~b ) && ( a.size() == (~b).size() ) );
2309 }
2310 //*************************************************************************************************
2311 
2312 
2313 //*************************************************************************************************
2325 template< typename VT // Type of the sparse vector
2326  , bool AF // Alignment flag
2327  , bool TF > // Transpose flag
2328 inline bool isSame( const SparseVector<VT,TF>& a, const SparseSubvector<VT,AF,TF>& b )
2329 {
2330  return ( isSame( ~a, b.vector_ ) && ( (~a).size() == b.size() ) );
2331 }
2332 //*************************************************************************************************
2333 
2334 
2335 //*************************************************************************************************
2347 template< typename VT // Type of the sparse vector
2348  , bool AF // Alignment flag
2349  , bool TF > // Transpose flag
2351 {
2352  return ( isSame( a.vector_, b.vector_ ) && ( a.offset_ == b.offset_ ) && ( a.size_ == b.size_ ) );
2353 }
2354 //*************************************************************************************************
2355 
2356 
2357 //*************************************************************************************************
2372 template< typename VT1 // Type of the sparse vector
2373  , bool AF // Alignment flag
2374  , bool TF // Transpose flag
2375  , typename VT2 > // Type of the right-hand side vector
2376 inline bool tryAssign( const SparseSubvector<VT1,AF,TF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
2377 {
2378  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2379  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
2380 
2381  return tryAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
2382 }
2384 //*************************************************************************************************
2385 
2386 
2387 //*************************************************************************************************
2402 template< typename VT1 // Type of the sparse vector
2403  , bool AF // Alignment flag
2404  , bool TF // Transpose flag
2405  , typename VT2 > // Type of the right-hand side vector
2406 inline bool tryAddAssign( const SparseSubvector<VT1,AF,TF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
2407 {
2408  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2409  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
2410 
2411  return tryAddAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
2412 }
2414 //*************************************************************************************************
2415 
2416 
2417 //*************************************************************************************************
2433 template< typename VT1 // Type of the sparse vector
2434  , bool AF // Alignment flag
2435  , bool TF // Transpose flag
2436  , typename VT2 > // Type of the right-hand side vector
2437 inline bool trySubAssign( const SparseSubvector<VT1,AF,TF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
2438 {
2439  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2440  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
2441 
2442  return trySubAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
2443 }
2445 //*************************************************************************************************
2446 
2447 
2448 //*************************************************************************************************
2464 template< typename VT1 // Type of the sparse vector
2465  , bool AF // Alignment flag
2466  , bool TF // Transpose flag
2467  , typename VT2 > // Type of the right-hand side vector
2468 inline bool tryMultAssign( const SparseSubvector<VT1,AF,TF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
2469 {
2470  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2471  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
2472 
2473  return tryMultAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
2474 }
2476 //*************************************************************************************************
2477 
2478 
2479 //*************************************************************************************************
2494 template< typename VT // Type of the sparse vector
2495  , bool AF // Alignment flag
2496  , bool TF > // Transpose flag
2497 inline typename DerestrictTrait< SparseSubvector<VT,AF,TF> >::Type
2498  derestrict( SparseSubvector<VT,AF,TF>& sv )
2499 {
2500  typedef typename DerestrictTrait< SparseSubvector<VT,AF,TF> >::Type ReturnType;
2501  return ReturnType( derestrict( sv.vector_ ), sv.offset_, sv.size_ );
2502 }
2504 //*************************************************************************************************
2505 
2506 
2507 
2508 
2509 //=================================================================================================
2510 //
2511 // GLOBAL RESTRUCTURING OPERATORS
2512 //
2513 //=================================================================================================
2514 
2515 //*************************************************************************************************
2528 template< bool AF1 // Required alignment flag
2529  , typename VT // Type of the sparse vector
2530  , bool AF2 // Present alignment flag
2531  , bool TF > // Transpose flag
2532 inline const SparseSubvector<VT,AF1,TF>
2533  subvector( const SparseSubvector<VT,AF2,TF>& sv, size_t index, size_t size )
2534 {
2536 
2537  if( index + size > sv.size() ) {
2538  BLAZE_THROW_INVALID_ARGUMENT( "Invalid subvector specification" );
2539  }
2540 
2541  return SparseSubvector<VT,AF1,TF>( sv.vector_, sv.offset_ + index, size );
2542 }
2544 //*************************************************************************************************
2545 
2546 
2547 
2548 
2549 //=================================================================================================
2550 //
2551 // ISRESTRICTED SPECIALIZATIONS
2552 //
2553 //=================================================================================================
2554 
2555 //*************************************************************************************************
2557 template< typename VT, bool AF, bool TF >
2558 struct IsRestricted< SparseSubvector<VT,AF,TF> > : public If< IsRestricted<VT>, TrueType, FalseType >::Type
2559 {
2560  enum { value = IsRestricted<VT>::value };
2561  typedef typename If< IsRestricted<VT>, TrueType, FalseType >::Type Type;
2562 };
2564 //*************************************************************************************************
2565 
2566 
2567 
2568 
2569 //=================================================================================================
2570 //
2571 // DERESTRICTTRAIT SPECIALIZATIONS
2572 //
2573 //=================================================================================================
2574 
2575 //*************************************************************************************************
2577 template< typename VT, bool AF, bool TF >
2578 struct DerestrictTrait< SparseSubvector<VT,AF,TF> >
2579 {
2580  typedef SparseSubvector< typename RemoveReference< typename DerestrictTrait<VT>::Type >::Type, AF, TF > Type;
2581 };
2583 //*************************************************************************************************
2584 
2585 
2586 
2587 
2588 //=================================================================================================
2589 //
2590 // ADDTRAIT SPECIALIZATIONS
2591 //
2592 //=================================================================================================
2593 
2594 //*************************************************************************************************
2596 template< typename VT, bool AF, bool TF, typename T >
2597 struct AddTrait< SparseSubvector<VT,AF,TF>, T >
2598 {
2599  typedef typename AddTrait< typename SubvectorTrait<VT>::Type, T >::Type Type;
2600 };
2601 
2602 template< typename T, typename VT, bool AF, bool TF >
2603 struct AddTrait< T, SparseSubvector<VT,AF,TF> >
2604 {
2605  typedef typename AddTrait< T, typename SubvectorTrait<VT>::Type >::Type Type;
2606 };
2608 //*************************************************************************************************
2609 
2610 
2611 
2612 
2613 //=================================================================================================
2614 //
2615 // SUBTRAIT SPECIALIZATIONS
2616 //
2617 //=================================================================================================
2618 
2619 //*************************************************************************************************
2621 template< typename VT, bool AF, bool TF, typename T >
2622 struct SubTrait< SparseSubvector<VT,AF,TF>, T >
2623 {
2624  typedef typename SubTrait< typename SubvectorTrait<VT>::Type, T >::Type Type;
2625 };
2626 
2627 template< typename T, typename VT, bool AF, bool TF >
2628 struct SubTrait< T, SparseSubvector<VT,AF,TF> >
2629 {
2630  typedef typename SubTrait< T, typename SubvectorTrait<VT>::Type >::Type Type;
2631 };
2633 //*************************************************************************************************
2634 
2635 
2636 
2637 
2638 //=================================================================================================
2639 //
2640 // MULTTRAIT SPECIALIZATIONS
2641 //
2642 //=================================================================================================
2643 
2644 //*************************************************************************************************
2646 template< typename VT, bool AF, bool TF, typename T >
2647 struct MultTrait< SparseSubvector<VT,AF,TF>, T >
2648 {
2649  typedef typename MultTrait< typename SubvectorTrait<VT>::Type, T >::Type Type;
2650 };
2651 
2652 template< typename T, typename VT, bool AF, bool TF >
2653 struct MultTrait< T, SparseSubvector<VT,AF,TF> >
2654 {
2655  typedef typename MultTrait< T, typename SubvectorTrait<VT>::Type >::Type Type;
2656 };
2658 //*************************************************************************************************
2659 
2660 
2661 
2662 
2663 //=================================================================================================
2664 //
2665 // CROSSTRAIT SPECIALIZATIONS
2666 //
2667 //=================================================================================================
2668 
2669 //*************************************************************************************************
2671 template< typename VT, bool AF, bool TF, typename T >
2672 struct CrossTrait< SparseSubvector<VT,AF,TF>, T >
2673 {
2674  typedef typename CrossTrait< typename SubvectorTrait<VT>::Type, T >::Type Type;
2675 };
2676 
2677 template< typename T, typename VT, bool AF, bool TF >
2678 struct CrossTrait< T, SparseSubvector<VT,AF,TF> >
2679 {
2680  typedef typename CrossTrait< T, typename SubvectorTrait<VT>::Type >::Type Type;
2681 };
2683 //*************************************************************************************************
2684 
2685 
2686 
2687 
2688 //=================================================================================================
2689 //
2690 // DIVTRAIT SPECIALIZATIONS
2691 //
2692 //=================================================================================================
2693 
2694 //*************************************************************************************************
2696 template< typename VT, bool AF, bool TF, typename T >
2697 struct DivTrait< SparseSubvector<VT,AF,TF>, T >
2698 {
2699  typedef typename DivTrait< typename SubvectorTrait<VT>::Type, T >::Type Type;
2700 };
2701 
2702 template< typename T, typename VT, bool AF, bool TF >
2703 struct DivTrait< T, SparseSubvector<VT,AF,TF> >
2704 {
2705  typedef typename DivTrait< T, typename SubvectorTrait<VT>::Type >::Type Type;
2706 };
2708 //*************************************************************************************************
2709 
2710 
2711 
2712 
2713 //=================================================================================================
2714 //
2715 // SUBVECTORTRAIT SPECIALIZATIONS
2716 //
2717 //=================================================================================================
2718 
2719 //*************************************************************************************************
2721 template< typename VT, bool AF, bool TF >
2722 struct SubvectorTrait< SparseSubvector<VT,AF,TF> >
2723 {
2725 };
2727 //*************************************************************************************************
2728 
2729 
2730 
2731 
2732 //=================================================================================================
2733 //
2734 // SUBVECTOREXPRTRAIT SPECIALIZATIONS
2735 //
2736 //=================================================================================================
2737 
2738 //*************************************************************************************************
2740 template< typename VT, bool AF1, bool TF, bool AF2 >
2741 struct SubvectorExprTrait< SparseSubvector<VT,AF1,TF>, AF2 >
2742 {
2743  typedef SparseSubvector<VT,AF2,TF> Type;
2744 };
2746 //*************************************************************************************************
2747 
2748 
2749 //*************************************************************************************************
2751 template< typename VT, bool AF1, bool TF, bool AF2 >
2752 struct SubvectorExprTrait< const SparseSubvector<VT,AF1,TF>, AF2 >
2753 {
2754  typedef SparseSubvector<VT,AF2,TF> Type;
2755 };
2757 //*************************************************************************************************
2758 
2759 
2760 //*************************************************************************************************
2762 template< typename VT, bool AF1, bool TF, bool AF2 >
2763 struct SubvectorExprTrait< volatile SparseSubvector<VT,AF1,TF>, AF2 >
2764 {
2765  typedef SparseSubvector<VT,AF2,TF> Type;
2766 };
2768 //*************************************************************************************************
2769 
2770 
2771 //*************************************************************************************************
2773 template< typename VT, bool AF1, bool TF, bool AF2 >
2774 struct SubvectorExprTrait< const volatile SparseSubvector<VT,AF1,TF>, AF2 >
2775 {
2776  typedef SparseSubvector<VT,AF2,TF> Type;
2777 };
2779 //*************************************************************************************************
2780 
2781 } // namespace blaze
2782 
2783 #endif
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SparseSubvector.h:568
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Constraint on the data type.
Pointer difference type of the Blaze library.
View on a specific subvector of a sparse vector.The SparseSubvector template represents a view on a s...
Definition: Forward.h:54
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
If< IsConst< VT >, ConstReference, typename VT::Reference >::Type Reference
Reference to a non-constant subvector value.
Definition: SparseSubvector.h:412
ValueType value_type
Type of the underlying elements.
Definition: SparseSubvector.h:576
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
const SubvectorElement * operator->() const
Direct access to the sparse subvector element at the current iterator position.
Definition: SparseSubvector.h:526
const SparseSubvector & CompositeType
Data type for composite expression templates.
Definition: SparseSubvector.h:406
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
IndexType index() const
Access to the current index of the sparse element.
Definition: SparseSubvector.h:546
size_t offset_
The offset of the subvector within the sparse vector.
Definition: SparseSubvector.h:716
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:250
PointerType pointer
Pointer return type.
Definition: SparseSubvector.h:577
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:118
size_t IndexType
The index type of the row element.
Definition: SparseSubvector.h:444
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:647
ReferenceType reference
Reference return type.
Definition: SparseSubvector.h:578
Iterator begin()
Returns an iterator to the first element of the subvector.
Definition: SparseSubvector.h:1036
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
CRT ConstReference
Reference-to-const return type.
Definition: SparseSubvector.h:446
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
Header file for the IsRowVector type trait.
SparseSubvector(Operand vector, size_t index, size_t n)
The constructor for SparseSubvector.
Definition: SparseSubvector.h:916
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
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:378
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: SparseSubvector.h:1777
size_t offset_
Offset within the according sparse vector.
Definition: SparseSubvector.h:554
IfTrue< returnConst, CRT, RT >::Type Reference
Reference return type.
Definition: SparseSubvector.h:445
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:118
size_t size() const
Returns the size/dimension of the sparse subvector.
Definition: SparseSubvector.h:1498
If< IsConst< VT >, ConstIterator, SubvectorIterator< VT, typename VT::Iterator > >::Type Iterator
Iterator over non-constant elements.
Definition: SparseSubvector.h:726
void reserve(size_t n)
Setting the minimum capacity of the sparse subvector.
Definition: SparseSubvector.h:1665
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SparseSubvector.h:572
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
DifferenceType operator-(const SubvectorIterator &rhs) const
Calculating the number of elements between two subvector iterators.
Definition: SparseSubvector.h:688
VT::ElementType ElementType
Type of the subvector elements.
Definition: SparseSubvector.h:404
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:123
Constraint on the data type.
const SubvectorIterator operator++(int)
Post-increment operator.
Definition: SparseSubvector.h:631
Iterator end()
Returns an iterator just past the last element of the subvector.
Definition: SparseSubvector.h:1096
IteratorCategory iterator_category
The iterator category.
Definition: SparseSubvector.h:575
Header file for the multiplication trait.
void erase(size_t index)
Erasing an element from the sparse subvector.
Definition: SparseSubvector.h:1608
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
size_t capacity() const
Returns the maximum capacity of the sparse subvector.
Definition: SparseSubvector.h:1513
Header file for the If class template.
Header file for the Subvector base class.
SubvectorIterator< const VT, typename VT::ConstIterator > ConstIterator
Iterator over constant elements.
Definition: SparseSubvector.h:723
SET::ValueType ValueType
The value type of the row element.
Definition: SparseSubvector.h:443
Header file for the IsFloatingPoint type trait.
bool canSMPAssign() const
Returns whether the subvector can be used in SMP assignments.
Definition: SparseSubvector.h:1961
SubvectorElement & operator-=(const T &v)
Subtraction assignment to the accessed sparse subvector element.
Definition: SparseSubvector.h:491
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
Header file for the Or class template.
#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
void assign(const DenseVector< VT2, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: SparseSubvector.h:1983
SubvectorIterator(const SubvectorIterator< VectorType2, IteratorType2 > &it)
Conversion constructor from different SubvectorIterator instances.
Definition: SparseSubvector.h:609
Header file for the subvector trait.
Access proxy for a specific element of the sparse subvector.
Definition: SparseSubvector.h:420
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse subvector.
Definition: SparseSubvector.h:1888
bool operator==(const SubvectorIterator< VectorType2, IteratorType2 > &rhs) const
Equality comparison between two SubvectorIterator objects.
Definition: SparseSubvector.h:665
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseSubvector.h:403
SubvectorTrait< VT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseSubvector.h:402
Operand vector_
The sparse vector containing the subvector.
Definition: SparseSubvector.h:838
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:79
If< IsExpression< VT >, VT, VT & >::Type Operand
Composite data type of the sparse vector expression.
Definition: SparseSubvector.h:396
SparseSubvector< VT, AF, TF > This
Type of this SparseSubvector instance.
Definition: SparseSubvector.h:401
SubvectorIterator & operator++()
Pre-increment operator.
Definition: SparseSubvector.h:620
const size_t size_
The size of the subvector.
Definition: SparseSubvector.h:840
Constraint on the data type.
Header file for the SparseElement base class.
Reference value() const
Access to the current value of the sparse subvector element.
Definition: SparseSubvector.h:536
Constraint on the data type.
void subAssign(const DenseVector< VT2, TF > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: SparseSubvector.h:2105
Constraint on the data type.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:187
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:94
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseSubvector.h:1823
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
IteratorType pos_
Iterator to the current sparse element.
Definition: SparseSubvector.h:715
size_t offset() const
Access to the offset of the subvector iterator.
Definition: SparseSubvector.h:708
const bool unaligned
Alignment flag for unaligned vectors and matrices.Via this flag it is possible to specify subvectors...
Definition: AlignmentFlag.h:64
Constraint on the data type.
Reference at(size_t index)
Checked access to the subvector elements.
Definition: SparseSubvector.h:992
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
Header file for the serial shim.
Header file for the DerestrictTrait class template.
SET::Reference RT
Reference type of the underlying sparse element.
Definition: SparseSubvector.h:437
Header file for the IsNumeric type trait.
Reference operator[](size_t index)
Subscript operator for the direct access to the subvector elements.
Definition: SparseSubvector.h:949
SubvectorElement & operator=(const T &v)
Assignment to the accessed sparse subvector element.
Definition: SparseSubvector.h:467
SET::ConstReference CRT
Reference-to-const type of the underlying sparse element.
Definition: SparseSubvector.h:438
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for the IsConst type trait.
ValueType ReferenceType
Reference return type.
Definition: SparseSubvector.h:571
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:138
Base template for the MultTrait class.
Definition: MultTrait.h:138
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
SubvectorExprTrait< VT, unaligned >::Type subvector(Vector< VT, TF > &vector, size_t index, size_t size)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:143
SubvectorIterator()
Default constructor for the SubvectorIterator class.
Definition: SparseSubvector.h:585
bool canAlias(const Other *alias) const
Returns whether the sparse subvector can alias with the given address alias.
Definition: SparseSubvector.h:1920
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Header file for the isDefault shim.
bool isAliased(const Other *alias) const
Returns whether the sparse subvector is aliased with the given address alias.
Definition: SparseSubvector.h:1941
Iterator set(size_t index, const ElementType &value)
Setting an element of the sparse subvector.
Definition: SparseSubvector.h:1567
Base class for all sparse element types.The SparseElement class is the base class for all sparse elem...
Definition: SparseElement.h:57
#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
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
Header file for the IsReference type trait.
Header file for the RemoveReference type trait.
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
SubvectorElement & operator+=(const T &v)
Addition assignment to the accessed sparse subvector element.
Definition: SparseSubvector.h:479
Iterator find(size_t index)
Searches for a specific subvector element.
Definition: SparseSubvector.h:1720
Base template for the DivTrait class.
Definition: DivTrait.h:138
size_t nonZeros() const
Returns the number of non-zero elements in the subvector.
Definition: SparseSubvector.h:1530
IteratorType base() const
Access to the current position of the subvector iterator.
Definition: SparseSubvector.h:698
ReferenceType operator*() const
Direct access to the current sparse subvector element.
Definition: SparseSubvector.h:643
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBVECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is a subvector type (i.e. a dense or sparse subvector), a compilation error is created.
Definition: Subvector.h:118
ValueType PointerType
Pointer return type.
Definition: SparseSubvector.h:570
ConstIterator cbegin() const
Returns an iterator to the first element of the subvector.
Definition: SparseSubvector.h:1076
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse subvector.
Definition: SparseSubvector.h:1590
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
PointerType operator->() const
Direct access to the current sparse subvector element.
Definition: SparseSubvector.h:653
Iterator over the elements of the sparse subvector.
Definition: SparseSubvector.h:564
std::iterator_traits< IteratorType >::value_type SET
Type of the underlying sparse elements.
Definition: SparseSubvector.h:435
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#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
const size_t offset_
The offset of the subvector within the sparse vector.
Definition: SparseSubvector.h:839
SubvectorElement & operator/=(const T &v)
Division assignment to the accessed sparse subvector element.
Definition: SparseSubvector.h:515
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
SubvectorIterator(IteratorType iterator, size_t index)
Constructor for the SubvectorIterator class.
Definition: SparseSubvector.h:597
VT::ConstReference ConstReference
Reference to a constant subvector value.
Definition: SparseSubvector.h:409
Compile time type check.This class tests whether the given template parameter T is a reference type (...
Definition: IsReference.h:94
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
void reset()
Reset to the default initial values.
Definition: SparseSubvector.h:1545
Header file for the SubvectorExprTrait class template.
IteratorType pos_
Iterator to the current position within the sparse subvector.
Definition: SparseSubvector.h:553
SparseSubvector & operator=(const SparseSubvector &rhs)
Copy assignment operator for SparseSubvector.
Definition: SparseSubvector.h:1169
ConstIterator cend() const
Returns an iterator just past the last element of the subvector.
Definition: SparseSubvector.h:1136
void addAssign(const DenseVector< VT2, TF > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseSubvector.h:2041
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Base template for the SubTrait class.
Definition: SubTrait.h:138
DifferenceType difference_type
Difference between two iterators.
Definition: SparseSubvector.h:579
Header file for exception macros.
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
SubvectorElement< VectorType, IteratorType > ValueType
Type of the underlying elements.
Definition: SparseSubvector.h:569
SubvectorElement & operator*=(const T &v)
Multiplication assignment to the accessed sparse subvector element.
Definition: SparseSubvector.h:503
Header file for the IsRestricted type trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:81
bool operator!=(const SubvectorIterator< VectorType2, IteratorType2 > &rhs) const
Inequality comparison between two SubvectorIterator objects.
Definition: SparseSubvector.h:677
#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
VT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseSubvector.h:405
SubvectorElement(IteratorType pos, size_t offset)
Constructor for the SubvectorElement class.
Definition: SparseSubvector.h:455
Compile time type selection.The IfTrue class template selects one of the two given types T1 and T2 de...
Definition: If.h:59
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.