35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 197 template<
typename Type
198 ,
bool TF = defaultTransposeFlag >
219 explicit Element() =
default;
220 Element(
const Element& rhs ) =
default;
221 Element( Element&& rhs ) =
default;
225 inline Element&
operator=(
const Element& rhs )
227 this->value_ = rhs.value_;
231 inline Element&
operator=( Element&& rhs )
233 this->value_ = std::move( rhs.value_ );
237 template<
typename Other >
241 this->value_ = rhs.value();
245 template<
typename Other >
250 this->value_ = std::move( rhs.value() );
254 template<
typename Other >
262 template<
typename Other >
264 , IsRValueReference<Other&&> >, Element& >
267 this->value_ = std::move( v );
297 template<
typename NewType >
306 template<
size_t NewN >
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
579 template<
typename Type
586 for(
const Type& element : list ) {
587 if( !isDefault<strict>( element ) )
603 template<
typename Type
619 template<
typename Type
640 template<
typename Type
642 template<
typename VT >
658 template<
typename Type
660 template<
typename VT >
682 template<
typename Type
710 template<
typename Type
728 template<
typename Type
737 if( pos ==
end_ || pos->index_ != index )
757 template<
typename Type
762 if( index >=
size_ ) {
765 return (*
this)[index];
782 template<
typename Type
787 if( index >=
size_ ) {
790 return (*
this)[index];
800 template<
typename Type
814 template<
typename Type
829 template<
typename Type
844 template<
typename Type
858 template<
typename Type
873 template<
typename Type
907 template<
typename Type
914 resize( list.size(), false );
919 for(
const Type& element : list ) {
920 if( !isDefault<strict>( element ) )
939 template<
typename Type
946 if( &rhs ==
this )
return *
this;
948 const size_t nonzeros( rhs.
nonZeros() );
951 Iterator newBegin( allocate<Element>( nonzeros ) );
975 template<
typename Type
989 rhs.begin_ =
nullptr;
1006 template<
typename Type
1008 template<
typename VT >
1012 using blaze::assign;
1038 template<
typename Type
1040 template<
typename VT >
1044 using blaze::assign;
1071 template<
typename Type
1073 template<
typename VT >
1076 using blaze::addAssign;
1099 template<
typename Type
1101 template<
typename VT >
1104 using blaze::subAssign;
1128 template<
typename Type
1130 template<
typename VT >
1134 using blaze::multAssign;
1165 template<
typename Type
1167 template<
typename VT >
1193 template<
typename Type
1195 template<
typename VT >
1198 using blaze::divAssign;
1229 template<
typename Type
1231 template<
typename VT >
1234 using blaze::assign;
1242 if(
size_ != 3UL || (~rhs).
size() != 3UL ) {
1246 const CrossType tmp( *
this % (~rhs) );
1268 template<
typename Type
1282 template<
typename Type
1299 template<
typename Type
1313 template<
typename Type
1329 template<
typename Type
1353 template<
typename Type
1378 template<
typename Type
1385 const size_t newCapacity( n );
1388 Iterator newBegin = allocate<Element>( newCapacity );
1409 template<
typename Type
1426 template<
typename Type
1448 template<
typename Type
1456 nonzeros =
max( nonzeros, 7UL );
1474 template<
typename Type
1479 return static_cast<Iterator>( it );
1492 template<
typename Type
1521 template<
typename Type
1530 if( pos !=
end_ && pos->index_ == index ) {
1531 pos->value() = value;
1534 else return insert( pos, index, value );
1551 template<
typename Type
1560 if( pos !=
end_ && pos->index_ == index ) {
1564 return insert( pos, index, value );
1578 template<
typename Type
1587 pos->value_ = value;
1588 pos->index_ = index;
1596 Iterator newBegin = allocate<Element>( newCapacity );
1598 tmp->value_ = value;
1599 tmp->index_ = index;
1636 template<
typename Type
1644 end_->value_ = value;
1646 if( !check || !isDefault<strict>(
end_->value_ ) ) {
1647 end_->index_ = index;
1670 template<
typename Type
1691 template<
typename Type
1714 template<
typename Type
1751 template<
typename Type
1753 template<
typename Pred
1758 [predicate=predicate](
const ElementBase& element ) {
1759 return predicate( element.
value() );
1788 template<
typename Type
1790 template<
typename Pred >
1797 const auto pos = std::remove_if(
castUp( first ),
castUp( last ),
1798 [predicate=predicate](
const ElementBase& element ) {
1799 return predicate( element.
value() );
1828 template<
typename Type
1832 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1850 template<
typename Type
1855 if( pos !=
end_ && pos->index_ == index )
1874 template<
typename Type
1896 template<
typename Type
1901 return std::lower_bound(
begin_,
end_, index,
1902 [](
const Element& element,
size_t i )
1904 return element.index() < i;
1922 template<
typename Type
1944 template<
typename Type
1949 return std::upper_bound(
begin_,
end_, index,
1950 [](
size_t i,
const Element& element )
1952 return i < element.index();
1983 template<
typename Type
1985 template<
typename Other >
1989 element->value_ *= scalar;
2013 template<
typename Type
2015 template<
typename Other >
2018 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2033 template<
typename Type
2035 template<
typename Other >
2038 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2053 template<
typename Type
2073 template<
typename Type
2075 template<
typename VT >
2081 size_t nonzeros( 0UL );
2083 for(
size_t i=0UL; i<
size_; ++i )
2088 end_->value_ = (~rhs)[i];
2090 if( !isDefault<strict>(
end_->value_ ) ) {
2111 template<
typename Type
2113 template<
typename VT >
2126 append( element->index(), element->value() );
2142 template<
typename Type
2144 template<
typename VT >
2155 const AddType tmp(
serial( *
this + (~rhs) ) );
2173 template<
typename Type
2175 template<
typename VT >
2197 template<
typename Type
2199 template<
typename VT >
2210 const SubType tmp(
serial( *
this - (~rhs) ) );
2228 template<
typename Type
2230 template<
typename VT >
2252 template<
typename Type
2254 template<
typename VT >
2262 element->value_ *= (~rhs)[element->index_];
2279 template<
typename Type
2281 template<
typename VT >
2289 element->value_ /= (~rhs)[element->index_];
2306 template<
typename Type,
bool TF >
2309 template<
typename Type,
bool TF >
2312 template<
bool RF,
typename Type,
bool TF >
2315 template<
typename Type,
bool TF >
2318 template<
typename Type,
bool TF >
2331 template<
typename Type
2347 template<
typename Type
2385 return ( v.
size() == 0UL );
2408 template<
typename Type
2425 template<
typename Type
2444 template<
typename T,
bool TF >
2462 template<
typename T,
bool TF >
2480 template<
typename T1,
bool TF,
typename T2,
size_t N >
2481 struct AddTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2486 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2487 struct AddTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2492 template<
typename T1,
bool TF,
typename T2,
size_t N >
2493 struct AddTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2498 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2499 struct AddTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2504 template<
typename T1,
bool TF,
typename T2 >
2505 struct AddTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2510 template<
typename T1,
bool TF,
typename T2 >
2511 struct AddTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2516 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2517 struct AddTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2522 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2523 struct AddTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2528 template<
typename T1,
bool TF,
typename T2 >
2529 struct AddTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2547 template<
typename T1,
bool TF,
typename T2,
size_t N >
2548 struct SubTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2553 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2554 struct SubTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2559 template<
typename T1,
bool TF,
typename T2,
size_t N >
2560 struct SubTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2565 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2566 struct SubTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2571 template<
typename T1,
bool TF,
typename T2 >
2572 struct SubTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2577 template<
typename T1,
bool TF,
typename T2 >
2578 struct SubTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2583 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2584 struct SubTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2589 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2590 struct SubTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2595 template<
typename T1,
bool TF,
typename T2 >
2596 struct SubTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2614 template<
typename T1,
bool TF,
typename T2 >
2615 struct MultTrait< CompressedVector<T1,TF>, T2, EnableIf_< IsNumeric<T2> > >
2620 template<
typename T1,
typename T2,
bool TF >
2621 struct MultTrait< T1, CompressedVector<T2,TF>, EnableIf_< IsNumeric<T1> > >
2626 template<
typename T1,
bool TF,
typename T2,
size_t N >
2627 struct MultTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2632 template<
typename T1,
typename T2,
size_t N >
2633 struct MultTrait< CompressedVector<T1,false>, StaticVector<T2,N,true> >
2638 template<
typename T1,
typename T2,
size_t N >
2639 struct MultTrait< CompressedVector<T1,true>, StaticVector<T2,N,false> >
2644 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2645 struct MultTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2650 template<
typename T1,
size_t N,
typename T2 >
2651 struct MultTrait< StaticVector<T1,N,false>, CompressedVector<T2,true> >
2656 template<
typename T1,
size_t N,
typename T2 >
2657 struct MultTrait< StaticVector<T1,N,true>, CompressedVector<T2,false> >
2662 template<
typename T1,
bool TF,
typename T2,
size_t N >
2663 struct MultTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2668 template<
typename T1,
typename T2,
size_t N >
2669 struct MultTrait< CompressedVector<T1,false>, HybridVector<T2,N,true> >
2674 template<
typename T1,
typename T2,
size_t N >
2675 struct MultTrait< CompressedVector<T1,true>, HybridVector<T2,N,false> >
2680 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2681 struct MultTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2686 template<
typename T1,
size_t N,
typename T2 >
2687 struct MultTrait< HybridVector<T1,N,false>, CompressedVector<T2,true> >
2692 template<
typename T1,
size_t N,
typename T2 >
2693 struct MultTrait< HybridVector<T1,N,true>, CompressedVector<T2,false> >
2698 template<
typename T1,
bool TF,
typename T2 >
2699 struct MultTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2704 template<
typename T1,
typename T2 >
2705 struct MultTrait< CompressedVector<T1,false>, DynamicVector<T2,true> >
2710 template<
typename T1,
typename T2 >
2711 struct MultTrait< CompressedVector<T1,true>, DynamicVector<T2,false> >
2716 template<
typename T1,
bool TF,
typename T2 >
2717 struct MultTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2722 template<
typename T1,
typename T2 >
2723 struct MultTrait< DynamicVector<T1,false>, CompressedVector<T2,true> >
2728 template<
typename T1,
typename T2 >
2729 struct MultTrait< DynamicVector<T1,true>, CompressedVector<T2,false> >
2734 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2735 struct MultTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2740 template<
typename T1,
typename T2,
bool AF,
bool PF >
2741 struct MultTrait< CompressedVector<T1,false>, CustomVector<T2,AF,PF,true> >
2746 template<
typename T1,
typename T2,
bool AF,
bool PF >
2747 struct MultTrait< CompressedVector<T1,true>, CustomVector<T2,AF,PF,false> >
2752 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2753 struct MultTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2758 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2759 struct MultTrait< CustomVector<T1,AF,PF,false>, CompressedVector<T2,true> >
2764 template<
typename T1,
bool AF,
bool PF,
typename T2 >
2765 struct MultTrait< CustomVector<T1,AF,PF,true>, CompressedVector<T2,false> >
2770 template<
typename T1,
bool TF,
typename T2 >
2771 struct MultTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2776 template<
typename T1,
typename T2 >
2777 struct MultTrait< CompressedVector<T1,false>, CompressedVector<T2,true> >
2782 template<
typename T1,
typename T2 >
2783 struct MultTrait< CompressedVector<T1,true>, CompressedVector<T2,false> >
2801 template<
typename T1,
bool TF,
typename T2 >
2802 struct DivTrait< CompressedVector<T1,TF>, T2, EnableIf_< IsNumeric<T2> > >
2807 template<
typename T1,
bool TF,
typename T2,
size_t N >
2808 struct DivTrait< CompressedVector<T1,TF>, StaticVector<T2,N,TF> >
2813 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2814 struct DivTrait< StaticVector<T1,N,TF>, CompressedVector<T2,TF> >
2819 template<
typename T1,
bool TF,
typename T2,
size_t N >
2820 struct DivTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2825 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2826 struct DivTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2831 template<
typename T1,
bool TF,
typename T2 >
2832 struct DivTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2837 template<
typename T1,
bool TF,
typename T2 >
2838 struct DivTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2843 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
2844 struct DivTrait< CompressedVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
2849 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
2850 struct DivTrait< CustomVector<T1,AF,PF,TF>, CompressedVector<T2,TF> >
2855 template<
typename T1,
bool TF,
typename T2 >
2856 struct DivTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2874 template<
typename T1,
bool TF,
typename T2 >
2875 struct CrossTrait< CompressedVector<T1,TF>, StaticVector<T2,3UL,TF> >
2884 template<
typename T1,
bool TF,
typename T2 >
2885 struct CrossTrait< StaticVector<T1,3UL,TF>, CompressedVector<T2,TF> >
2894 template<
typename T1,
bool TF,
typename T2,
size_t N >
2895 struct CrossTrait< CompressedVector<T1,TF>, HybridVector<T2,N,TF> >
2904 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2905 struct CrossTrait< HybridVector<T1,N,TF>, CompressedVector<T2,TF> >
2914 template<
typename T1,
bool TF,
typename T2 >
2915 struct CrossTrait< CompressedVector<T1,TF>, DynamicVector<T2,TF> >
2924 template<
typename T1,
bool TF,
typename T2 >
2925 struct CrossTrait< DynamicVector<T1,TF>, CompressedVector<T2,TF> >
2934 template<
typename T1,
bool TF,
typename T2 >
2935 struct CrossTrait< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2957 template<
typename T,
bool TF,
typename OP >
2976 template<
typename T1,
bool TF,
typename T2 >
2977 struct HighType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2995 template<
typename T1,
bool TF,
typename T2 >
2996 struct LowType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
3014 template<
typename T,
bool TF,
size_t... CSAs >
3033 template<
typename T,
bool TF,
size_t... CEAs >
#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.
#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:2076
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1925
Resize mechanism to obtain a CompressedVector with a different fixed number of elements.
Definition: CompressedVector.h:307
Header file for the serial shim.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:221
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
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:1495
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:1903
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:2145
#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:1331
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
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:560
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:185
Header file for memory allocation and deallocation functionality.
Header file for the extended initializer_list functionality.
size_t size_
The current size/dimension of the compressed vector.
Definition: CompressedVector.h:474
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
Header file for the elements trait.
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:713
Constraint on the data type.
Base template for the CrossTrait class.
Definition: CrossTrait.h:113
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:288
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:109
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:285
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:298
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:1524
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:2200
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1638
Header file for the multiplication trait.
Header file for the unary map trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
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:1554
#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:1270
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:286
#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:1411
Header file for the subvector trait.
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:1301
Iterator castDown(IteratorBase it) const noexcept
Performs a down-cast of the given iterator.
Definition: CompressedVector.h:1477
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:76
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 data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:123
Base template for the ElementsTrait class.
Definition: ElementsTrait.h:108
typename CrossTrait< T1, T2 >::Type CrossTrait_
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_ alias declaration provi...
Definition: CrossTrait.h:209
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:1672
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1877
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1830
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:1315
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:1355
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:291
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:119
Header file for the relaxation flag types.
CompressedVector & operator=(initializer_list< Type > list)
List assignment to all vector elements.
Definition: CompressedVector.h:910
Base template for the MultTrait class.
Definition: MultTrait.h:119
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Constraint on the data type.
size_t extendCapacity() const noexcept
Calculating a new vector capacity.
Definition: CompressedVector.h:1450
Reference at(size_t index)
Checked access to the compressed vector elements.
Definition: CompressedVector.h:760
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:816
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:290
#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:2255
void divAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the division assignment of a dense vector.
Definition: CompressedVector.h:2282
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:2036
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:120
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:289
void swap(CompressedVector &sv) noexcept
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1428
ConstIterator cbegin() const noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:832
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
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
Iterator end() noexcept
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:846
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:684
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:291
size_t capacity() const noexcept
Returns the maximum capacity of the compressed vector.
Definition: CompressedVector.h:1284
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:281
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
ConstIterator cend() const noexcept
Returns an iterator just past the last non-zero element of the compressed vector. ...
Definition: CompressedVector.h:876
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
Base template for the SubTrait class.
Definition: SubTrait.h:119
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:802
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
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:2016
Header file for the IsResizable type trait.
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:2055
Base template for the UnaryMapTrait class.
Definition: UnaryMapTrait.h:95
#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:291
#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:199
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:1380
Header file for the HighType type trait.