35#ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
36#define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_
215template<
typename Type
219 :
public SparseVector< CompressedVector<Type,TF,Tag>, TF >
239 Element(
const Element& rhs ) =
default;
240 Element( Element&& rhs ) =
default;
244 inline Element&
operator=(
const Element& rhs )
246 this->value_ = rhs.value_;
250 inline Element&
operator=( Element&& rhs )
252 this->value_ = std::move( rhs.value_ );
256 template<
typename Other >
257 inline auto operator=(
const Other& rhs )
260 this->value_ = rhs.value();
264 template<
typename Other >
267 IsRValueReference_v<Other&&>, Element& >
269 this->value_ = std::move( rhs.value() );
273 template<
typename Other >
281 template<
typename Other >
284 IsRValueReference_v<Other&&>, Element& >
286 this->value_ = std::move( v );
321 template<
typename NewType >
330 template<
size_t NewN >
370 inline
Reference operator[](
size_t index ) noexcept;
404 inline
size_t size() const noexcept;
405 inline
size_t capacity() const noexcept;
409 inline
void resize(
size_t n,
bool preserve=true );
419 inline
Iterator set (
size_t index, const Type& value );
421 inline
void append(
size_t index, const Type& value,
bool check=false );
428 inline
void erase(
size_t index );
433 inline
void erase( Pred predicate );
435 template< typename Pred >
455 template< typename Other > inline
CompressedVector& scale( const Other& scalar );
462 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
463 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
528template< typename Type
545template<
typename Type
562template<
typename Type
580template<
typename Type
607template<
typename Type
615 for(
const Type& element : list ) {
616 if( !isDefault<strict>( element ) )
632template<
typename Type
649template<
typename Type
654 , capacity_( sv.capacity_ )
655 , begin_ ( sv.begin_ )
671template<
typename Type
674template<
typename VT >
692template<
typename Type
695template<
typename VT >
719template<
typename Type
748template<
typename Type
767template<
typename Type
777 if( pos == end_ || pos->index_ != index )
797template<
typename Type
803 if( index >= size_ ) {
806 return (*
this)[index];
821template<
typename Type
827 if( index >= size_ ) {
830 return (*
this)[index];
840template<
typename Type
856template<
typename Type
872template<
typename Type
888template<
typename Type
904template<
typename Type
920template<
typename Type
955template<
typename Type
963 resize( list.size(),
false );
968 for(
const Type& element : list ) {
969 if( !isDefault<strict>( element ) )
970 append( i, element );
988template<
typename Type
996 if( &rhs ==
this )
return *
this;
998 const size_t nonzeros( rhs.nonZeros() );
1000 if( nonzeros > capacity_ ) {
1001 Iterator newBegin( allocate<Element>( nonzeros ) );
1002 end_ = castDown( std::copy( rhs.begin_, rhs.end_, castUp( newBegin ) ) );
1003 swap( begin_, newBegin );
1007 capacity_ = nonzeros;
1010 end_ = castDown( std::copy( rhs.begin_, rhs.end_, castUp( begin_ ) ) );
1025template<
typename Type
1034 capacity_ = rhs.capacity_;
1035 begin_ = rhs.begin_;
1039 rhs.capacity_ = 0UL;
1040 rhs.begin_ =
nullptr;
1057template<
typename Type
1060template<
typename VT >
1061inline CompressedVector<Type,TF,Tag>&
1064 using blaze::assign;
1068 if( (*rhs).canAlias(
this ) ) {
1073 size_ = (*rhs).size();
1075 assign( *
this, *rhs );
1092template<
typename Type
1095template<
typename VT >
1099 using blaze::assign;
1103 if( (*rhs).canAlias(
this ) || (*rhs).nonZeros() > capacity_ ) {
1108 size_ = (*rhs).size();
1111 if( !IsZero_v<VT> ) {
1112 assign( *
this, *rhs );
1131template<
typename Type
1134template<
typename VT >
1138 using blaze::addAssign;
1142 if( (*rhs).size() != size_ ) {
1146 if( !IsZero_v<VT> ) {
1147 addAssign( *
this, *rhs );
1165template<
typename Type
1168template<
typename VT >
1172 using blaze::subAssign;
1176 if( (*rhs).size() != size_ ) {
1180 if( !IsZero_v<VT> ) {
1181 subAssign( *
this, *rhs );
1200template<
typename Type
1203template<
typename VT >
1207 using blaze::multAssign;
1211 if( (*rhs).size() != size_ ) {
1215 if( (*rhs).canAlias(
this ) ) {
1221 multAssign( *
this, tmp );
1240template<
typename Type
1243template<
typename VT >
1249 if( (*rhs).size() != size_ ) {
1253 if( !IsZero_v<VT> ) {
1276template<
typename Type
1279template<
typename VT >
1283 using blaze::divAssign;
1287 if( (*rhs).size() != size_ ) {
1291 if( (*rhs).canAlias(
this ) ) {
1297 divAssign( *
this, tmp );
1316template<
typename Type
1319template<
typename VT >
1323 using blaze::assign;
1336 if( size_ != 3UL || (*rhs).size() != 3UL ) {
1340 if( !IsZero_v<VT> ) {
1341 const CrossType tmp( *
this % (*rhs) );
1343 assign( *
this, tmp );
1367template<
typename Type
1382template<
typename Type
1400template<
typename Type
1405 return end_ - begin_;
1415template<
typename Type
1432template<
typename Type
1457template<
typename Type
1483template<
typename Type
1490 if( n > capacity_ ) {
1491 const size_t newCapacity( n );
1494 Iterator newBegin = allocate<Element>( newCapacity );
1497 end_ = castDown(
transfer( begin_, end_, castUp( newBegin ) ) );
1498 swap( newBegin, begin_ );
1499 capacity_ = newCapacity;
1515template<
typename Type
1533template<
typename Type
1540 swap( size_, sv.size_ );
1541 swap( capacity_, sv.capacity_ );
1542 swap( begin_, sv.begin_ );
1543 swap( end_, sv.end_ );
1556template<
typename Type
1564 size_t nonzeros( 2UL*capacity_+1UL );
1565 nonzeros =
max( nonzeros, 7UL );
1566 nonzeros =
min( nonzeros, size_ );
1583template<
typename Type
1589 return static_cast<Iterator>( it );
1602template<
typename Type
1632template<
typename Type
1642 if( pos != end_ && pos->index_ == index ) {
1643 pos->value() = value;
1646 else return insert( pos, index, value );
1663template<
typename Type
1673 if( pos != end_ && pos->index_ == index ) {
1677 return insert( pos, index, value );
1691template<
typename Type
1700 std::move_backward( pos, end_, castUp( end_+1 ) );
1701 pos->value_ = value;
1702 pos->index_ = index;
1708 size_t newCapacity( extendCapacity() );
1710 Iterator newBegin = allocate<Element>( newCapacity );
1711 Iterator tmp = castDown( std::move( begin_, pos, castUp( newBegin ) ) );
1712 tmp->value_ = value;
1713 tmp->index_ = index;
1714 end_ = castDown( std::move( pos, end_, castUp( tmp+1 ) ) );
1716 swap( newBegin, begin_ );
1718 capacity_ = newCapacity;
1750template<
typename Type
1757 BLAZE_USER_ASSERT( begin_ == end_ || (end_-1UL)->index_ < index,
"Index is not strictly increasing" );
1759 end_->value_ = value;
1761 if( !check || !isDefault<strict>( end_->value_ ) ) {
1762 end_->index_ = index;
1785template<
typename Type
1794 end_ = castDown( std::move( pos+1, end_, castUp( pos ) ) );
1807template<
typename Type
1813 BLAZE_USER_ASSERT( pos >= begin_ && pos <= end_,
"Invalid compressed vector iterator" );
1816 end_ = castDown( std::move( pos+1, end_, castUp( pos ) ) );
1831template<
typename Type
1838 BLAZE_USER_ASSERT( first >= begin_ && first <= end_,
"Invalid compressed vector iterator" );
1839 BLAZE_USER_ASSERT( last >= begin_ && last <= end_,
"Invalid compressed vector iterator" );
1842 end_ = castDown( std::move( last, end_, castUp( first ) ) );
1869template<
typename Type
1872template<
typename Pred
1876 end_ = castDown( std::remove_if( castUp( begin_ ), castUp( end_ ),
1877 [predicate=predicate](
const ElementBase& element ) {
1878 return predicate( element.
value() );
1907template<
typename Type
1910template<
typename Pred >
1914 BLAZE_USER_ASSERT( first >= begin_ && first <= end_,
"Invalid compressed vector iterator" );
1915 BLAZE_USER_ASSERT( last >= begin_ && last <= end_,
"Invalid compressed vector iterator" );
1917 const auto pos = std::remove_if( castUp( first ), castUp( last ),
1918 [predicate=predicate](
const ElementBase& element ) {
1919 return predicate( element.
value() );
1922 end_ = castDown( std::move( last, end_, pos ) );
1948template<
typename Type
1954 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( index ) );
1972template<
typename Type
1979 if( pos != end_ && pos->index_ == index )
1998template<
typename Type
2021template<
typename Type
2027 return std::lower_bound( begin_, end_, index,
2028 [](
const Element& element,
size_t i )
2030 return element.index() < i;
2048template<
typename Type
2071template<
typename Type
2077 return std::upper_bound( begin_, end_, index,
2078 [](
size_t i,
const Element& element )
2080 return i < element.index();
2111template<
typename Type
2114template<
typename Other >
2117 for(
auto element=begin_; element!=end_; ++element )
2118 element->value_ *= scalar;
2142template<
typename Type
2145template<
typename Other >
2148 return static_cast<const void*
>( this ) ==
static_cast<const void*
>( alias );
2163template<
typename Type
2166template<
typename Other >
2169 return static_cast<const void*
>( this ) ==
static_cast<const void*
>( alias );
2184template<
typename Type
2205template<
typename Type
2208template<
typename VT >
2214 size_t nonzeros( 0UL );
2216 for(
size_t i=0UL; i<size_; ++i )
2218 if( nonzeros == capacity_ )
2219 reserve( extendCapacity() );
2221 end_->value_ = (*rhs)[i];
2223 if( !isDefault<strict>( end_->value_ ) ) {
2244template<
typename Type
2247template<
typename VT >
2259 for(
auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2260 append( element->index(), element->value() );
2276template<
typename Type
2279template<
typename VT >
2290 const AddType tmp(
serial( *
this + (*rhs) ) );
2308template<
typename Type
2311template<
typename VT >
2333template<
typename Type
2336template<
typename VT >
2347 const SubType tmp(
serial( *
this - (*rhs) ) );
2365template<
typename Type
2368template<
typename VT >
2390template<
typename Type
2393template<
typename VT >
2400 for(
auto element=begin_; element!=end_; ++element ) {
2401 element->value_ *= (*rhs)[element->index_];
2418template<
typename Type
2421template<
typename VT >
2428 for(
auto element=begin_; element!=end_; ++element ) {
2429 element->value_ /= (*rhs)[element->index_];
2446template< RelaxationFlag RF,
typename Type,
bool TF,
typename Tag >
2449template<
typename Type,
bool TF,
typename Tag >
2452template<
typename Type,
bool TF,
typename Tag >
2488 return ( v.
size() == 0UL );
2511template<
typename Type
2516 return ( v.nonZeros() <= v.capacity() );
2529template<
typename Type
2549template<
typename T1,
typename T2 >
2550struct AddTraitEval2< T1, T2
2553 using Type = CompressedVector< AddTrait_t< ElementType_t<T1>, ElementType_t<T2> >
2554 , TransposeFlag_v<T1>
2555 , AddTrait_t< TagType_t<T1>, TagType_t<T2> > >;
2571template<
typename T1,
typename T2 >
2572struct SubTraitEval2< T1, T2
2575 using Type = CompressedVector< SubTrait_t< ElementType_t<T1>, ElementType_t<T2> >
2576 , TransposeFlag_v<T1>
2577 , SubTrait_t< TagType_t<T1>, TagType_t<T2> > >;
2593template<
typename T1,
typename T2 >
2594struct MultTraitEval2< T1, T2
2597 using Type = CompressedVector< MultTrait_t< ElementType_t<T1>, T2 >
2598 , TransposeFlag_v<T1>
2599 , MultTrait_t< TagType_t<T1>, T2 > >;
2602template<
typename T1,
typename T2 >
2603struct MultTraitEval2< T1, T2
2606 using Type = CompressedVector< MultTrait_t< T1, ElementType_t<T2> >
2607 , TransposeFlag_v<T2>
2608 , MultTrait_t< T1, TagType_t<T2> > >;
2611template<
typename T1,
typename T2 >
2612struct MultTraitEval2< T1, T2
2614 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
2615 ( IsSparseVector_v<T1> || IsSparseVector_v<T2> ) > >
2617 using Type = CompressedVector< MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >
2618 , TransposeFlag_v<T1>
2619 , MultTrait_t< TagType_t<T1>, TagType_t<T2> > >;
2622template<
typename T1,
typename T2 >
2623struct MultTraitEval2< T1, T2
2625 IsSparseVector_v<T2> &&
2626 IsColumnVector_v<T2> > >
2628 using MultType = MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >;
2629 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
2631 using Type = CompressedVector< AddTrait_t<MultType,MultType>
2633 , AddTrait_t<MultTag,MultTag> >;
2636template<
typename T1,
typename T2 >
2637struct MultTraitEval2< T1, T2
2639 IsRowVector_v<T1> &&
2640 IsSparseMatrix_v<T2> > >
2642 using MultType = MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >;
2643 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
2645 using Type = CompressedVector< AddTrait_t<MultType,MultType>
2647 , AddTrait_t<MultTag,MultTag> >;
2663template<
typename T1
2665struct KronTraitEval2< T1, T2
2668 ( IsSparseVector_v<T1> || IsSparseVector_v<T2> ) > >
2670 using Type = CompressedVector< MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >
2671 , ( IsDenseVector_v<T2> ? TransposeFlag_v<T1> : TransposeFlag_v<T2> )
2688template<
typename T1,
typename T2 >
2689struct DivTraitEval2< T1, T2
2692 using Type = CompressedVector< DivTrait_t< ElementType_t<T1>, T2 >
2693 , TransposeFlag_v<T1>
2694 , DivTrait_t< TagType_t<T1>, T2 > >;
2697template<
typename T1,
typename T2 >
2698struct DivTraitEval2< T1, T2
2701 using Type = CompressedVector< DivTrait_t< ElementType_t<T1>, ElementType_t<T2> >
2702 , TransposeFlag_v<T1>
2703 , DivTrait_t< TagType_t<T1>, TagType_t<T2> > >;
2719template<
typename T,
typename OP >
2720struct UnaryMapTraitEval2< T, OP
2723 using ElementType =
decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) );
2725 using Type = CompressedVector< EvaluateTrait_t<ElementType>
2726 , TransposeFlag_v<T>
2727 , MapTrait_t< TagType_t<T>, OP > >;
2743template<
typename T,
size_t R0 >
2744struct RepeatTraitEval2< T, R0,
inf,
inf
2747 using Type = CompressedVector< ElementType_t<T>
2748 , TransposeFlag_v<T>
2765template<
typename T1,
bool TF,
typename Tag,
typename T2 >
2766struct HighType< CompressedVector<T1,TF,Tag>, CompressedVector<T2,TF,Tag> >
2768 using Type = CompressedVector< typename HighType<T1,T2>::Type, TF, Tag >;
2784template<
typename T1,
bool TF,
typename Tag,
typename T2 >
2785struct LowType< CompressedVector<T1,TF,Tag>, CompressedVector<T2,TF,Tag> >
2787 using Type = CompressedVector< typename LowType<T1,T2>::Type, TF, Tag >;
2803template<
typename VT,
size_t I,
size_t N >
2804struct SubvectorTraitEval2< VT, I, N
2807 using Type = CompressedVector< RemoveConst_t< ElementType_t<VT> >
2808 , TransposeFlag_v<VT>
2825template<
typename VT,
size_t N >
2826struct ElementsTraitEval2< VT, N
2829 using Type = CompressedVector< RemoveConst_t< ElementType_t<VT> >
2830 , TransposeFlag_v<VT>
2847template<
typename MT,
size_t I >
2848struct RowTraitEval2< MT, I
2851 using Type = CompressedVector< RemoveConst_t< ElementType_t<MT> >
2869template<
typename MT,
size_t I >
2870struct ColumnTraitEval2< MT, I
2873 using Type = CompressedVector< RemoveConst_t< ElementType_t<MT> >
2891template<
typename MT, ptrdiff_t I >
2892struct BandTraitEval2< MT, I
2895 using Type = CompressedVector< RemoveConst_t< ElementType_t<MT> >
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename ResultType_t< T >::TagType TagType_t
Alias declaration for nested TagType type definitions.
Definition: Aliases.h:530
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
Header file for run time assertion macros.
Header file for the band trait.
Header file for the column trait.
Constraint on the data type.
Header file for the cross product trait.
Header file for the division trait.
Header file for the elements trait.
Header file for the EnableIf class template.
Header file for the EvaluateTrait class template.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Header file for the IsColumnVector type trait.
Header file for the isDefault shim.
Header file for the IsDenseVector type trait.
Header file for the IsFloatingPoint type trait.
Header file for the IsIntegral type trait.
Header file for the IsRowVector type trait.
Header file for the IsSMPAssignable type trait.
Header file for the IsScalar type trait.
Header file for the IsSparseMatrix type trait.
Header file for the IsSparseVector type trait.
Header file for the IsVector type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Header file for the map trait.
Header file for memory allocation and deallocation functionality.
Header file for the multiplication trait.
Constraint on the data type.
Constraint on the data type.
Header file for the relaxation flag enumeration.
Header file for the RemoveConst type trait.
Header file for the repeat trait.
Header file for the row trait.
Constraint on the size of two data types.
Header file for the subtraction trait.
Header file for the subvector trait.
Header file for the generic transfer algorithm.
Header file for the ValueIndexPair class.
Header file for the VectorAccessProxy class.
Constraint on the data type.
Efficient implementation of an arbitrary sized sparse vector.
Definition: CompressedVector.h:220
void reset()
Reset to the default initial values.
Definition: CompressedVector.h:1418
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:2146
Iterator insert(size_t index, const Type &value)
Inserting an element into the compressed vector.
Definition: CompressedVector.h:1667
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1788
size_t capacity() const noexcept
Returns the maximum capacity of the compressed vector.
Definition: CompressedVector.h:1385
ConstIterator cbegin() const noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:876
Iterator begin_
Pointer to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:500
void swap(CompressedVector &sv) noexcept
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1536
size_t size() const noexcept
Returns the current size/dimension of the compressed vector.
Definition: CompressedVector.h:1370
Iterator begin() noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:844
Iterator end_
Pointer one past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:501
Tag TagType
Tag type of this CompressedVector instance.
Definition: CompressedVector.h:308
void subAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: CompressedVector.h:2337
void assign(const DenseVector< VT, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: CompressedVector.h:2209
ConstIterator cend() const noexcept
Returns an iterator just past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:924
Type ElementType
Type of the compressed vector elements.
Definition: CompressedVector.h:307
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the compressed vector elements.
Definition: CompressedVector.h:752
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: CompressedVector.h:2167
size_t extendCapacity() const noexcept
Calculating a new vector capacity.
Definition: CompressedVector.h:1559
Iterator end() noexcept
Returns an iterator just past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:892
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:503
void divAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the division assignment of a dense vector.
Definition: CompressedVector.h:2422
void multAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the multiplication assignment of a dense vector.
Definition: CompressedVector.h:2394
void resize(size_t n, bool preserve=true)
Changing the size of the compressed vector.
Definition: CompressedVector.h:1460
Iterator castDown(IteratorBase it) const noexcept
Performs a down-cast of the given iterator.
Definition: CompressedVector.h:1587
Reference at(size_t index)
Checked access to the compressed vector elements.
Definition: CompressedVector.h:801
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:2187
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: CompressedVector.h:1518
void addAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: CompressedVector.h:2280
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1753
IteratorBase castUp(Iterator it) const noexcept
Performs an up-cast of the given iterator.
Definition: CompressedVector.h:1606
CompressedVector() noexcept
The default constructor for CompressedVector.
Definition: CompressedVector.h:548
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:309
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:2052
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:314
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1486
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1952
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedVector.h:341
~CompressedVector()
The destructor for CompressedVector.
Definition: CompressedVector.h:722
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:1403
void clear()
Clearing the compressed vector.
Definition: CompressedVector.h:1435
size_t size_
The current size/dimension of the compressed vector.
Definition: CompressedVector.h:498
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:2002
CompressedVector & operator=(initializer_list< Type > list) &
List assignment to all vector elements.
Definition: CompressedVector.h:959
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:499
CompressedVector< Type, TF, Tag > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:300
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:315
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:313
Iterator set(size_t index, const Type &value)
Setting an element of the compressed vector.
Definition: CompressedVector.h:1636
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Base class for sparse vectors.
Definition: SparseVector.h:72
Index-value-pair for sparse vectors and matrices.
Definition: ValueIndexPair.h:75
constexpr Reference value() noexcept
Access to the current value of the value-index-pair.
Definition: ValueIndexPair.h:370
Access proxy for sparse, N-dimensional vectors.
Definition: VectorAccessProxy.h:101
Base class for N-dimensional vectors.
Definition: Vector.h:82
Constraint on the data type.
Constraint on the data type.
Header file for the DenseVector base class.
Header file for the SparseVector base class.
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Transfer.h:71
bool isIntact(const CompressedVector< Type, TF, Tag > &v) noexcept
Returns whether the invariants of the given compressed vector are intact.
Definition: CompressedVector.h:2514
void swap(CompressedVector< Type, TF, Tag > &a, CompressedVector< Type, TF, Tag > &b) noexcept
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:2532
bool isDefault(const CompressedVector< Type, TF, Tag > &v)
Returns whether the given compressed vector is in default state.
Definition: CompressedVector.h:2486
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition: Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_HAVE_SAME_SIZE(T1, T2)
Constraint on the size of two data types.
Definition: SameSize.h:60
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:60
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition: Const.h:79
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TAG(A, B)
Data type constraint.
Definition: SameTag.h:68
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition: TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition: AddTrait.h:163
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.
Definition: CrossTrait.h:138
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition: SubTrait.h:163
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.
Definition: IsVector.h:125
constexpr bool IsSparseMatrix_v
Auxiliary variable template for the IsSparseMatrix type trait.
Definition: IsSparseMatrix.h:124
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.
Definition: IsRowVector.h:126
constexpr bool IsSparseVector_v
Auxiliary variable template for the IsSparseVector type trait.
Definition: IsSparseVector.h:124
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition: Infinity.h:1080
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:730
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:1108
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
MT::Iterator lowerBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index not less than the given index.
Definition: SparseMatrix.h:194
MT::Iterator find(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Searches for a specific matrix element.
Definition: SparseMatrix.h:144
constexpr bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.
Definition: TransposeFlag.h:75
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.
Definition: IsIntegral.h:95
void deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:230
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
T * allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:158
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
Header file for the extended initializer_list functionality.
Constraint on the data type.
Header file for all forward declarations for sparse vectors and matrices.
Header file for the TransposeFlag type trait.
Header file for the serial shim.
Rebind mechanism to obtain a CompressedVector with different data/element type.
Definition: CompressedVector.h:322
Resize mechanism to obtain a CompressedVector with a different fixed number of elements.
Definition: CompressedVector.h:331
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the default transpose flag for all vectors of the Blaze library.
Header file for the IsZero type trait.
Header file for basic type definitions.
Header file for the generic max algorithm.
Header file for the generic min algorithm.