35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
181 template<
typename Type
198 template<
typename Other >
199 inline Element&
operator=(
const Other& rhs )
201 ElementBase::operator=( rhs );
214 struct FindIndex :
public std::binary_function<Element,size_t,bool>
216 inline bool operator()(
const Element& element,
size_t index )
const {
217 return element.index() < index;
219 inline bool operator()(
size_t index,
const Element& element )
const {
220 return index < element.index();
222 inline bool operator()(
const Element& element1,
const Element& element2 )
const {
223 return element1.index() < element2.index();
294 template<
typename Other >
296 operator*=( Other rhs );
298 template<
typename Other >
300 operator/=( Other rhs );
307 inline size_t size()
const;
313 inline void erase (
size_t index );
316 inline void resize(
size_t n,
bool preserve=
true );
338 inline void append(
size_t index,
const Type& value,
bool check=
false );
345 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
346 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
400 template<
typename Type
416 template<
typename Type
432 template<
typename Type
449 template<
typename Type
468 template<
typename Type
486 template<
typename Type
488 template<
typename VT >
490 : size_ ( (~dv).size() )
506 template<
typename Type
508 template<
typename VT >
510 : size_ ( (~sv).size() )
532 template<
typename Type
560 template<
typename Type
578 template<
typename Type
587 if( pos ==
end_ || pos->index_ != index )
600 template<
typename Type
614 template<
typename Type
628 template<
typename Type
642 template<
typename Type
656 template<
typename Type
670 template<
typename Type
696 template<
typename Type
701 if( &rhs ==
this )
return *
this;
703 const size_t nonzeros( rhs.
nonZeros() );
706 Iterator newBegin( allocate<Element>( nonzeros ) );
733 template<
typename Type
735 template<
typename VT >
741 if( (~rhs).canAlias(
this ) ) {
746 size_ = (~rhs).size();
765 template<
typename Type
767 template<
typename VT >
778 size_ = (~rhs).size();
798 template<
typename Type
800 template<
typename VT >
805 if( (~rhs).size() != size_ )
806 throw std::invalid_argument(
"Vector sizes do not match" );
825 template<
typename Type
827 template<
typename VT >
832 if( (~rhs).size() != size_ )
833 throw std::invalid_argument(
"Vector sizes do not match" );
853 template<
typename Type
855 template<
typename VT >
858 if( (~rhs).size() != size_ )
859 throw std::invalid_argument(
"Vector sizes do not match" );
880 template<
typename Type
882 template<
typename Other >
887 element->value_ *= rhs;
905 template<
typename Type
907 template<
typename Other >
919 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
921 element->value_ *= tmp;
925 element->value_ /= rhs;
946 template<
typename Type
960 template<
typename Type
977 template<
typename Type
991 template<
typename Type
1007 template<
typename Type
1029 template<
typename Type
1036 const Iterator pos( lowerBound( index ) );
1038 if( pos !=
end_ && pos->index_ == index )
1039 throw std::invalid_argument(
"Bad access index" );
1042 std::copy_backward( pos,
end_,
end_+1 );
1043 pos->value_ = value;
1044 pos->index_ = index;
1050 size_t newCapacity( extendCapacity() );
1052 Iterator newBegin = allocate<Element>( newCapacity );
1054 tmp->value_ = value;
1055 tmp->index_ = index;
1056 end_ = std::copy( pos,
end_, tmp+1 );
1076 template<
typename Type
1082 const Iterator pos( find( index ) );
1084 end_ = std::copy( pos+1,
end_, pos );
1097 template<
typename Type
1104 end_ = std::copy( pos+1,
end_, pos );
1119 template<
typename Type
1129 end_ = std::copy( last,
end_, first );
1149 template<
typename Type
1154 end_ = lowerBound( n );
1174 template<
typename Type
1179 const size_t newCapacity( n );
1182 Iterator newBegin = allocate<Element>( newCapacity );
1200 template<
typename Type
1202 template<
typename Other >
1206 element->value_ *= scalar;
1219 template<
typename Type
1239 template<
typename Type
1247 nonzeros = max( nonzeros, 7UL );
1248 nonzeros = min( nonzeros, size_ );
1278 template<
typename Type
1282 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1300 template<
typename Type
1305 if( pos !=
end_ && pos->index_ == index )
1324 template<
typename Type
1346 template<
typename Type
1351 return std::lower_bound(
begin_,
end_, index, FindIndex() );
1368 template<
typename Type
1390 template<
typename Type
1395 return std::upper_bound(
begin_,
end_, index, FindIndex() );
1432 template<
typename Type
1440 end_->value_ = value;
1443 end_->index_ = index;
1468 template<
typename Type
1470 template<
typename Other >
1473 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1488 template<
typename Type
1490 template<
typename Other >
1493 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1508 template<
typename Type
1528 template<
typename Type
1530 template<
typename VT >
1536 size_t nonzeros( 0UL );
1538 for(
size_t i=0UL; i<size_; ++i )
1541 reserve( extendCapacity() );
1543 end_->value_ = (~rhs)[i];
1566 template<
typename Type
1568 template<
typename VT >
1580 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1581 append( element->index(), element->value() );
1597 template<
typename Type
1599 template<
typename VT >
1610 const AddType tmp(
serial( *
this + (~rhs) ) );
1628 template<
typename Type
1630 template<
typename VT >
1652 template<
typename Type
1654 template<
typename VT >
1665 const SubType tmp(
serial( *
this - (~rhs) ) );
1683 template<
typename Type
1685 template<
typename VT >
1707 template<
typename Type,
bool TF >
1710 template<
typename Type,
bool TF >
1713 template<
typename Type,
bool TF >
1716 template<
typename Type,
bool TF >
1729 template<
typename Type
1745 template<
typename Type
1773 template<
typename Type
1779 for( ConstIterator element=v.
begin(); element!=v.
end(); ++element )
1780 if( !
isDefault( element->value() ) )
return false;
1795 template<
typename Type
1814 template<
typename T,
bool TF >
1815 struct IsResizable< CompressedVector<T,TF> > :
public TrueType
1821 template<
typename T,
bool TF >
1822 struct IsResizable< const CompressedVector<T,TF> > :
public TrueType
1828 template<
typename T,
bool TF >
1829 struct IsResizable< volatile CompressedVector<T,TF> > :
public TrueType
1835 template<
typename T,
bool TF >
1836 struct IsResizable< const volatile CompressedVector<T,TF> > :
public TrueType
1855 template<
typename T1,
bool TF,
typename T2,
size_t N >
1856 struct AddTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1858 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1861 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1862 struct AddTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
1864 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1867 template<
typename T1,
bool TF,
typename T2,
size_t N >
1868 struct AddTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
1870 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1873 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1874 struct AddTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
1876 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1879 template<
typename T1,
bool TF,
typename T2 >
1880 struct AddTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
1882 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
1885 template<
typename T1,
bool TF,
typename T2 >
1886 struct AddTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
1888 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
1891 template<
typename T1,
bool TF,
typename T2 >
1892 struct AddTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
1894 typedef CompressedVector< typename AddTrait<T1,T2>::Type, TF > Type;
1910 template<
typename T1,
bool TF,
typename T2,
size_t N >
1911 struct SubTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1913 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1916 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1917 struct SubTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
1919 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1922 template<
typename T1,
bool TF,
typename T2,
size_t N >
1923 struct SubTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
1925 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1928 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1929 struct SubTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
1931 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1934 template<
typename T1,
bool TF,
typename T2 >
1935 struct SubTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
1937 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
1940 template<
typename T1,
bool TF,
typename T2 >
1941 struct SubTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
1943 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
1946 template<
typename T1,
bool TF,
typename T2 >
1947 struct SubTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
1949 typedef CompressedVector< typename SubTrait<T1,T2>::Type, TF > Type;
1965 template<
typename T1,
bool TF,
typename T2 >
1966 struct MultTrait< CompressedVector<T1,TF>, T2 >
1968 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1972 template<
typename T1,
typename T2,
bool TF >
1973 struct MultTrait< T1, CompressedVector<T2,TF> >
1975 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1979 template<
typename T1,
bool TF,
typename T2,
size_t N >
1980 struct MultTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1982 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
1985 template<
typename T1,
typename T2,
size_t N >
1986 struct MultTrait< CompressedVector<T1,false>, StaticVector<T2,N,true> >
1988 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
1991 template<
typename T1,
typename T2,
size_t N >
1992 struct MultTrait< CompressedVector<T1,true>, StaticVector<T2,N,false> >
1994 typedef typename MultTrait<T1,T2>::Type Type;
1997 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1998 struct MultTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2000 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2003 template<
typename T1,
size_t N,
typename T2 >
2004 struct MultTrait< StaticVector<T1,N,false>, CompressedVector<T2,true> >
2006 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2009 template<
typename T1,
size_t N,
typename T2 >
2010 struct MultTrait< StaticVector<T1,N,true>, CompressedVector<T2,false> >
2012 typedef typename MultTrait<T1,T2>::Type Type;
2015 template<
typename T1,
bool TF,
typename T2,
size_t N >
2016 struct MultTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2018 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2021 template<
typename T1,
typename T2,
size_t N >
2022 struct MultTrait< CompressedVector<T1,false>, HybridVector<T2,N,true> >
2024 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2027 template<
typename T1,
typename T2,
size_t N >
2028 struct MultTrait< CompressedVector<T1,true>, HybridVector<T2,N,false> >
2030 typedef typename MultTrait<T1,T2>::Type Type;
2033 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2034 struct MultTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2036 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2039 template<
typename T1,
size_t N,
typename T2 >
2040 struct MultTrait< HybridVector<T1,N,false>, CompressedVector<T2,true> >
2042 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2045 template<
typename T1,
size_t N,
typename T2 >
2046 struct MultTrait< HybridVector<T1,N,true>, CompressedVector<T2,false> >
2048 typedef typename MultTrait<T1,T2>::Type Type;
2051 template<
typename T1,
bool TF,
typename T2 >
2052 struct MultTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2054 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2057 template<
typename T1,
typename T2 >
2058 struct MultTrait< CompressedVector<T1,false>, DynamicVector<T2,true> >
2060 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2063 template<
typename T1,
typename T2 >
2064 struct MultTrait< CompressedVector<T1,true>, DynamicVector<T2,false> >
2066 typedef typename MultTrait<T1,T2>::Type Type;
2069 template<
typename T1,
bool TF,
typename T2 >
2070 struct MultTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2072 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2075 template<
typename T1,
typename T2 >
2076 struct MultTrait< DynamicVector<T1,false>, CompressedVector<T2,true> >
2078 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2081 template<
typename T1,
typename T2 >
2082 struct MultTrait< DynamicVector<T1,true>, CompressedVector<T2,false> >
2084 typedef typename MultTrait<T1,T2>::Type Type;
2087 template<
typename T1,
bool TF,
typename T2 >
2088 struct MultTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2090 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2093 template<
typename T1,
typename T2 >
2094 struct MultTrait< CompressedVector<T1,false>, CompressedVector<T2,true> >
2096 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2099 template<
typename T1,
typename T2 >
2100 struct MultTrait< CompressedVector<T1,true>, CompressedVector<T2,false> >
2102 typedef typename MultTrait<T1,T2>::Type Type;
2118 template<
typename T1,
typename T2 >
2119 struct CrossTrait< CompressedVector<T1,false>, StaticVector<T2,3UL,false> >
2122 typedef typename MultTrait<T1,T2>::Type T;
2125 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2128 template<
typename T1,
typename T2 >
2129 struct CrossTrait< StaticVector<T1,3UL,false>, CompressedVector<T2,false> >
2132 typedef typename MultTrait<T1,T2>::Type T;
2135 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2138 template<
typename T1,
typename T2,
size_t N >
2139 struct CrossTrait< CompressedVector<T1,false>, HybridVector<T2,N,false> >
2142 typedef typename MultTrait<T1,T2>::Type T;
2145 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2148 template<
typename T1,
size_t N,
typename T2 >
2149 struct CrossTrait< HybridVector<T1,N,false>, CompressedVector<T2,false> >
2152 typedef typename MultTrait<T1,T2>::Type T;
2155 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2158 template<
typename T1,
typename T2 >
2159 struct CrossTrait< CompressedVector<T1,false>, DynamicVector<T2,false> >
2162 typedef typename MultTrait<T1,T2>::Type T;
2165 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2168 template<
typename T1,
typename T2 >
2169 struct CrossTrait< DynamicVector<T1,false>, CompressedVector<T2,false> >
2172 typedef typename MultTrait<T1,T2>::Type T;
2175 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2178 template<
typename T1,
typename T2 >
2179 struct CrossTrait< CompressedVector<T1,false>, CompressedVector<T2,false> >
2182 typedef typename MultTrait<T1,T2>::Type T;
2185 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2201 template<
typename T1,
bool TF,
typename T2 >
2202 struct DivTrait< CompressedVector<T1,TF>, T2 >
2204 typedef CompressedVector< typename DivTrait<T1,T2>::Type, TF > Type;
2221 template<
typename T1,
bool TF,
typename T2 >
2222 struct MathTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2224 typedef CompressedVector< typename MathTrait<T1,T2>::HighType, TF > HighType;
2225 typedef CompressedVector< typename MathTrait<T1,T2>::LowType , TF > LowType;
2241 template<
typename T1,
bool TF >
2242 struct SubvectorTrait< CompressedVector<T1,TF> >
2244 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:1491
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:4599
#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:962
void assign(const DenseVector< VT, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: CompressedVector.h:1531
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1371
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4642
ValueIndexPair< Type > ElementBase
Base class for the compressed vector element.
Definition: CompressedVector.h:187
CompressedVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedVector.h:233
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:1221
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
VectorAccessProxy< This > Reference
Reference to a non-constant vector value.
Definition: CompressedVector.h:237
Header file for a safe C++ NULL pointer implementation.
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:238
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:1600
Iterator end()
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:644
#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:1009
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
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:370
const CompressedVector & CompositeType
Data type for composite expression templates.
Definition: CompressedVector.h:236
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4615
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2557
void deallocate(T *address)
Deallocation of memory.
Definition: Memory.h:115
size_t extendCapacity() const
Calculating a new vector capacity.
Definition: CompressedVector.h:1241
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:1655
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1434
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:418
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two sparse matrices.
Definition: CompressedMatrix.h:4605
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:1471
Iterator insert(size_t index, const Type &value)
Inserting an element into the compressed vector.
Definition: CompressedVector.h:1032
#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
Header file for the IsSMPAssignable type trait.
ConstIterator cend() const
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:672
Iterator * end_
Pointers one past the last non-zero element of each column.
Definition: CompressedMatrix.h:2559
Iterator begin_
Pointer to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:372
size_t nonZeros(const Matrix< MT, SO > &m)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:224
#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:271
Constraint on the data type.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:235
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:630
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
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:120
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2410
bool canSMPAssign() const
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:1510
Header file for the EnableIf class template.
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:371
This ResultType
Result type for expression template evaluations.
Definition: CompressedVector.h:232
Header file for the serial shim.
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1078
Reference operator[](size_t index)
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:563
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1327
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1280
Header file for the IsNumeric type trait.
void reset()
Reset to the default initial values.
Definition: CompressedVector.h:993
void resize(size_t n, bool preserve=true)
Changing the size of the compressed vector.
Definition: CompressedVector.h:1151
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:4671
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:301
Constraint on the data type.
CompressedVector< Type, TF > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:231
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:331
const VT::ElementType max(const SparseVector< VT, TF > &sv)
Returns the largest element of the sparse vector.
Definition: SparseVector.h:408
#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:948
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
Header file for the VectorAccessProxy class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:240
Header file for the isDefault shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:239
Constraint on the data type.
Iterator * begin_
Pointers to the first non-zero element of each column.
Definition: CompressedMatrix.h:2558
T * allocate(size_t size)
Aligned array allocation.
Definition: Memory.h:84
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:979
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:534
CompressedVector & operator=(const CompressedVector &rhs)
Copy assignment operator for CompressedVector.
Definition: CompressedVector.h:699
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:2561
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
Iterator end_
Pointer one past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:373
Iterator begin()
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:602
Header file for basic type definitions.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2409
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:351
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:234
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:375
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
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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:183
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1176
size_t capacity(const Matrix< MT, SO > &m)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:186