35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
186 template<
typename Type
203 template<
typename Other >
204 inline Element&
operator=(
const Other& rhs )
206 ElementBase::operator=( rhs );
219 struct FindIndex :
public std::binary_function<Element,size_t,bool>
221 inline bool operator()(
const Element& element,
size_t index )
const {
222 return element.index() < index;
224 inline bool operator()(
size_t index,
const Element& element )
const {
225 return index < element.index();
227 inline bool operator()(
const Element& element1,
const Element& element2 )
const {
228 return element1.index() < element2.index();
251 template<
typename ET >
308 template<
typename Other >
310 operator*=( Other rhs );
312 template<
typename Other >
314 operator/=( Other rhs );
321 inline size_t size()
const;
326 inline Iterator set (
size_t index,
const Type& value );
328 inline void erase (
size_t index );
331 inline void resize(
size_t n,
bool preserve=
true );
333 template<
typename Other >
inline CompressedVector& scale(
const Other& scalar );
353 inline void append(
size_t index,
const Type& value,
bool check=
false );
360 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
361 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
416 template<
typename Type
432 template<
typename Type
448 template<
typename Type
465 template<
typename Type
484 template<
typename Type
502 template<
typename Type
504 template<
typename VT >
506 : size_ ( (~dv).
size() )
522 template<
typename Type
524 template<
typename VT >
526 : size_ ( (~sv).
size() )
548 template<
typename Type
576 template<
typename Type
594 template<
typename Type
603 if( pos ==
end_ || pos->index_ != index )
616 template<
typename Type
630 template<
typename Type
644 template<
typename Type
658 template<
typename Type
672 template<
typename Type
686 template<
typename Type
712 template<
typename Type
717 if( &rhs ==
this )
return *
this;
719 const size_t nonzeros( rhs.
nonZeros() );
722 Iterator newBegin( allocate<Element>( nonzeros ) );
749 template<
typename Type
751 template<
typename VT >
757 if( (~rhs).canAlias(
this ) ) {
762 size_ = (~rhs).
size();
781 template<
typename Type
783 template<
typename VT >
794 size_ = (~rhs).
size();
814 template<
typename Type
816 template<
typename VT >
821 if( (~rhs).
size() != size_ )
822 throw std::invalid_argument(
"Vector sizes do not match" );
841 template<
typename Type
843 template<
typename VT >
848 if( (~rhs).
size() != size_ )
849 throw std::invalid_argument(
"Vector sizes do not match" );
869 template<
typename Type
871 template<
typename VT >
874 if( (~rhs).
size() != size_ )
875 throw std::invalid_argument(
"Vector sizes do not match" );
896 template<
typename Type
898 template<
typename Other >
903 element->value_ *= rhs;
921 template<
typename Type
923 template<
typename Other >
935 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
937 element->value_ *= tmp;
941 element->value_ /= rhs;
962 template<
typename Type
976 template<
typename Type
993 template<
typename Type
1007 template<
typename Type
1023 template<
typename Type
1044 template<
typename Type
1051 const Iterator pos( lowerBound( index ) );
1053 if( pos !=
end_ && pos->index_ == index ) {
1054 pos->value() = value;
1057 else return insert( pos, index, value );
1074 template<
typename Type
1081 const Iterator pos( lowerBound( index ) );
1083 if( pos !=
end_ && pos->index_ == index )
1084 throw std::invalid_argument(
"Bad access index" );
1086 return insert( pos, index, value );
1100 template<
typename Type
1106 std::copy_backward( pos,
end_,
end_+1 );
1107 pos->value_ = value;
1108 pos->index_ = index;
1114 size_t newCapacity( extendCapacity() );
1116 Iterator newBegin = allocate<Element>( newCapacity );
1118 tmp->value_ = value;
1119 tmp->index_ = index;
1120 end_ = std::copy( pos,
end_, tmp+1 );
1140 template<
typename Type
1146 const Iterator pos( find( index ) );
1148 end_ = std::copy( pos+1,
end_, pos );
1161 template<
typename Type
1168 end_ = std::copy( pos+1,
end_, pos );
1183 template<
typename Type
1193 end_ = std::copy( last,
end_, first );
1213 template<
typename Type
1218 end_ = lowerBound( n );
1238 template<
typename Type
1243 const size_t newCapacity( n );
1246 Iterator newBegin = allocate<Element>( newCapacity );
1264 template<
typename Type
1266 template<
typename Other >
1270 element->value_ *= scalar;
1283 template<
typename Type
1303 template<
typename Type
1311 nonzeros =
max( nonzeros, 7UL );
1312 nonzeros =
min( nonzeros, size_ );
1342 template<
typename Type
1346 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1364 template<
typename Type
1369 if( pos !=
end_ && pos->index_ == index )
1388 template<
typename Type
1410 template<
typename Type
1415 return std::lower_bound(
begin_,
end_, index, FindIndex() );
1432 template<
typename Type
1454 template<
typename Type
1459 return std::upper_bound(
begin_,
end_, index, FindIndex() );
1496 template<
typename Type
1504 end_->value_ = value;
1507 end_->index_ = index;
1532 template<
typename Type
1534 template<
typename Other >
1537 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1552 template<
typename Type
1554 template<
typename Other >
1557 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1572 template<
typename Type
1592 template<
typename Type
1594 template<
typename VT >
1600 size_t nonzeros( 0UL );
1602 for(
size_t i=0UL; i<size_; ++i )
1605 reserve( extendCapacity() );
1607 end_->value_ = (~rhs)[i];
1630 template<
typename Type
1632 template<
typename VT >
1645 append( element->index(), element->value() );
1661 template<
typename Type
1663 template<
typename VT >
1674 const AddType tmp(
serial( *
this + (~rhs) ) );
1692 template<
typename Type
1694 template<
typename VT >
1716 template<
typename Type
1718 template<
typename VT >
1729 const SubType tmp(
serial( *
this - (~rhs) ) );
1747 template<
typename Type
1749 template<
typename VT >
1771 template<
typename Type,
bool TF >
1774 template<
typename Type,
bool TF >
1777 template<
typename Type,
bool TF >
1780 template<
typename Type,
bool TF >
1783 template<
typename Type,
bool TF >
1796 template<
typename Type
1812 template<
typename Type
1838 template<
typename Type
1842 return ( v.
size() == 0UL );
1856 template<
typename Type
1874 template<
typename Type
1893 template<
typename T,
bool TF >
1894 struct IsResizable< CompressedVector<T,TF> > :
public TrueType
1913 template<
typename T1,
bool TF,
typename T2,
size_t N >
1914 struct AddTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1916 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1919 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1920 struct AddTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
1922 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1925 template<
typename T1,
bool TF,
typename T2,
size_t N >
1926 struct AddTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
1928 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1931 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1932 struct AddTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
1934 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
1937 template<
typename T1,
bool TF,
typename T2 >
1938 struct AddTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
1940 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
1943 template<
typename T1,
bool TF,
typename T2 >
1944 struct AddTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
1946 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
1949 template<
typename T1,
bool TF,
typename T2 >
1950 struct AddTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
1952 typedef CompressedVector< typename AddTrait<T1,T2>::Type, TF > Type;
1968 template<
typename T1,
bool TF,
typename T2,
size_t N >
1969 struct SubTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
1971 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1974 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1975 struct SubTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
1977 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1980 template<
typename T1,
bool TF,
typename T2,
size_t N >
1981 struct SubTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
1983 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1986 template<
typename T1,
size_t N,
bool TF,
typename T2 >
1987 struct SubTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
1989 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
1992 template<
typename T1,
bool TF,
typename T2 >
1993 struct SubTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
1995 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
1998 template<
typename T1,
bool TF,
typename T2 >
1999 struct SubTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2001 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
2004 template<
typename T1,
bool TF,
typename T2 >
2005 struct SubTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2007 typedef CompressedVector< typename SubTrait<T1,T2>::Type, TF > Type;
2023 template<
typename T1,
bool TF,
typename T2 >
2024 struct MultTrait< CompressedVector<T1,TF>, T2 >
2026 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2030 template<
typename T1,
typename T2,
bool TF >
2031 struct MultTrait< T1, CompressedVector<T2,TF> >
2033 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2037 template<
typename T1,
bool TF,
typename T2,
size_t N >
2038 struct MultTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2040 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2043 template<
typename T1,
typename T2,
size_t N >
2044 struct MultTrait< CompressedVector<T1,false>, StaticVector<T2,N,true> >
2046 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2049 template<
typename T1,
typename T2,
size_t N >
2050 struct MultTrait< CompressedVector<T1,true>, StaticVector<T2,N,false> >
2052 typedef typename MultTrait<T1,T2>::Type Type;
2055 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2056 struct MultTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2058 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2061 template<
typename T1,
size_t N,
typename T2 >
2062 struct MultTrait< StaticVector<T1,N,false>, CompressedVector<T2,true> >
2064 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2067 template<
typename T1,
size_t N,
typename T2 >
2068 struct MultTrait< StaticVector<T1,N,true>, CompressedVector<T2,false> >
2070 typedef typename MultTrait<T1,T2>::Type Type;
2073 template<
typename T1,
bool TF,
typename T2,
size_t N >
2074 struct MultTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2076 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2079 template<
typename T1,
typename T2,
size_t N >
2080 struct MultTrait< CompressedVector<T1,false>, HybridVector<T2,N,true> >
2082 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2085 template<
typename T1,
typename T2,
size_t N >
2086 struct MultTrait< CompressedVector<T1,true>, HybridVector<T2,N,false> >
2088 typedef typename MultTrait<T1,T2>::Type Type;
2091 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2092 struct MultTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2094 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2097 template<
typename T1,
size_t N,
typename T2 >
2098 struct MultTrait< HybridVector<T1,N,false>, CompressedVector<T2,true> >
2100 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2103 template<
typename T1,
size_t N,
typename T2 >
2104 struct MultTrait< HybridVector<T1,N,true>, CompressedVector<T2,false> >
2106 typedef typename MultTrait<T1,T2>::Type Type;
2109 template<
typename T1,
bool TF,
typename T2 >
2110 struct MultTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2112 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2115 template<
typename T1,
typename T2 >
2116 struct MultTrait< CompressedVector<T1,false>, DynamicVector<T2,true> >
2118 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2121 template<
typename T1,
typename T2 >
2122 struct MultTrait< CompressedVector<T1,true>, DynamicVector<T2,false> >
2124 typedef typename MultTrait<T1,T2>::Type Type;
2127 template<
typename T1,
bool TF,
typename T2 >
2128 struct MultTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2130 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2133 template<
typename T1,
typename T2 >
2134 struct MultTrait< DynamicVector<T1,false>, CompressedVector<T2,true> >
2136 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2139 template<
typename T1,
typename T2 >
2140 struct MultTrait< DynamicVector<T1,true>, CompressedVector<T2,false> >
2142 typedef typename MultTrait<T1,T2>::Type Type;
2145 template<
typename T1,
bool TF,
typename T2 >
2146 struct MultTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2148 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2151 template<
typename T1,
typename T2 >
2152 struct MultTrait< CompressedVector<T1,false>, CompressedVector<T2,true> >
2154 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2157 template<
typename T1,
typename T2 >
2158 struct MultTrait< CompressedVector<T1,true>, CompressedVector<T2,false> >
2160 typedef typename MultTrait<T1,T2>::Type Type;
2176 template<
typename T1,
typename T2 >
2177 struct CrossTrait< CompressedVector<T1,false>, StaticVector<T2,3UL,false> >
2180 typedef typename MultTrait<T1,T2>::Type T;
2183 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2186 template<
typename T1,
typename T2 >
2187 struct CrossTrait< StaticVector<T1,3UL,false>, CompressedVector<T2,false> >
2190 typedef typename MultTrait<T1,T2>::Type T;
2193 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2196 template<
typename T1,
typename T2,
size_t N >
2197 struct CrossTrait< CompressedVector<T1,false>, HybridVector<T2,N,false> >
2200 typedef typename MultTrait<T1,T2>::Type T;
2203 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2206 template<
typename T1,
size_t N,
typename T2 >
2207 struct CrossTrait< HybridVector<T1,N,false>, CompressedVector<T2,false> >
2210 typedef typename MultTrait<T1,T2>::Type T;
2213 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2216 template<
typename T1,
typename T2 >
2217 struct CrossTrait< CompressedVector<T1,false>, DynamicVector<T2,false> >
2220 typedef typename MultTrait<T1,T2>::Type T;
2223 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2226 template<
typename T1,
typename T2 >
2227 struct CrossTrait< DynamicVector<T1,false>, CompressedVector<T2,false> >
2230 typedef typename MultTrait<T1,T2>::Type T;
2233 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2236 template<
typename T1,
typename T2 >
2237 struct CrossTrait< CompressedVector<T1,false>, CompressedVector<T2,false> >
2240 typedef typename MultTrait<T1,T2>::Type T;
2243 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2259 template<
typename T1,
bool TF,
typename T2 >
2260 struct DivTrait< CompressedVector<T1,TF>, T2 >
2262 typedef CompressedVector< typename DivTrait<T1,T2>::Type, TF > Type;
2279 template<
typename T1,
bool TF,
typename T2 >
2280 struct MathTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2282 typedef CompressedVector< typename MathTrait<T1,T2>::HighType, TF > HighType;
2283 typedef CompressedVector< typename MathTrait<T1,T2>::LowType , TF > LowType;
2299 template<
typename T1,
bool TF >
2300 struct SubvectorTrait< CompressedVector<T1,TF> >
2302 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:1555
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:994
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 swap(SymmetricMatrix< MT, SO, DF, NF > &a, SymmetricMatrix< MT, SO, DF, NF > &b)
Swapping the contents of two matrices.
Definition: SymmetricMatrix.h:195
#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:978
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:258
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:258
void assign(const DenseVector< VT, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: CompressedVector.h:1595
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1435
ValueIndexPair< Type > ElementBase
Base class for the compressed vector element.
Definition: CompressedVector.h:192
CompressedVector< ET, TF > Other
The type of the other CompressedVector.
Definition: CompressedVector.h:253
CompressedVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedVector.h:238
Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elem...
Definition: VectorAccessProxy.h:95
void swap(CompressedVector &sv)
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1285
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2478
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:348
VectorAccessProxy< This > Reference
Reference to a non-constant vector value.
Definition: CompressedVector.h:242
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:243
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:1664
Iterator end()
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:660
#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:1025
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:695
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:386
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a no...
Definition: MatrixAccessProxy.h:95
Header file for memory allocation and deallocation functionality.
size_t size_
The current size/dimension of the compressed vector.
Definition: CompressedVector.h:386
const CompressedVector & CompositeType
Data type for composite expression templates.
Definition: CompressedVector.h:241
EnableIf< IsBuiltin< T >, T * >::Type allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:151
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2638
size_t extendCapacity() const
Calculating a new vector capacity.
Definition: CompressedVector.h:1305
Header file for the ValueIndexPair class.
Rebind mechanism to obtain a CompressedVector with different data/element type.
Definition: CompressedVector.h:252
Iterator set(size_t index, const Type &value)
Setting an element of the compressed vector.
Definition: CompressedVector.h:1047
void subAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: CompressedVector.h:1719
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1498
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:434
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4754
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:1535
Iterator insert(size_t index, const Type &value)
Inserting an element into the compressed vector.
Definition: CompressedVector.h:1077
#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:688
Iterator * end_
Pointers one past the last non-zero element of each column.
Definition: CompressedMatrix.h:2640
Iterator begin_
Pointer to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:388
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:947
BLAZE_ALWAYS_INLINE 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:635
EnableIf< IsBuiltin< T > >::Type deallocate(T *address)
Deallocation of memory for built-in data types.
Definition: Memory.h:226
#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
BLAZE_ALWAYS_INLINE void clear(const NonNumericProxy< MT > &proxy)
Clearing the represented element.
Definition: NonNumericProxy.h:854
Header file for the subvector trait.
Constraint on the data type.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:240
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:646
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.
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:195
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:2480
bool canSMPAssign() const
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:1574
Header file for the EnableIf class template.
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:387
This ResultType
Result type for expression template evaluations.
Definition: CompressedVector.h:237
Header file for the serial shim.
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1142
Reference operator[](size_t index)
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:579
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1391
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1344
Header file for the IsNumeric type trait.
void reset()
Reset to the default initial values.
Definition: CompressedVector.h:1009
void resize(size_t n, bool preserve=true)
Changing the size of the compressed vector.
Definition: CompressedVector.h:1215
Header file for the IsSparseVector type trait.
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:142
Header file for the addition trait.
Header file for the cross product trait.
BLAZE_ALWAYS_INLINE 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:742
Header file for the division trait.
Constraint on the data type.
CompressedVector< Type, TF > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:236
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 move(DynamicMatrix< Type, SO > &dst, DynamicMatrix< Type, SO > &src)
Moving the contents of one dynamic matrix to another.
Definition: DynamicMatrix.h:4769
#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:964
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2481
Header file for the VectorAccessProxy class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:245
Header file for the isDefault shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:244
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
BLAZE_ALWAYS_INLINE void reset(const NonNumericProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: NonNumericProxy.h:833
Iterator * begin_
Pointers to the first non-zero element of each column.
Definition: CompressedMatrix.h:2639
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:995
Base template for the DivTrait class.
Definition: DivTrait.h:142
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:70
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:550
CompressedVector & operator=(const CompressedVector &rhs)
Copy assignment operator for CompressedVector.
Definition: CompressedVector.h:715
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:2642
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:389
Iterator begin()
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:618
Header file for basic type definitions.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2479
Base template for the SubTrait class.
Definition: SubTrait.h:142
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:239
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:391
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:188
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1240
BLAZE_ALWAYS_INLINE 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:849
Header file for a safe C++ NULL pointer implementation.