35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 190 template<
typename Type
207 struct Element :
public ElementBase
210 explicit Element() =
default;
211 Element(
const Element& rhs ) =
default;
212 Element( Element&& rhs ) =
default;
216 inline Element&
operator=(
const Element& rhs )
218 this->value_ = rhs.value_;
222 inline Element&
operator=( Element&& rhs )
224 this->value_ = std::move( rhs.value_ );
228 template<
typename Other >
232 this->value_ = rhs.value();
236 template<
typename Other >
241 this->value_ = std::move( rhs.value() );
245 template<
typename Other >
253 template<
typename Other >
255 , IsRValueReference<Other&&> >, Element& >
258 this->value_ = std::move( v );
288 template<
typename NewType >
297 template<
size_t NewN >
334 inline Reference
operator[](
size_t index ) noexcept;
335 inline ConstReference
operator[](
size_t index )
const noexcept;
336 inline Reference
at(
size_t index );
337 inline ConstReference
at(
size_t index )
const;
338 inline Iterator
begin () noexcept;
339 inline ConstIterator
begin ()
const noexcept;
340 inline ConstIterator
cbegin()
const noexcept;
341 inline Iterator
end () noexcept;
342 inline ConstIterator
end ()
const noexcept;
343 inline ConstIterator
cend ()
const noexcept;
361 template<
typename Other >
364 template<
typename Other >
372 inline size_t size()
const noexcept;
373 inline size_t capacity()
const noexcept;
377 inline void resize(
size_t n,
bool preserve=
true );
386 inline Iterator
set (
size_t index,
const Type& value );
387 inline Iterator
insert(
size_t index,
const Type& value );
388 inline void append(
size_t index,
const Type& value,
bool check=
false );
395 inline void erase(
size_t index );
396 inline Iterator
erase( Iterator pos );
397 inline Iterator
erase( Iterator first, Iterator last );
399 template<
typename Pred,
typename = DisableIf_< IsIntegral<Pred> > >
400 inline void erase( Pred predicate );
402 template<
typename Pred >
403 inline void erase( Iterator first, Iterator last, Pred predicate );
410 inline Iterator
find (
size_t index );
411 inline ConstIterator
find (
size_t index )
const;
413 inline ConstIterator
lowerBound(
size_t index )
const;
415 inline ConstIterator
upperBound(
size_t index )
const;
429 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
430 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
450 inline Iterator
castDown( IteratorBase it )
const noexcept;
451 inline IteratorBase
castUp ( Iterator it )
const noexcept;
458 Iterator
insert( Iterator pos,
size_t index,
const Type& value );
495 template<
typename Type
511 template<
typename Type
527 template<
typename Type
544 template<
typename Type
563 template<
typename Type
581 template<
typename Type
602 template<
typename Type
604 template<
typename VT >
622 template<
typename Type
624 template<
typename VT >
648 template<
typename Type
676 template<
typename Type
694 template<
typename Type
703 if( pos ==
end_ || pos->index_ != index )
723 template<
typename Type
728 if( index >=
size_ ) {
731 return (*
this)[index];
748 template<
typename Type
753 if( index >=
size_ ) {
756 return (*
this)[index];
766 template<
typename Type
780 template<
typename Type
795 template<
typename Type
810 template<
typename Type
824 template<
typename Type
839 template<
typename Type
866 template<
typename Type
871 if( &rhs ==
this )
return *
this;
873 const size_t nonzeros( rhs.
nonZeros() );
876 Iterator newBegin( allocate<Element>( nonzeros ) );
900 template<
typename Type
914 rhs.begin_ =
nullptr;
931 template<
typename Type
933 template<
typename VT >
963 template<
typename Type
965 template<
typename VT >
996 template<
typename Type
998 template<
typename VT >
1001 using blaze::addAssign;
1024 template<
typename Type
1026 template<
typename VT >
1029 using blaze::subAssign;
1053 template<
typename Type
1055 template<
typename VT >
1059 using blaze::multAssign;
1090 template<
typename Type
1092 template<
typename VT >
1118 template<
typename Type
1120 template<
typename VT >
1123 using blaze::divAssign;
1154 template<
typename Type
1156 template<
typename Other >
1161 element->value_ *= rhs;
1179 template<
typename Type
1181 template<
typename Other >
1193 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1195 element->value_ *= tmp;
1199 element->value_ /= rhs;
1220 template<
typename Type
1234 template<
typename Type
1251 template<
typename Type
1265 template<
typename Type
1281 template<
typename Type
1305 template<
typename Type
1330 template<
typename Type
1335 const size_t newCapacity( n );
1338 Iterator newBegin = allocate<Element>( newCapacity );
1356 template<
typename Type
1376 template<
typename Type
1384 nonzeros =
max( nonzeros, 7UL );
1402 template<
typename Type
1407 return static_cast<Iterator>( it );
1420 template<
typename Type
1449 template<
typename Type
1458 if( pos !=
end_ && pos->index_ == index ) {
1459 pos->value() = value;
1462 else return insert( pos, index, value );
1479 template<
typename Type
1488 if( pos !=
end_ && pos->index_ == index ) {
1492 return insert( pos, index, value );
1506 template<
typename Type
1513 pos->value_ = value;
1514 pos->index_ = index;
1522 Iterator newBegin = allocate<Element>( newCapacity );
1524 tmp->value_ = value;
1525 tmp->index_ = index;
1562 template<
typename Type
1570 end_->value_ = value;
1572 if( !check || !isDefault<strict>(
end_->value_ ) ) {
1573 end_->index_ = index;
1596 template<
typename Type
1617 template<
typename Type
1640 template<
typename Type
1677 template<
typename Type
1679 template<
typename Pred
1684 [predicate=predicate](
const ElementBase& element ) {
1685 return predicate( element.
value() );
1714 template<
typename Type
1716 template<
typename Pred >
1723 const auto pos = std::remove_if(
castUp( first ),
castUp( last ),
1724 [predicate=predicate](
const ElementBase& element ) {
1725 return predicate( element.
value() );
1754 template<
typename Type
1758 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1776 template<
typename Type
1781 if( pos !=
end_ && pos->index_ == index )
1800 template<
typename Type
1822 template<
typename Type
1827 return std::lower_bound(
begin_,
end_, index,
1828 [](
const Element& element,
size_t i )
1830 return element.index() < i;
1848 template<
typename Type
1870 template<
typename Type
1875 return std::upper_bound(
begin_,
end_, index,
1876 [](
size_t i,
const Element& element )
1878 return i < element.index();
1898 template<
typename Type
1900 template<
typename Other >
1904 element->value_ *= scalar;
1928 template<
typename Type
1930 template<
typename Other >
1933 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1948 template<
typename Type
1950 template<
typename Other >
1953 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1968 template<
typename Type
1988 template<
typename Type
1990 template<
typename VT >
1996 size_t nonzeros( 0UL );
1998 for(
size_t i=0UL; i<
size_; ++i )
2003 end_->value_ = (~rhs)[i];
2005 if( !isDefault<strict>(
end_->value_ ) ) {
2026 template<
typename Type
2028 template<
typename VT >
2041 append( element->index(), element->value() );
2057 template<
typename Type
2059 template<
typename VT >
2070 const AddType tmp(
serial( *
this + (~rhs) ) );
2088 template<
typename Type
2090 template<
typename VT >
2112 template<
typename Type
2114 template<
typename VT >
2125 const SubType tmp(
serial( *
this - (~rhs) ) );
2143 template<
typename Type
2145 template<
typename VT >
2167 template<
typename Type
2169 template<
typename VT >
2177 element->value_ *= (~rhs)[element->index_];
2194 template<
typename Type
2196 template<
typename VT >
2204 element->value_ /= (~rhs)[element->index_];
2221 template<
typename Type,
bool TF >
2224 template<
typename Type,
bool TF >
2227 template<
bool RF,
typename Type,
bool TF >
2230 template<
typename Type,
bool TF >
2233 template<
typename Type,
bool TF >
2246 template<
typename Type
2262 template<
typename Type
2300 return ( v.
size() == 0UL );
2323 template<
typename Type
2340 template<
typename Type
2359 template<
typename T,
bool TF >
2376 template<
typename T1,
bool TF,
typename T2,
size_t N >
2377 struct AddTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2382 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2383 struct AddTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2388 template<
typename T1,
bool TF,
typename T2,
size_t N >
2389 struct AddTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2394 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2395 struct AddTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2400 template<
typename T1,
bool TF,
typename T2 >
2401 struct AddTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2406 template<
typename T1,
bool TF,
typename T2 >
2407 struct AddTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2412 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2413 struct AddTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2418 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2419 struct AddTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2424 template<
typename T1,
bool TF,
typename T2 >
2425 struct AddTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2443 template<
typename T1,
bool TF,
typename T2,
size_t N >
2444 struct SubTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2449 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2450 struct SubTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2455 template<
typename T1,
bool TF,
typename T2,
size_t N >
2456 struct SubTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2461 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2462 struct SubTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2467 template<
typename T1,
bool TF,
typename T2 >
2468 struct SubTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2473 template<
typename T1,
bool TF,
typename T2 >
2474 struct SubTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2479 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2480 struct SubTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2485 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2486 struct SubTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2491 template<
typename T1,
bool TF,
typename T2 >
2492 struct SubTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2510 template<
typename T1,
bool TF,
typename T2 >
2511 struct MultTrait< CompressedVector<T1,TF>, T2, EnableIf_< IsNumeric<T2> > >
2516 template<
typename T1,
typename T2,
bool TF >
2517 struct MultTrait< T1, CompressedVector<T2,TF>, EnableIf_< IsNumeric<T1> > >
2522 template<
typename T1,
bool TF,
typename T2,
size_t N >
2523 struct MultTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2528 template<
typename T1,
typename T2,
size_t N >
2529 struct MultTrait< CompressedVector<T1,false>, StaticVector<T2,N,true> >
2534 template<
typename T1,
typename T2,
size_t N >
2535 struct MultTrait< CompressedVector<T1,true>, StaticVector<T2,N,false> >
2540 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2541 struct MultTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2546 template<
typename T1,
size_t N,
typename T2 >
2547 struct MultTrait< StaticVector<T1,N,false>, CompressedVector<T2,true> >
2552 template<
typename T1,
size_t N,
typename T2 >
2553 struct MultTrait< StaticVector<T1,N,true>, CompressedVector<T2,false> >
2558 template<
typename T1,
bool TF,
typename T2,
size_t N >
2559 struct MultTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2564 template<
typename T1,
typename T2,
size_t N >
2565 struct MultTrait< CompressedVector<T1,false>, HybridVector<T2,N,true> >
2570 template<
typename T1,
typename T2,
size_t N >
2571 struct MultTrait< CompressedVector<T1,true>, HybridVector<T2,N,false> >
2576 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2577 struct MultTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2582 template<
typename T1,
size_t N,
typename T2 >
2583 struct MultTrait< HybridVector<T1,N,false>, CompressedVector<T2,true> >
2588 template<
typename T1,
size_t N,
typename T2 >
2589 struct MultTrait< HybridVector<T1,N,true>, CompressedVector<T2,false> >
2594 template<
typename T1,
bool TF,
typename T2 >
2595 struct MultTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2600 template<
typename T1,
typename T2 >
2601 struct MultTrait< CompressedVector<T1,false>, DynamicVector<T2,true> >
2606 template<
typename T1,
typename T2 >
2607 struct MultTrait< CompressedVector<T1,true>, DynamicVector<T2,false> >
2612 template<
typename T1,
bool TF,
typename T2 >
2613 struct MultTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2618 template<
typename T1,
typename T2 >
2619 struct MultTrait< DynamicVector<T1,false>, CompressedVector<T2,true> >
2624 template<
typename T1,
typename T2 >
2625 struct MultTrait< DynamicVector<T1,true>, CompressedVector<T2,false> >
2630 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2631 struct MultTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2636 template<
typename T1,
typename T2,
bool AF,
bool PF >
2637 struct MultTrait< CompressedVector<T1,false>, CustomVector<T2,AF,PF,true> >
2642 template<
typename T1,
typename T2,
bool AF,
bool PF >
2643 struct MultTrait< CompressedVector<T1,true>, CustomVector<T2,AF,PF,false> >
2648 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2649 struct MultTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2654 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2655 struct MultTrait< CustomVector<T1,AF,PF,false>, CompressedVector<T2,true> >
2660 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2661 struct MultTrait< CustomVector<T1,AF,PF,true>, CompressedVector<T2,false> >
2666 template<
typename T1,
bool TF,
typename T2 >
2667 struct MultTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2672 template<
typename T1,
typename T2 >
2673 struct MultTrait< CompressedVector<T1,false>, CompressedVector<T2,true> >
2678 template<
typename T1,
typename T2 >
2679 struct MultTrait< CompressedVector<T1,true>, CompressedVector<T2,false> >
2697 template<
typename T1,
bool TF,
typename T2 >
2698 struct CrossTrait< CompressedVector<T1,TF>, StaticVector<T2,3UL,TF> >
2707 template<
typename T1,
bool TF,
typename T2 >
2708 struct CrossTrait< StaticVector<T1,3UL,TF>, CompressedVector<T2,TF> >
2717 template<
typename T1,
bool TF,
typename T2,
size_t N >
2718 struct CrossTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2727 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2728 struct CrossTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2737 template<
typename T1,
bool TF,
typename T2 >
2738 struct CrossTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2747 template<
typename T1,
bool TF,
typename T2 >
2748 struct CrossTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2757 template<
typename T1,
bool TF,
typename T2 >
2758 struct CrossTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2780 template<
typename T1,
bool TF,
typename T2 >
2781 struct DivTrait< CompressedVector<T1,TF>, T2, EnableIf_< IsNumeric<T2> > >
2786 template<
typename T1,
bool TF,
typename T2,
size_t N >
2787 struct DivTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2792 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2793 struct DivTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2798 template<
typename T1,
bool TF,
typename T2,
size_t N >
2799 struct DivTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2804 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2805 struct DivTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2810 template<
typename T1,
bool TF,
typename T2 >
2811 struct DivTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2816 template<
typename T1,
bool TF,
typename T2 >
2817 struct DivTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2822 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2823 struct DivTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2828 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2829 struct DivTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2834 template<
typename T1,
bool TF,
typename T2 >
2835 struct DivTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2853 template<
typename T1,
bool TF,
typename T2 >
2854 struct HighType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2872 template<
typename T1,
bool TF,
typename T2 >
2873 struct LowType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2891 template<
typename T1,
bool TF >
#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:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
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
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
void assign(const DenseVector< VT, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: CompressedVector.h:1991
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1851
Resize mechanism to obtain a CompressedVector with a different fixed number of elements.
Definition: CompressedVector.h:298
Header file for the serial shim.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
ValueIndexPair< Type > ElementBase
Base class for the compressed vector element.
Definition: CompressedVector.h:196
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
CompressedVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedVector.h:275
Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elem...
Definition: VectorAccessProxy.h:101
VectorAccessProxy< This > Reference
Reference to a non-constant vector value.
Definition: CompressedVector.h:279
Header file for the IsIntegral type trait.
IteratorBase castUp(Iterator it) const noexcept
Performs an up-cast of the given iterator.
Definition: CompressedVector.h:1423
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:280
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Algorithm.h:71
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
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:2060
#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:79
void clear()
Clearing the compressed vector.
Definition: CompressedVector.h:1283
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
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
ElementBase * IteratorBase
Iterator over non-constant base elements.
Definition: CompressedVector.h:197
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:177
Header file for memory allocation and deallocation functionality.
size_t size_
The current size/dimension of the compressed vector.
Definition: CompressedVector.h:465
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
const CompressedVector & CompositeType
Data type for composite expression templates.
Definition: CompressedVector.h:278
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1802
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:679
Constraint on the data type.
Base template for the CrossTrait class.
Definition: CrossTrait.h:110
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:61
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:120
Efficient implementation of a dynamically sized vector with static memory.The HybridVector class temp...
Definition: Forward.h:59
EnableIf_< IsBuiltin< T >, T *> allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:150
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Header file for the ValueIndexPair class.
Rebind mechanism to obtain a CompressedVector with different data/element type.
Definition: CompressedVector.h:289
CompressedVector() noexcept
The default constructor for CompressedVector.
Definition: CompressedVector.h:513
Header file for the DisableIf class template.
Iterator set(size_t index, const Type &value)
Setting an element of the compressed vector.
Definition: CompressedVector.h:1452
Header file for the LowType type trait.
Base template for the HighType type trait.
Definition: HighType.h:133
void subAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: CompressedVector.h:2115
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1564
Header file for the multiplication trait.
CompressedVector< NewType, TF > Other
The type of the other CompressedVector.
Definition: CompressedVector.h:290
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5635
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
constexpr bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.This value specifies the default tran...
Definition: TransposeFlag.h:56
Header file for all forward declarations of the math module.
Iterator insert(size_t index, const Type &value)
Inserting an element into the compressed vector.
Definition: CompressedVector.h:1482
#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:79
Header file for the IsSMPAssignable type trait.
Iterator begin_
Pointer to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:467
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
size_t size() const noexcept
Returns the current size/dimension of the compressed vector.
Definition: CompressedVector.h:1222
#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:60
Header file for the subvector trait.
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:1253
Iterator castDown(IteratorBase it) const noexcept
Performs a down-cast of the given iterator.
Definition: CompressedVector.h:1405
Constraint on the data type.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:277
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
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:60
Constraint on the data type.
Header file for the exception macros of the math module.
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:75
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:119
Constraint on the data type.
Headerfile for generic algorithms.
Header file for the EnableIf class template.
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:466
This ResultType
Result type for expression template evaluations.
Definition: CompressedVector.h:274
CompressedVector< Type, TF > Other
The type of the other CompressedVector.
Definition: CompressedVector.h:299
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1598
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:245
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1803
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1756
Header file for the IsNumeric type trait.
Base template for the LowType type trait.
Definition: LowType.h:133
void reset()
Reset to the default initial values.
Definition: CompressedVector.h:1267
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
void resize(size_t n, bool preserve=true)
Changing the size of the compressed vector.
Definition: CompressedVector.h:1307
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:143
Header file for the relaxation flag types.
Base template for the MultTrait class.
Definition: MultTrait.h:143
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Constraint on the data type.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
size_t extendCapacity() const noexcept
Calculating a new vector capacity.
Definition: CompressedVector.h:1378
CompressedVector< Type, TF > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:272
Reference at(size_t index)
Checked access to the compressed vector elements.
Definition: CompressedVector.h:726
#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:79
Header file for the VectorAccessProxy class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:282
Header file for the isDefault shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:281
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
void multAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the multiplication assignment of a dense vector.
Definition: CompressedVector.h:2170
void divAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the division assignment of a dense vector.
Definition: CompressedVector.h:2197
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:225
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: CompressedVector.h:1951
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Base template for the DivTrait class.
Definition: DivTrait.h:143
void swap(CompressedVector &sv) noexcept
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1358
ConstIterator cbegin() const noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:798
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#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:61
Iterator end() noexcept
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:812
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
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:650
CompressedVector & operator=(const CompressedVector &rhs)
Copy assignment operator for CompressedVector.
Definition: CompressedVector.h:869
SparseVector< This, TF > BaseType
Base type of this CompressedVector instance.
Definition: CompressedVector.h:273
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
size_t capacity() const noexcept
Returns the maximum capacity of the compressed vector.
Definition: CompressedVector.h:1236
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:120
Iterator end_
Pointer one past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:468
Compile time type check.This class tests whether the given template parameter T is an rvalue referenc...
Definition: IsRValueReference.h:77
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
ConstIterator cend() const noexcept
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:842
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Base template for the SubTrait class.
Definition: SubTrait.h:143
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
Iterator begin() noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:768
Type ElementType
Type of the compressed vector elements.
Definition: CompressedVector.h:276
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:470
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:1931
Header file for the IsResizable type trait.
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:1970
#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:63
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:245
#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:192
Reference value()
Access to the current value of the value-index-pair.
Definition: ValueIndexPair.h:361
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1332
Header file for the HighType type trait.