35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
185 template<
typename Type
198 struct Element :
public ElementBase
202 template<
typename Other >
203 inline Element&
operator=(
const Other& rhs )
205 ElementBase::operator=( rhs );
218 struct FindIndex :
public std::binary_function<Element,size_t,bool>
220 inline bool operator()(
const Element& element,
size_t index )
const {
221 return element.index() < index;
223 inline bool operator()(
size_t index,
const Element& element )
const {
224 return index < element.index();
226 inline bool operator()(
const Element& element1,
const Element& element2 )
const {
227 return element1.index() < element2.index();
250 template<
typename ET >
287 inline ConstReference
operator[](
size_t index )
const;
288 inline Reference
at(
size_t index );
289 inline ConstReference
at(
size_t index )
const;
290 inline Iterator
begin ();
291 inline ConstIterator
begin ()
const;
292 inline ConstIterator
cbegin()
const;
293 inline Iterator
end ();
294 inline ConstIterator
end ()
const;
295 inline ConstIterator
cend ()
const;
309 template<
typename Other >
311 operator*=( Other rhs );
313 template<
typename Other >
315 operator/=( Other rhs );
322 inline size_t size()
const;
327 inline Iterator
set (
size_t index,
const Type& value );
328 inline Iterator
insert(
size_t index,
const Type& value );
329 inline void erase (
size_t index );
330 inline Iterator
erase ( Iterator pos );
331 inline Iterator
erase ( Iterator first, Iterator last );
332 inline void resize(
size_t n,
bool preserve=
true );
334 template<
typename Other >
inline CompressedVector& scale(
const Other& scalar );
342 inline Iterator
find (
size_t index );
343 inline ConstIterator
find (
size_t index )
const;
345 inline ConstIterator
lowerBound(
size_t index )
const;
347 inline ConstIterator
upperBound(
size_t index )
const;
354 inline void append(
size_t index,
const Type& value,
bool check=
false );
361 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
362 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
379 Iterator
insert( Iterator pos,
size_t index,
const Type& value );
417 template<
typename Type
433 template<
typename Type
449 template<
typename Type
466 template<
typename Type
485 template<
typename Type
503 template<
typename Type
505 template<
typename VT >
507 : size_ ( (~dv).
size() )
523 template<
typename Type
525 template<
typename VT >
527 : size_ ( (~sv).
size() )
549 template<
typename Type
577 template<
typename Type
595 template<
typename Type
604 if( pos ==
end_ || pos->index_ != index )
624 template<
typename Type
629 if( index >= size_ ) {
632 return (*
this)[index];
649 template<
typename Type
654 if( index >= size_ ) {
657 return (*
this)[index];
667 template<
typename Type
681 template<
typename Type
695 template<
typename Type
709 template<
typename Type
723 template<
typename Type
737 template<
typename Type
763 template<
typename Type
768 if( &rhs ==
this )
return *
this;
770 const size_t nonzeros( rhs.
nonZeros() );
773 Iterator newBegin( allocate<Element>( nonzeros ) );
800 template<
typename Type
802 template<
typename VT >
808 if( (~rhs).canAlias(
this ) ) {
813 size_ = (~rhs).
size();
815 assign( *
this, ~rhs );
832 template<
typename Type
834 template<
typename VT >
845 size_ = (~rhs).
size();
847 assign( *
this, ~rhs );
865 template<
typename Type
867 template<
typename VT >
870 using blaze::addAssign;
872 if( (~rhs).
size() != size_ ) {
876 addAssign( *
this, ~rhs );
893 template<
typename Type
895 template<
typename VT >
898 using blaze::subAssign;
900 if( (~rhs).
size() != size_ ) {
904 subAssign( *
this, ~rhs );
922 template<
typename Type
924 template<
typename VT >
927 if( (~rhs).
size() != size_ ) {
950 template<
typename Type
952 template<
typename Other >
957 element->value_ *= rhs;
975 template<
typename Type
977 template<
typename Other >
989 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
991 element->value_ *= tmp;
995 element->value_ /= rhs;
1016 template<
typename Type
1030 template<
typename Type
1047 template<
typename Type
1061 template<
typename Type
1077 template<
typename Type
1098 template<
typename Type
1105 const Iterator pos( lowerBound( index ) );
1107 if( pos !=
end_ && pos->index_ == index ) {
1108 pos->value() = value;
1111 else return insert( pos, index, value );
1128 template<
typename Type
1135 const Iterator pos( lowerBound( index ) );
1137 if( pos !=
end_ && pos->index_ == index ) {
1141 return insert( pos, index, value );
1155 template<
typename Type
1161 std::copy_backward( pos,
end_,
end_+1 );
1162 pos->value_ = value;
1163 pos->index_ = index;
1169 size_t newCapacity( extendCapacity() );
1171 Iterator newBegin = allocate<Element>( newCapacity );
1173 tmp->value_ = value;
1174 tmp->index_ = index;
1175 end_ = std::copy( pos,
end_, tmp+1 );
1195 template<
typename Type
1201 const Iterator pos( find( index ) );
1203 end_ = std::copy( pos+1,
end_, pos );
1216 template<
typename Type
1223 end_ = std::copy( pos+1,
end_, pos );
1238 template<
typename Type
1248 end_ = std::copy( last,
end_, first );
1268 template<
typename Type
1273 end_ = lowerBound( n );
1293 template<
typename Type
1298 const size_t newCapacity( n );
1301 Iterator newBegin = allocate<Element>( newCapacity );
1319 template<
typename Type
1321 template<
typename Other >
1325 element->value_ *= scalar;
1338 template<
typename Type
1358 template<
typename Type
1366 nonzeros =
max( nonzeros, 7UL );
1367 nonzeros =
min( nonzeros, size_ );
1397 template<
typename Type
1401 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1419 template<
typename Type
1424 if( pos !=
end_ && pos->index_ == index )
1443 template<
typename Type
1465 template<
typename Type
1470 return std::lower_bound(
begin_,
end_, index, FindIndex() );
1487 template<
typename Type
1509 template<
typename Type
1514 return std::upper_bound(
begin_,
end_, index, FindIndex() );
1551 template<
typename Type
1559 end_->value_ = value;
1562 end_->index_ = index;
1587 template<
typename Type
1589 template<
typename Other >
1592 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1607 template<
typename Type
1609 template<
typename Other >
1612 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1627 template<
typename Type
1647 template<
typename Type
1649 template<
typename VT >
1655 size_t nonzeros( 0UL );
1657 for(
size_t i=0UL; i<size_; ++i )
1660 reserve( extendCapacity() );
1662 end_->value_ = (~rhs)[i];
1685 template<
typename Type
1687 template<
typename VT >
1700 append( element->index(), element->value() );
1716 template<
typename Type
1718 template<
typename VT >
1729 const AddType tmp(
serial( *
this + (~rhs) ) );
1747 template<
typename Type
1749 template<
typename VT >
1771 template<
typename Type
1773 template<
typename VT >
1784 const SubType tmp(
serial( *
this - (~rhs) ) );
1802 template<
typename Type
1804 template<
typename VT >
1826 template<
typename Type,
bool TF >
1829 template<
typename Type,
bool TF >
1832 template<
typename Type,
bool TF >
1835 template<
typename Type,
bool TF >
1838 template<
typename Type,
bool TF >
1841 template<
typename Type,
bool TF >
1854 template<
typename Type
1870 template<
typename Type
1896 template<
typename Type
1900 return ( v.
size() == 0UL );
1923 template<
typename Type
1941 template<
typename Type
1959 template<
typename Type
1978 template<
typename T,
bool TF >
1979 struct IsResizable< CompressedVector<T,TF> > :
public TrueType
1998 template<
typename T1,
bool TF,
typename T2,
size_t N >
1999 struct AddTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2001 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2004 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2005 struct AddTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2007 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2010 template<
typename T1,
bool TF,
typename T2,
size_t N >
2011 struct AddTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2013 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2016 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2017 struct AddTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2019 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2022 template<
typename T1,
bool TF,
typename T2 >
2023 struct AddTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2025 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
2028 template<
typename T1,
bool TF,
typename T2 >
2029 struct AddTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2031 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
2034 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2035 struct AddTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2037 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
2040 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2041 struct AddTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2043 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
2046 template<
typename T1,
bool TF,
typename T2 >
2047 struct AddTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2049 typedef CompressedVector< typename AddTrait<T1,T2>::Type, TF > Type;
2065 template<
typename T1,
bool TF,
typename T2,
size_t N >
2066 struct SubTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2068 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2071 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2072 struct SubTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2074 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2077 template<
typename T1,
bool TF,
typename T2,
size_t N >
2078 struct SubTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2080 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2083 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2084 struct SubTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2086 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2089 template<
typename T1,
bool TF,
typename T2 >
2090 struct SubTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2092 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
2095 template<
typename T1,
bool TF,
typename T2 >
2096 struct SubTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2098 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
2101 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2102 struct SubTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2104 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
2107 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2108 struct SubTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2110 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
2113 template<
typename T1,
bool TF,
typename T2 >
2114 struct SubTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2116 typedef CompressedVector< typename SubTrait<T1,T2>::Type, TF > Type;
2132 template<
typename T1,
bool TF,
typename T2 >
2133 struct MultTrait< CompressedVector<T1,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2135 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2138 template<
typename T1,
typename T2,
bool TF >
2139 struct MultTrait< T1, CompressedVector<T2,TF>, typename EnableIf< IsNumeric<T1> >::Type >
2141 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2144 template<
typename T1,
bool TF,
typename T2,
size_t N >
2145 struct MultTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2147 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2150 template<
typename T1,
typename T2,
size_t N >
2151 struct MultTrait< CompressedVector<T1,false>, StaticVector<T2,N,true> >
2153 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2156 template<
typename T1,
typename T2,
size_t N >
2157 struct MultTrait< CompressedVector<T1,true>, StaticVector<T2,N,false> >
2159 typedef typename MultTrait<T1,T2>::Type Type;
2162 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2163 struct MultTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2165 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2168 template<
typename T1,
size_t N,
typename T2 >
2169 struct MultTrait< StaticVector<T1,N,false>, CompressedVector<T2,true> >
2171 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2174 template<
typename T1,
size_t N,
typename T2 >
2175 struct MultTrait< StaticVector<T1,N,true>, CompressedVector<T2,false> >
2177 typedef typename MultTrait<T1,T2>::Type Type;
2180 template<
typename T1,
bool TF,
typename T2,
size_t N >
2181 struct MultTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2183 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2186 template<
typename T1,
typename T2,
size_t N >
2187 struct MultTrait< CompressedVector<T1,false>, HybridVector<T2,N,true> >
2189 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2192 template<
typename T1,
typename T2,
size_t N >
2193 struct MultTrait< CompressedVector<T1,true>, HybridVector<T2,N,false> >
2195 typedef typename MultTrait<T1,T2>::Type Type;
2198 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2199 struct MultTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2201 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2204 template<
typename T1,
size_t N,
typename T2 >
2205 struct MultTrait< HybridVector<T1,N,false>, CompressedVector<T2,true> >
2207 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2210 template<
typename T1,
size_t N,
typename T2 >
2211 struct MultTrait< HybridVector<T1,N,true>, CompressedVector<T2,false> >
2213 typedef typename MultTrait<T1,T2>::Type Type;
2216 template<
typename T1,
bool TF,
typename T2 >
2217 struct MultTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2219 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2222 template<
typename T1,
typename T2 >
2223 struct MultTrait< CompressedVector<T1,false>, DynamicVector<T2,true> >
2225 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2228 template<
typename T1,
typename T2 >
2229 struct MultTrait< CompressedVector<T1,true>, DynamicVector<T2,false> >
2231 typedef typename MultTrait<T1,T2>::Type Type;
2234 template<
typename T1,
bool TF,
typename T2 >
2235 struct MultTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2237 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2240 template<
typename T1,
typename T2 >
2241 struct MultTrait< DynamicVector<T1,false>, CompressedVector<T2,true> >
2243 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2246 template<
typename T1,
typename T2 >
2247 struct MultTrait< DynamicVector<T1,true>, CompressedVector<T2,false> >
2249 typedef typename MultTrait<T1,T2>::Type Type;
2252 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2253 struct MultTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2255 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2258 template<
typename T1,
typename T2,
bool AF,
bool PF >
2259 struct MultTrait< CompressedVector<T1,false>, CustomVector<T2,AF,PF,true> >
2261 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
true > Type;
2264 template<
typename T1,
typename T2,
bool AF,
bool PF >
2265 struct MultTrait< CompressedVector<T1,true>, CustomVector<T2,AF,PF,false> >
2267 typedef typename MultTrait<T1,T2>::Type Type;
2270 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2271 struct MultTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2273 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2276 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2277 struct MultTrait< CustomVector<T1,AF,PF,false>, CompressedVector<T2,true> >
2279 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2282 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2283 struct MultTrait< CustomVector<T1,AF,PF,true>, CompressedVector<T2,false> >
2285 typedef typename MultTrait<T1,T2>::Type Type;
2288 template<
typename T1,
bool TF,
typename T2 >
2289 struct MultTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2291 typedef CompressedVector< typename MultTrait<T1,T2>::Type, TF > Type;
2294 template<
typename T1,
typename T2 >
2295 struct MultTrait< CompressedVector<T1,false>, CompressedVector<T2,true> >
2297 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
2300 template<
typename T1,
typename T2 >
2301 struct MultTrait< CompressedVector<T1,true>, CompressedVector<T2,false> >
2303 typedef typename MultTrait<T1,T2>::Type Type;
2319 template<
typename T1,
typename T2 >
2320 struct CrossTrait< CompressedVector<T1,false>, StaticVector<T2,3UL,false> >
2323 typedef typename MultTrait<T1,T2>::Type T;
2326 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2329 template<
typename T1,
typename T2 >
2330 struct CrossTrait< StaticVector<T1,3UL,false>, CompressedVector<T2,false> >
2333 typedef typename MultTrait<T1,T2>::Type T;
2336 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2339 template<
typename T1,
typename T2,
size_t N >
2340 struct CrossTrait< CompressedVector<T1,false>, HybridVector<T2,N,false> >
2343 typedef typename MultTrait<T1,T2>::Type T;
2346 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2349 template<
typename T1,
size_t N,
typename T2 >
2350 struct CrossTrait< HybridVector<T1,N,false>, CompressedVector<T2,false> >
2353 typedef typename MultTrait<T1,T2>::Type T;
2356 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2359 template<
typename T1,
typename T2 >
2360 struct CrossTrait< CompressedVector<T1,false>, DynamicVector<T2,false> >
2363 typedef typename MultTrait<T1,T2>::Type T;
2366 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2369 template<
typename T1,
typename T2 >
2370 struct CrossTrait< DynamicVector<T1,false>, CompressedVector<T2,false> >
2373 typedef typename MultTrait<T1,T2>::Type T;
2376 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2379 template<
typename T1,
typename T2 >
2380 struct CrossTrait< CompressedVector<T1,false>, CompressedVector<T2,false> >
2383 typedef typename MultTrait<T1,T2>::Type T;
2386 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
2402 template<
typename T1,
bool TF,
typename T2 >
2403 struct DivTrait< CompressedVector<T1,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2405 typedef CompressedVector< typename DivTrait<T1,T2>::Type, TF > Type;
2421 template<
typename T1,
bool TF,
typename T2 >
2422 struct MathTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2424 typedef CompressedVector< typename MathTrait<T1,T2>::HighType, TF > HighType;
2425 typedef CompressedVector< typename MathTrait<T1,T2>::LowType , TF > LowType;
2441 template<
typename T1,
bool TF >
2442 struct SubvectorTrait< CompressedVector<T1,TF> >
2444 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
#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
bool isAliased(const Other *alias) const
Returns whether the vector is aliased with the given address alias.
Definition: CompressedVector.h:1610
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1729
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
Header file for mathematical functions.
#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 basic type definitions.
Header file for the SparseVector base class.
size_t capacity() const
Returns the maximum capacity of the compressed vector.
Definition: CompressedVector.h:1032
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
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
void assign(const DenseVector< VT, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: CompressedVector.h:1650
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1490
ValueIndexPair< Type > ElementBase
Base class for the compressed vector element.
Definition: CompressedVector.h:191
CompressedVector< ET, TF > Other
The type of the other CompressedVector.
Definition: CompressedVector.h:252
CompressedVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedVector.h:237
Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elem...
Definition: VectorAccessProxy.h:100
void swap(CompressedVector &sv)
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1340
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
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
VectorAccessProxy< This > Reference
Reference to a non-constant vector value.
Definition: CompressedVector.h:241
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:242
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:1719
Iterator end()
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:711
#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:1079
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
Header file for memory allocation and deallocation functionality.
void move(CustomMatrix< Type, AF, PF, SO > &dst, CustomMatrix< Type, AF, PF, SO > &src)
Moving the contents of one custom matrix to another.
Definition: CustomMatrix.h:6085
size_t size_
The current size/dimension of the compressed vector.
Definition: CompressedVector.h:387
const CompressedVector & CompositeType
Data type for composite expression templates.
Definition: CompressedVector.h:240
EnableIf< IsBuiltin< T >, T * >::Type allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:152
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2751
size_t extendCapacity() const
Calculating a new vector capacity.
Definition: CompressedVector.h:1360
Header file for the ValueIndexPair class.
Rebind mechanism to obtain a CompressedVector with different data/element type.
Definition: CompressedVector.h:251
Iterator set(size_t index, const Type &value)
Setting an element of the compressed vector.
Definition: CompressedVector.h:1101
void subAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: CompressedVector.h:1774
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1553
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
CompressedVector()
The default constructor for CompressedVector.
Definition: CompressedVector.h:435
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:1590
Iterator insert(size_t index, const Type &value)
Inserting an element into the compressed vector.
Definition: CompressedVector.h:1131
#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:739
Iterator * end_
Pointers one past the last non-zero element of each column.
Definition: CompressedMatrix.h:2753
Iterator begin_
Pointer to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:389
#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
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
EnableIf< IsBuiltin< T > >::Type deallocate(T *address)
Deallocation of memory for built-in data types.
Definition: Memory.h:227
#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.
Constraint on the data type.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:239
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:697
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:187
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
bool canSMPAssign() const
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:1629
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:388
This ResultType
Result type for expression template evaluations.
Definition: CompressedVector.h:236
Header file for the serial shim.
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1197
Reference operator[](size_t index)
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:580
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1446
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1399
Header file for the IsNumeric type trait.
void reset()
Reset to the default initial values.
Definition: CompressedVector.h:1063
void resize(size_t n, bool preserve=true)
Changing the size of the compressed vector.
Definition: CompressedVector.h:1270
Header file for the IsSparseVector type trait.
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:138
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Constraint on the data type.
CompressedVector< Type, TF > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:235
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Reference at(size_t index)
Checked access to the compressed vector elements.
Definition: CompressedVector.h:627
#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:1018
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Header file for the VectorAccessProxy class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:244
Header file for the isDefault shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:243
Constraint on the data type.
Iterator * begin_
Pointers to the first non-zero element of each column.
Definition: CompressedMatrix.h:2752
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:1049
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
Base template for the DivTrait class.
Definition: DivTrait.h:138
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.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
Header file for the default transpose flag for all vectors of the Blaze library.
~CompressedVector()
The destructor for CompressedVector.
Definition: CompressedVector.h:551
CompressedVector & operator=(const CompressedVector &rhs)
Copy assignment operator for CompressedVector.
Definition: CompressedVector.h:766
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:2755
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
Iterator end_
Pointer one past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:390
Iterator begin()
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:669
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Base template for the SubTrait class.
Definition: SubTrait.h:138
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
Type ElementType
Type of the compressed vector elements.
Definition: CompressedVector.h:238
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:392
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:81
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:187
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1295
Header file for a safe C++ NULL pointer implementation.