35 #ifndef _BLAZE_MATH_VIEWS_ELEMENTS_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_ELEMENTS_SPARSE_H_ 102 class Elements<VT,TF,false,CEAs...>
103 :
public View< SparseVector< Elements<VT,TF,false,CEAs...>, TF > >
104 ,
private ElementsData<CEAs...>
108 using DataType = ElementsData<CEAs...>;
109 using Operand = If_t< IsExpression_v<VT>, VT, VT& >;
119 using This = Elements<VT,TF,
false,CEAs...>;
121 using BaseType = SparseVector<This,TF>;
122 using ViewedType = VT;
123 using ResultType = ElementsTrait_t<VT,N>;
124 using TransposeType = TransposeType_t<ResultType>;
125 using ElementType = ElementType_t<VT>;
126 using ReturnType = ReturnType_t<VT>;
127 using CompositeType =
const Elements&;
130 using ConstReference = ConstReference_t<VT>;
133 using Reference = If_t< IsConst_v<VT>, ConstReference, Reference_t<VT> >;
139 template<
typename IteratorType >
140 class ElementsElement
141 :
private SparseElement
150 inline ElementsElement( IteratorType pos,
size_t index )
162 template<
typename T >
inline ElementsElement& operator=(
const T& v ) {
174 template<
typename T >
inline ElementsElement&
operator+=(
const T& v ) {
186 template<
typename T >
inline ElementsElement&
operator-=(
const T& v ) {
198 template<
typename T >
inline ElementsElement&
operator*=(
const T& v ) {
210 template<
typename T >
inline ElementsElement&
operator/=(
const T& v ) {
221 inline const ElementsElement* operator->()
const {
231 inline decltype(
auto) value()
const {
232 return pos_->value();
241 inline size_t index()
const {
257 template<
typename ET
258 ,
typename IteratorType >
259 class ElementsIterator
263 using IteratorCategory = std::forward_iterator_tag;
264 using ValueType = ElementsElement<IteratorType>;
265 using PointerType = ValueType;
266 using ReferenceType = ValueType;
267 using DifferenceType = ptrdiff_t;
270 using iterator_category = IteratorCategory;
271 using value_type = ValueType;
272 using pointer = PointerType;
273 using reference = ReferenceType;
274 using difference_type = DifferenceType;
280 inline ElementsIterator()
281 : elements_( nullptr )
293 inline ElementsIterator( ET*
elements,
size_t index )
298 for( ; index_<elements_->size(); ++index_ ) {
299 pos_ = elements_->operand().find( elements_->idx(index_) );
300 if( pos_ != elements_->operand().end() )
break;
312 inline ElementsIterator( ET*
elements,
size_t index, IteratorType pos )
324 template<
typename ET2,
typename IteratorType2 >
325 inline ElementsIterator(
const ElementsIterator<ET2,IteratorType2>& it )
326 : elements_( it.elements_ )
327 , index_ ( it.index_ )
337 inline ElementsIterator& operator++() {
339 for( ; index_<elements_->size(); ++index_ ) {
340 pos_ = elements_->operand().find( elements_->idx(index_) );
341 if( pos_ != elements_->operand().end() )
break;
352 inline const ElementsIterator operator++(
int ) {
353 const ElementsIterator tmp( *
this );
365 return ReferenceType( pos_, index_ );
374 inline PointerType operator->()
const {
375 return PointerType( pos_, index_ );
385 inline bool operator==(
const ElementsIterator& rhs )
const {
386 return index_ == rhs.index_;
396 inline bool operator!=(
const ElementsIterator& rhs )
const {
397 return index_ != rhs.index_;
407 inline DifferenceType
operator-(
const ElementsIterator& rhs )
const {
408 size_t counter( 0UL );
409 for(
size_t j=rhs.index_; j<index_; ++j ) {
410 if( elements_->find( j ) != elements_->end() )
425 template<
typename VT2,
bool TF2,
bool DF2,
typename... CEAs2 >
friend class Elements;
426 template<
typename ET2,
typename IteratorType2 >
friend class ElementsIterator;
433 using ConstIterator = ElementsIterator< const This, ConstIterator_t<VT> >;
436 using Iterator = If_t< IsConst_v<VT>, ConstIterator, ElementsIterator< This, Iterator_t<VT> > >;
441 static constexpr
bool smpAssignable =
false;
444 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
450 template<
typename... REAs >
451 explicit inline Elements( VT& vector, REAs... args );
453 Elements(
const Elements& ) =
default;
454 Elements( Elements&& ) =
default;
461 ~Elements() =
default;
468 inline Reference operator[](
size_t index );
469 inline ConstReference operator[](
size_t index )
const;
470 inline Reference at(
size_t index );
471 inline ConstReference at(
size_t index )
const;
472 inline Iterator
begin ();
473 inline ConstIterator
begin ()
const;
474 inline ConstIterator
cbegin()
const;
475 inline Iterator
end ();
476 inline ConstIterator
end ()
const;
477 inline ConstIterator
cend ()
const;
484 inline Elements& operator= ( initializer_list<ElementType> list );
485 inline Elements& operator= (
const Elements& rhs );
486 template<
typename VT2 >
inline Elements& operator= (
const Vector<VT2,TF>& rhs );
487 template<
typename VT2 >
inline Elements&
operator+=(
const Vector<VT2,TF>& rhs );
488 template<
typename VT2 >
inline Elements&
operator-=(
const Vector<VT2,TF>& rhs );
489 template<
typename VT2 >
inline Elements&
operator*=(
const Vector<VT2,TF>& rhs );
490 template<
typename VT2 >
inline Elements&
operator/=(
const DenseVector<VT2,TF>& rhs );
491 template<
typename VT2 >
inline Elements& operator%=(
const Vector<VT2,TF>& rhs );
498 using DataType::idces;
502 inline VT& operand() noexcept;
503 inline const VT& operand() const noexcept;
505 inline
size_t capacity() const noexcept;
508 inline
void reserve(
size_t n );
515 inline Iterator
set (
size_t index, const ElementType& value );
516 inline Iterator insert(
size_t index, const ElementType& value );
517 inline
void append(
size_t index, const ElementType& value,
bool check=false );
524 inline
void erase(
size_t index );
525 inline Iterator erase( Iterator pos );
526 inline Iterator erase( Iterator first, Iterator last );
529 inline
void erase( Pred predicate );
531 template< typename Pred >
532 inline
void erase( Iterator first, Iterator last, Pred predicate );
539 inline Iterator find (
size_t index );
540 inline ConstIterator find (
size_t index ) const;
541 inline Iterator lowerBound(
size_t index );
542 inline ConstIterator lowerBound(
size_t index ) const;
543 inline Iterator upperBound(
size_t index );
544 inline ConstIterator upperBound(
size_t index ) const;
551 template< typename Other > inline Elements& scale( const Other& scalar );
558 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
559 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
561 inline
bool canSMPAssign() const noexcept;
563 template< typename VT2 > inline
void assign ( const DenseVector <VT2,TF>& rhs );
564 template< typename VT2 > inline
void assign ( const SparseVector<VT2,TF>& rhs );
565 template< typename VT2 > inline
void addAssign( const Vector<VT2,TF>& rhs );
566 template< typename VT2 > inline
void subAssign( const Vector<VT2,TF>& rhs );
612 template< typename VT
615 template< typename... REAs >
616 inline Elements<VT,TF,false,CEAs...>::Elements( VT& vector, REAs... args )
617 : DataType( args... )
621 for(
size_t i=0UL; i<
size(); ++i ) {
622 if( vector_.size() <= idx(i) ) {
650 template<
typename VT
653 inline typename Elements<VT,TF,
false,CEAs...>::Reference
654 Elements<VT,TF,false,CEAs...>::operator[](
size_t index )
657 return vector_[idx(index)];
673 template<
typename VT
676 inline typename Elements<VT,TF,
false,CEAs...>::ConstReference
677 Elements<VT,TF,false,CEAs...>::operator[](
size_t index )
const 680 return const_cast<const VT&>( vector_ )[idx(index)];
697 template<
typename VT
700 inline typename Elements<VT,TF,
false,CEAs...>::Reference
701 Elements<VT,TF,false,CEAs...>::at(
size_t index )
703 if( index >=
size() ) {
706 return (*
this)[index];
723 template<
typename VT
726 inline typename Elements<VT,TF,
false,CEAs...>::ConstReference
727 Elements<VT,TF,false,CEAs...>::at(
size_t index )
const 729 if( index >=
size() ) {
732 return (*
this)[index];
746 template<
typename VT
749 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
752 return Iterator(
this, 0UL );
766 template<
typename VT
769 inline typename Elements<VT,TF,
false,CEAs...>::ConstIterator
772 return ConstIterator(
this, 0UL );
786 template<
typename VT
789 inline typename Elements<VT,TF,
false,CEAs...>::ConstIterator
792 return ConstIterator(
this, 0UL );
806 template<
typename VT
809 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
812 return Iterator(
this,
size() );
826 template<
typename VT
829 inline typename Elements<VT,TF,
false,CEAs...>::ConstIterator
832 return ConstIterator(
this,
size() );
846 template<
typename VT
849 inline typename Elements<VT,TF,
false,CEAs...>::ConstIterator
852 return ConstIterator(
this,
size() );
882 template<
typename VT
885 inline Elements<VT,TF,
false,CEAs...>&
886 Elements<VT,TF,false,CEAs...>::operator=( initializer_list<ElementType> list )
890 if( list.size() >
size() ) {
894 const InitializerVector<ElementType,TF> tmp( list,
size() );
896 if( IsRestricted_v<VT> ) {
897 for(
size_t i=0UL; i<
size(); ++i ) {
898 if( !trySet( vector_, idx(i), tmp[i] ) ) {
904 decltype(
auto) left( derestrict( *this ) );
928 template< typename VT
931 inline Elements<VT,TF,false,CEAs...>&
932 Elements<VT,TF,false,CEAs...>::operator=( const Elements& rhs )
939 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && compareIndices( *
this, rhs ) ) )
942 if(
size() != rhs.size() ) {
946 if( IsRestricted_v<VT> ) {
947 for(
size_t i=0UL; i<
size(); ++i ) {
948 if( !trySet( vector_, idx(i), rhs[i] ) ) {
954 decltype(
auto) left( derestrict( *this ) );
956 if( rhs.canAlias( &vector_ ) ) {
957 const ResultType tmp( rhs );
984 template<
typename VT
987 template<
typename VT2 >
988 inline Elements<VT,TF,
false,CEAs...>&
989 Elements<VT,TF,false,CEAs...>::operator=(
const Vector<VT2,TF>& rhs )
1000 using Right = If_t< IsRestricted_v<VT>, CompositeType_t<VT2>,
const VT2& >;
1001 Right right( ~rhs );
1003 if( IsRestricted_v<VT> ) {
1004 for(
size_t i=0UL; i<
size(); ++i ) {
1005 if( !trySet( vector_, idx(i), right[i] ) ) {
1011 decltype(
auto) left( derestrict( *this ) );
1014 const ResultType_t<VT2> tmp( right );
1015 assign( left, tmp );
1018 assign( left, right );
1041 template<
typename VT
1043 ,
typename... CEAs >
1044 template<
typename VT2 >
1045 inline Elements<VT,TF,
false,CEAs...>&
1048 using blaze::addAssign;
1057 using Right = If_t< IsRestricted_v<VT>, CompositeType_t<VT2>,
const VT2& >;
1058 Right right( ~rhs );
1060 if( IsRestricted_v<VT> ) {
1061 for(
size_t i=0UL; i<
size(); ++i ) {
1062 if( !tryAdd( vector_, idx(i), right[i] ) ) {
1068 decltype(
auto) left( derestrict( *this ) );
1071 const ResultType_t<VT2> tmp( right );
1072 addAssign( left, tmp );
1075 addAssign( left, right );
1098 template<
typename VT
1100 ,
typename... CEAs >
1101 template<
typename VT2 >
1102 inline Elements<VT,TF,
false,CEAs...>&
1105 using blaze::subAssign;
1114 using Right = If_t< IsRestricted_v<VT>, CompositeType_t<VT2>,
const VT2& >;
1115 Right right( ~rhs );
1117 if( IsRestricted_v<VT> ) {
1118 for(
size_t i=0UL; i<
size(); ++i ) {
1119 if( !trySub( vector_, idx(i), right[i] ) ) {
1125 decltype(
auto) left( derestrict( *this ) );
1128 const ResultType_t<VT2> tmp( right );
1129 subAssign( left, tmp );
1132 subAssign( left, right );
1156 template<
typename VT
1158 ,
typename... CEAs >
1159 template<
typename VT2 >
1160 inline Elements<VT,TF,
false,CEAs...>&
1163 using blaze::assign;
1169 using MultType = MultTrait_t< ResultType, ResultType_t<VT2> >;
1178 const MultType tmp( *
this * (~rhs) );
1180 if( IsRestricted_v<VT> ) {
1181 for(
size_t i=0UL; i<
size(); ++i ) {
1182 if( !trySet( vector_, idx(i), tmp[i] ) ) {
1188 decltype(
auto) left( derestrict( *this ) );
1190 assign( left, tmp );
1212 template< typename VT
1214 , typename... CEAs >
1215 template< typename VT2 >
1216 inline Elements<VT,TF,false,CEAs...>&
1217 Elements<VT,TF,false,CEAs...>::operator/=( const DenseVector<VT2,TF>& rhs )
1219 using blaze::assign;
1226 using DivType = DivTrait_t< ResultType, ResultType_t<VT2> >;
1236 const DivType tmp( *
this / (~rhs) );
1238 if( IsRestricted_v<VT> ) {
1239 for(
size_t i=0UL; i<
size(); ++i ) {
1240 if( !trySet( vector_, idx(i), tmp[i] ) ) {
1246 decltype(
auto) left( derestrict( *this ) );
1248 assign( left, tmp );
1271 template< typename VT
1273 , typename... CEAs >
1274 template< typename VT2 >
1275 inline Elements<VT,TF,false,CEAs...>&
1276 Elements<VT,TF,false,CEAs...>::operator%=( const Vector<VT2,TF>& rhs )
1278 using blaze::assign;
1283 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT2> >;
1289 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1293 const CrossType tmp( *
this % (~rhs) );
1295 if( IsRestricted_v<VT> ) {
1296 for(
size_t i=0UL; i<
size(); ++i ) {
1297 if( !trySet( vector_, idx(i), tmp[i] ) ) {
1303 decltype(
auto) left( derestrict( *this ) );
1305 assign( left, tmp );
1329 template< typename VT
1331 , typename... CEAs >
1332 inline VT& Elements<VT,TF,false,CEAs...>::operand() noexcept
1346 template<
typename VT
1348 ,
typename... CEAs >
1349 inline const VT& Elements<VT,TF,false,CEAs...>::operand() const noexcept
1363 template<
typename VT
1365 ,
typename... CEAs >
1368 return nonZeros() + vector_.capacity() - vector_.nonZeros();
1383 template<
typename VT
1385 ,
typename... CEAs >
1388 size_t counter( 0UL );
1389 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
1404 template<
typename VT
1406 ,
typename... CEAs >
1409 for(
size_t i=0UL; i<
size(); ++i )
1410 vector_.erase( idx(i) );
1426 template<
typename VT
1428 ,
typename... CEAs >
1429 void Elements<VT,TF,false,CEAs...>::reserve(
size_t n )
1431 const size_t current(
capacity() );
1434 vector_.reserve( vector_.capacity() + n - current );
1461 template<
typename VT
1463 ,
typename... CEAs >
1464 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
1467 return Iterator(
this, index, vector_.set( idx(index), value ) );
1486 template<
typename VT
1488 ,
typename... CEAs >
1489 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
1490 Elements<VT,TF,false,CEAs...>::insert(
size_t index,
const ElementType& value )
1492 return Iterator(
this, index, vector_.insert( idx(index), value ) );
1523 template<
typename VT
1525 ,
typename... CEAs >
1526 inline void Elements<VT,TF,false,CEAs...>::append(
size_t index,
const ElementType& value,
bool check )
1528 if( !check || !isDefault<strict>( value ) )
1529 vector_.insert( idx(index), value );
1552 template<
typename VT
1554 ,
typename... CEAs >
1555 inline void Elements<VT,TF,false,CEAs...>::erase(
size_t index )
1557 vector_.erase( idx(index) );
1572 template<
typename VT
1574 ,
typename... CEAs >
1575 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
1576 Elements<VT,TF,false,CEAs...>::erase( Iterator pos )
1578 const size_t index( pos.index_ );
1580 if( index ==
size() )
1583 vector_.erase( pos.pos_ );
1584 return Iterator(
this, index+1UL );
1600 template<
typename VT
1602 ,
typename... CEAs >
1603 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
1604 Elements<VT,TF,false,CEAs...>::erase( Iterator first, Iterator last )
1606 for( ; first!=last; ++first ) {
1607 vector_.erase( first.pos_ );
1610 return Iterator(
this, last.index_ );
1639 template<
typename VT
1641 ,
typename... CEAs >
1642 template<
typename Pred
1644 inline void Elements<VT,TF,false,CEAs...>::erase( Pred predicate )
1646 erase(
begin(),
end(), predicate );
1678 template<
typename VT
1680 ,
typename... CEAs >
1681 template<
typename Pred >
1682 inline void Elements<VT,TF,false,CEAs...>::erase( Iterator first, Iterator last, Pred predicate )
1684 for( ; first!=last; ++first ) {
1685 if( predicate( first->value() ) )
1686 vector_.erase( first.pos_ );
1715 template<
typename VT
1717 ,
typename... CEAs >
1718 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
1719 Elements<VT,TF,false,CEAs...>::find(
size_t index )
1721 const Iterator_t<VT> pos( vector_.find( idx(index) ) );
1723 if( pos != vector_.end() )
1724 return Iterator(
this, index, pos );
1746 template<
typename VT
1748 ,
typename... CEAs >
1749 inline typename Elements<VT,TF,
false,CEAs...>::ConstIterator
1750 Elements<VT,TF,false,CEAs...>::find(
size_t index )
const 1752 const ConstIterator_t<VT> pos( vector_.find( idx(index) ) );
1754 if( pos != vector_.end() )
1755 return ConstIterator(
this, index, pos );
1776 template<
typename VT
1778 ,
typename... CEAs >
1779 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
1780 Elements<VT,TF,false,CEAs...>::lowerBound(
size_t index )
1782 for( ; index<
size(); ++index ) {
1783 const Iterator_t<VT> pos( vector_.find( idx(index) ) );
1784 if( pos != vector_.end() )
1785 return Iterator(
this, index, pos );
1806 template<
typename VT
1808 ,
typename... CEAs >
1809 inline typename Elements<VT,TF,
false,CEAs...>::ConstIterator
1810 Elements<VT,TF,false,CEAs...>::lowerBound(
size_t index )
const 1812 for( ; index<
size(); ++index ) {
1813 const ConstIterator_t<VT> pos( vector_.find( idx(index) ) );
1814 if( pos != vector_.end() )
1815 return ConstIterator(
this, index, pos );
1836 template<
typename VT
1838 ,
typename... CEAs >
1839 inline typename Elements<VT,TF,
false,CEAs...>::Iterator
1840 Elements<VT,TF,false,CEAs...>::upperBound(
size_t index )
1842 while( (++index) <
size() ) {
1843 const Iterator_t<VT> pos( vector_.find( idx(index) ) );
1844 if( pos != vector_.end() )
1845 return Iterator(
this, index, pos );
1866 template<
typename VT
1868 ,
typename... CEAs >
1869 inline typename Elements<VT,TF,
false,CEAs...>::ConstIterator
1870 Elements<VT,TF,false,CEAs...>::upperBound(
size_t index )
const 1872 while( (++index) <
size() ) {
1873 const ConstIterator_t<VT> pos( vector_.find( idx(index) ) );
1874 if( pos != vector_.end() )
1875 return ConstIterator(
this, index, pos );
1902 template<
typename VT
1904 ,
typename... CEAs >
1905 template<
typename Other >
1906 inline Elements<VT,TF,
false,CEAs...>&
1907 Elements<VT,TF,false,CEAs...>::scale(
const Other& scalar )
1909 for( Iterator element=
begin(); element!=
end(); ++element )
1910 element->value() *= scalar;
1936 template<
typename VT
1938 ,
typename... CEAs >
1939 template<
typename Other >
1940 inline bool Elements<VT,TF,false,CEAs...>::canAlias(
const Other* alias )
const noexcept
1942 return vector_.isAliased( alias );
1959 template<
typename VT
1961 ,
typename... CEAs >
1962 template<
typename Other >
1963 inline bool Elements<VT,TF,false,CEAs...>::isAliased(
const Other* alias )
const noexcept
1965 return vector_.isAliased( alias );
1983 template<
typename VT
1985 ,
typename... CEAs >
1986 template<
typename VT2 >
1987 inline void Elements<VT,TF,false,CEAs...>::assign(
const DenseVector<VT2,TF>& rhs )
1991 using RT = If_t< IsComputation_v<VT2>, ElementType_t<VT>,
const ElementType_t<VT2>& >;
1993 reserve( (~rhs).
size() );
1995 for(
size_t i=0UL; i<
size(); ++i ) {
1996 RT value( (~rhs)[i] );
1997 if( !isDefault<strict>( value ) )
1998 vector_.set( idx(i), std::move( value ) );
1999 else vector_.erase( idx(i) );
2018 template<
typename VT
2020 ,
typename... CEAs >
2021 template<
typename VT2 >
2022 inline void Elements<VT,TF,false,CEAs...>::assign(
const SparseVector<VT2,TF>& rhs )
2026 using RT = If_t< IsComputation_v<VT2>, ElementType_t<VT>,
const ElementType_t<VT2>& >;
2030 for( ConstIterator_t<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
2031 for( ; i<element->index(); ++i )
2032 vector_.erase( idx(i) );
2033 RT value( element->value() );
2034 if( !isDefault<strict>( value ) )
2035 vector_.set( idx(i), std::move( value ) );
2036 else vector_.erase( idx(i) );
2039 for( ; i<
size(); ++i ) {
2040 vector_.erase( idx(i) );
2059 template<
typename VT
2061 ,
typename... CEAs >
2062 template<
typename VT2 >
2063 inline void Elements<VT,TF,false,CEAs...>::addAssign(
const Vector<VT2,TF>& rhs )
2065 using AddType = AddTrait_t< ResultType, ResultType_t<VT2> >;
2072 const AddType tmp(
serial( *
this + (~rhs) ) );
2091 template<
typename VT
2093 ,
typename... CEAs >
2094 template<
typename VT2 >
2095 inline void Elements<VT,TF,false,CEAs...>::subAssign(
const Vector<VT2,TF>& rhs )
2097 using SubType = SubTrait_t< ResultType, ResultType_t<VT2> >;
2104 const SubType tmp(
serial( *
this - (~rhs) ) );
#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
Constraint on the data type.
Header file for auxiliary alias declarations.
Header file for the blaze::checked and blaze::unchecked instances.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
#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
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.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
Header file for the SparseVector base class.
Header file for the View base class.
Header file for the serial shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i....
Definition: Computation.h:81
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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Header file for the IsIntegral type trait.
Constraint on the data type.
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i....
Definition: TransExpr.h:81
Header file for the extended initializer_list functionality.
Header file for the elements trait.
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
decltype(auto) operator *(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:9091
#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
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:138
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ELEMENTS_TYPE(T)
Constraint on the data type.In case the given data type T is an element selection (i....
Definition: Elements.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type,...
Definition: SparseVector.h:61
Constraint on the data type.
Header file for the SparseElement base class.
Header file for the implementation of the Elements base template.
Constraint on the data type.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:139
Constraint on the data type.
Header file for the exception macros of the math module.
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
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Constraint on the data type.
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:558
Header file for the IsConst type trait.
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance,...
Definition: Check.h:96
Header file for all forward declarations for expression class templates.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#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
Header file for the IsReference type trait.
#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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBVECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is a subvector type (i.e....
Definition: Subvector.h:81
Header file for the IsComputation type trait class.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
Header file for the implementation of the ElementsData class template.
auto operator *=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:494
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
Header file for the IsRestricted type trait.
#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
#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
Header file for the IsExpression type trait class.