35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 195 template<
typename Type
196 ,
bool TF = defaultTransposeFlag >
217 explicit Element() =
default;
218 Element(
const Element& rhs ) =
default;
219 Element( Element&& rhs ) =
default;
223 inline Element&
operator=(
const Element& rhs )
225 this->value_ = rhs.value_;
229 inline Element&
operator=( Element&& rhs )
231 this->value_ = std::move( rhs.value_ );
235 template<
typename Other >
239 this->value_ = rhs.value();
243 template<
typename Other >
248 this->value_ = std::move( rhs.value() );
252 template<
typename Other >
260 template<
typename Other >
262 , IsRValueReference<Other&&> >, Element& >
265 this->value_ = std::move( v );
295 template<
typename NewType >
304 template<
size_t NewN >
369 template<
typename Other >
372 template<
typename Other >
380 inline size_t size()
const noexcept;
381 inline size_t capacity()
const noexcept;
385 inline void resize(
size_t n,
bool preserve=
true );
395 inline Iterator set (
size_t index,
const Type& value );
397 inline void append(
size_t index,
const Type& value,
bool check=
false );
404 inline void erase(
size_t index );
408 template<
typename Pred,
typename = DisableIf_< IsIntegral<Pred> > >
409 inline void erase( Pred predicate );
411 template<
typename Pred >
438 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
439 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
504 template<
typename Type
520 template<
typename Type
536 template<
typename Type
553 template<
typename Type
572 template<
typename Type
590 template<
typename Type
611 template<
typename Type
613 template<
typename VT >
631 template<
typename Type
633 template<
typename VT >
657 template<
typename Type
685 template<
typename Type
703 template<
typename Type
712 if( pos ==
end_ || pos->index_ != index )
732 template<
typename Type
737 if( index >=
size_ ) {
740 return (*
this)[index];
757 template<
typename Type
762 if( index >=
size_ ) {
765 return (*
this)[index];
775 template<
typename Type
789 template<
typename Type
804 template<
typename Type
819 template<
typename Type
833 template<
typename Type
848 template<
typename Type
875 template<
typename Type
880 if( &rhs ==
this )
return *
this;
882 const size_t nonzeros( rhs.
nonZeros() );
885 Iterator newBegin( allocate<Element>( nonzeros ) );
909 template<
typename Type
923 rhs.begin_ =
nullptr;
940 template<
typename Type
942 template<
typename VT >
972 template<
typename Type
974 template<
typename VT >
1005 template<
typename Type
1007 template<
typename VT >
1010 using blaze::addAssign;
1033 template<
typename Type
1035 template<
typename VT >
1038 using blaze::subAssign;
1062 template<
typename Type
1064 template<
typename VT >
1068 using blaze::multAssign;
1099 template<
typename Type
1101 template<
typename VT >
1127 template<
typename Type
1129 template<
typename VT >
1132 using blaze::divAssign;
1163 template<
typename Type
1165 template<
typename VT >
1168 using blaze::assign;
1176 if(
size_ != 3UL || (~rhs).
size() != 3UL ) {
1180 const CrossType tmp( *
this % (~rhs) );
1200 template<
typename Type
1202 template<
typename Other >
1207 element->value_ *= rhs;
1225 template<
typename Type
1227 template<
typename Other >
1239 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1241 element->value_ *= tmp;
1245 element->value_ /= rhs;
1266 template<
typename Type
1280 template<
typename Type
1297 template<
typename Type
1311 template<
typename Type
1327 template<
typename Type
1351 template<
typename Type
1376 template<
typename Type
1381 const size_t newCapacity( n );
1384 Iterator newBegin = allocate<Element>( newCapacity );
1405 template<
typename Type
1422 template<
typename Type
1442 template<
typename Type
1450 nonzeros =
max( nonzeros, 7UL );
1468 template<
typename Type
1473 return static_cast<Iterator>( it );
1486 template<
typename Type
1515 template<
typename Type
1524 if( pos !=
end_ && pos->index_ == index ) {
1525 pos->value() = value;
1528 else return insert( pos, index, value );
1545 template<
typename Type
1554 if( pos !=
end_ && pos->index_ == index ) {
1558 return insert( pos, index, value );
1572 template<
typename Type
1579 pos->value_ = value;
1580 pos->index_ = index;
1588 Iterator newBegin = allocate<Element>( newCapacity );
1590 tmp->value_ = value;
1591 tmp->index_ = index;
1628 template<
typename Type
1636 end_->value_ = value;
1638 if( !check || !isDefault<strict>(
end_->value_ ) ) {
1639 end_->index_ = index;
1662 template<
typename Type
1683 template<
typename Type
1706 template<
typename Type
1743 template<
typename Type
1745 template<
typename Pred
1750 [predicate=predicate](
const ElementBase& element ) {
1751 return predicate( element.
value() );
1780 template<
typename Type
1782 template<
typename Pred >
1789 const auto pos = std::remove_if(
castUp( first ),
castUp( last ),
1790 [predicate=predicate](
const ElementBase& element ) {
1791 return predicate( element.
value() );
1820 template<
typename Type
1824 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1842 template<
typename Type
1847 if( pos !=
end_ && pos->index_ == index )
1866 template<
typename Type
1888 template<
typename Type
1893 return std::lower_bound(
begin_,
end_, index,
1894 [](
const Element& element,
size_t i )
1896 return element.index() < i;
1914 template<
typename Type
1936 template<
typename Type
1941 return std::upper_bound(
begin_,
end_, index,
1942 [](
size_t i,
const Element& element )
1944 return i < element.index();
1975 template<
typename Type
1977 template<
typename Other >
1981 element->value_ *= scalar;
2005 template<
typename Type
2007 template<
typename Other >
2010 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2025 template<
typename Type
2027 template<
typename Other >
2030 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2045 template<
typename Type
2065 template<
typename Type
2067 template<
typename VT >
2073 size_t nonzeros( 0UL );
2075 for(
size_t i=0UL; i<
size_; ++i )
2080 end_->value_ = (~rhs)[i];
2082 if( !isDefault<strict>(
end_->value_ ) ) {
2103 template<
typename Type
2105 template<
typename VT >
2118 append( element->index(), element->value() );
2134 template<
typename Type
2136 template<
typename VT >
2147 const AddType tmp(
serial( *
this + (~rhs) ) );
2165 template<
typename Type
2167 template<
typename VT >
2189 template<
typename Type
2191 template<
typename VT >
2202 const SubType tmp(
serial( *
this - (~rhs) ) );
2220 template<
typename Type
2222 template<
typename VT >
2244 template<
typename Type
2246 template<
typename VT >
2254 element->value_ *= (~rhs)[element->index_];
2271 template<
typename Type
2273 template<
typename VT >
2281 element->value_ /= (~rhs)[element->index_];
2298 template<
typename Type,
bool TF >
2301 template<
typename Type,
bool TF >
2304 template<
bool RF,
typename Type,
bool TF >
2307 template<
typename Type,
bool TF >
2310 template<
typename Type,
bool TF >
2323 template<
typename Type
2339 template<
typename Type
2377 return ( v.
size() == 0UL );
2400 template<
typename Type
2417 template<
typename Type
2436 template<
typename T,
bool TF >
2454 template<
typename T,
bool TF >
2472 template<
typename T1,
bool TF,
typename T2,
size_t N >
2473 struct AddTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2478 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2479 struct AddTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2484 template<
typename T1,
bool TF,
typename T2,
size_t N >
2485 struct AddTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2490 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2491 struct AddTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2496 template<
typename T1,
bool TF,
typename T2 >
2497 struct AddTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2502 template<
typename T1,
bool TF,
typename T2 >
2503 struct AddTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2508 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2509 struct AddTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2514 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2515 struct AddTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2520 template<
typename T1,
bool TF,
typename T2 >
2521 struct AddTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2539 template<
typename T1,
bool TF,
typename T2,
size_t N >
2540 struct SubTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2545 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2546 struct SubTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2551 template<
typename T1,
bool TF,
typename T2,
size_t N >
2552 struct SubTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2557 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2558 struct SubTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2563 template<
typename T1,
bool TF,
typename T2 >
2564 struct SubTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2569 template<
typename T1,
bool TF,
typename T2 >
2570 struct SubTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2575 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2576 struct SubTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2581 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2582 struct SubTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2587 template<
typename T1,
bool TF,
typename T2 >
2588 struct SubTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2606 template<
typename T1,
bool TF,
typename T2 >
2607 struct MultTrait< CompressedVector<T1,TF>, T2, EnableIf_< IsNumeric<T2> > >
2612 template<
typename T1,
typename T2,
bool TF >
2613 struct MultTrait< T1, CompressedVector<T2,TF>, EnableIf_< IsNumeric<T1> > >
2618 template<
typename T1,
bool TF,
typename T2,
size_t N >
2619 struct MultTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2624 template<
typename T1,
typename T2,
size_t N >
2625 struct MultTrait< CompressedVector<T1,false>, StaticVector<T2,N,true> >
2630 template<
typename T1,
typename T2,
size_t N >
2631 struct MultTrait< CompressedVector<T1,true>, StaticVector<T2,N,false> >
2636 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2637 struct MultTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2642 template<
typename T1,
size_t N,
typename T2 >
2643 struct MultTrait< StaticVector<T1,N,false>, CompressedVector<T2,true> >
2648 template<
typename T1,
size_t N,
typename T2 >
2649 struct MultTrait< StaticVector<T1,N,true>, CompressedVector<T2,false> >
2654 template<
typename T1,
bool TF,
typename T2,
size_t N >
2655 struct MultTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2660 template<
typename T1,
typename T2,
size_t N >
2661 struct MultTrait< CompressedVector<T1,false>, HybridVector<T2,N,true> >
2666 template<
typename T1,
typename T2,
size_t N >
2667 struct MultTrait< CompressedVector<T1,true>, HybridVector<T2,N,false> >
2672 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2673 struct MultTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2678 template<
typename T1,
size_t N,
typename T2 >
2679 struct MultTrait< HybridVector<T1,N,false>, CompressedVector<T2,true> >
2684 template<
typename T1,
size_t N,
typename T2 >
2685 struct MultTrait< HybridVector<T1,N,true>, CompressedVector<T2,false> >
2690 template<
typename T1,
bool TF,
typename T2 >
2691 struct MultTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2696 template<
typename T1,
typename T2 >
2697 struct MultTrait< CompressedVector<T1,false>, DynamicVector<T2,true> >
2702 template<
typename T1,
typename T2 >
2703 struct MultTrait< CompressedVector<T1,true>, DynamicVector<T2,false> >
2708 template<
typename T1,
bool TF,
typename T2 >
2709 struct MultTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2714 template<
typename T1,
typename T2 >
2715 struct MultTrait< DynamicVector<T1,false>, CompressedVector<T2,true> >
2720 template<
typename T1,
typename T2 >
2721 struct MultTrait< DynamicVector<T1,true>, CompressedVector<T2,false> >
2726 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2727 struct MultTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2732 template<
typename T1,
typename T2,
bool AF,
bool PF >
2733 struct MultTrait< CompressedVector<T1,false>, CustomVector<T2,AF,PF,true> >
2738 template<
typename T1,
typename T2,
bool AF,
bool PF >
2739 struct MultTrait< CompressedVector<T1,true>, CustomVector<T2,AF,PF,false> >
2744 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2745 struct MultTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2750 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2751 struct MultTrait< CustomVector<T1,AF,PF,false>, CompressedVector<T2,true> >
2756 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2757 struct MultTrait< CustomVector<T1,AF,PF,true>, CompressedVector<T2,false> >
2762 template<
typename T1,
bool TF,
typename T2 >
2763 struct MultTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2768 template<
typename T1,
typename T2 >
2769 struct MultTrait< CompressedVector<T1,false>, CompressedVector<T2,true> >
2774 template<
typename T1,
typename T2 >
2775 struct MultTrait< CompressedVector<T1,true>, CompressedVector<T2,false> >
2793 template<
typename T1,
bool TF,
typename T2 >
2794 struct DivTrait< CompressedVector<T1,TF>, T2, EnableIf_< IsNumeric<T2> > >
2799 template<
typename T1,
bool TF,
typename T2,
size_t N >
2800 struct DivTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2805 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2806 struct DivTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2811 template<
typename T1,
bool TF,
typename T2,
size_t N >
2812 struct DivTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2817 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2818 struct DivTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2823 template<
typename T1,
bool TF,
typename T2 >
2824 struct DivTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2829 template<
typename T1,
bool TF,
typename T2 >
2830 struct DivTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2835 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2836 struct DivTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2841 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2842 struct DivTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2847 template<
typename T1,
bool TF,
typename T2 >
2848 struct DivTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2866 template<
typename T1,
bool TF,
typename T2 >
2867 struct CrossTrait< CompressedVector<T1,TF>, StaticVector<T2,3UL,TF> >
2876 template<
typename T1,
bool TF,
typename T2 >
2877 struct CrossTrait< StaticVector<T1,3UL,TF>, CompressedVector<T2,TF> >
2886 template<
typename T1,
bool TF,
typename T2,
size_t N >
2887 struct CrossTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2896 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2897 struct CrossTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2906 template<
typename T1,
bool TF,
typename T2 >
2907 struct CrossTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2916 template<
typename T1,
bool TF,
typename T2 >
2917 struct CrossTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2926 template<
typename T1,
bool TF,
typename T2 >
2927 struct CrossTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2949 template<
typename T,
bool TF,
typename OP >
2968 template<
typename T1,
bool TF,
typename T2 >
2969 struct HighType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2987 template<
typename T1,
bool TF,
typename T2 >
2988 struct LowType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
3006 template<
typename T,
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.
Headerfile for the generic min algorithm.
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
#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:2068
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1917
Resize mechanism to obtain a CompressedVector with a different fixed number of elements.
Definition: CompressedVector.h:305
Header file for the serial shim.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:216
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:1411
Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elem...
Definition: VectorAccessProxy.h:101
Header file for the IsIntegral type trait.
IteratorBase castUp(Iterator it) const noexcept
Performs an up-cast of the given iterator.
Definition: CompressedVector.h:1489
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
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:2137
#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:1329
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:183
Header file for memory allocation and deallocation functionality.
size_t size_
The current size/dimension of the compressed vector.
Definition: CompressedVector.h:474
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:1393
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:688
Constraint on the data type.
Base template for the CrossTrait class.
Definition: CrossTrait.h:116
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:61
VectorAccessProxy< This > Reference
Reference to a non-constant vector value.
Definition: CompressedVector.h:286
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:155
Type ElementType
Type of the compressed vector elements.
Definition: CompressedVector.h:283
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Headerfile for the generic max algorithm.
Header file for the ValueIndexPair class.
Rebind mechanism to obtain a CompressedVector with different data/element type.
Definition: CompressedVector.h:296
CompressedVector() noexcept
The default constructor for CompressedVector.
Definition: CompressedVector.h:522
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:1518
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:2192
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1630
Header file for the multiplication trait.
Header file for the unary map trait.
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:5924
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
Header file for the IsShrinkable type trait.
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:1548
#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:476
#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:1268
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:284
#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 Not class template.
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: CompressedVector.h:1407
Header file for the subvector trait.
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:1299
Iterator castDown(IteratorBase it) const noexcept
Performs a down-cast of the given iterator.
Definition: CompressedVector.h:1471
Constraint on the data type.
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
typename CrossTrait< T1, T2 >::Type CrossTrait_
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_ alias declaration provi...
Definition: CrossTrait.h:159
Constraint on the data type.
Header file for the EnableIf class template.
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:475
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1664
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:250
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1869
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1822
Compile time check for shrinkable data types.This type trait tests whether the given data type is a s...
Definition: IsShrinkable.h:75
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:1313
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:1353
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:289
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:1357
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:139
Header file for the relaxation flag types.
Base template for the MultTrait class.
Definition: MultTrait.h:139
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:154
size_t extendCapacity() const noexcept
Calculating a new vector capacity.
Definition: CompressedVector.h:1444
Reference at(size_t index)
Checked access to the compressed vector elements.
Definition: CompressedVector.h:735
Headerfile for the generic transfer algorithm.
#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.
Header file for the isDefault shim.
Constraint on the data type.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:288
#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:2247
void divAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the division assignment of a dense vector.
Definition: CompressedVector.h:2274
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:230
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: CompressedVector.h:2028
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Base template for the DivTrait class.
Definition: DivTrait.h:139
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:287
void swap(CompressedVector &sv) noexcept
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1424
ConstIterator cbegin() const noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:807
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:821
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:177
Header file for the default transpose flag for all vectors of the Blaze library.
~CompressedVector()
The destructor for CompressedVector.
Definition: CompressedVector.h:659
CompressedVector & operator=(const CompressedVector &rhs)
Copy assignment operator for CompressedVector.
Definition: CompressedVector.h:878
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:250
size_t capacity() const noexcept
Returns the maximum capacity of the compressed vector.
Definition: CompressedVector.h:1282
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
Iterator end_
Pointer one past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:477
Compile time type check.This class tests whether the given template parameter T is an rvalue referenc...
Definition: IsRValueReference.h:77
CompressedVector< Type, TF > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:279
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
ConstIterator cend() const noexcept
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:851
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
Base template for the SubTrait class.
Definition: SubTrait.h:139
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:1375
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Transfer.h:70
Iterator begin() noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:777
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:479
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:2008
Header file for the IsResizable type trait.
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:2047
Base template for the UnaryMapTrait class.
Definition: UnaryMapTrait.h:117
#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:250
#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:197
Reference value()
Access to the current value of the value-index-pair.
Definition: ValueIndexPair.h:362
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1378
Header file for the HighType type trait.