35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
179 template<
typename Type
196 template<
typename Other >
197 inline Element&
operator=(
const Other& rhs )
199 ElementBase::operator=( rhs );
212 struct FindIndex :
public std::binary_function<Element,size_t,bool>
214 inline bool operator()(
const Element& element,
size_t index )
const {
215 return element.index() < index;
217 inline bool operator()(
size_t index,
const Element& element )
const {
218 return index < element.index();
220 inline bool operator()(
const Element& element1,
const Element& element2 )
const {
221 return element1.index() < element2.index();
246 enum { smpAssignable = 0 };
292 template<
typename Other >
294 operator*=( Other rhs );
296 template<
typename Other >
298 operator/=( Other rhs );
305 inline size_t size()
const;
311 inline void erase (
size_t index );
314 inline void resize(
size_t n,
bool preserve=
true );
336 inline void append(
size_t index,
const Type& value,
bool check=
false );
343 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
344 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
395 template<
typename Type
411 template<
typename Type
427 template<
typename Type
444 template<
typename Type
463 template<
typename Type
481 template<
typename Type
483 template<
typename VT >
485 : size_ ( (~dv).size() )
501 template<
typename Type
503 template<
typename VT >
505 : size_ ( (~sv).size() )
527 template<
typename Type
555 template<
typename Type
573 template<
typename Type
582 if( pos ==
end_ || pos->index_ != index )
595 template<
typename Type
609 template<
typename Type
623 template<
typename Type
637 template<
typename Type
651 template<
typename Type
665 template<
typename Type
691 template<
typename Type
696 if( &rhs ==
this )
return *
this;
698 const size_t nonzeros( rhs.
nonZeros() );
701 Iterator newBegin( allocate<Element>( nonzeros ) );
728 template<
typename Type
730 template<
typename VT >
736 if( (~rhs).canAlias(
this ) ) {
741 size_ = (~rhs).size();
760 template<
typename Type
762 template<
typename VT >
768 if( (~rhs).canAlias(
this ) || (~rhs).nonZeros() >
capacity_ ) {
773 size_ = (~rhs).size();
793 template<
typename Type
795 template<
typename VT >
800 if( (~rhs).size() != size_ )
801 throw std::invalid_argument(
"Vector sizes do not match" );
820 template<
typename Type
822 template<
typename VT >
827 if( (~rhs).size() != size_ )
828 throw std::invalid_argument(
"Vector sizes do not match" );
848 template<
typename Type
850 template<
typename VT >
853 if( (~rhs).size() != size_ )
854 throw std::invalid_argument(
"Vector sizes do not match" );
875 template<
typename Type
877 template<
typename Other >
882 element->value_ *= rhs;
900 template<
typename Type
902 template<
typename Other >
914 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
916 element->value_ *= tmp;
920 element->value_ /= rhs;
941 template<
typename Type
955 template<
typename Type
972 template<
typename Type
986 template<
typename Type
1002 template<
typename Type
1024 template<
typename Type
1031 const Iterator pos( lowerBound( index ) );
1033 if( pos !=
end_ && pos->index_ == index )
1034 throw std::invalid_argument(
"Bad access index" );
1037 std::copy_backward( pos,
end_,
end_+1 );
1038 pos->value_ = value;
1039 pos->index_ = index;
1045 size_t newCapacity( extendCapacity() );
1047 Iterator newBegin = allocate<Element>( newCapacity );
1049 tmp->value_ = value;
1050 tmp->index_ = index;
1051 end_ = std::copy( pos,
end_, tmp+1 );
1071 template<
typename Type
1077 const Iterator pos( find( index ) );
1079 end_ = std::copy( pos+1,
end_, pos );
1092 template<
typename Type
1099 end_ = std::copy( pos+1,
end_, pos );
1114 template<
typename Type
1124 end_ = std::copy( last,
end_, first );
1142 template<
typename Type
1147 end_ = lowerBound( n );
1167 template<
typename Type
1172 const size_t newCapacity( n );
1175 Iterator newBegin = allocate<Element>( newCapacity );
1193 template<
typename Type
1195 template<
typename Other >
1199 element->value_ *= scalar;
1212 template<
typename Type
1232 template<
typename Type
1240 nonzeros = max( nonzeros, 7UL );
1241 nonzeros = min( nonzeros, size_ );
1271 template<
typename Type
1275 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1293 template<
typename Type
1298 if( pos !=
end_ && pos->index_ == index )
1317 template<
typename Type
1339 template<
typename Type
1344 return std::lower_bound(
begin_,
end_, index, FindIndex() );
1361 template<
typename Type
1383 template<
typename Type
1388 return std::upper_bound(
begin_,
end_, index, FindIndex() );
1425 template<
typename Type
1433 end_->value_ = value;
1436 end_->index_ = index;
1461 template<
typename Type
1463 template<
typename Other >
1466 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1481 template<
typename Type
1483 template<
typename Other >
1486 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1502 template<
typename Type
1504 template<
typename VT >
1510 size_t nonzeros( 0UL );
1512 for(
size_t i=0UL; i<size_; ++i )
1515 reserve( extendCapacity() );
1517 end_->value_ = (~rhs)[i];
1540 template<
typename Type
1542 template<
typename VT >
1554 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1555 append( element->index(), element->value() );
1571 template<
typename Type
1573 template<
typename VT >
1584 const AddType tmp( *
this + (~rhs) );
1602 template<
typename Type
1604 template<
typename VT >
1626 template<
typename Type
1628 template<
typename VT >
1639 const SubType tmp( *
this - (~rhs) );
1657 template<
typename Type
1659 template<
typename VT >
1681 template<
typename Type,
bool TF >
1684 template<
typename Type,
bool TF >
1687 template<
typename Type,
bool TF >
1690 template<
typename Type,
bool TF >
1703 template<
typename Type
1719 template<
typename Type
1747 template<
typename Type
1753 for( ConstIterator element=v.
begin(); element!=v.
end(); ++element )
1754 if( !
isDefault( element->value() ) )
return false;
1769 template<
typename Type
1788 template<
typename T,
bool TF >
1789 struct IsResizable< CompressedVector<T,TF> > :
public TrueType
1795 template<
typename T,
bool TF >
1796 struct IsResizable< const CompressedVector<T,TF> > :
public TrueType
1802 template<
typename T,
bool TF >
1803 struct IsResizable< volatile CompressedVector<T,TF> > :
public TrueType
1809 template<
typename T,
bool TF >
1810 struct IsResizable< const volatile CompressedVector<T,TF> > :
public TrueType
1829 template<
typename T1,
bool TF,
typename T2,
size_t N >
1830 struct AddTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1832 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1835 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1836 struct AddTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
1838 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1841 template<
typename T1,
bool TF,
typename T2,
size_t N >
1842 struct AddTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
1844 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1847 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1848 struct AddTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
1850 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1853 template<
typename T1,
bool TF,
typename T2 >
1854 struct AddTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
1856 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
1859 template<
typename T1,
bool TF,
typename T2 >
1860 struct AddTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
1862 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
1865 template<
typename T1,
bool TF,
typename T2 >
1866 struct AddTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
1868 typedef CompressedVector< typename AddTrait<T1,T2>::Type, TF > Type;
1884 template<
typename T1,
bool TF,
typename T2,
size_t N >
1885 struct SubTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1887 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1890 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1891 struct SubTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
1893 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1896 template<
typename T1,
bool TF,
typename T2,
size_t N >
1897 struct SubTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
1899 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1902 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1903 struct SubTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
1905 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1908 template<
typename T1,
bool TF,
typename T2 >
1909 struct SubTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
1911 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
1914 template<
typename T1,
bool TF,
typename T2 >
1915 struct SubTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
1917 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
1920 template<
typename T1,
bool TF,
typename T2 >
1921 struct SubTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
1923 typedef CompressedVector< typename SubTrait<T1,T2>::Type, TF > Type;
1939 template<
typename T1,
bool TF,
typename T2 >
1940 struct MultTrait< CompressedVector<T1,TF>, T2 >
1942 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1946 template<
typename T1,
typename T2,
bool TF >
1947 struct MultTrait< T1, CompressedVector<T2,TF> >
1949 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1953 template<
typename T1,
bool TF,
typename T2,
size_t N >
1954 struct MultTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1956 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1959 template<
typename T1,
typename T2,
size_t N >
1960 struct MultTrait< CompressedVector<T1,false>, StaticVector<T2,N,true> >
1962 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
1965 template<
typename T1,
typename T2,
size_t N >
1966 struct MultTrait< CompressedVector<T1,true>, StaticVector<T2,N,false> >
1968 typedef typename MultTrait<T1,T2>::Type Type;
1971 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1972 struct MultTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
1974 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1977 template<
typename T1,
size_t N,
typename T2 >
1978 struct MultTrait< StaticVector<T1,N,false>, CompressedVector<T2,true> >
1980 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
1983 template<
typename T1,
size_t N,
typename T2 >
1984 struct MultTrait< StaticVector<T1,N,true>, CompressedVector<T2,false> >
1986 typedef typename MultTrait<T1,T2>::Type Type;
1989 template<
typename T1,
bool TF,
typename T2,
size_t N >
1990 struct MultTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
1992 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1995 template<
typename T1,
typename T2,
size_t N >
1996 struct MultTrait< CompressedVector<T1,false>, HybridVector<T2,N,true> >
1998 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2001 template<
typename T1,
typename T2,
size_t N >
2002 struct MultTrait< CompressedVector<T1,true>, HybridVector<T2,N,false> >
2004 typedef typename MultTrait<T1,T2>::Type Type;
2007 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2008 struct MultTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2010 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2013 template<
typename T1,
size_t N,
typename T2 >
2014 struct MultTrait< HybridVector<T1,N,false>, CompressedVector<T2,true> >
2016 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2019 template<
typename T1,
size_t N,
typename T2 >
2020 struct MultTrait< HybridVector<T1,N,true>, CompressedVector<T2,false> >
2022 typedef typename MultTrait<T1,T2>::Type Type;
2025 template<
typename T1,
bool TF,
typename T2 >
2026 struct MultTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2028 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2031 template<
typename T1,
typename T2 >
2032 struct MultTrait< CompressedVector<T1,false>, DynamicVector<T2,true> >
2034 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2037 template<
typename T1,
typename T2 >
2038 struct MultTrait< CompressedVector<T1,true>, DynamicVector<T2,false> >
2040 typedef typename MultTrait<T1,T2>::Type Type;
2043 template<
typename T1,
bool TF,
typename T2 >
2044 struct MultTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2046 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2049 template<
typename T1,
typename T2 >
2050 struct MultTrait< DynamicVector<T1,false>, CompressedVector<T2,true> >
2052 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2055 template<
typename T1,
typename T2 >
2056 struct MultTrait< DynamicVector<T1,true>, CompressedVector<T2,false> >
2058 typedef typename MultTrait<T1,T2>::Type Type;
2061 template<
typename T1,
bool TF,
typename T2 >
2062 struct MultTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2064 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2067 template<
typename T1,
typename T2 >
2068 struct MultTrait< CompressedVector<T1,false>, CompressedVector<T2,true> >
2070 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2073 template<
typename T1,
typename T2 >
2074 struct MultTrait< CompressedVector<T1,true>, CompressedVector<T2,false> >
2076 typedef typename MultTrait<T1,T2>::Type Type;
2092 template<
typename T1,
typename T2 >
2093 struct CrossTrait< CompressedVector<T1,false>, StaticVector<T2,3UL,false> >
2096 typedef typename MultTrait<T1,T2>::Type T;
2099 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2102 template<
typename T1,
typename T2 >
2103 struct CrossTrait< StaticVector<T1,3UL,false>, CompressedVector<T2,false> >
2106 typedef typename MultTrait<T1,T2>::Type T;
2109 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2112 template<
typename T1,
typename T2,
size_t N >
2113 struct CrossTrait< CompressedVector<T1,false>, HybridVector<T2,N,false> >
2116 typedef typename MultTrait<T1,T2>::Type T;
2119 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2122 template<
typename T1,
size_t N,
typename T2 >
2123 struct CrossTrait< HybridVector<T1,N,false>, CompressedVector<T2,false> >
2126 typedef typename MultTrait<T1,T2>::Type T;
2129 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2132 template<
typename T1,
typename T2 >
2133 struct CrossTrait< CompressedVector<T1,false>, DynamicVector<T2,false> >
2136 typedef typename MultTrait<T1,T2>::Type T;
2139 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2142 template<
typename T1,
typename T2 >
2143 struct CrossTrait< DynamicVector<T1,false>, CompressedVector<T2,false> >
2146 typedef typename MultTrait<T1,T2>::Type T;
2149 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2152 template<
typename T1,
typename T2 >
2153 struct CrossTrait< CompressedVector<T1,false>, CompressedVector<T2,false> >
2156 typedef typename MultTrait<T1,T2>::Type T;
2159 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2175 template<
typename T1,
bool TF,
typename T2 >
2176 struct DivTrait< CompressedVector<T1,TF>, T2 >
2178 typedef CompressedVector< typename DivTrait<T1,T2>::Type, TF > Type;
2195 template<
typename T1,
bool TF,
typename T2 >
2196 struct MathTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2198 typedef CompressedVector< typename MathTrait<T1,T2>::HighType, TF > HighType;
2199 typedef CompressedVector< typename MathTrait<T1,T2>::LowType , TF > LowType;
2215 template<
typename T1,
bool TF >
2216 struct SubvectorTrait< CompressedVector<T1,TF> >
2218 typedef CompressedVector<T1,TF> Type;
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:116
bool isAliased(const Other *alias) const
Returns whether the vector is aliased with the given address alias.
Definition: CompressedVector.h:1484
const bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.This value specifies the default tran...
Definition: TransposeFlag.h:56
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
Constraint on the data type.
Header file for mathematical functions.
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#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
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 the SparseVector base class.
size_t capacity() const
Returns the maximum capacity of the compressed vector.
Definition: CompressedVector.h:957
void assign(const DenseVector< VT, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: CompressedVector.h:1505
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1364
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
ValueIndexPair< Type > ElementBase
Base class for the compressed vector element.
Definition: CompressedVector.h:185
CompressedVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedVector.h:231
const blaze::Null NULL
Global NULL pointer.This instance of the Null class replaces the NULL macro to ensure a type-safe NUL...
Definition: Null.h:300
Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elem...
Definition: VectorAccessProxy.h:89
void swap(CompressedVector &sv)
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1214
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2384
VectorAccessProxy< This > Reference
Reference to a non-constant vector value.
Definition: CompressedVector.h:235
Header file for a safe C++ NULL pointer implementation.
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:236
Header file for the DenseVector base class.
void addAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: CompressedVector.h:1574
Iterator end()
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:639
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:116
void clear()
Clearing the compressed vector.
Definition: CompressedVector.h:1004
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a no...
Definition: MatrixAccessProxy.h:86
Header file for memory allocation and deallocation functionality.
size_t size_
The current size/dimension of the compressed vector.
Definition: CompressedVector.h:365
const CompressedVector & CompositeType
Data type for composite expression templates.
Definition: CompressedVector.h:234
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4595
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2530
void deallocate(T *address)
Deallocation of memory.
Definition: Memory.h:114
Header file for the floating point precision of the Blaze library.
size_t extendCapacity() const
Calculating a new vector capacity.
Definition: CompressedVector.h:1234
Header file for the ValueIndexPair class.
void subAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: CompressedVector.h:1629
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1427
Header file for the multiplication trait.
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
CompressedVector()
The default constructor for CompressedVector.
Definition: CompressedVector.h:413
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two sparse matrices.
Definition: CompressedMatrix.h:4558
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:1464
Iterator insert(size_t index, const Type &value)
Inserting an element into the compressed vector.
Definition: CompressedVector.h:1027
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:116
ConstIterator cend() const
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:667
Iterator * end_
Pointers one past the last non-zero element of each column.
Definition: CompressedMatrix.h:2532
Iterator begin_
Pointer to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:367
#define BLAZE_CONSTRAINT_MUST_HAVE_SAME_SIZE(T1, T2)
Constraint on the size of two data types.In case the types T1 and T2 don't have the same size...
Definition: SameSize.h:78
Header file for the subvector trait.
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:179
Constraint on the data type.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:233
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
ConstIterator cbegin() const
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:625
Constraint on the data type.
#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
Constraint on the data type.
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:94
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2386
Header file for the EnableIf class template.
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:366
This ResultType
Result type for expression template evaluations.
Definition: CompressedVector.h:230
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1073
Reference operator[](size_t index)
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:558
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1320
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1273
Header file for the IsNumeric type trait.
void reset()
Reset to the default initial values.
Definition: CompressedVector.h:988
void resize(size_t n, bool preserve=true)
Changing the size of the compressed vector.
Definition: CompressedVector.h:1144
Header file for the IsSparseVector type trait.
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:141
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
void swap(DynamicMatrix< Type, SO > &a, DynamicMatrix< Type, SO > &b)
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:4651
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:209
Constraint on the data type.
CompressedVector< Type, TF > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:229
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:239
const VT::ElementType max(const SparseVector< VT, TF > &sv)
Returns the largest element of the sparse vector.
Definition: SparseVector.h:405
#define BLAZE_CONSTRAINT_MUST_NOT_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:116
size_t size() const
Returns the current size/dimension of the compressed vector.
Definition: CompressedVector.h:943
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2387
Header file for the VectorAccessProxy class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:238
Header file for the isDefault shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:237
Constraint on the data type.
Iterator * begin_
Pointers to the first non-zero element of each column.
Definition: CompressedMatrix.h:2531
T * allocate(size_t size)
Aligned array allocation.
Definition: Memory.h:83
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:974
Base template for the DivTrait class.
Definition: DivTrait.h:141
Header file for the mathematical trait.
#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
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:69
Constraint on the size of two data types.
Header file for the default transpose flag for all vectors of the Blaze library.
~CompressedVector()
The destructor for CompressedVector.
Definition: CompressedVector.h:529
CompressedVector & operator=(const CompressedVector &rhs)
Copy assignment operator for CompressedVector.
Definition: CompressedVector.h:694
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:2534
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
Iterator end_
Pointer one past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:368
Iterator begin()
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:597
Header file for basic type definitions.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2385
Base template for the SubTrait class.
Definition: SubTrait.h:141
const VT::ElementType min(const SparseVector< VT, TF > &sv)
Returns the smallest element of the sparse vector.
Definition: SparseVector.h:348
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
Type ElementType
Type of the compressed vector elements.
Definition: CompressedVector.h:232
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:370
Header file for the IsResizable 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:238
#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
Efficient implementation of an arbitrary sized sparse vector.The CompressedVector class is the repres...
Definition: CompressedVector.h:181
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1169