35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_DENSE_H_ 119 template<
typename MT
121 class Column<MT,true,true,SF>
122 :
public DenseVector< Column<MT,true,true,SF>, false >
128 typedef If_< IsExpression<MT>, MT, MT& > Operand;
133 typedef Column<MT,true,true,SF>
This;
134 typedef DenseVector<This,false>
BaseType;
138 typedef SIMDTrait_<ElementType> SIMDType;
149 typedef const ElementType* ConstPointer;
152 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
163 enum :
bool { simdEnabled = MT::simdEnabled };
166 enum :
bool { smpAssignable = MT::smpAssignable };
172 explicit inline Column( Operand matrix,
size_t index );
184 inline Reference operator[](
size_t index );
185 inline ConstReference operator[](
size_t index )
const;
186 inline Reference at(
size_t index );
187 inline ConstReference at(
size_t index )
const;
188 inline Pointer data () noexcept;
189 inline ConstPointer data () const noexcept;
190 inline Iterator
begin ();
191 inline ConstIterator begin () const;
192 inline ConstIterator
cbegin() const;
193 inline Iterator
end ();
194 inline ConstIterator end () const;
195 inline ConstIterator
cend () const;
202 inline Column& operator=( const ElementType& rhs );
203 inline Column& operator=( initializer_list<ElementType> list );
204 inline Column& operator=( const Column& rhs );
206 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
207 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
208 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
209 template< typename VT > inline Column& operator*=( const DenseVector<VT,false>& rhs );
210 template< typename VT > inline Column& operator*=( const SparseVector<VT,false>& rhs );
211 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
213 template< typename Other >
214 inline
EnableIf_< IsNumeric<Other>, Column >& operator*=( Other rhs );
216 template< typename Other >
217 inline
EnableIf_< IsNumeric<Other>, Column >& operator/=( Other rhs );
224 inline
size_t size() const noexcept;
225 inline
size_t capacity() const noexcept;
234 template< typename Other > inline Column& scale( const Other& scalar );
241 template< typename VT >
242 struct VectorizedAssign {
244 simdEnabled && VT::simdEnabled &&
245 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
251 template<
typename VT >
252 struct VectorizedAddAssign {
254 simdEnabled && VT::simdEnabled &&
255 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
256 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
262 template<
typename VT >
263 struct VectorizedSubAssign {
265 simdEnabled && VT::simdEnabled &&
266 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
267 HasSIMDSub< ElementType, ElementType_<VT> >::value };
273 template<
typename VT >
274 struct VectorizedMultAssign {
276 simdEnabled && VT::simdEnabled &&
277 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
278 HasSIMDMult< ElementType, ElementType_<VT> >::value };
284 template<
typename VT >
285 struct VectorizedDivAssign {
287 simdEnabled && VT::simdEnabled &&
288 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
289 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
302 template<
typename Other >
303 inline bool canAlias(
const Other* alias )
const noexcept;
305 template<
typename MT2,
bool SO2,
bool SF2 >
306 inline bool canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
308 template<
typename Other >
309 inline bool isAliased(
const Other* alias )
const noexcept;
311 template<
typename MT2,
bool SO2,
bool SF2 >
312 inline bool isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
314 inline bool isAligned () const noexcept;
315 inline
bool canSMPAssign() const noexcept;
326 template< typename VT >
327 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
329 template< typename VT >
330 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
332 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
334 template< typename VT >
335 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
337 template< typename VT >
338 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
340 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
342 template< typename VT >
343 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
345 template< typename VT >
346 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
348 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
350 template< typename VT >
351 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
353 template< typename VT >
354 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
356 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
358 template< typename VT >
359 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
361 template< typename VT >
362 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
376 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Column;
378 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
379 friend
bool isIntact( const Column<MT2,SO2,DF2,SF2>&
column ) noexcept;
381 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
382 friend
bool isSame( const Column<MT2,SO2,DF2,SF2>& a, const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
384 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
385 friend
bool tryAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
387 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
388 friend
bool tryAddAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
390 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
391 friend
bool trySubAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
393 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
394 friend
bool tryMultAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
396 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
397 friend
bool tryDivAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
399 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
432 template< typename MT
434 inline Column<MT,true,true,SF>::Column( Operand matrix,
size_t index )
438 if( matrix_.columns() <= index ) {
464 template<
typename MT
469 return matrix_(index,col_);
485 template<
typename MT
488 Column<MT,true,true,SF>::operator[](
size_t index )
const 491 return const_cast<const MT&
>( matrix_ )(index,col_);
508 template<
typename MT
512 if( index >=
size() ) {
515 return (*
this)[index];
532 template<
typename MT
535 Column<MT,true,true,SF>::at(
size_t index )
const 537 if( index >=
size() ) {
540 return (*
this)[index];
555 template<
typename MT
557 inline typename Column<MT,true,true,SF>::Pointer Column<MT,true,true,SF>::data() noexcept
559 return matrix_.data( col_ );
574 template<
typename MT
576 inline typename Column<MT,true,true,SF>::ConstPointer Column<MT,true,true,SF>::data() const noexcept
578 return matrix_.data( col_ );
592 template<
typename MT
596 return matrix_.begin( col_ );
610 template<
typename MT
614 return matrix_.cbegin( col_ );
628 template<
typename MT
632 return matrix_.cbegin( col_ );
646 template<
typename MT
650 return matrix_.end( col_ );
664 template<
typename MT
668 return matrix_.cend( col_ );
682 template<
typename MT
686 return matrix_.cend( col_ );
711 template<
typename MT
713 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=(
const ElementType& rhs )
715 const size_t ibegin( ( IsLower<MT>::value )
716 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
720 const size_t iend ( ( IsUpper<MT>::value )
721 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
726 for(
size_t i=ibegin; i<iend; ++i )
727 matrix_(i,col_) = rhs;
748 template<
typename MT
750 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=( initializer_list<ElementType> list )
752 if( list.size() >
size() ) {
780 template<
typename MT
782 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=(
const Column& rhs )
784 if( &rhs ==
this )
return *
this;
786 if(
size() != rhs.size() ) {
790 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
794 DerestrictTrait_<This> left( derestrict( *
this ) );
820 template<
typename MT
822 template<
typename VT >
823 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=(
const Vector<VT,false>& rhs )
832 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
835 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
839 DerestrictTrait_<This> left( derestrict( *
this ) );
841 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
842 const ResultType_<VT> tmp( right );
846 if( IsSparseVector<VT>::value )
873 template<
typename MT
875 template<
typename VT >
885 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
888 if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
892 DerestrictTrait_<This> left( derestrict( *
this ) );
894 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
895 const ResultType_<VT> tmp( right );
924 template<
typename MT
926 template<
typename VT >
936 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
939 if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
943 DerestrictTrait_<This> left( derestrict( *
this ) );
945 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
946 const ResultType_<VT> tmp( right );
974 template<
typename MT
976 template<
typename VT >
986 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
989 if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
993 DerestrictTrait_<This> left( derestrict( *
this ) );
995 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
996 const ResultType_<VT> tmp( right );
1024 template<
typename MT
1026 template<
typename VT >
1037 const ResultType right( *
this * (~rhs) );
1039 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
1043 DerestrictTrait_<This> left( derestrict( *
this ) );
1067 template<
typename MT
1069 template<
typename VT >
1079 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
1080 Right right( ~rhs );
1082 if( !tryDivAssign( matrix_, right, 0UL, col_ ) ) {
1086 DerestrictTrait_<This> left( derestrict( *
this ) );
1088 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1089 const ResultType_<VT> tmp( right );
1115 template<
typename MT
1117 template<
typename Other >
1118 inline EnableIf_< IsNumeric<Other>, Column<MT,true,true,SF> >&
1123 return operator=( (*
this) * rhs );
1142 template<
typename MT
1144 template<
typename Other >
1145 inline EnableIf_< IsNumeric<Other>, Column<MT,true,true,SF> >&
1152 return operator=( (*
this) / rhs );
1172 template<
typename MT
1176 return matrix_.rows();
1188 template<
typename MT
1192 return matrix_.capacity( col_ );
1207 template<
typename MT
1211 return matrix_.nonZeros( col_ );
1223 template<
typename MT
1227 matrix_.reset( col_ );
1252 template<
typename MT
1254 template<
typename Other >
1255 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::scale(
const Other& scalar )
1259 const size_t ibegin( ( IsLower<MT>::value )
1260 ?( ( IsStrictlyLower<MT>::value )
1264 const size_t iend ( ( IsUpper<MT>::value )
1265 ?( ( IsStrictlyUpper<MT>::value )
1270 for(
size_t i=ibegin; i<iend; ++i ) {
1271 matrix_(i,col_) *= scalar;
1299 template<
typename MT
1301 template<
typename Other >
1302 inline bool Column<MT,true,true,SF>::canAlias(
const Other* alias )
const noexcept
1304 return matrix_.isAliased( alias );
1321 template<
typename MT
1323 template<
typename MT2
1326 inline bool Column<MT,true,true,SF>::canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
1328 return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
1345 template<
typename MT
1347 template<
typename Other >
1348 inline bool Column<MT,true,true,SF>::isAliased(
const Other* alias )
const noexcept
1350 return matrix_.isAliased( alias );
1367 template<
typename MT
1369 template<
typename MT2
1372 inline bool Column<MT,true,true,SF>::isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
1374 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
1390 template<
typename MT
1392 inline bool Column<MT,true,true,SF>::isAligned() const noexcept
1394 return matrix_.isAligned();
1411 template<
typename MT
1413 inline bool Column<MT,true,true,SF>::canSMPAssign() const noexcept
1415 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1433 template<
typename MT
1436 Column<MT,true,true,SF>::load(
size_t index )
const noexcept
1438 return matrix_.load( index, col_ );
1457 template<
typename MT
1462 return matrix_.loada( index, col_ );
1481 template<
typename MT
1486 return matrix_.loadu( index, col_ );
1505 template<
typename MT
1508 Column<MT,true,true,SF>::store(
size_t index,
const SIMDType& value ) noexcept
1510 matrix_.store( index, col_, value );
1530 template<
typename MT
1535 matrix_.storea( index, col_, value );
1555 template<
typename MT
1560 matrix_.storeu( index, col_, value );
1580 template<
typename MT
1585 matrix_.stream( index, col_, value );
1603 template<
typename MT
1605 template<
typename VT >
1606 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1607 Column<MT,true,true,SF>::assign(
const DenseVector<VT,false>& rhs )
1611 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1612 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1613 matrix_(i ,col_) = (~rhs)[i ];
1614 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1616 if( ipos < (~rhs).size() )
1617 matrix_(ipos,col_) = (~rhs)[ipos];
1635 template<
typename MT
1637 template<
typename VT >
1638 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1639 Column<MT,true,true,SF>::assign(
const DenseVector<VT,false>& rhs )
1645 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1649 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1653 Iterator left(
begin() );
1654 ConstIterator_<VT> right( (~rhs).
begin() );
1658 for( ; i<ipos; i+=SIMDSIZE ) {
1659 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1661 for( ; remainder && i<
rows; ++i ) {
1662 *left = *right; ++left; ++right;
1667 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1668 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1669 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1670 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1671 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1673 for( ; i<ipos; i+=SIMDSIZE ) {
1674 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1676 for( ; remainder && i<
rows; ++i ) {
1677 *left = *right; ++left; ++right;
1697 template<
typename MT
1699 template<
typename VT >
1700 inline void Column<MT,true,true,SF>::assign(
const SparseVector<VT,false>& rhs )
1704 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1705 matrix_(element->index(),col_) = element->value();
1723 template<
typename MT
1725 template<
typename VT >
1726 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1727 Column<MT,true,true,SF>::addAssign(
const DenseVector<VT,false>& rhs )
1731 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1732 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1733 matrix_(i ,col_) += (~rhs)[i ];
1734 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1736 if( ipos < (~rhs).size() )
1737 matrix_(ipos,col_) += (~rhs)[ipos];
1755 template<
typename MT
1757 template<
typename VT >
1758 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1759 Column<MT,true,true,SF>::addAssign(
const DenseVector<VT,false>& rhs )
1765 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1769 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1773 Iterator left(
begin() );
1774 ConstIterator_<VT> right( (~rhs).
begin() );
1776 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1777 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1778 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1779 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1780 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1782 for( ; i<ipos; i+=SIMDSIZE ) {
1783 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1785 for( ; remainder && i<
rows; ++i ) {
1786 *left += *right; ++left; ++right;
1805 template<
typename MT
1807 template<
typename VT >
1808 inline void Column<MT,true,true,SF>::addAssign(
const SparseVector<VT,false>& rhs )
1812 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1813 matrix_(element->index(),col_) += element->value();
1831 template<
typename MT
1833 template<
typename VT >
1834 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1835 Column<MT,true,true,SF>::subAssign(
const DenseVector<VT,false>& rhs )
1839 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1840 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1841 matrix_(i ,col_) -= (~rhs)[i ];
1842 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1844 if( ipos < (~rhs).size() )
1845 matrix_(ipos,col_) -= (~rhs)[ipos];
1863 template<
typename MT
1865 template<
typename VT >
1866 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1867 Column<MT,true,true,SF>::subAssign(
const DenseVector<VT,false>& rhs )
1873 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1877 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1881 Iterator left(
begin() );
1882 ConstIterator_<VT> right( (~rhs).
begin() );
1884 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1885 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1886 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1887 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1888 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1890 for( ; i<ipos; i+=SIMDSIZE ) {
1891 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1893 for( ; remainder && i<
rows; ++i ) {
1894 *left -= *right; ++left; ++right;
1913 template<
typename MT
1915 template<
typename VT >
1916 inline void Column<MT,true,true,SF>::subAssign(
const SparseVector<VT,false>& rhs )
1920 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1921 matrix_(element->index(),col_) -= element->value();
1939 template<
typename MT
1941 template<
typename VT >
1942 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
1943 Column<MT,true,true,SF>::multAssign(
const DenseVector<VT,false>& rhs )
1947 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1948 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1949 matrix_(i ,col_) *= (~rhs)[i ];
1950 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
1952 if( ipos < (~rhs).size() )
1953 matrix_(ipos,col_) *= (~rhs)[ipos];
1971 template<
typename MT
1973 template<
typename VT >
1974 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
1975 Column<MT,true,true,SF>::multAssign(
const DenseVector<VT,false>& rhs )
1981 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1985 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1989 Iterator left(
begin() );
1990 ConstIterator_<VT> right( (~rhs).
begin() );
1992 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1993 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1994 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1995 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1996 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1998 for( ; i<ipos; i+=SIMDSIZE ) {
1999 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2001 for( ; remainder && i<
rows; ++i ) {
2002 *left *= *right; ++left, ++right;
2021 template<
typename MT
2023 template<
typename VT >
2024 inline void Column<MT,true,true,SF>::multAssign(
const SparseVector<VT,false>& rhs )
2028 const ResultType tmp(
serial( *
this ) );
2032 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2033 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
2051 template<
typename MT
2053 template<
typename VT >
2054 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2055 Column<MT,true,true,SF>::divAssign(
const DenseVector<VT,false>& rhs )
2059 const size_t ipos( (~rhs).
size() &
size_t(-2) );
2060 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2061 matrix_(i ,col_) /= (~rhs)[i ];
2062 matrix_(i+1UL,col_) /= (~rhs)[i+1UL];
2064 if( ipos < (~rhs).size() )
2065 matrix_(ipos,col_) /= (~rhs)[ipos];
2083 template<
typename MT
2085 template<
typename VT >
2086 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2087 Column<MT,true,true,SF>::divAssign(
const DenseVector<VT,false>& rhs )
2095 const size_t ipos(
rows &
size_t(-SIMDSIZE) );
2099 Iterator left(
begin() );
2100 ConstIterator_<VT> right( (~rhs).
begin() );
2102 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2103 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2104 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2105 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2106 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2108 for( ; i<ipos; i+=SIMDSIZE ) {
2109 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2111 for( ; i<
rows; ++i ) {
2112 *left /= *right; ++left; ++right;
2139 template<
typename MT >
2140 class Column<MT,false,true,false>
2141 :
public DenseVector< Column<MT,false,true,false>, false >
2147 typedef If_< IsExpression<MT>, MT, MT& > Operand;
2152 typedef Column<MT,false,true,false>
This;
2153 typedef DenseVector<This,false>
BaseType;
2167 typedef const ElementType* ConstPointer;
2170 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
2176 template<
typename MatrixType >
2177 class ColumnIterator
2182 typedef If_< IsConst<MatrixType>, ConstReference_<MatrixType>, Reference_<MatrixType> >
Reference;
2184 typedef std::random_access_iterator_tag IteratorCategory;
2185 typedef RemoveReference_<Reference> ValueType;
2186 typedef ValueType* PointerType;
2187 typedef Reference ReferenceType;
2188 typedef ptrdiff_t DifferenceType;
2191 typedef IteratorCategory iterator_category;
2192 typedef ValueType value_type;
2193 typedef PointerType pointer;
2194 typedef ReferenceType reference;
2195 typedef DifferenceType difference_type;
2201 inline ColumnIterator() noexcept
2202 : matrix_(
nullptr )
2215 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2216 : matrix_( &matrix )
2227 template<
typename MatrixType2 >
2228 inline ColumnIterator(
const ColumnIterator<MatrixType2>& it ) noexcept
2229 : matrix_( it.matrix_ )
2231 , column_( it.column_ )
2241 inline ColumnIterator&
operator+=(
size_t inc ) noexcept {
2253 inline ColumnIterator&
operator-=(
size_t dec ) noexcept {
2264 inline ColumnIterator& operator++() noexcept {
2275 inline const ColumnIterator operator++(
int ) noexcept {
2276 const ColumnIterator tmp( *
this );
2287 inline ColumnIterator& operator--() noexcept {
2298 inline const ColumnIterator operator--(
int ) noexcept {
2299 const ColumnIterator tmp( *
this );
2311 inline ReferenceType operator[](
size_t index )
const {
2312 return (*matrix_)(row_+index,column_);
2321 inline ReferenceType
operator*()
const {
2322 return (*matrix_)(row_,column_);
2331 inline PointerType operator->()
const {
2332 return &(*matrix_)(row_,column_);
2342 template<
typename MatrixType2 >
2343 inline bool operator==(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2344 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2354 template<
typename MatrixType2 >
2355 inline bool operator!=(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2356 return !( *
this == rhs );
2366 template<
typename MatrixType2 >
2367 inline bool operator<( const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2368 return ( matrix_ == rhs.matrix_ ) && ( row_ < rhs.row_ ) && ( column_ == rhs.column_ );
2378 template<
typename MatrixType2 >
2379 inline bool operator>(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2380 return ( matrix_ == rhs.matrix_ ) && ( row_ > rhs.row_ ) && ( column_ == rhs.column_ );
2390 template<
typename MatrixType2 >
2391 inline bool operator<=( const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2392 return ( matrix_ == rhs.matrix_ ) && ( row_ <= rhs.row_ ) && ( column_ == rhs.column_ );
2402 template<
typename MatrixType2 >
2403 inline bool operator>=(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2404 return ( matrix_ == rhs.matrix_ ) && ( row_ >= rhs.row_ ) && ( column_ == rhs.column_ );
2414 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const noexcept {
2415 return row_ - rhs.row_;
2426 friend inline const ColumnIterator
operator+(
const ColumnIterator& it,
size_t inc ) noexcept {
2427 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2438 friend inline const ColumnIterator
operator+(
size_t inc,
const ColumnIterator& it ) noexcept {
2439 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2450 friend inline const ColumnIterator
operator-(
const ColumnIterator& it,
size_t dec ) noexcept {
2451 return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2457 MatrixType* matrix_;
2463 template<
typename MatrixType2 >
friend class ColumnIterator;
2478 enum :
bool { simdEnabled =
false };
2481 enum :
bool { smpAssignable = MT::smpAssignable };
2487 explicit inline Column( Operand matrix,
size_t index );
2499 inline Reference operator[](
size_t index );
2500 inline ConstReference operator[](
size_t index )
const;
2501 inline Reference at(
size_t index );
2502 inline ConstReference at(
size_t index )
const;
2503 inline Pointer data () noexcept;
2504 inline ConstPointer data () const noexcept;
2505 inline Iterator
begin ();
2506 inline ConstIterator begin () const;
2507 inline ConstIterator
cbegin() const;
2508 inline Iterator
end ();
2509 inline ConstIterator end () const;
2510 inline ConstIterator
cend () const;
2517 inline Column& operator=( const ElementType& rhs );
2518 inline Column& operator=( initializer_list<ElementType> list );
2519 inline Column& operator=( const Column& rhs );
2521 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
2522 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
2523 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
2524 template< typename VT > inline Column& operator*=( const DenseVector<VT,false>& rhs );
2525 template< typename VT > inline Column& operator*=( const SparseVector<VT,false>& rhs );
2526 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
2528 template< typename Other >
2529 inline
EnableIf_< IsNumeric<Other>, Column >& operator*=( Other rhs );
2531 template< typename Other >
2532 inline
EnableIf_< IsNumeric<Other>, Column >& operator/=( Other rhs );
2539 inline
size_t size() const noexcept;
2540 inline
size_t capacity() const noexcept;
2542 inline
void reset();
2549 template< typename Other > inline Column& scale( const Other& scalar );
2557 template< typename Other >
2558 inline
bool canAlias ( const Other* alias ) const noexcept;
2560 template< typename MT2,
bool SO2,
bool SF2 >
2561 inline
bool canAlias ( const Column<MT2,SO2,true,SF2>* alias ) const noexcept;
2563 template< typename Other >
2564 inline
bool isAliased( const Other* alias ) const noexcept;
2566 template< typename MT2,
bool SO2,
bool SF2 >
2567 inline
bool isAliased( const Column<MT2,SO2,true,SF2>* alias ) const noexcept;
2569 inline
bool isAligned () const noexcept;
2570 inline
bool canSMPAssign() const noexcept;
2572 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2573 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2574 template< typename VT > inline
void addAssign ( const DenseVector <VT,false>& rhs );
2575 template< typename VT > inline
void addAssign ( const SparseVector<VT,false>& rhs );
2576 template< typename VT > inline
void subAssign ( const DenseVector <VT,false>& rhs );
2577 template< typename VT > inline
void subAssign ( const SparseVector<VT,false>& rhs );
2578 template< typename VT > inline
void multAssign( const DenseVector <VT,false>& rhs );
2579 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
2580 template< typename VT > inline
void divAssign ( const DenseVector <VT,false>& rhs );
2594 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Column;
2596 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2597 friend
bool isIntact( const Column<MT2,SO2,DF2,SF2>& column ) noexcept;
2599 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2600 friend
bool isSame( const Column<MT2,SO2,DF2,SF2>& a, const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
2602 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2603 friend
bool tryAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
2605 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2606 friend
bool tryAddAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
2608 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2609 friend
bool trySubAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
2611 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2612 friend
bool tryMultAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
2614 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2615 friend
bool tryDivAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
2617 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2618 friend
DerestrictTrait_< Column<MT2,SO2,DF2,SF2> > derestrict( Column<MT2,SO2,DF2,SF2>& column );
2651 template< typename MT >
2652 inline Column<MT,false,true,false>::Column( Operand matrix,
size_t index )
2656 if( matrix_.columns() <= index ) {
2682 template<
typename MT >
2684 Column<MT,false,true,false>::operator[](
size_t index )
2687 return matrix_(index,col_);
2703 template<
typename MT >
2705 Column<MT,false,true,false>::operator[](
size_t index )
const 2708 return const_cast<const MT&
>( matrix_ )(index,col_);
2725 template<
typename MT >
2727 Column<MT,false,true,false>::at(
size_t index )
2729 if( index >=
size() ) {
2732 return (*
this)[index];
2749 template<
typename MT >
2751 Column<MT,false,true,false>::at(
size_t index )
const 2753 if( index >=
size() ) {
2756 return (*
this)[index];
2771 template<
typename MT >
2772 inline typename Column<MT,false,true,false>::Pointer Column<MT,false,true,false>::data() noexcept
2774 return matrix_.data() + col_;
2789 template<
typename MT >
2790 inline typename Column<MT,false,true,false>::ConstPointer Column<MT,false,true,false>::data() const noexcept
2792 return matrix_.data() + col_;
2806 template<
typename MT >
2809 return Iterator( matrix_, 0UL, col_ );
2823 template<
typename MT >
2841 template<
typename MT >
2859 template<
typename MT >
2876 template<
typename MT >
2894 template<
typename MT >
2923 template<
typename MT >
2924 inline Column<MT,false,true,false>&
2925 Column<MT,false,true,false>::operator=(
const ElementType& rhs )
2927 const size_t ibegin( ( IsLower<MT>::value )
2928 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2932 const size_t iend ( ( IsUpper<MT>::value )
2933 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2938 for(
size_t i=ibegin; i<iend; ++i )
2939 matrix_(i,col_) = rhs;
2960 template<
typename MT >
2961 inline Column<MT,false,true,false>&
2962 Column<MT,false,true,false>::operator=( initializer_list<ElementType> list )
2964 if( list.size() >
size() ) {
2992 template<
typename MT >
2993 inline Column<MT,false,true,false>&
2994 Column<MT,false,true,false>::operator=(
const Column& rhs )
2996 if( &rhs ==
this )
return *
this;
2998 if(
size() != rhs.size() ) {
3002 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
3006 DerestrictTrait_<This> left( derestrict( *
this ) );
3032 template<
typename MT >
3033 template<
typename VT >
3034 inline Column<MT,false,true,false>&
3035 Column<MT,false,true,false>::operator=(
const Vector<VT,false>& rhs )
3045 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3046 Right right( ~rhs );
3048 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
3052 DerestrictTrait_<This> left( derestrict( *
this ) );
3054 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3055 const ResultType tmp( right );
3059 if( IsSparseVector<VT>::value )
3086 template<
typename MT >
3087 template<
typename VT >
3088 inline Column<MT,false,true,false>&
3098 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3099 Right right( ~rhs );
3101 if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
3105 DerestrictTrait_<This> left( derestrict( *
this ) );
3107 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3108 const ResultType_<VT> tmp( right );
3137 template<
typename MT >
3138 template<
typename VT >
3139 inline Column<MT,false,true,false>&
3149 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3150 Right right( ~rhs );
3152 if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
3156 DerestrictTrait_<This> left( derestrict( *
this ) );
3158 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3159 const ResultType_<VT> tmp( right );
3187 template<
typename MT >
3188 template<
typename VT >
3189 inline Column<MT,false,true,false>&
3199 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3200 Right right( ~rhs );
3202 if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
3206 DerestrictTrait_<This> left( derestrict( *
this ) );
3208 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3209 const ResultType_<VT> tmp( right );
3237 template<
typename MT >
3238 template<
typename VT >
3239 inline Column<MT,false,true,false>&
3250 const ResultType right( *
this * (~rhs) );
3252 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
3256 DerestrictTrait_<This> left( derestrict( *
this ) );
3280 template<
typename MT >
3281 template<
typename VT >
3282 inline Column<MT,false,true,false>&
3292 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3293 Right right( ~rhs );
3295 if( !tryDivAssign( matrix_, right, 0UL, col_ ) ) {
3299 DerestrictTrait_<This> left( derestrict( *
this ) );
3301 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3302 const ResultType_<VT> tmp( right );
3328 template<
typename MT >
3329 template<
typename Other >
3330 inline EnableIf_< IsNumeric<Other>, Column<MT,false,true,false> >&
3335 return operator=( (*
this) * rhs );
3354 template<
typename MT >
3355 template<
typename Other >
3356 inline EnableIf_< IsNumeric<Other>, Column<MT,false,true,false> >&
3363 return operator=( (*
this) / rhs );
3383 template<
typename MT >
3386 return matrix_.rows();
3398 template<
typename MT >
3401 return matrix_.rows();
3416 template<
typename MT >
3420 size_t nonzeros( 0UL );
3422 for(
size_t i=0UL; i<
rows; ++i )
3438 template<
typename MT >
3443 const size_t ibegin( ( IsLower<MT>::value )
3444 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3448 const size_t iend ( ( IsUpper<MT>::value )
3449 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3454 for(
size_t i=ibegin; i<iend; ++i )
3455 clear( matrix_(i,col_) );
3480 template<
typename MT >
3481 template<
typename Other >
3482 inline Column<MT,false,true,false>& Column<MT,false,true,false>::scale(
const Other& scalar )
3486 const size_t ibegin( ( IsLower<MT>::value )
3487 ?( ( IsStrictlyLower<MT>::value )
3491 const size_t iend ( ( IsUpper<MT>::value )
3492 ?( ( IsStrictlyUpper<MT>::value )
3497 for(
size_t i=ibegin; i<iend; ++i ) {
3498 matrix_(i,col_) *= scalar;
3526 template<
typename MT >
3527 template<
typename Other >
3528 inline bool Column<MT,false,true,false>::canAlias(
const Other* alias )
const noexcept
3530 return matrix_.isAliased( alias );
3547 template<
typename MT >
3548 template<
typename MT2
3551 inline bool Column<MT,false,true,false>::canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
3553 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3570 template<
typename MT >
3571 template<
typename Other >
3572 inline bool Column<MT,false,true,false>::isAliased(
const Other* alias )
const noexcept
3574 return matrix_.isAliased( alias );
3591 template<
typename MT >
3592 template<
typename MT2
3595 inline bool Column<MT,false,true,false>::isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
3597 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3613 template<
typename MT >
3614 inline bool Column<MT,false,true,false>::isAligned() const noexcept
3633 template<
typename MT >
3634 inline bool Column<MT,false,true,false>::canSMPAssign() const noexcept
3636 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3654 template<
typename MT >
3655 template<
typename VT >
3656 inline void Column<MT,false,true,false>::assign(
const DenseVector<VT,false>& rhs )
3660 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3661 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3662 matrix_(i ,col_) = (~rhs)[i ];
3663 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
3665 if( ipos < (~rhs).size() )
3666 matrix_(ipos,col_) = (~rhs)[ipos];
3684 template<
typename MT >
3685 template<
typename VT >
3686 inline void Column<MT,false,true,false>::assign(
const SparseVector<VT,false>& rhs )
3690 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3691 matrix_(element->index(),col_) = element->value();
3709 template<
typename MT >
3710 template<
typename VT >
3711 inline void Column<MT,false,true,false>::addAssign(
const DenseVector<VT,false>& rhs )
3715 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3716 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3717 matrix_(i ,col_) += (~rhs)[i ];
3718 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
3720 if( ipos < (~rhs).size() )
3721 matrix_(ipos,col_) += (~rhs)[ipos];
3739 template<
typename MT >
3740 template<
typename VT >
3741 inline void Column<MT,false,true,false>::addAssign(
const SparseVector<VT,false>& rhs )
3745 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3746 matrix_(element->index(),col_) += element->value();
3764 template<
typename MT >
3765 template<
typename VT >
3766 inline void Column<MT,false,true,false>::subAssign(
const DenseVector<VT,false>& rhs )
3770 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3771 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3772 matrix_(i ,col_) -= (~rhs)[i ];
3773 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
3775 if( ipos < (~rhs).size() )
3776 matrix_(ipos,col_) -= (~rhs)[ipos];
3794 template<
typename MT >
3795 template<
typename VT >
3796 inline void Column<MT,false,true,false>::subAssign(
const SparseVector<VT,false>& rhs )
3800 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3801 matrix_(element->index(),col_) -= element->value();
3819 template<
typename MT >
3820 template<
typename VT >
3821 inline void Column<MT,false,true,false>::multAssign(
const DenseVector<VT,false>& rhs )
3825 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3826 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3827 matrix_(i ,col_) *= (~rhs)[i ];
3828 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
3830 if( ipos < (~rhs).size() )
3831 matrix_(ipos,col_) *= (~rhs)[ipos];
3849 template<
typename MT >
3850 template<
typename VT >
3851 inline void Column<MT,false,true,false>::multAssign(
const SparseVector<VT,false>& rhs )
3855 const ResultType tmp(
serial( *
this ) );
3859 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3860 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
3878 template<
typename MT >
3879 template<
typename VT >
3880 inline void Column<MT,false,true,false>::divAssign(
const DenseVector<VT,false>& rhs )
3884 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3885 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3886 matrix_(i ,col_) /= (~rhs)[i ];
3887 matrix_(i+1UL,col_) /= (~rhs)[i+1UL];
3889 if( ipos < (~rhs).size() )
3890 matrix_(ipos,col_) /= (~rhs)[ipos];
3916 template<
typename MT >
3917 class Column<MT,false,true,true>
3918 :
public DenseVector< Column<MT,false,true,true>, false >
3924 typedef If_< IsExpression<MT>, MT, MT& > Operand;
3929 typedef Column<MT,false,true,true>
This;
3930 typedef DenseVector<This,false>
BaseType;
3934 typedef SIMDTrait_<ElementType> SIMDType;
3945 typedef const ElementType* ConstPointer;
3948 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
3959 enum :
bool { simdEnabled = MT::simdEnabled };
3962 enum :
bool { smpAssignable = MT::smpAssignable };
3968 explicit inline Column( Operand matrix,
size_t index );
3980 inline Reference operator[](
size_t index );
3981 inline ConstReference operator[](
size_t index )
const;
3982 inline Reference at(
size_t index );
3983 inline ConstReference at(
size_t index )
const;
3984 inline Pointer data () noexcept;
3985 inline ConstPointer data () const noexcept;
3986 inline Iterator begin ();
3987 inline ConstIterator begin () const;
3988 inline ConstIterator
cbegin() const;
3989 inline Iterator end ();
3990 inline ConstIterator end () const;
3991 inline ConstIterator
cend () const;
3998 inline Column& operator=( const ElementType& rhs );
3999 inline Column& operator=( initializer_list<ElementType> list );
4000 inline Column& operator=( const Column& rhs );
4002 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
4003 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
4004 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
4005 template< typename VT > inline Column& operator*=( const DenseVector<VT,false>& rhs );
4006 template< typename VT > inline Column& operator*=( const SparseVector<VT,false>& rhs );
4007 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
4009 template< typename Other >
4010 inline
EnableIf_< IsNumeric<Other>, Column >& operator*=( Other rhs );
4012 template< typename Other >
4013 inline
EnableIf_< IsNumeric<Other>, Column >& operator/=( Other rhs );
4020 inline
size_t size() const noexcept;
4021 inline
size_t capacity() const noexcept;
4023 inline
void reset();
4030 template< typename Other > inline Column& scale( const Other& scalar );
4037 template< typename VT >
4038 struct VectorizedAssign {
4040 simdEnabled && VT::simdEnabled &&
4041 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
4047 template<
typename VT >
4048 struct VectorizedAddAssign {
4050 simdEnabled && VT::simdEnabled &&
4051 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4052 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
4058 template<
typename VT >
4059 struct VectorizedSubAssign {
4061 simdEnabled && VT::simdEnabled &&
4062 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4063 HasSIMDSub< ElementType, ElementType_<VT> >::value };
4069 template<
typename VT >
4070 struct VectorizedMultAssign {
4072 simdEnabled && VT::simdEnabled &&
4073 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4074 HasSIMDMult< ElementType, ElementType_<VT> >::value };
4080 template<
typename VT >
4081 struct VectorizedDivAssign {
4083 simdEnabled && VT::simdEnabled &&
4084 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4085 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
4098 template<
typename Other >
4099 inline bool canAlias(
const Other* alias )
const noexcept;
4101 template<
typename MT2,
bool SO2,
bool SF2 >
4102 inline bool canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
4104 template<
typename Other >
4105 inline bool isAliased(
const Other* alias )
const noexcept;
4107 template<
typename MT2,
bool SO2,
bool SF2 >
4108 inline bool isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
4110 inline bool isAligned () const noexcept;
4111 inline
bool canSMPAssign() const noexcept;
4122 template< typename VT >
4123 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
4125 template< typename VT >
4126 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
4128 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
4130 template< typename VT >
4131 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
4133 template< typename VT >
4134 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
4136 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4138 template< typename VT >
4139 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
4141 template< typename VT >
4142 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
4144 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4146 template< typename VT >
4147 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
4149 template< typename VT >
4150 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
4152 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
4154 template< typename VT >
4155 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
4157 template< typename VT >
4158 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
4172 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Column;
4174 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4175 friend
bool isIntact( const Column<MT2,SO2,DF2,SF2>& column ) noexcept;
4177 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4178 friend
bool isSame( const Column<MT2,SO2,DF2,SF2>& a, const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
4180 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4181 friend
bool tryAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4183 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4184 friend
bool tryAddAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4186 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4187 friend
bool trySubAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4189 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4190 friend
bool tryMultAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4192 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4193 friend
bool tryDivAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4195 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4196 friend
DerestrictTrait_< Column<MT2,SO2,DF2,SF2> > derestrict( Column<MT2,SO2,DF2,SF2>& column );
4229 template< typename MT >
4230 inline Column<MT,false,true,true>::Column( Operand matrix,
size_t index )
4234 if( matrix_.columns() <= index ) {
4260 template<
typename MT >
4262 Column<MT,false,true,true>::operator[](
size_t index )
4265 return matrix_(col_,index);
4281 template<
typename MT >
4283 Column<MT,false,true,true>::operator[](
size_t index )
const 4286 return const_cast<const MT&
>( matrix_ )(index,col_);
4303 template<
typename MT >
4305 Column<MT,false,true,true>::at(
size_t index )
4307 if( index >=
size() ) {
4310 return (*
this)[index];
4327 template<
typename MT >
4329 Column<MT,false,true,true>::at(
size_t index )
const 4331 if( index >=
size() ) {
4334 return (*
this)[index];
4349 template<
typename MT >
4350 inline typename Column<MT,false,true,true>::Pointer Column<MT,false,true,true>::data() noexcept
4352 return matrix_.data( col_ );
4367 template<
typename MT >
4368 inline typename Column<MT,false,true,true>::ConstPointer
4369 Column<MT,false,true,true>::data() const noexcept
4371 return matrix_.data( col_ );
4385 template<
typename MT >
4388 return matrix_.begin( col_ );
4402 template<
typename MT >
4405 return matrix_.cbegin( col_ );
4419 template<
typename MT >
4422 return matrix_.cbegin( col_ );
4436 template<
typename MT >
4439 return matrix_.end( col_ );
4453 template<
typename MT >
4456 return matrix_.cend( col_ );
4470 template<
typename MT >
4473 return matrix_.cend( col_ );
4494 template<
typename MT >
4495 inline Column<MT,false,true,true>& Column<MT,false,true,true>::operator=(
const ElementType& rhs )
4497 const size_t jbegin( ( IsUpper<MT>::value )
4498 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4502 const size_t jend ( ( IsLower<MT>::value )
4503 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4508 for(
size_t j=jbegin; j<jend; ++j )
4509 matrix_(col_,j) = rhs;
4530 template<
typename MT >
4531 inline Column<MT,false,true,true>&
4532 Column<MT,false,true,true>::operator=( initializer_list<ElementType> list )
4534 if( list.size() >
size() ) {
4562 template<
typename MT >
4563 inline Column<MT,false,true,true>& Column<MT,false,true,true>::operator=(
const Column& rhs )
4565 if( &rhs ==
this )
return *
this;
4567 if(
size() != rhs.size() ) {
4571 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
4575 DerestrictTrait_<This> left( derestrict( *
this ) );
4601 template<
typename MT >
4602 template<
typename VT >
4603 inline Column<MT,false,true,true>&
4604 Column<MT,false,true,true>::operator=(
const Vector<VT,false>& rhs )
4613 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4614 Right right( ~rhs );
4616 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4620 DerestrictTrait_<This> left( derestrict( *
this ) );
4622 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4623 const ResultType_<VT> tmp( right );
4627 if( IsSparseVector<VT>::value )
4654 template<
typename MT >
4655 template<
typename VT >
4656 inline Column<MT,false,true,true>&
4666 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4667 Right right( ~rhs );
4669 if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
4673 DerestrictTrait_<This> left( derestrict( *
this ) );
4675 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4676 const ResultType_<VT> tmp( right );
4705 template<
typename MT >
4706 template<
typename VT >
4707 inline Column<MT,false,true,true>&
4717 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4718 Right right( ~rhs );
4720 if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
4724 DerestrictTrait_<This> left( derestrict( *
this ) );
4726 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4727 const ResultType_<VT> tmp( right );
4755 template<
typename MT >
4756 template<
typename VT >
4757 inline Column<MT,false,true,true>&
4767 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4768 Right right( ~rhs );
4770 if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
4774 DerestrictTrait_<This> left( derestrict( *
this ) );
4776 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4777 const ResultType_<VT> tmp( right );
4805 template<
typename MT >
4806 template<
typename VT >
4807 inline Column<MT,false,true,true>&
4818 const ResultType right( *
this * (~rhs) );
4820 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4824 DerestrictTrait_<This> left( derestrict( *
this ) );
4848 template<
typename MT >
4849 template<
typename VT >
4850 inline Column<MT,false,true,true>&
4860 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4861 Right right( ~rhs );
4863 if( !tryDivAssign( matrix_, right, 0UL, col_ ) ) {
4867 DerestrictTrait_<This> left( derestrict( *
this ) );
4869 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4870 const ResultType_<VT> tmp( right );
4896 template<
typename MT >
4897 template<
typename Other >
4898 inline EnableIf_< IsNumeric<Other>, Column<MT,false,true,true> >&
4903 return operator=( (*
this) * rhs );
4922 template<
typename MT >
4923 template<
typename Other >
4924 inline EnableIf_< IsNumeric<Other>, Column<MT,false,true,true> >&
4931 return operator=( (*
this) / rhs );
4951 template<
typename MT >
4954 return matrix_.rows();
4966 template<
typename MT >
4969 return matrix_.capacity( col_ );
4984 template<
typename MT >
4987 return matrix_.nonZeros( col_ );
4999 template<
typename MT >
5002 matrix_.reset( col_ );
5027 template<
typename MT >
5028 template<
typename Other >
5029 inline Column<MT,false,true,true>& Column<MT,false,true,true>::scale(
const Other& scalar )
5033 const size_t jbegin( ( IsUpper<MT>::value )
5034 ?( ( IsStrictlyUpper<MT>::value )
5038 const size_t jend ( ( IsLower<MT>::value )
5039 ?( ( IsStrictlyLower<MT>::value )
5044 for(
size_t j=jbegin; j<jend; ++j ) {
5045 matrix_(col_,j) *= scalar;
5073 template<
typename MT >
5074 template<
typename Other >
5075 inline bool Column<MT,false,true,true>::canAlias(
const Other* alias )
const noexcept
5077 return matrix_.isAliased( alias );
5094 template<
typename MT >
5095 template<
typename MT2
5098 inline bool Column<MT,false,true,true>::canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
5100 return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
5117 template<
typename MT >
5118 template<
typename Other >
5119 inline bool Column<MT,false,true,true>::isAliased(
const Other* alias )
const noexcept
5121 return matrix_.isAliased( alias );
5138 template<
typename MT >
5139 template<
typename MT2
5142 inline bool Column<MT,false,true,true>::isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
5144 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
5160 template<
typename MT >
5161 inline bool Column<MT,false,true,true>::isAligned() const noexcept
5163 return matrix_.isAligned();
5180 template<
typename MT >
5181 inline bool Column<MT,false,true,true>::canSMPAssign() const noexcept
5183 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5201 template<
typename MT >
5203 Column<MT,false,true,true>::load(
size_t index )
const noexcept
5205 return matrix_.load( col_, index );
5224 template<
typename MT >
5228 return matrix_.loada( col_, index );
5247 template<
typename MT >
5251 return matrix_.loadu( col_, index );
5270 template<
typename MT >
5272 Column<MT,false,true,true>::store(
size_t index,
const SIMDType& value ) noexcept
5274 matrix_.store( col_, index, value );
5294 template<
typename MT >
5298 matrix_.storea( col_, index, value );
5318 template<
typename MT >
5322 matrix_.storeu( col_, index, value );
5342 template<
typename MT >
5346 matrix_.stream( col_, index, value );
5364 template<
typename MT >
5365 template<
typename VT >
5366 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5367 Column<MT,false,true,true>::assign(
const DenseVector<VT,false>& rhs )
5371 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5372 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5373 matrix_(col_,j ) = (~rhs)[j ];
5374 matrix_(col_,j+1UL) = (~rhs)[j+1UL];
5376 if( jpos < (~rhs).size() )
5377 matrix_(col_,jpos) = (~rhs)[jpos];
5395 template<
typename MT >
5396 template<
typename VT >
5397 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5398 Column<MT,false,true,true>::assign(
const DenseVector<VT,false>& rhs )
5404 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5408 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5412 Iterator left(
begin() );
5413 ConstIterator_<VT> right( (~rhs).
begin() );
5417 for( ; j<jpos; j+=SIMDSIZE ) {
5418 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5420 for( ; remainder && j<
columns; ++j ) {
5421 *left = *right; ++left; ++right;
5426 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5427 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5428 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5429 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5430 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5432 for( ; j<jpos; j+=SIMDSIZE ) {
5433 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5435 for( ; remainder && j<
columns; ++j ) {
5436 *left = *right; ++left; ++right;
5456 template<
typename MT >
5457 template<
typename VT >
5458 inline void Column<MT,false,true,true>::assign(
const SparseVector<VT,false>& rhs )
5462 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5463 matrix_(col_,element->index()) = element->value();
5481 template<
typename MT >
5482 template<
typename VT >
5483 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5484 Column<MT,false,true,true>::addAssign(
const DenseVector<VT,false>& rhs )
5488 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5489 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5490 matrix_(col_,j ) += (~rhs)[j ];
5491 matrix_(col_,j+1UL) += (~rhs)[j+1UL];
5493 if( jpos < (~rhs).size() )
5494 matrix_(col_,jpos) += (~rhs)[jpos];
5512 template<
typename MT >
5513 template<
typename VT >
5514 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5515 Column<MT,false,true,true>::addAssign(
const DenseVector<VT,false>& rhs )
5521 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5525 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5529 Iterator left(
begin() );
5530 ConstIterator_<VT> right( (~rhs).
begin() );
5532 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5533 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5534 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5535 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5536 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5538 for( ; j<jpos; j+=SIMDSIZE ) {
5539 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5541 for( ; remainder && j<
columns; ++j ) {
5542 *left += *right; ++left; ++right;
5561 template<
typename MT >
5562 template<
typename VT >
5563 inline void Column<MT,false,true,true>::addAssign(
const SparseVector<VT,false>& rhs )
5567 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5568 matrix_(col_,element->index()) += element->value();
5586 template<
typename MT >
5587 template<
typename VT >
5588 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5589 Column<MT,false,true,true>::subAssign(
const DenseVector<VT,false>& rhs )
5593 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5594 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5595 matrix_(col_,j ) -= (~rhs)[j ];
5596 matrix_(col_,j+1UL) -= (~rhs)[j+1UL];
5598 if( jpos < (~rhs).size() )
5599 matrix_(col_,jpos) -= (~rhs)[jpos];
5617 template<
typename MT >
5618 template<
typename VT >
5619 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5620 Column<MT,false,true,true>::subAssign(
const DenseVector<VT,false>& rhs )
5626 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5630 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5634 Iterator left(
begin() );
5635 ConstIterator_<VT> right( (~rhs).
begin() );
5637 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5638 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5639 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5640 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5641 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5643 for( ; j<jpos; j+=SIMDSIZE ) {
5644 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5646 for( ; remainder && j<
columns; ++j ) {
5647 *left -= *right; ++left; ++right;
5666 template<
typename MT >
5667 template<
typename VT >
5668 inline void Column<MT,false,true,true>::subAssign(
const SparseVector<VT,false>& rhs )
5672 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5673 matrix_(col_,element->index()) -= element->value();
5691 template<
typename MT >
5692 template<
typename VT >
5693 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5694 Column<MT,false,true,true>::multAssign(
const DenseVector<VT,false>& rhs )
5698 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5699 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5700 matrix_(col_,j ) *= (~rhs)[j ];
5701 matrix_(col_,j+1UL) *= (~rhs)[j+1UL];
5703 if( jpos < (~rhs).size() )
5704 matrix_(col_,jpos) *= (~rhs)[jpos];
5722 template<
typename MT >
5723 template<
typename VT >
5724 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5725 Column<MT,false,true,true>::multAssign(
const DenseVector<VT,false>& rhs )
5731 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5735 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5739 Iterator left(
begin() );
5740 ConstIterator_<VT> right( (~rhs).
begin() );
5742 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5743 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5744 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5745 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5746 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5748 for( ; j<jpos; j+=SIMDSIZE ) {
5749 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5751 for( ; remainder && j<
columns; ++j ) {
5752 *left *= *right; ++left; ++right;
5771 template<
typename MT >
5772 template<
typename VT >
5773 inline void Column<MT,false,true,true>::multAssign(
const SparseVector<VT,false>& rhs )
5777 const ResultType tmp(
serial( *
this ) );
5781 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5782 matrix_(col_,element->index()) = tmp[element->index()] * element->value();
5800 template<
typename MT >
5801 template<
typename VT >
5802 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
5803 Column<MT,false,true,true>::divAssign(
const DenseVector<VT,false>& rhs )
5807 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5808 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5809 matrix_(col_,j ) /= (~rhs)[j ];
5810 matrix_(col_,j+1UL) /= (~rhs)[j+1UL];
5812 if( jpos < (~rhs).size() )
5813 matrix_(col_,jpos) /= (~rhs)[jpos];
5831 template<
typename MT >
5832 template<
typename VT >
5833 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
5834 Column<MT,false,true,true>::divAssign(
const DenseVector<VT,false>& rhs )
5842 const size_t jpos(
columns &
size_t(-SIMDSIZE) );
5846 Iterator left(
begin() );
5847 ConstIterator_<VT> right( (~rhs).
begin() );
5849 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5850 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5851 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5852 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5853 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5855 for( ; j<jpos; j+=SIMDSIZE ) {
5856 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5859 *left /= *right; ++left; ++right;
Constraint on the data type.
#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.
constexpr bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
typename DerestrictTrait< T >::Type DerestrictTrait_
Auxiliary alias declaration for the DerestrictTrait type trait.The DerestrictTrait_ alias declaration...
Definition: DerestrictTrait.h:110
#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
Header file for the IsUniUpper type trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:352
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:721
Header file for basic type definitions.
Header file for the View base class.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
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:160
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
#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 size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
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:194
Header file for the implementation of the Column base template.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
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:699
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2935
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
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
Header file for the DenseVector base class.
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
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:390
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
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:731
Constraints on the storage order of matrix types.
#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
System settings for performance optimizations.
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
Header file for the IsUniLower type trait.
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:129
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:304
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:238
Constraint on the data type.
Header file for the std::initializer_list aliases.
Constraint on the transpose flag of vector types.
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
constexpr bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
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:98
Header file for the Or class template.
#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
Header file for the HasSIMDAdd type trait.
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.
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
Header file for all SIMD functionality.
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:336
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraint on the data type.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:128
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:61
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2932
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:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
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.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:128
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsPadded type trait.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
Header file for the IsSIMDCombinable type trait.
Header file for the IsSparseVector type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the HasSIMDMult type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
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:1285
Header file for run time assertion macros.
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 cache size of the target architecture.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
Header file for the column trait.
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Header file for the HasSIMDSub type trait.
Constraints on the storage order of matrix types.
#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.
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
#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
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
Header file for the HasSIMDDiv type trait.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
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:1303
Header file for the IsUpper type trait.
Header file for the IsRestricted type trait.
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
System settings for the inline keywords.
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 TrueType type/value trait base class.
Header file for the IsExpression type trait class.