35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 36 #define _BLAZE_MATH_SPARSE_COMPRESSEDVECTOR_H_ 208 template<
typename Type
209 ,
bool TF = defaultTransposeFlag >
230 explicit Element() =
default;
231 Element(
const Element& rhs ) =
default;
232 Element( Element&& rhs ) =
default;
236 inline Element&
operator=(
const Element& rhs )
238 this->value_ = rhs.value_;
242 inline Element&
operator=( Element&& rhs )
244 this->value_ = std::move( rhs.value_ );
248 template<
typename Other >
249 inline auto operator=(
const Other& rhs )
252 this->value_ = rhs.value();
256 template<
typename Other >
259 IsRValueReference_v<Other&&>, Element& >
261 this->value_ = std::move( rhs.value() );
265 template<
typename Other >
273 template<
typename Other >
276 IsRValueReference_v<Other&&>, Element& >
278 this->value_ = std::move( v );
308 template<
typename NewType >
317 template<
size_t NewN >
357 inline
Reference operator[](
size_t index ) noexcept;
391 inline
size_t size() const noexcept;
392 inline
size_t capacity() const noexcept;
396 inline
void resize(
size_t n,
bool preserve=true );
406 inline
Iterator set (
size_t index, const Type& value );
408 inline
void append(
size_t index, const Type& value,
bool check=false );
415 inline
void erase(
size_t index );
420 inline
void erase( Pred predicate );
422 template< typename Pred >
442 template< typename Other > inline
CompressedVector& scale( const Other& scalar );
449 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
450 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
515 template< typename Type
531 template<
typename Type
547 template<
typename Type
564 template<
typename Type
590 template<
typename Type
597 for(
const Type& element : list ) {
598 if( !isDefault<strict>( element ) )
614 template<
typename Type
630 template<
typename Type
634 , capacity_( sv.capacity_ )
635 , begin_ ( sv.begin_ )
651 template<
typename Type
653 template<
typename VT >
669 template<
typename Type
671 template<
typename VT >
693 template<
typename Type
721 template<
typename Type
739 template<
typename Type
748 if( pos == end_ || pos->index_ != index )
768 template<
typename Type
773 if( index >= size_ ) {
776 return (*
this)[index];
791 template<
typename Type
796 if( index >= size_ ) {
799 return (*
this)[index];
809 template<
typename Type
823 template<
typename Type
838 template<
typename Type
853 template<
typename Type
867 template<
typename Type
882 template<
typename Type
916 template<
typename Type
923 resize( list.size(), false );
928 for(
const Type& element : list ) {
929 if( !isDefault<strict>( element ) )
930 append( i, element );
948 template<
typename Type
955 if( &rhs ==
this )
return *
this;
957 const size_t nonzeros( rhs.
nonZeros() );
959 if( nonzeros > capacity_ ) {
960 Iterator newBegin( allocate<Element>( nonzeros ) );
961 end_ = castDown( std::copy( rhs.
begin_, rhs.
end_, castUp( newBegin ) ) );
962 swap( begin_, newBegin );
966 capacity_ = nonzeros;
969 end_ = castDown( std::copy( rhs.
begin_, rhs.
end_, castUp( begin_ ) ) );
984 template<
typename Type
992 capacity_ = rhs.capacity_;
998 rhs.begin_ =
nullptr;
1015 template<
typename Type
1017 template<
typename VT >
1021 using blaze::assign;
1023 if( (~rhs).canAlias(
this ) ) {
1028 size_ = (~rhs).
size();
1030 assign( *
this, ~rhs );
1047 template<
typename Type
1049 template<
typename VT >
1053 using blaze::assign;
1055 if( (~rhs).canAlias(
this ) || (~rhs).
nonZeros() > capacity_ ) {
1060 size_ = (~rhs).
size();
1063 if( !IsZero_v<VT> ) {
1064 assign( *
this, ~rhs );
1083 template<
typename Type
1085 template<
typename VT >
1088 using blaze::addAssign;
1090 if( (~rhs).
size() != size_ ) {
1094 if( !IsZero_v<VT> ) {
1095 addAssign( *
this, ~rhs );
1113 template<
typename Type
1115 template<
typename VT >
1118 using blaze::subAssign;
1120 if( (~rhs).
size() != size_ ) {
1124 if( !IsZero_v<VT> ) {
1125 subAssign( *
this, ~rhs );
1144 template<
typename Type
1146 template<
typename VT >
1150 using blaze::multAssign;
1152 if( (~rhs).
size() != size_ ) {
1156 if( (~rhs).canAlias(
this ) ) {
1162 multAssign( *
this, tmp );
1181 template<
typename Type
1183 template<
typename VT >
1187 if( (~rhs).
size() != size_ ) {
1191 if( !IsZero_v<VT> ) {
1214 template<
typename Type
1216 template<
typename VT >
1219 using blaze::divAssign;
1221 if( (~rhs).
size() != size_ ) {
1225 if( (~rhs).canAlias(
this ) ) {
1231 divAssign( *
this, tmp );
1250 template<
typename Type
1252 template<
typename VT >
1255 using blaze::assign;
1266 if( size_ != 3UL || (~rhs).
size() != 3UL ) {
1270 if( !IsZero_v<VT> ) {
1271 const CrossType tmp( *
this % (~rhs) );
1273 assign( *
this, tmp );
1297 template<
typename Type
1311 template<
typename Type
1328 template<
typename Type
1332 return end_ - begin_;
1342 template<
typename Type
1358 template<
typename Type
1382 template<
typename Type
1387 end_ = lowerBound( n );
1407 template<
typename Type
1413 if( n > capacity_ ) {
1414 const size_t newCapacity( n );
1417 Iterator newBegin = allocate<Element>( newCapacity );
1420 end_ = castDown(
transfer( begin_, end_, castUp( newBegin ) ) );
1421 swap( newBegin, begin_ );
1422 capacity_ = newCapacity;
1438 template<
typename Type
1455 template<
typename Type
1461 swap( size_, sv.size_ );
1462 swap( capacity_, sv.capacity_ );
1463 swap( begin_, sv.begin_ );
1464 swap( end_, sv.end_ );
1477 template<
typename Type
1484 size_t nonzeros( 2UL*capacity_+1UL );
1485 nonzeros =
max( nonzeros, 7UL );
1486 nonzeros =
min( nonzeros, size_ );
1503 template<
typename Type
1508 return static_cast<Iterator>( it );
1521 template<
typename Type
1526 return static_cast<IteratorBase>( it );
1550 template<
typename Type
1557 const Iterator pos( lowerBound( index ) );
1559 if( pos != end_ && pos->index_ == index ) {
1560 pos->value() = value;
1563 else return insert( pos, index, value );
1580 template<
typename Type
1587 const Iterator pos( lowerBound( index ) );
1589 if( pos != end_ && pos->index_ == index ) {
1593 return insert( pos, index, value );
1607 template<
typename Type
1615 std::move_backward( pos, end_, castUp( end_+1 ) );
1616 pos->value_ = value;
1617 pos->index_ = index;
1623 size_t newCapacity( extendCapacity() );
1625 Iterator newBegin = allocate<Element>( newCapacity );
1626 Iterator tmp = castDown( std::move( begin_, pos, castUp( newBegin ) ) );
1627 tmp->value_ = value;
1628 tmp->index_ = index;
1629 end_ = castDown( std::move( pos, end_, castUp( tmp+1 ) ) );
1631 swap( newBegin, begin_ );
1633 capacity_ = newCapacity;
1665 template<
typename Type
1671 BLAZE_USER_ASSERT( begin_ == end_ || (end_-1UL)->index_ < index,
"Index is not strictly increasing" );
1673 end_->value_ = value;
1675 if( !check || !isDefault<strict>( end_->value_ ) ) {
1676 end_->index_ = index;
1699 template<
typename Type
1705 const Iterator pos( find( index ) );
1707 end_ = castDown( std::move( pos+1, end_, castUp( pos ) ) );
1720 template<
typename Type
1725 BLAZE_USER_ASSERT( pos >= begin_ && pos <= end_,
"Invalid compressed vector iterator" );
1728 end_ = castDown( std::move( pos+1, end_, castUp( pos ) ) );
1743 template<
typename Type
1749 BLAZE_USER_ASSERT( first >= begin_ && first <= end_,
"Invalid compressed vector iterator" );
1750 BLAZE_USER_ASSERT( last >= begin_ && last <= end_,
"Invalid compressed vector iterator" );
1753 end_ = castDown( std::move( last, end_, castUp( first ) ) );
1780 template<
typename Type
1782 template<
typename Pred
1786 end_ = castDown( std::remove_if( castUp( begin_ ), castUp( end_ ),
1787 [predicate=predicate](
const ElementBase& element ) {
1788 return predicate( element.
value() );
1817 template<
typename Type
1819 template<
typename Pred >
1823 BLAZE_USER_ASSERT( first >= begin_ && first <= end_,
"Invalid compressed vector iterator" );
1824 BLAZE_USER_ASSERT( last >= begin_ && last <= end_,
"Invalid compressed vector iterator" );
1826 const auto pos = std::remove_if( castUp( first ), castUp( last ),
1827 [predicate=predicate](
const ElementBase& element ) {
1828 return predicate( element.
value() );
1831 end_ = castDown( std::move( last, end_, pos ) );
1857 template<
typename Type
1861 return const_cast<Iterator>( const_cast<const This&>( *this ).find( index ) );
1879 template<
typename Type
1884 if( pos != end_ && pos->index_ == index )
1903 template<
typename Type
1908 return const_cast<Iterator>( const_cast<const This&>( *this ).lowerBound( index ) );
1925 template<
typename Type
1930 return std::lower_bound( begin_, end_, index,
1931 [](
const Element& element,
size_t i )
1933 return element.index() < i;
1951 template<
typename Type
1956 return const_cast<Iterator>( const_cast<const This&>( *this ).upperBound( index ) );
1973 template<
typename Type
1978 return std::upper_bound( begin_, end_, index,
1979 [](
size_t i,
const Element& element )
1981 return i < element.index();
2012 template<
typename Type
2014 template<
typename Other >
2017 for(
auto element=begin_; element!=end_; ++element )
2018 element->value_ *= scalar;
2042 template<
typename Type
2044 template<
typename Other >
2047 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
2062 template<
typename Type
2064 template<
typename Other >
2067 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
2082 template<
typename Type
2102 template<
typename Type
2104 template<
typename VT >
2110 size_t nonzeros( 0UL );
2112 for(
size_t i=0UL; i<size_; ++i )
2114 if( nonzeros == capacity_ )
2115 reserve( extendCapacity() );
2117 end_->value_ = (~rhs)[i];
2119 if( !isDefault<strict>( end_->value_ ) ) {
2140 template<
typename Type
2142 template<
typename VT >
2154 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2155 append( element->index(), element->value() );
2171 template<
typename Type
2173 template<
typename VT >
2184 const AddType tmp(
serial( *
this + (~rhs) ) );
2202 template<
typename Type
2204 template<
typename VT >
2226 template<
typename Type
2228 template<
typename VT >
2239 const SubType tmp(
serial( *
this - (~rhs) ) );
2257 template<
typename Type
2259 template<
typename VT >
2281 template<
typename Type
2283 template<
typename VT >
2290 for(
auto element=begin_; element!=end_; ++element ) {
2291 element->value_ *= (~rhs)[element->index_];
2308 template<
typename Type
2310 template<
typename VT >
2317 for(
auto element=begin_; element!=end_; ++element ) {
2318 element->value_ /= (~rhs)[element->index_];
2335 template<
typename Type,
bool TF >
2338 template<
typename Type,
bool TF >
2341 template<
bool RF,
typename Type,
bool TF >
2344 template<
typename Type,
bool TF >
2347 template<
typename Type,
bool TF >
2360 template<
typename Type
2376 template<
typename Type
2414 return ( v.
size() == 0UL );
2437 template<
typename Type
2441 return ( v.nonZeros() <= v.capacity() );
2454 template<
typename Type
2473 template<
typename T,
bool TF >
2474 struct IsResizable< CompressedVector<T,TF> >
2491 template<
typename T,
bool TF >
2492 struct IsShrinkable< CompressedVector<T,TF> >
2509 template<
typename T1,
typename T2 >
2510 struct AddTraitEval2< T1, T2
2513 using ET1 = ElementType_t<T1>;
2514 using ET2 = ElementType_t<T2>;
2516 using Type = CompressedVector< AddTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2532 template<
typename T1,
typename T2 >
2533 struct SubTraitEval2< T1, T2
2536 using ET1 = ElementType_t<T1>;
2537 using ET2 = ElementType_t<T2>;
2539 using Type = CompressedVector< SubTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2555 template<
typename T1,
typename T2 >
2556 struct MultTraitEval2< T1, T2
2559 using ET1 = ElementType_t<T1>;
2561 using Type = CompressedVector< MultTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
2564 template<
typename T1,
typename T2 >
2565 struct MultTraitEval2< T1, T2
2568 using ET2 = ElementType_t<T2>;
2570 using Type = CompressedVector< MultTrait_t<T1,ET2>, TransposeFlag_v<T2> >;
2573 template<
typename T1,
typename T2 >
2574 struct MultTraitEval2< T1, T2
2576 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
2577 ( IsSparseVector_v<T1> || IsSparseVector_v<T2> ) > >
2579 using ET1 = ElementType_t<T1>;
2580 using ET2 = ElementType_t<T2>;
2582 using Type = CompressedVector< MultTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2585 template<
typename T1,
typename T2 >
2586 struct MultTraitEval2< T1, T2
2588 IsSparseVector_v<T2> &&
2589 IsColumnVector_v<T2> > >
2591 using ET1 = ElementType_t<T1>;
2592 using ET2 = ElementType_t<T2>;
2594 using Type = CompressedVector< MultTrait_t<ET1,ET2>,
false >;
2597 template<
typename T1,
typename T2 >
2598 struct MultTraitEval2< T1, T2
2600 IsRowVector_v<T1> &&
2601 IsSparseMatrix_v<T2> > >
2603 using ET1 = ElementType_t<T1>;
2604 using ET2 = ElementType_t<T2>;
2606 using Type = CompressedVector< MultTrait_t<ET1,ET2>,
true >;
2622 template<
typename T1,
typename T2 >
2623 struct DivTraitEval2< T1, T2
2626 using ET1 = ElementType_t<T1>;
2628 using Type = CompressedVector< DivTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
2631 template<
typename T1,
typename T2 >
2632 struct DivTraitEval2< T1, T2
2635 using ET1 = ElementType_t<T1>;
2636 using ET2 = ElementType_t<T2>;
2638 using Type = CompressedVector< DivTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2654 template<
typename T1
2656 struct KronTraitEval2< T1, T2
2659 ( IsSparseVector_v<T1> || IsSparseVector_v<T2> ) > >
2661 using ET1 = ElementType_t<T1>;
2662 using ET2 = ElementType_t<T2>;
2664 static constexpr
bool TF = ( IsDenseVector_v<T2> ? TransposeFlag_v<T1> : TransposeFlag_v<T2> );
2666 using Type = CompressedVector< MultTrait_t<ET1,ET2>, TF >;
2682 template<
typename T,
typename OP >
2683 struct UnaryMapTraitEval2< T, OP
2686 using ET = ElementType_t<T>;
2688 using Type = CompressedVector< MapTrait_t<ET,OP>, TransposeFlag_v<T> >;
2704 template<
typename T1,
bool TF,
typename T2 >
2705 struct HighType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2707 using Type = CompressedVector< typename HighType<T1,T2>::Type, TF >;
2723 template<
typename T1,
bool TF,
typename T2 >
2724 struct LowType< CompressedVector<T1,TF>, CompressedVector<T2,TF> >
2726 using Type = CompressedVector< typename LowType<T1,T2>::Type, TF >;
2742 template<
typename VT,
size_t I,
size_t N >
2743 struct SubvectorTraitEval2< VT, I, N
2746 using Type = CompressedVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
2762 template<
typename VT,
size_t N >
2763 struct ElementsTraitEval2< VT, N
2766 using Type = CompressedVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
2782 template<
typename MT,
size_t I >
2783 struct RowTraitEval2< MT, I
2786 using Type = CompressedVector< RemoveConst_t< ElementType_t<MT> >,
true >;
2802 template<
typename MT,
size_t I >
2803 struct ColumnTraitEval2< MT, I
2806 using Type = CompressedVector< RemoveConst_t< ElementType_t<MT> >,
false >;
2822 template<
typename MT, ptrdiff_t I >
2823 struct BandTraitEval2< MT, I
2826 using Type = CompressedVector< RemoveConst_t< ElementType_t<MT> >, defaultTransposeFlag >;
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
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,...
Definition: Assert.h:117
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.The SubTrait_t alias declaration provides...
Definition: SubTrait.h:238
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
Header file for the SparseVector base class.
Header file for the row trait.
void assign(const DenseVector< VT, TF > &rhs)
Default implementation of the assignment of a dense vector.
Definition: CompressedVector.h:2105
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: CompressedVector.h:1954
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.The IsRowVector_v variable template provid...
Definition: IsRowVector.h:142
void swap(CompressedVector< Type, TF > &a, CompressedVector< Type, TF > &b) noexcept
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:2456
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Resize mechanism to obtain a CompressedVector with a different fixed number of elements.
Definition: CompressedVector.h:318
Header file for the IsSparseMatrix type trait.
Header file for the serial shim.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elem...
Definition: VectorAccessProxy.h:101
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Header file for the IsRowVector type trait.
Header file for the IsIntegral type trait.
IteratorBase castUp(Iterator it) const noexcept
Performs an up-cast of the given iterator.
Definition: CompressedVector.h:1524
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:2174
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
void clear()
Clearing the compressed vector.
Definition: CompressedVector.h:1360
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Header file for all forward declarations of the math module.
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:485
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:724
Header file for the band trait.
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Type ElementType
Type of the compressed vector elements.
Definition: CompressedVector.h:296
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:309
CompressedVector() noexcept
The default constructor for CompressedVector.
Definition: CompressedVector.h:533
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:1553
Header file for the LowType type trait.
void subAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: CompressedVector.h:2229
void append(size_t index, const Type &value, bool check=false)
Appending an element to the compressed vector.
Definition: CompressedVector.h:1667
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the IsFloatingPoint type trait.
Header file for the IsShrinkable type trait.
Iterator insert(size_t index, const Type &value)
Inserting an element into the compressed vector.
Definition: CompressedVector.h:1583
#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.
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:1162
Iterator begin_
Pointer to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:487
#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:1299
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedVector.h:297
#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
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: CompressedVector.h:1440
Header file for the subvector trait.
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
size_t nonZeros() const
Returns the number of non-zero elements in the compressed vector.
Definition: CompressedVector.h:1330
Iterator castDown(IteratorBase it) const noexcept
Performs a down-cast of the given iterator.
Definition: CompressedVector.h:1506
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
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.The AddTrait_t alias declaration provides...
Definition: AddTrait.h:238
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,...
Definition: Reference.h:60
Header file for the Kron product trait.
Header file for the TransposeFlag type trait.
Constraint on the data type.
Header file for the exception macros of the math module.
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:1198
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
Constraint on the data type.
Header file for the IsVector type trait.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
size_t capacity_
The maximum capacity of the compressed vector.
Definition: CompressedVector.h:486
void erase(size_t index)
Erasing an element from the compressed vector.
Definition: CompressedVector.h:1701
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_t alias declaration prov...
Definition: CrossTrait.h:164
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: CompressedVector.h:1906
Iterator find(size_t index)
Searches for a specific vector element.
Definition: CompressedVector.h:1859
Header file for the IsNumeric type trait.
void reset()
Reset to the default initial values.
Definition: CompressedVector.h:1344
Header file for the RemoveConst type trait.
void resize(size_t n, bool preserve=true)
Changing the size of the compressed vector.
Definition: CompressedVector.h:1384
Header file for the IsSparseVector type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedVector.h:302
Header file for run time assertion macros.
Header file for the relaxation flag types.
CompressedVector & operator=(initializer_list< Type > list)
List assignment to all vector elements.
Definition: CompressedVector.h:919
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
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:1479
Reference at(size_t index)
Checked access to the compressed vector elements.
Definition: CompressedVector.h:771
Headerfile for the generic transfer algorithm.
Header file for the IsZero type trait.
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:139
#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,...
Definition: Reference.h:79
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedVector.h:328
Header file for the column trait.
Header file for the VectorAccessProxy class.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
constexpr Reference value() noexcept
Access to the current value of the value-index-pair.
Definition: ValueIndexPair.h:370
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:808
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedVector.h:301
#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:2284
void divAssign(const DenseVector< VT, TF > &rhs)
Default implementation of the division assignment of a dense vector.
Definition: CompressedVector.h:2311
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: CompressedVector.h:2065
Header file for the IsDenseVector type trait.
const Type & ConstReference
Reference to a constant vector value.
Definition: CompressedVector.h:300
void swap(CompressedVector &sv) noexcept
Swapping the contents of two compressed vectors.
Definition: CompressedVector.h:1457
ConstIterator cbegin() const noexcept
Returns an iterator to the first non-zero element of the compressed vector.
Definition: CompressedVector.h:841
#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:855
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:198
EnableIf_t< IsBuiltin_v< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:224
Header file for the default transpose flag for all vectors of the Blaze library.
Initializer list type of the Blaze library.
~CompressedVector()
The destructor for CompressedVector.
Definition: CompressedVector.h:695
size_t capacity() const noexcept
Returns the maximum capacity of the compressed vector.
Definition: CompressedVector.h:1313
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
Iterator end_
Pointer one past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:488
CompressedVector< Type, TF > This
Type of this CompressedVector instance.
Definition: CompressedVector.h:292
Header file for the IntegralConstant class template.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
ConstIterator cend() const noexcept
Returns an iterator just past the last non-zero element of the compressed vector.
Definition: CompressedVector.h:885
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.The IsIntegral_v variable template provides...
Definition: IsIntegral.h:95
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
constexpr bool IsSparseVector_v
Auxiliary variable template for the IsSparseVector type trait.The IsSparseVector_v variable template ...
Definition: IsSparseVector.h:138
Header file for the IsColumnVector type trait.
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:811
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedVector.h:490
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: CompressedVector.h:2045
Header file for the IsResizable type trait.
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: CompressedVector.h:2084
EnableIf_t< IsBuiltin_v< T >, T * > allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:156
#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.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
Efficient implementation of an arbitrary sized sparse vector.The CompressedVector class is the repres...
Definition: CompressedVector.h:210
void reserve(size_t n)
Setting the minimum capacity of the compressed vector.
Definition: CompressedVector.h:1409
constexpr bool IsSparseMatrix_v
Auxiliary variable template for the IsSparseMatrix type trait.The IsSparseMatrix_v variable template ...
Definition: IsSparseMatrix.h:138
Header file for the HighType type trait.