35#ifndef _BLAZE_MATH_VIEWS_ELEMENTS_DENSE_H_
36#define _BLAZE_MATH_VIEWS_ELEMENTS_DENSE_H_
97class Elements<VT,TF,true,CEAs...>
98 :
public View< DenseVector< Elements<VT,TF,true,CEAs...>, TF > >
99 ,
private ElementsData<CEAs...>
103 using DataType = ElementsData<CEAs...>;
104 using Operand = If_t< IsExpression_v<VT>, VT, VT& >;
114 using This = Elements<VT,TF,
true,CEAs...>;
117 using BaseType = View< DenseVector<This,TF> >;
119 using ViewedType = VT;
120 using ResultType = ElementsTrait_t<VT,N>;
121 using TransposeType = TransposeType_t<ResultType>;
122 using ElementType = ElementType_t<VT>;
123 using ReturnType = ReturnType_t<VT>;
124 using CompositeType =
const Elements&;
127 using ConstReference = ConstReference_t<VT>;
130 using Reference = If_t< IsConst_v<VT>, ConstReference, Reference_t<VT> >;
133 using ConstPointer = ConstPointer_t<VT>;
136 using Pointer = If_t< IsConst_v<VT> || !HasMutableDataAccess_v<VT>, ConstPointer, Pointer_t<VT> >;
142 template<
typename ElementsType
143 ,
typename IteratorType >
144 class ElementsIterator
149 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
152 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
155 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
158 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
161 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
164 using iterator_category = IteratorCategory;
165 using value_type = ValueType;
166 using pointer = PointerType;
167 using reference = ReferenceType;
168 using difference_type = DifferenceType;
174 inline ElementsIterator()
175 : elements_( nullptr )
187 inline ElementsIterator( ElementsType* elements,
size_t index )
192 if( index_ < elements_->
size() )
193 pos_ = elements_->operand().begin() + elements_->idx( index_ );
202 template<
typename ElementsType2,
typename IteratorType2 >
203 inline ElementsIterator(
const ElementsIterator<ElementsType2,IteratorType2>& it )
204 : elements_( it.elements_ )
205 , index_ ( it.index_ )
216 inline ElementsIterator&
operator+=(
size_t inc ) {
219 if( index_ < elements_->
size() )
220 pos_ = elements_->operand().begin() + elements_->idx( index_ );
232 inline ElementsIterator&
operator-=(
size_t dec ) {
235 if( index_ < elements_->
size() )
236 pos_ = elements_->operand().begin() + elements_->idx( index_ );
247 inline ElementsIterator& operator++() {
250 if( index_ < elements_->
size() )
251 pos_ = elements_->operand().begin() + elements_->idx( index_ );
262 inline const ElementsIterator operator++(
int ) {
263 const ElementsIterator tmp( *
this );
274 inline ElementsIterator& operator--() {
277 if( index_ < elements_->
size() )
278 pos_ = elements_->operand().begin() + elements_->idx( index_ );
289 inline const ElementsIterator operator--(
int ) {
290 const ElementsIterator tmp( *
this );
302 inline ReferenceType operator[](
size_t index )
const {
303 const IteratorType pos( elements_->operand().begin() + elements_->idx( index_ + index ) );
323 inline PointerType operator->()
const {
334 inline bool operator==(
const ElementsIterator& rhs )
const {
335 return index_ == rhs.index_;
345 inline bool operator!=(
const ElementsIterator& rhs )
const {
346 return index_ != rhs.index_;
356 inline bool operator<(
const ElementsIterator& rhs )
const {
357 return index_ < rhs.index_;
367 inline bool operator>(
const ElementsIterator& rhs )
const {
368 return index_ > rhs.index_;
378 inline bool operator<=(
const ElementsIterator& rhs )
const {
379 return index_ <= rhs.index_;
389 inline bool operator>=(
const ElementsIterator& rhs )
const {
390 return index_ >= rhs.index_;
400 inline DifferenceType
operator-(
const ElementsIterator& rhs )
const {
401 return index_ - rhs.index_;
412 friend inline const ElementsIterator
operator+(
const ElementsIterator& it,
size_t inc ) {
413 return ElementsIterator( it.elements_, it.index_ + inc );
424 friend inline const ElementsIterator
operator+(
size_t inc,
const ElementsIterator& it ) {
425 return ElementsIterator( it.elements_, it.index_ + inc );
436 friend inline const ElementsIterator
operator-(
const ElementsIterator& it,
size_t dec ) {
437 return ElementsIterator( it.elements_, it.index_ - dec );
443 ElementsType* elements_;
449 template<
typename ElementsType2,
typename IteratorType2 >
friend class ElementsIterator;
456 using ConstIterator = ElementsIterator< const This, ConstIterator_t<VT> >;
459 using Iterator = If_t< IsConst_v<VT>, ConstIterator, ElementsIterator< This, Iterator_t<VT> > >;
464 static constexpr bool simdEnabled =
false;
467 static constexpr bool smpAssignable = VT::smpAssignable;
470 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
476 template<
typename... REAs >
477 explicit inline Elements( VT& vector, REAs... args );
479 Elements(
const Elements& ) =
default;
480 Elements( Elements&& ) =
default;
487 ~Elements() =
default;
494 inline Reference operator[](
size_t index );
495 inline ConstReference operator[](
size_t index )
const;
496 inline Reference at(
size_t index );
497 inline ConstReference at(
size_t index )
const;
498 inline Pointer
data () noexcept;
499 inline ConstPointer data () const noexcept;
500 inline Iterator begin ();
501 inline ConstIterator begin () const;
502 inline ConstIterator cbegin() const;
503 inline Iterator end ();
504 inline ConstIterator end () const;
505 inline ConstIterator cend () const;
512 inline Elements& operator= ( const ElementType& rhs );
513 inline Elements& operator= ( initializer_list<ElementType> list );
514 inline Elements& operator= ( const Elements& rhs );
515 template< typename VT2 > inline Elements& operator= ( const Vector<VT2,TF>& rhs );
516 template< typename VT2 > inline Elements& operator+=( const Vector<VT2,TF>& rhs );
517 template< typename VT2 > inline Elements& operator-=( const Vector<VT2,TF>& rhs );
518 template< typename VT2 > inline Elements& operator*=( const Vector<VT2,TF>& rhs );
519 template< typename VT2 > inline Elements& operator/=( const DenseVector<VT2,TF>& rhs );
520 template< typename VT2 > inline Elements& operator%=( const Vector<VT2,TF>& rhs );
527 using DataType::idces;
529 using DataType::size;
531 inline VT& operand() noexcept;
532 inline const VT& operand() const noexcept;
534 inline
size_t spacing() const noexcept;
535 inline
size_t capacity() const noexcept;
536 inline
size_t nonZeros() const;
544 template< typename Other > inline Elements& scale( const Other& scalar );
551 template< typename Other >
552 inline
bool canAlias( const Other* alias ) const noexcept;
554 template< typename Other >
555 inline
bool isAliased( const Other* alias ) const noexcept;
557 inline
bool isAligned () const noexcept;
558 inline
bool canSMPAssign() const noexcept;
560 template< typename VT2 > inline
void assign ( const DenseVector <VT2,TF>& rhs );
561 template< typename VT2 > inline
void assign ( const SparseVector<VT2,TF>& rhs );
562 template< typename VT2 > inline
void addAssign ( const DenseVector <VT2,TF>& rhs );
563 template< typename VT2 > inline
void addAssign ( const SparseVector<VT2,TF>& rhs );
564 template< typename VT2 > inline
void subAssign ( const DenseVector <VT2,TF>& rhs );
565 template< typename VT2 > inline
void subAssign ( const SparseVector<VT2,TF>& rhs );
566 template< typename VT2 > inline
void multAssign( const DenseVector <VT2,TF>& rhs );
567 template< typename VT2 > inline
void multAssign( const SparseVector<VT2,TF>& rhs );
568 template< typename VT2 > inline
void divAssign ( const DenseVector <VT2,TF>& rhs );
617template< typename... REAs >
618inline Elements<VT,TF,true,CEAs...>::Elements( VT& vector, REAs... args )
619 : DataType( args... )
623 for( size_t i=0UL; i<size(); ++i ) {
624 if( vector_.size() <= idx(i) ) {
625 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid element access index" );
655inline typename Elements<VT,TF,
true,CEAs...>::Reference
656 Elements<VT,TF,true,CEAs...>::operator[](
size_t index )
659 return vector_[idx(index)];
678inline typename Elements<VT,TF,
true,CEAs...>::ConstReference
679 Elements<VT,TF,true,CEAs...>::operator[](
size_t index )
const
682 return const_cast<const VT&
>( vector_ )[idx(index)];
702inline typename Elements<VT,TF,
true,CEAs...>::Reference
703 Elements<VT,TF,true,CEAs...>::at(
size_t index )
705 if( index >=
size() ) {
708 return (*
this)[index];
728inline typename Elements<VT,TF,
true,CEAs...>::ConstReference
729 Elements<VT,TF,true,CEAs...>::at(
size_t index )
const
731 if( index >=
size() ) {
734 return (*
this)[index];
751inline typename Elements<VT,TF,
true,CEAs...>::Pointer
752 Elements<VT,TF,true,CEAs...>::data() noexcept
754 return vector_.data() + idx(0UL);
771inline typename Elements<VT,TF,
true,CEAs...>::ConstPointer
772 Elements<VT,TF,true,CEAs...>::data() const noexcept
774 return vector_.data() + idx(0UL);
791inline typename Elements<VT,TF,
true,CEAs...>::Iterator
792 Elements<VT,TF,true,CEAs...>::begin()
794 return Iterator(
this, 0UL );
811inline typename Elements<VT,TF,
true,CEAs...>::ConstIterator
812 Elements<VT,TF,true,CEAs...>::begin()
const
814 return ConstIterator(
this, 0UL );
831inline typename Elements<VT,TF,
true,CEAs...>::ConstIterator
832 Elements<VT,TF,true,CEAs...>::cbegin()
const
834 return ConstIterator(
this, 0UL );
851inline typename Elements<VT,TF,
true,CEAs...>::Iterator
852 Elements<VT,TF,true,CEAs...>::end()
854 return Iterator(
this,
size() );
871inline typename Elements<VT,TF,
true,CEAs...>::ConstIterator
872 Elements<VT,TF,true,CEAs...>::end()
const
874 return ConstIterator(
this,
size() );
891inline typename Elements<VT,TF,
true,CEAs...>::ConstIterator
892 Elements<VT,TF,true,CEAs...>::cend()
const
894 return ConstIterator(
this,
size() );
918inline Elements<VT,TF,
true,CEAs...>&
919 Elements<VT,TF,true,CEAs...>::operator=(
const ElementType& rhs )
921 decltype(
auto) left( derestrict( vector_ ) );
923 for(
size_t i=0UL; i<
size(); ++i ) {
924 const size_t index( idx(i) );
954inline Elements<VT,TF,
true,CEAs...>&
955 Elements<VT,TF,true,CEAs...>::operator=( initializer_list<ElementType> list )
957 if( list.size() >
size() ) {
964 for(
size_t i=0UL; i<
size(); ++i ) {
965 if( !trySet( vector_, idx(i), tmp[i] ) ) {
971 decltype(
auto) left( derestrict( vector_ ) );
972 for(
size_t i=0UL; i<
size(); ++i ) {
973 left[idx(i)] = tmp[i];
999inline Elements<VT,TF,
true,CEAs...>&
1000 Elements<VT,TF,true,CEAs...>::operator=(
const Elements& rhs )
1005 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && compareIndices( *
this, rhs ) ) )
1008 if(
size() != rhs.size() ) {
1013 for(
size_t i=0UL; i<
size(); ++i ) {
1014 if( !trySet( vector_, idx(i), rhs[i] ) ) {
1020 decltype(
auto) left( derestrict( *
this ) );
1022 if( rhs.canAlias(
this ) ) {
1023 const ResultType tmp( rhs );
1050template<
typename VT
1052 ,
typename... CEAs >
1053template<
typename VT2 >
1054inline Elements<VT,TF,
true,CEAs...>&
1055 Elements<VT,TF,true,CEAs...>::operator=(
const Vector<VT2,TF>& rhs )
1060 if(
size() != (*rhs).size() ) {
1065 Right right( *rhs );
1068 for(
size_t i=0UL; i<
size(); ++i ) {
1069 if( !trySet( vector_, idx(i), right[i] ) ) {
1075 decltype(
auto) left( derestrict( *
this ) );
1107template<
typename VT
1109 ,
typename... CEAs >
1110template<
typename VT2 >
1111inline Elements<VT,TF,
true,CEAs...>&
1112 Elements<VT,TF,true,CEAs...>::operator+=(
const Vector<VT2,TF>& rhs )
1117 if(
size() != (*rhs).size() ) {
1122 Right right( *rhs );
1125 for(
size_t i=0UL; i<
size(); ++i ) {
1126 if( !tryAdd( vector_, idx(i), right[i] ) ) {
1132 decltype(
auto) left( derestrict( *
this ) );
1162template<
typename VT
1164 ,
typename... CEAs >
1165template<
typename VT2 >
1166inline Elements<VT,TF,
true,CEAs...>&
1167 Elements<VT,TF,true,CEAs...>::operator-=(
const Vector<VT2,TF>& rhs )
1172 if(
size() != (*rhs).size() ) {
1177 Right right( *rhs );
1180 for(
size_t i=0UL; i<
size(); ++i ) {
1181 if( !trySub( vector_, idx(i), right[i] ) ) {
1187 decltype(
auto) left( derestrict( *
this ) );
1218template<
typename VT
1220 ,
typename... CEAs >
1221template<
typename VT2 >
1222inline Elements<VT,TF,
true,CEAs...>&
1223 Elements<VT,TF,true,CEAs...>::operator*=(
const Vector<VT2,TF>& rhs )
1228 if(
size() != (*rhs).size() ) {
1233 Right right( *rhs );
1236 for(
size_t i=0UL; i<
size(); ++i ) {
1237 if( !tryMult( vector_, idx(i), right[i] ) ) {
1243 decltype(
auto) left( derestrict( *
this ) );
1273template<
typename VT
1275 ,
typename... CEAs >
1276template<
typename VT2 >
1277inline Elements<VT,TF,
true,CEAs...>&
1283 if(
size() != (*rhs).size() ) {
1288 Right right( *rhs );
1291 for(
size_t i=0UL; i<
size(); ++i ) {
1292 if( !tryDiv( vector_, idx(i), right[i] ) ) {
1298 decltype(
auto) left( derestrict( *
this ) );
1329template<
typename VT
1331 ,
typename... CEAs >
1332template<
typename VT2 >
1333inline Elements<VT,TF,
true,CEAs...>&
1334 Elements<VT,TF,true,CEAs...>::operator%=(
const Vector<VT2,TF>& rhs )
1336 using blaze::assign;
1347 if(
size() != 3UL || (*rhs).size() != 3UL ) {
1351 const CrossType tmp( *
this % (*rhs) );
1354 for(
size_t i=0UL; i<
size(); ++i ) {
1355 if( !trySet( vector_, idx(i), tmp[i] ) ) {
1361 decltype(
auto) left( derestrict( *
this ) );
1363 assign( left, tmp );
1387template<
typename VT
1389 ,
typename... CEAs >
1390inline VT& Elements<VT,TF,true,CEAs...>::operand() noexcept
1404template<
typename VT
1406 ,
typename... CEAs >
1407inline const VT& Elements<VT,TF,true,CEAs...>::operand() const noexcept
1421template<
typename VT
1423 ,
typename... CEAs >
1424inline size_t Elements<VT,TF,true,CEAs...>::spacing() const noexcept
1438template<
typename VT
1440 ,
typename... CEAs >
1441inline size_t Elements<VT,TF,true,CEAs...>::capacity() const noexcept
1458template<
typename VT
1460 ,
typename... CEAs >
1461inline size_t Elements<VT,TF,true,CEAs...>::nonZeros()
const
1463 size_t nonzeros( 0 );
1465 for(
size_t i=0UL; i<
size(); ++i ) {
1482template<
typename VT
1484 ,
typename... CEAs >
1485inline void Elements<VT,TF,true,CEAs...>::reset()
1489 for(
size_t i=0UL; i<
size(); ++i )
1490 clear( vector_[idx(i)] );
1515template<
typename VT
1517 ,
typename... CEAs >
1518template<
typename Other >
1519inline Elements<VT,TF,
true,CEAs...>&
1520 Elements<VT,TF,true,CEAs...>::scale(
const Other& scalar )
1522 for(
size_t i=0UL; i<
size(); ++i )
1523 vector_[idx(i)] *= scalar;
1549template<
typename VT
1551 ,
typename... CEAs >
1552template<
typename Other >
1553inline bool Elements<VT,TF,true,CEAs...>::canAlias(
const Other* alias )
const noexcept
1555 return vector_.isAliased( &unview( *alias ) );
1572template<
typename VT
1574 ,
typename... CEAs >
1575template<
typename Other >
1576inline bool Elements<VT,TF,true,CEAs...>::isAliased(
const Other* alias )
const noexcept
1578 return vector_.isAliased( &unview( *alias ) );
1594template<
typename VT
1596 ,
typename... CEAs >
1597inline bool Elements<VT,TF,true,CEAs...>::isAligned() const noexcept
1616template<
typename VT
1618 ,
typename... CEAs >
1619inline bool Elements<VT,TF,true,CEAs...>::canSMPAssign() const noexcept
1621 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1639template<
typename VT
1641 ,
typename... CEAs >
1642template<
typename VT2 >
1650 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1651 vector_[idx(i )] = (*rhs)[i ];
1652 vector_[idx(i+1UL)] = (*rhs)[i+1UL];
1654 if( ipos <
size() ) {
1655 vector_[idx(ipos)] = (*rhs)[ipos];
1674template<
typename VT
1676 ,
typename... CEAs >
1677template<
typename VT2 >
1683 vector_[idx(element->index())] = element->value();
1701template<
typename VT
1703 ,
typename... CEAs >
1704template<
typename VT2 >
1712 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1713 vector_[idx(i )] += (*rhs)[i ];
1714 vector_[idx(i+1UL)] += (*rhs)[i+1UL];
1716 if( ipos <
size() ) {
1717 vector_[idx(ipos)] += (*rhs)[ipos];
1736template<
typename VT
1738 ,
typename... CEAs >
1739template<
typename VT2 >
1745 vector_[idx(element->index())] += element->value();
1763template<
typename VT
1765 ,
typename... CEAs >
1766template<
typename VT2 >
1774 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1775 vector_[idx(i )] -= (*rhs)[i ];
1776 vector_[idx(i+1UL)] -= (*rhs)[i+1UL];
1778 if( ipos <
size() ) {
1779 vector_[idx(ipos)] -= (*rhs)[ipos];
1798template<
typename VT
1800 ,
typename... CEAs >
1801template<
typename VT2 >
1807 vector_[idx(element->index())] -= element->value();
1825template<
typename VT
1827 ,
typename... CEAs >
1828template<
typename VT2 >
1836 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1837 vector_[idx(i )] *= (*rhs)[i ];
1838 vector_[idx(i+1UL)] *= (*rhs)[i+1UL];
1840 if( ipos <
size() ) {
1841 vector_[idx(ipos)] *= (*rhs)[ipos];
1860template<
typename VT
1862 ,
typename... CEAs >
1863template<
typename VT2 >
1873 const size_t index( element->index() );
1874 for( ; i<index; ++i )
1875 reset( vector_[idx(i)] );
1876 vector_[idx(i)] *= element->value();
1880 for( ; i<
size(); ++i ) {
1881 reset( vector_[idx(i)] );
1900template<
typename VT
1902 ,
typename... CEAs >
1903template<
typename VT2 >
1911 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1912 vector_[idx(i )] /= (*rhs)[i ];
1913 vector_[idx(i+1UL)] /= (*rhs)[i+1UL];
1915 if( ipos <
size() ) {
1916 vector_[idx(ipos)] /= (*rhs)[ipos];
1943template<
typename VT1
1946 ,
typename... CEAs >
1948 :
public View< DenseVector< Elements< const DVecDVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
1949 ,
private ElementsData<CEAs...>
1953 using CPE = DVecDVecCrossExpr<VT1,VT2,TF>;
1954 using RT = ResultType_t<CPE>;
1955 using DataType = ElementsData<CEAs...>;
1965 using This = Elements<
const CPE,TF,
true,CEAs...>;
1968 using BaseType = View< DenseVector<This,TF> >;
1970 using ViewedType = CPE;
1971 using ResultType = ElementsTrait_t<RT,N>;
1972 using TransposeType = TransposeType_t<ResultType>;
1973 using ElementType = ElementType_t<CPE>;
1974 using ReturnType = ReturnType_t<CPE>;
1975 using CompositeType =
const ResultType;
1980 static constexpr bool simdEnabled =
false;
1983 static constexpr bool smpAssignable =
false;
1986 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
1996 template<
typename... REAs >
1997 explicit inline Elements(
const CPE& vector, REAs... args )
1998 : DataType( args... )
1999 , vector_ ( vector )
2002 for( size_t i=0UL; i<size(); ++i ) {
2003 if( vector_.size() <= idx(i) ) {
2004 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid element access index" );
2017 inline ReturnType operator[](
size_t index )
const {
2019 return vector_[idx(index)];
2030 inline ReturnType at(
size_t index )
const {
2031 if( index >=
size() ) {
2034 return (*
this)[index];
2039 using DataType::idces;
2040 using DataType::idx;
2041 using DataType::size;
2049 inline CPE operand() const noexcept {
2060 template<
typename T >
2061 inline bool canAlias(
const T* alias )
const noexcept {
2062 return vector_.canAlias( &unview( *alias ) );
2072 template<
typename T >
2073 inline bool isAliased(
const T* alias )
const noexcept {
2074 return vector_.isAliased( &unview( *alias ) );
2107template<
typename VT1
2110 ,
typename... CEAs >
2111class Elements< const DVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >
2112 :
public View< DenseVector< Elements< const DVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
2113 ,
private ElementsData<CEAs...>
2117 using CPE = DVecSVecCrossExpr<VT1,VT2,TF>;
2118 using RT = ResultType_t<CPE>;
2119 using DataType = ElementsData<CEAs...>;
2129 using This = Elements<
const CPE,TF,
true,CEAs...>;
2132 using BaseType = View< DenseVector<This,TF> >;
2134 using ViewedType = CPE;
2135 using ResultType = ElementsTrait_t<RT,N>;
2136 using TransposeType = TransposeType_t<ResultType>;
2137 using ElementType = ElementType_t<CPE>;
2138 using ReturnType = ReturnType_t<CPE>;
2139 using CompositeType =
const ResultType;
2144 static constexpr bool simdEnabled =
false;
2147 static constexpr bool smpAssignable =
false;
2150 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2160 template<
typename... REAs >
2161 explicit inline Elements(
const CPE& vector, REAs... args )
2162 : DataType( args... )
2163 , vector_ ( vector )
2166 for( size_t i=0UL; i<size(); ++i ) {
2167 if( vector_.size() <= idx(i) ) {
2168 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid element access index" );
2181 inline ReturnType operator[](
size_t index )
const {
2183 return vector_[idx(index)];
2194 inline ReturnType at(
size_t index )
const {
2195 if( index >=
size() ) {
2198 return (*
this)[index];
2203 using DataType::idces;
2204 using DataType::idx;
2205 using DataType::size;
2213 inline CPE operand() const noexcept {
2224 template<
typename T >
2225 inline bool canAlias(
const T* alias )
const noexcept {
2226 return vector_.canAlias( &unview( *alias ) );
2236 template<
typename T >
2237 inline bool isAliased(
const T* alias )
const noexcept {
2238 return vector_.isAliased( &unview( *alias ) );
2271template<
typename VT1
2274 ,
typename... CEAs >
2275class Elements< const SVecDVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >
2276 :
public View< DenseVector< Elements< const SVecDVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
2277 ,
private ElementsData<CEAs...>
2281 using CPE = SVecDVecCrossExpr<VT1,VT2,TF>;
2282 using RT = ResultType_t<CPE>;
2283 using DataType = ElementsData<CEAs...>;
2293 using This = Elements<
const CPE,TF,
true,CEAs...>;
2296 using BaseType = View< DenseVector<This,TF> >;
2298 using ViewedType = CPE;
2299 using ResultType = ElementsTrait_t<RT,N>;
2300 using TransposeType = TransposeType_t<ResultType>;
2301 using ElementType = ElementType_t<CPE>;
2302 using ReturnType = ReturnType_t<CPE>;
2303 using CompositeType =
const ResultType;
2308 static constexpr bool simdEnabled =
false;
2311 static constexpr bool smpAssignable =
false;
2314 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2324 template<
typename... REAs >
2325 explicit inline Elements(
const CPE& vector, REAs... args )
2326 : DataType( args... )
2327 , vector_ ( vector )
2330 for( size_t i=0UL; i<size(); ++i ) {
2331 if( vector_.size() <= idx(i) ) {
2332 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid element access index" );
2345 inline ReturnType operator[](
size_t index )
const {
2347 return vector_[idx(index)];
2358 inline ReturnType at(
size_t index )
const {
2359 if( index >=
size() ) {
2362 return (*
this)[index];
2367 using DataType::idces;
2368 using DataType::idx;
2369 using DataType::size;
2377 inline CPE operand() const noexcept {
2388 template<
typename T >
2389 inline bool canAlias(
const T* alias )
const noexcept {
2390 return vector_.canAlias( &unview( *alias ) );
2400 template<
typename T >
2401 inline bool isAliased(
const T* alias )
const noexcept {
2402 return vector_.isAliased( &unview( *alias ) );
2435template<
typename VT1
2438 ,
typename... CEAs >
2439class Elements< const SVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >
2440 :
public View< DenseVector< Elements< const SVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
2441 ,
private ElementsData<CEAs...>
2445 using CPE = SVecSVecCrossExpr<VT1,VT2,TF>;
2446 using RT = ResultType_t<CPE>;
2447 using DataType = ElementsData<CEAs...>;
2457 using This = Elements<
const CPE,TF,
true,CEAs...>;
2460 using BaseType = View< DenseVector<This,TF> >;
2462 using ViewedType = CPE;
2463 using ResultType = ElementsTrait_t<RT,N>;
2464 using TransposeType = TransposeType_t<ResultType>;
2465 using ElementType = ElementType_t<CPE>;
2466 using ReturnType = ReturnType_t<CPE>;
2467 using CompositeType =
const ResultType;
2472 static constexpr bool simdEnabled =
false;
2475 static constexpr bool smpAssignable =
false;
2478 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2488 template<
typename... REAs >
2489 explicit inline Elements(
const CPE& vector, REAs... args )
2490 : DataType( args... )
2491 , vector_ ( vector )
2494 for( size_t i=0UL; i<size(); ++i ) {
2495 if( vector_.size() <= idx(i) ) {
2496 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid element access index" );
2509 inline ReturnType operator[](
size_t index )
const {
2511 return vector_[idx(index)];
2522 inline ReturnType at(
size_t index )
const {
2523 if( index >=
size() ) {
2526 return (*
this)[index];
2531 using DataType::idces;
2532 using DataType::idx;
2533 using DataType::size;
2541 inline CPE operand() const noexcept {
2552 template<
typename T >
2553 inline bool canAlias(
const T* alias )
const noexcept {
2554 return vector_.canAlias( &unview( *alias ) );
2564 template<
typename T >
2565 inline bool isAliased(
const T* alias )
const noexcept {
2566 return vector_.isAliased( &unview( *alias ) );
Header file for auxiliary alias declarations.
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition Aliases.h:130
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition Aliases.h:110
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 blaze::checked and blaze::unchecked instances.
Header file for the cross product trait.
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:751
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition DenseIterator.h:719
Header file for the implementation of the ElementsData class template.
Header file for the elements trait.
Header file for the HasMutableDataAccess type trait.
Header file for the If class template.
Header file for the IsConst type trait.
Header file for the isDefault shim.
Header file for the IsExpression type trait class.
Header file for the IsReference type trait.
Header file for the IsRestricted type trait.
Header file for the IsSparseVector type trait.
Deactivation of problematic macros.
Header file for the prevMultiple shim.
Expression object for dense vector-dense vector cross products.
Definition DVecDVecCrossExpr.h:90
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Dense vector representation of an initializer list.
Definition InitializerVector.h:182
Base class for sparse vectors.
Definition SparseVector.h:72
Base class for N-dimensional vectors.
Definition Vector.h:82
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of a vector representation of an initializer list.
Header file for the DenseVector base class.
Header file for the View base class.
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition DenseMatrix.h:182
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition DenseMatrix.h:386
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:9640
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition DenseMatrix.h:448
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition DiagonalMatrix.h:207
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition Elements.h:143
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.
Definition TransExpr.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_NOT_BE_ELEMENTS_TYPE(T)
Constraint on the data type.
Definition Elements.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBVECTOR_TYPE(T)
Constraint on the data type.
Definition Subvector.h:81
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.
Definition CrossTrait.h:138
constexpr bool IsSparseVector_v
Auxiliary variable template for the IsSparseVector type trait.
Definition IsSparseVector.h:124
constexpr bool IsRestricted_v
Auxiliary variable template for the IsRestricted type trait.
Definition IsRestricted.h:140
BLAZE_ALWAYS_INLINE constexpr auto prevMultiple(T1 value, T2 factor) noexcept
Rounds down an integral value to the previous multiple of a given factor.
Definition PrevMultiple.h:68
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition Accuracy.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 operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition Accuracy.h:332
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition Accuracy.h:446
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
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition Accuracy.h:408
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition Matrix.h:960
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition Matrix.h:806
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
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition DenseVector.h:221
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition DenseMatrix.h:162
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition DenseMatrix.h:100
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition DenseVector.h:192
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition DenseMatrix.h:131
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.
Definition IsReference.h:95
#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
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition If.h:108
constexpr bool isChecked(const Ts &... args)
Extracting blaze::Check arguments from a given list of arguments.
Definition Check.h:225
Header file for the exception macros of the math module.
Header file for the extended initializer_list functionality.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the clear shim.
Header file for the reset shim.
Base class for all views.
Definition View.h:67
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the implementation of the Elements base template.