35 #ifndef _BLAZE_MATH_VIEWS_ELEMENTS_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_ELEMENTS_DENSE_H_ 97 class 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_< IsExpression<VT>, VT, VT& >;
110 using This = Elements<VT,TF,
true,CEAs...>;
112 using BaseType = DenseVector<This,TF>;
113 using ViewedType = VT;
127 using ConstPointer = ConstPointer_<VT>;
130 using Pointer = If_< Or< IsConst<VT>, Not< HasMutableDataAccess<VT> > >, ConstPointer, Pointer_<VT> >;
136 template<
typename ElementsType
137 ,
typename IteratorType >
138 class ElementsIterator
143 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
146 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
149 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
152 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
155 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
158 using iterator_category = IteratorCategory;
159 using value_type = ValueType;
160 using pointer = PointerType;
161 using reference = ReferenceType;
162 using difference_type = DifferenceType;
168 inline ElementsIterator()
169 : elements_( nullptr )
181 inline ElementsIterator( ElementsType*
elements,
size_t index )
182 : elements_( elements )
186 if( index_ < elements_->
size() )
187 pos_ = elements_->operand().begin() + elements_->idx( index_ );
196 template<
typename ElementsType2,
typename IteratorType2 >
197 inline ElementsIterator(
const ElementsIterator<ElementsType2,IteratorType2>& it )
198 : elements_( it.elements_ )
199 , index_ ( it.index_ )
210 inline ElementsIterator&
operator+=(
size_t inc ) {
213 if( index_ < elements_->
size() )
214 pos_ = elements_->operand().begin() + elements_->idx( index_ );
226 inline ElementsIterator&
operator-=(
size_t dec ) {
229 if( index_ < elements_->
size() )
230 pos_ = elements_->operand().begin() + elements_->idx( index_ );
241 inline ElementsIterator& operator++() {
244 if( index_ < elements_->
size() )
245 pos_ = elements_->operand().begin() + elements_->idx( index_ );
256 inline const ElementsIterator operator++(
int ) {
257 const ElementsIterator tmp( *
this );
268 inline ElementsIterator& operator--() {
271 if( index_ < elements_->
size() )
272 pos_ = elements_->operand().begin() + elements_->idx( index_ );
283 inline const ElementsIterator operator--(
int ) {
284 const ElementsIterator tmp( *
this );
296 inline ReferenceType operator[](
size_t index )
const {
297 const IteratorType pos( elements_->operand().begin() + elements_->idx( index_ + index ) );
317 inline PointerType operator->()
const {
328 inline bool operator==(
const ElementsIterator& rhs )
const {
329 return index_ == rhs.index_;
339 inline bool operator!=(
const ElementsIterator& rhs )
const {
340 return index_ != rhs.index_;
350 inline bool operator<(
const ElementsIterator& rhs )
const {
351 return index_ < rhs.index_;
361 inline bool operator>(
const ElementsIterator& rhs )
const {
362 return index_ > rhs.index_;
372 inline bool operator<=(
const ElementsIterator& rhs )
const {
373 return index_ <= rhs.index_;
383 inline bool operator>=(
const ElementsIterator& rhs )
const {
384 return index_ >= rhs.index_;
394 inline DifferenceType
operator-(
const ElementsIterator& rhs )
const {
395 return index_ - rhs.index_;
406 friend inline const ElementsIterator
operator+(
const ElementsIterator& it,
size_t inc ) {
407 return ElementsIterator( it.elements_, it.index_ + inc );
418 friend inline const ElementsIterator
operator+(
size_t inc,
const ElementsIterator& it ) {
419 return ElementsIterator( it.elements_, it.index_ + inc );
430 friend inline const ElementsIterator
operator-(
const ElementsIterator& it,
size_t dec ) {
431 return ElementsIterator( it.elements_, it.index_ - dec );
437 ElementsType* elements_;
443 template<
typename ElementsType2,
typename IteratorType2 >
friend class ElementsIterator;
450 using ConstIterator = ElementsIterator< const This, ConstIterator_<VT> >;
458 enum :
bool { simdEnabled =
false };
461 enum :
bool { smpAssignable = VT::smpAssignable };
467 template<
typename... REAs >
468 explicit inline Elements( VT& vector, REAs... args );
470 inline Elements(
const Elements& ) =
default;
471 inline Elements( Elements&& ) =
default;
482 inline Reference operator[](
size_t index );
483 inline ConstReference operator[](
size_t index )
const;
485 inline ConstReference at(
size_t index )
const;
486 inline Pointer
data () noexcept;
487 inline ConstPointer
data () const noexcept;
489 inline ConstIterator begin () const;
490 inline ConstIterator
cbegin() const;
492 inline ConstIterator end () const;
493 inline ConstIterator
cend () const;
500 inline Elements& operator= ( const
ElementType& rhs );
501 inline Elements& operator= ( initializer_list<
ElementType> list );
502 inline Elements& operator= ( const Elements& rhs );
503 template< typename VT2 > inline Elements& operator= ( const Vector<VT2,TF>& rhs );
504 template< typename VT2 > inline Elements& operator+=( const Vector<VT2,TF>& rhs );
505 template< typename VT2 > inline Elements& operator-=( const Vector<VT2,TF>& rhs );
506 template< typename VT2 > inline Elements& operator*=( const Vector<VT2,TF>& rhs );
507 template< typename VT2 > inline Elements& operator/=( const DenseVector<VT2,TF>& rhs );
508 template< typename VT2 > inline Elements& operator%=( const Vector<VT2,TF>& rhs );
515 using DataType::idces;
517 using DataType::
size;
519 inline VT& operand() noexcept;
520 inline const VT& operand() const noexcept;
522 inline
size_t spacing() const noexcept;
523 inline
size_t capacity() const noexcept;
532 template< typename Other > inline Elements& scale( const Other& scalar );
539 template< typename Other >
540 inline
bool canAlias( const Other* alias ) const noexcept;
542 template< typename Other >
543 inline
bool isAliased( const Other* alias ) const noexcept;
545 inline
bool isAligned () const noexcept;
546 inline
bool canSMPAssign() const noexcept;
548 template< typename VT2 > inline
void assign ( const DenseVector <VT2,TF>& rhs );
549 template< typename VT2 > inline
void assign ( const SparseVector<VT2,TF>& rhs );
550 template< typename VT2 > inline
void addAssign ( const DenseVector <VT2,TF>& rhs );
551 template< typename VT2 > inline
void addAssign ( const SparseVector<VT2,TF>& rhs );
552 template< typename VT2 > inline
void subAssign ( const DenseVector <VT2,TF>& rhs );
553 template< typename VT2 > inline
void subAssign ( const SparseVector<VT2,TF>& rhs );
554 template< typename VT2 > inline
void multAssign( const DenseVector <VT2,TF>& rhs );
555 template< typename VT2 > inline
void multAssign( const SparseVector<VT2,TF>& rhs );
556 template< typename VT2 > inline
void divAssign ( const DenseVector <VT2,TF>& rhs );
601 template< typename VT
604 template< typename... REAs >
605 inline Elements<VT,TF,true,CEAs...>::Elements( VT& vector, REAs... args )
606 : DataType( args... )
609 if( !Contains< TypeList<REAs...>,
Unchecked >::value ) {
610 for(
size_t i=0UL; i<
size(); ++i ) {
611 if( vector_.size() <= idx(i) ) {
639 template<
typename VT
642 inline typename Elements<VT,TF,
true,CEAs...>
::Reference 643 Elements<VT,TF,true,CEAs...>::operator[](
size_t index )
646 return vector_[idx(index)];
662 template<
typename VT
666 Elements<VT,TF,true,CEAs...>::operator[](
size_t index )
const 669 return const_cast<const VT&
>( vector_ )[idx(index)];
686 template<
typename VT
689 inline typename Elements<VT,TF,
true,CEAs...>
::Reference 690 Elements<VT,TF,true,CEAs...>::at(
size_t index )
692 if( index >=
size() ) {
695 return (*
this)[index];
712 template<
typename VT
716 Elements<VT,TF,true,CEAs...>::at(
size_t index )
const 718 if( index >=
size() ) {
721 return (*
this)[index];
735 template<
typename VT
738 inline typename Elements<VT,TF,
true,CEAs...>::Pointer
741 return vector_.data() + idx(0UL);
755 template<
typename VT
758 inline typename Elements<VT,TF,
true,CEAs...>::ConstPointer
761 return vector_.data() + idx(0UL);
775 template<
typename VT
778 inline typename Elements<VT,TF,
true,CEAs...>
::Iterator 795 template<
typename VT
815 template<
typename VT
835 template<
typename VT
838 inline typename Elements<VT,TF,
true,CEAs...>
::Iterator 855 template<
typename VT
875 template<
typename VT
902 template<
typename VT
905 inline Elements<VT,TF,
true,CEAs...>&
906 Elements<VT,TF,true,CEAs...>::operator=(
const ElementType& rhs )
908 decltype(
auto) left( derestrict( vector_ ) );
910 for(
size_t i=0UL; i<size(); ++i ) {
911 const size_t index( idx(i) );
912 if( !IsRestricted<VT>::value || trySet( vector_, index, rhs ) )
938 template<
typename VT
941 inline Elements<VT,TF,
true,CEAs...>&
942 Elements<VT,TF,true,CEAs...>::operator=( initializer_list<ElementType> list )
944 if( list.size() >
size() ) {
948 const InitializerVector<ElementType,TF> tmp( list,
size() );
950 if( IsRestricted<VT>::value ) {
951 for(
size_t i=0UL; i<
size(); ++i ) {
952 if( !trySet( vector_, idx(i), tmp[i] ) ) {
958 decltype(
auto) left( derestrict( vector_ ) );
959 for(
size_t i=0UL; i<size(); ++i ) {
960 left[idx(i)] = tmp[i];
983 template<
typename VT
986 inline Elements<VT,TF,
true,CEAs...>&
987 Elements<VT,TF,true,CEAs...>::operator=(
const Elements& rhs )
992 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && idces() == rhs.idces() ) )
995 if(
size() != rhs.size() ) {
999 if( IsRestricted<VT>::value ) {
1000 for(
size_t i=0UL; i<
size(); ++i ) {
1001 if( !trySet( vector_, idx(i), rhs[i] ) ) {
1007 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1009 if( rhs.canAlias( &vector_ ) ) {
1037 template<
typename VT
1040 template<
typename VT2 >
1041 inline Elements<VT,TF,
true,CEAs...>&
1042 Elements<VT,TF,true,CEAs...>::operator=(
const Vector<VT2,TF>& rhs )
1051 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1052 Right right( ~rhs );
1054 if( IsRestricted<VT>::value ) {
1055 for(
size_t i=0UL; i<
size(); ++i ) {
1056 if( !trySet( vector_, idx(i), right[i] ) ) {
1062 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1064 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1065 const ResultType_<VT2> tmp( right );
1069 if( IsSparseVector<VT2>::value )
1094 template<
typename VT
1097 template<
typename VT2 >
1098 inline Elements<VT,TF,
true,CEAs...>&
1108 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1109 Right right( ~rhs );
1111 if( IsRestricted<VT>::value ) {
1112 for(
size_t i=0UL; i<
size(); ++i ) {
1113 if( !tryAdd( vector_, idx(i), right[i] ) ) {
1119 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1121 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1122 const ResultType_<VT2> tmp( right );
1149 template<
typename VT
1152 template<
typename VT2 >
1153 inline Elements<VT,TF,
true,CEAs...>&
1163 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1164 Right right( ~rhs );
1166 if( IsRestricted<VT>::value ) {
1167 for(
size_t i=0UL; i<
size(); ++i ) {
1168 if( !trySub( vector_, idx(i), right[i] ) ) {
1174 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1176 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1177 const ResultType_<VT2> tmp( right );
1205 template<
typename VT
1208 template<
typename VT2 >
1209 inline Elements<VT,TF,
true,CEAs...>&
1219 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1220 Right right( ~rhs );
1222 if( IsRestricted<VT>::value ) {
1223 for(
size_t i=0UL; i<
size(); ++i ) {
1224 if( !tryMult( vector_, idx(i), right[i] ) ) {
1230 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1232 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1233 const ResultType_<VT2> tmp( right );
1260 template<
typename VT
1263 template<
typename VT2 >
1264 inline Elements<VT,TF,
true,CEAs...>&
1274 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1275 Right right( ~rhs );
1277 if( IsRestricted<VT>::value ) {
1278 for(
size_t i=0UL; i<
size(); ++i ) {
1279 if( !tryDiv( vector_, idx(i), right[i] ) ) {
1285 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1287 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1288 const ResultType_<VT2> tmp( right );
1316 template<
typename VT
1319 template<
typename VT2 >
1320 inline Elements<VT,TF,
true,CEAs...>&
1321 Elements<VT,TF,true,CEAs...>::operator%=(
const Vector<VT2,TF>& rhs )
1323 using blaze::assign;
1328 using CrossType = CrossTrait_< ResultType, ResultType_<VT2> >;
1334 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1338 const CrossType tmp( *
this % (~rhs) );
1340 if( IsRestricted<VT>::value ) {
1341 for(
size_t i=0UL; i<
size(); ++i ) {
1342 if( !trySet( vector_, idx(i), tmp[i] ) ) {
1348 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1350 assign( left, tmp );
1374 template<
typename VT
1377 inline VT& Elements<VT,TF,true,CEAs...>::operand() noexcept
1391 template<
typename VT
1394 inline const VT& Elements<VT,TF,true,CEAs...>::operand() const noexcept
1408 template<
typename VT
1425 template<
typename VT
1445 template<
typename VT
1450 size_t nonzeros( 0 );
1452 for(
size_t i=0UL; i<
size(); ++i ) {
1469 template<
typename VT
1476 for(
size_t i=0UL; i<
size(); ++i )
1477 clear( vector_[idx(i)] );
1502 template<
typename VT
1505 template<
typename Other >
1506 inline Elements<VT,TF,
true,CEAs...>&
1507 Elements<VT,TF,true,CEAs...>::scale(
const Other& scalar )
1509 for(
size_t i=0UL; i<
size(); ++i )
1510 vector_[idx(i)] *= scalar;
1536 template<
typename VT
1539 template<
typename Other >
1540 inline bool Elements<VT,TF,true,CEAs...>::canAlias(
const Other* alias )
const noexcept
1542 return vector_.isAliased( alias );
1559 template<
typename VT
1562 template<
typename Other >
1563 inline bool Elements<VT,TF,true,CEAs...>::isAliased(
const Other* alias )
const noexcept
1565 return vector_.isAliased( alias );
1581 template<
typename VT
1584 inline bool Elements<VT,TF,true,CEAs...>::isAligned() const noexcept
1603 template<
typename VT
1606 inline bool Elements<VT,TF,true,CEAs...>::canSMPAssign() const noexcept
1608 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1626 template<
typename VT
1629 template<
typename VT2 >
1630 inline void Elements<VT,TF,true,CEAs...>::assign(
const DenseVector<VT2,TF>& rhs )
1634 const size_t ipos(
size() &
size_t(-2) );
1635 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1636 vector_[idx(i )] = (~rhs)[i ];
1637 vector_[idx(i+1UL)] = (~rhs)[i+1UL];
1639 if( ipos <
size() ) {
1640 vector_[idx(ipos)] = (~rhs)[ipos];
1659 template<
typename VT
1662 template<
typename VT2 >
1663 inline void Elements<VT,TF,true,CEAs...>::assign(
const SparseVector<VT2,TF>& rhs )
1667 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1668 vector_[idx(element->index())] = element->value();
1686 template<
typename VT
1689 template<
typename VT2 >
1690 inline void Elements<VT,TF,true,CEAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
1694 const size_t ipos(
size() &
size_t(-2) );
1695 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1696 vector_[idx(i )] += (~rhs)[i ];
1697 vector_[idx(i+1UL)] += (~rhs)[i+1UL];
1699 if( ipos <
size() ) {
1700 vector_[idx(ipos)] += (~rhs)[ipos];
1719 template<
typename VT
1722 template<
typename VT2 >
1723 inline void Elements<VT,TF,true,CEAs...>::addAssign(
const SparseVector<VT2,TF>& rhs )
1727 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1728 vector_[idx(element->index())] += element->value();
1746 template<
typename VT
1749 template<
typename VT2 >
1750 inline void Elements<VT,TF,true,CEAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
1754 const size_t ipos(
size() &
size_t(-2) );
1755 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1756 vector_[idx(i )] -= (~rhs)[i ];
1757 vector_[idx(i+1UL)] -= (~rhs)[i+1UL];
1759 if( ipos <
size() ) {
1760 vector_[idx(ipos)] -= (~rhs)[ipos];
1779 template<
typename VT
1782 template<
typename VT2 >
1783 inline void Elements<VT,TF,true,CEAs...>::subAssign(
const SparseVector<VT2,TF>& rhs )
1787 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1788 vector_[idx(element->index())] -= element->value();
1806 template<
typename VT
1809 template<
typename VT2 >
1810 inline void Elements<VT,TF,true,CEAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
1814 const size_t ipos(
size() &
size_t(-2) );
1815 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1816 vector_[idx(i )] *= (~rhs)[i ];
1817 vector_[idx(i+1UL)] *= (~rhs)[i+1UL];
1819 if( ipos <
size() ) {
1820 vector_[idx(ipos)] *= (~rhs)[ipos];
1839 template<
typename VT
1842 template<
typename VT2 >
1843 inline void Elements<VT,TF,true,CEAs...>::multAssign(
const SparseVector<VT2,TF>& rhs )
1851 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1852 const size_t index( element->index() );
1853 for( ; i<index; ++i )
1854 reset( vector_[idx(i)] );
1855 vector_[idx(i)] *= element->value();
1859 for( ; i<
size(); ++i ) {
1860 reset( vector_[idx(i)] );
1879 template<
typename VT
1882 template<
typename VT2 >
1883 inline void Elements<VT,TF,true,CEAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
1887 const size_t ipos(
size() &
size_t(-2) );
1888 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1889 vector_[idx(i )] /= (~rhs)[i ];
1890 vector_[idx(i+1UL)] /= (~rhs)[i+1UL];
1892 if( ipos <
size() ) {
1893 vector_[idx(ipos)] /= (~rhs)[ipos];
1920 template<
typename VT1
1924 class Elements< DVecDVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >
1925 :
public View< DenseVector< Elements< DVecDVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
1926 ,
private ElementsData<CEAs...>
1930 using CPE = DVecDVecCrossExpr<VT1,VT2,TF>;
1931 using RT = ResultType_<CPE>;
1932 using DataType = ElementsData<CEAs...>;
1938 using This = Elements<CPE,TF,
true,CEAs...>;
1940 using BaseType = DenseVector<This,TF>;
1941 using ViewedType = CPE;
1951 enum :
bool { simdEnabled =
false };
1954 enum :
bool { smpAssignable =
false };
1964 template<
typename... REAs >
1965 explicit inline Elements(
const CPE& vector, REAs... args )
1966 : DataType( args... )
1967 , vector_ ( vector )
1969 if( !Contains< TypeList<REAs...>,
Unchecked >::value ) {
1970 for(
size_t i=0UL; i<
size(); ++i ) {
1971 if( vector_.size() <= idx(i) ) {
1985 inline ReturnType operator[](
size_t index )
const {
1987 return vector_[idx(index)];
1999 if( index >=
size() ) {
2002 return (*
this)[index];
2007 using DataType::idces;
2008 using DataType::idx;
2017 inline CPE operand() const noexcept {
2028 template<
typename T >
2029 inline bool canAlias(
const T* alias )
const noexcept {
2030 return vector_.canAlias( alias );
2040 template<
typename T >
2041 inline bool isAliased(
const T* alias )
const noexcept {
2042 return vector_.isAliased( alias );
2075 template<
typename VT1
2079 class Elements< DVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >
2080 :
public View< DenseVector< Elements< DVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
2081 ,
private ElementsData<CEAs...>
2085 using CPE = DVecSVecCrossExpr<VT1,VT2,TF>;
2086 using RT = ResultType_<CPE>;
2087 using DataType = ElementsData<CEAs...>;
2093 using This = Elements<CPE,TF,
true,CEAs...>;
2095 using BaseType = DenseVector<This,TF>;
2096 using ViewedType = CPE;
2106 enum :
bool { simdEnabled =
false };
2109 enum :
bool { smpAssignable =
false };
2119 template<
typename... REAs >
2120 explicit inline Elements(
const CPE& vector, REAs... args )
2121 : DataType( args... )
2122 , vector_ ( vector )
2124 if( !Contains< TypeList<REAs...>,
Unchecked >::value ) {
2125 for(
size_t i=0UL; i<
size(); ++i ) {
2126 if( vector_.size() <= idx(i) ) {
2140 inline ReturnType operator[](
size_t index )
const {
2142 return vector_[idx(index)];
2154 if( index >=
size() ) {
2157 return (*
this)[index];
2162 using DataType::idces;
2163 using DataType::idx;
2172 inline CPE operand() const noexcept {
2183 template<
typename T >
2184 inline bool canAlias(
const T* alias )
const noexcept {
2185 return vector_.canAlias( alias );
2195 template<
typename T >
2196 inline bool isAliased(
const T* alias )
const noexcept {
2197 return vector_.isAliased( alias );
2230 template<
typename VT1
2234 class Elements< SVecDVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >
2235 :
public View< DenseVector< Elements< SVecDVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
2236 ,
private ElementsData<CEAs...>
2240 using CPE = SVecDVecCrossExpr<VT1,VT2,TF>;
2241 using RT = ResultType_<CPE>;
2242 using DataType = ElementsData<CEAs...>;
2248 using This = Elements<CPE,TF,
true,CEAs...>;
2250 using BaseType = DenseVector<This,TF>;
2251 using ViewedType = CPE;
2261 enum :
bool { simdEnabled =
false };
2264 enum :
bool { smpAssignable =
false };
2274 template<
typename... REAs >
2275 explicit inline Elements(
const CPE& vector, REAs... args )
2276 : DataType( args... )
2277 , vector_ ( vector )
2279 if( !Contains< TypeList<REAs...>,
Unchecked >::value ) {
2280 for(
size_t i=0UL; i<
size(); ++i ) {
2281 if( vector_.size() <= idx(i) ) {
2295 inline ReturnType operator[](
size_t index )
const {
2297 return vector_[idx(index)];
2309 if( index >=
size() ) {
2312 return (*
this)[index];
2317 using DataType::idces;
2318 using DataType::idx;
2327 inline CPE operand() const noexcept {
2338 template<
typename T >
2339 inline bool canAlias(
const T* alias )
const noexcept {
2340 return vector_.canAlias( alias );
2350 template<
typename T >
2351 inline bool isAliased(
const T* alias )
const noexcept {
2352 return vector_.isAliased( alias );
2385 template<
typename VT1
2389 class Elements< SVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >
2390 :
public View< DenseVector< Elements< SVecSVecCrossExpr<VT1,VT2,TF>, TF, true, CEAs... >, TF > >
2391 ,
private ElementsData<CEAs...>
2395 using CPE = SVecSVecCrossExpr<VT1,VT2,TF>;
2396 using RT = ResultType_<CPE>;
2397 using DataType = ElementsData<CEAs...>;
2403 using This = Elements<CPE,TF,
true,CEAs...>;
2405 using BaseType = DenseVector<This,TF>;
2406 using ViewedType = CPE;
2416 enum :
bool { simdEnabled =
false };
2419 enum :
bool { smpAssignable =
false };
2429 template<
typename... REAs >
2430 explicit inline Elements(
const CPE& vector, REAs... args )
2431 : DataType( args... )
2432 , vector_ ( vector )
2434 if( !Contains< TypeList<REAs...>,
Unchecked >::value ) {
2435 for(
size_t i=0UL; i<
size(); ++i ) {
2436 if( vector_.size() <= idx(i) ) {
2450 inline ReturnType operator[](
size_t index )
const {
2452 return vector_[idx(index)];
2464 if( index >=
size() ) {
2467 return (*
this)[index];
2472 using DataType::idces;
2473 using DataType::idx;
2482 inline CPE operand() const noexcept {
2493 template<
typename T >
2494 inline bool canAlias(
const T* alias )
const noexcept {
2495 return vector_.canAlias( alias );
2505 template<
typename T >
2506 inline bool isAliased(
const T* alias )
const noexcept {
2507 return vector_.isAliased( alias );
#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.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for the View base class.
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#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
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:329
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
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:701
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
Header file for the DenseVector base class.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
Header file for the decltype(auto) workaround.
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:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
typename ElementsTrait< VT, CEAs... >::Type ElementsTrait_
Auxiliary alias declaration for the ElementsTrait type trait.The ElementsTrait_ alias declaration pro...
Definition: ElementsTrait.h:144
#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.
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
Header file for the elements trait.
BLAZE_ALWAYS_INLINE 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:474
BLAZE_ALWAYS_INLINE 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:408
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
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.
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#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
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:367
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:443
Header file for the Not class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
#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
Constraint on the data type.
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:134
Constraint on the data type.
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE 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:430
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:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Header file for all forward declarations for expression class templates.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
Header file for the IsSparseVector type trait.
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the cross product 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
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
Header file for the reset shim.
Header file for the isDefault shim.
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:405
Header file for the HasMutableDataAccess type trait.
#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.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#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
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
Header file for the implementation of the ElementsData class template.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
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
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the IsExpression type trait class.