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 View< DenseVector< Column<MT,true,true,SF>, false > >
127 using Operand = If_< IsExpression<MT>, MT, MT& >;
132 using This = Column<MT,true,true,SF>;
133 using BaseType = DenseVector<This,false>;
137 using SIMDType = SIMDTrait_<ElementType>;
151 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer,
ElementType* >;
162 enum :
bool { simdEnabled = MT::simdEnabled };
165 enum :
bool { smpAssignable = MT::smpAssignable };
171 explicit inline Column( Operand matrix,
size_t index );
183 inline Reference operator[](
size_t index );
184 inline ConstReference operator[](
size_t index )
const;
186 inline ConstReference at(
size_t index )
const;
187 inline Pointer data () noexcept;
188 inline ConstPointer data () const noexcept;
190 inline ConstIterator begin () const;
191 inline ConstIterator
cbegin() const;
193 inline ConstIterator end () const;
194 inline ConstIterator
cend () const;
201 inline Column& operator=( const ElementType& rhs );
202 inline Column& operator=( initializer_list<ElementType> list );
203 inline Column& operator=( const Column& rhs );
205 template< typename VT > inline Column& operator= ( const Vector<VT,false>& 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 DenseVector<VT,false>& rhs );
209 template< typename VT > inline Column& operator*=( const SparseVector<VT,false>& rhs );
210 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
211 template< typename VT > inline Column& operator%=( const Vector<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 Operand operand() const noexcept;
225 inline
size_t column() const noexcept;
226 inline
size_t size() const noexcept;
227 inline
size_t spacing() const noexcept;
228 inline
size_t capacity() const noexcept;
237 template< typename Other > inline Column& scale( const Other& scalar );
244 template< typename VT >
245 struct VectorizedAssign {
246 enum :
bool { value = useOptimizedKernels &&
247 simdEnabled && VT::simdEnabled &&
248 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
254 template<
typename VT >
255 struct VectorizedAddAssign {
256 enum :
bool { value = useOptimizedKernels &&
257 simdEnabled && VT::simdEnabled &&
258 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
259 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
265 template<
typename VT >
266 struct VectorizedSubAssign {
267 enum :
bool { value = useOptimizedKernels &&
268 simdEnabled && VT::simdEnabled &&
269 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
270 HasSIMDSub< ElementType, ElementType_<VT> >::value };
276 template<
typename VT >
277 struct VectorizedMultAssign {
278 enum :
bool { value = useOptimizedKernels &&
279 simdEnabled && VT::simdEnabled &&
280 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
281 HasSIMDMult< ElementType, ElementType_<VT> >::value };
287 template<
typename VT >
288 struct VectorizedDivAssign {
289 enum :
bool { value = useOptimizedKernels &&
290 simdEnabled && VT::simdEnabled &&
291 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
292 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
305 template<
typename Other >
306 inline bool canAlias(
const Other* alias )
const noexcept;
308 template<
typename MT2,
bool SO2,
bool SF2 >
309 inline bool canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
311 template<
typename Other >
312 inline bool isAliased(
const Other* alias )
const noexcept;
314 template<
typename MT2,
bool SO2,
bool SF2 >
315 inline bool isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
317 inline bool isAligned () const noexcept;
318 inline
bool canSMPAssign() const noexcept;
329 template< typename VT >
330 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
332 template< typename VT >
333 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
335 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
337 template< typename VT >
338 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
340 template< typename VT >
341 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
343 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
345 template< typename VT >
346 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
348 template< typename VT >
349 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
351 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
353 template< typename VT >
354 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
356 template< typename VT >
357 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
359 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
361 template< typename VT >
362 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
364 template< typename VT >
365 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
379 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Column;
411 template< typename MT
413 inline Column<MT,true,true,SF>::Column( Operand matrix,
size_t index )
417 if( matrix_.columns() <= index ) {
443 template<
typename MT
448 return matrix_(index,col_);
464 template<
typename MT
467 Column<MT,true,true,SF>::operator[](
size_t index )
const 470 return const_cast<const MT&
>( matrix_ )(index,col_);
487 template<
typename MT
491 if( index >=
size() ) {
494 return (*
this)[index];
511 template<
typename MT
514 Column<MT,true,true,SF>::at(
size_t index )
const 516 if( index >=
size() ) {
519 return (*
this)[index];
534 template<
typename MT
536 inline typename Column<MT,true,true,SF>::Pointer Column<MT,true,true,SF>::data() noexcept
538 return matrix_.data( col_ );
553 template<
typename MT
555 inline typename Column<MT,true,true,SF>::ConstPointer Column<MT,true,true,SF>::data() const noexcept
557 return matrix_.data( col_ );
571 template<
typename MT
575 return matrix_.begin( col_ );
589 template<
typename MT
593 return matrix_.cbegin( col_ );
607 template<
typename MT
611 return matrix_.cbegin( col_ );
625 template<
typename MT
629 return matrix_.end( col_ );
643 template<
typename MT
647 return matrix_.cend( col_ );
661 template<
typename MT
665 return matrix_.cend( col_ );
690 template<
typename MT
692 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=(
const ElementType& rhs )
694 const size_t ibegin( ( IsLower<MT>::value )
695 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
699 const size_t iend ( ( IsUpper<MT>::value )
700 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
705 for(
size_t i=ibegin; i<iend; ++i )
706 matrix_(i,col_) = rhs;
727 template<
typename MT
729 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=( initializer_list<ElementType> list )
731 if( list.size() >
size() ) {
759 template<
typename MT
761 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=(
const Column& rhs )
763 if( &rhs ==
this )
return *
this;
765 if(
size() != rhs.size() ) {
769 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
773 decltype(
auto) left( derestrict( *this ) );
799 template< typename MT
801 template< typename VT >
802 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator=( const Vector<VT,false>& rhs )
811 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
814 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
818 decltype(
auto) left( derestrict( *this ) );
820 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
821 const ResultType_<VT> tmp( right );
825 if( IsSparseVector<VT>::value )
852 template<
typename MT
854 template<
typename VT >
864 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
867 if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
871 decltype(
auto) left( derestrict( *this ) );
873 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
874 const ResultType_<VT> tmp( right );
903 template<
typename MT
905 template<
typename VT >
915 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
918 if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
922 decltype(
auto) left( derestrict( *this ) );
924 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
925 const ResultType_<VT> tmp( right );
953 template<
typename MT
955 template<
typename VT >
965 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
968 if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
972 decltype(
auto) left( derestrict( *this ) );
974 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
975 const ResultType_<VT> tmp( right );
1003 template<
typename MT
1005 template<
typename VT >
1018 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
1022 decltype(
auto) left( derestrict( *this ) );
1046 template< typename MT
1048 template< typename VT >
1049 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator/=( const DenseVector<VT,false>& rhs )
1058 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
1059 Right right( ~rhs );
1061 if( !tryDivAssign( matrix_, right, 0UL, col_ ) ) {
1065 decltype(
auto) left( derestrict( *this ) );
1067 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1068 const ResultType_<VT> tmp( right );
1096 template<
typename MT
1098 template<
typename VT >
1099 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::operator%=(
const Vector<VT,false>& rhs )
1101 using blaze::assign;
1106 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1112 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1116 const CrossType right( *
this % (~rhs) );
1118 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
1122 decltype(
auto) left( derestrict( *this ) );
1124 assign( left, right );
1145 template< typename MT
1147 template< typename Other >
1148 inline
EnableIf_< IsNumeric<Other>, Column<MT,true,true,SF> >&
1149 Column<MT,true,true,SF>::operator*=( Other rhs )
1153 return operator=( (*
this) * rhs );
1172 template<
typename MT
1174 template<
typename Other >
1175 inline EnableIf_< IsNumeric<Other>, Column<MT,true,true,SF> >&
1182 return operator=( (*
this) / rhs );
1202 template<
typename MT
1204 inline typename Column<MT,true,true,SF>::Operand
1205 Column<MT,true,true,SF>::operand() const noexcept
1219 template<
typename MT
1235 template<
typename MT
1239 return matrix_.rows();
1254 template<
typename MT
1258 return matrix_.spacing();
1270 template<
typename MT
1274 return matrix_.capacity( col_ );
1289 template<
typename MT
1293 return matrix_.nonZeros( col_ );
1305 template<
typename MT
1309 matrix_.reset( col_ );
1336 template<
typename MT
1338 template<
typename Other >
1339 inline Column<MT,true,true,SF>& Column<MT,true,true,SF>::scale(
const Other& scalar )
1343 const size_t ibegin( ( IsLower<MT>::value )
1344 ?( ( IsStrictlyLower<MT>::value )
1348 const size_t iend ( ( IsUpper<MT>::value )
1349 ?( ( IsStrictlyUpper<MT>::value )
1354 for(
size_t i=ibegin; i<iend; ++i ) {
1355 matrix_(i,col_) *= scalar;
1383 template<
typename MT
1385 template<
typename Other >
1386 inline bool Column<MT,true,true,SF>::canAlias(
const Other* alias )
const noexcept
1388 return matrix_.isAliased( alias );
1405 template<
typename MT
1407 template<
typename MT2
1410 inline bool Column<MT,true,true,SF>::canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
1412 return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
1429 template<
typename MT
1431 template<
typename Other >
1432 inline bool Column<MT,true,true,SF>::isAliased(
const Other* alias )
const noexcept
1434 return matrix_.isAliased( alias );
1451 template<
typename MT
1453 template<
typename MT2
1456 inline bool Column<MT,true,true,SF>::isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
1458 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
1474 template<
typename MT
1476 inline bool Column<MT,true,true,SF>::isAligned() const noexcept
1478 return matrix_.isAligned();
1495 template<
typename MT
1497 inline bool Column<MT,true,true,SF>::canSMPAssign() const noexcept
1499 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1517 template<
typename MT
1520 Column<MT,true,true,SF>::load(
size_t index )
const noexcept
1522 return matrix_.load( index, col_ );
1541 template<
typename MT
1546 return matrix_.loada( index, col_ );
1565 template<
typename MT
1570 return matrix_.loadu( index, col_ );
1589 template<
typename MT
1592 Column<MT,true,true,SF>::store(
size_t index,
const SIMDType& value ) noexcept
1594 matrix_.store( index, col_, value );
1614 template<
typename MT
1619 matrix_.storea( index, col_, value );
1639 template<
typename MT
1644 matrix_.storeu( index, col_, value );
1664 template<
typename MT
1669 matrix_.stream( index, col_, value );
1687 template<
typename MT
1689 template<
typename VT >
1690 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1691 Column<MT,true,true,SF>::assign(
const DenseVector<VT,false>& rhs )
1695 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1696 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1697 matrix_(i ,col_) = (~rhs)[i ];
1698 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1700 if( ipos < (~rhs).size() )
1701 matrix_(ipos,col_) = (~rhs)[ipos];
1719 template<
typename MT
1721 template<
typename VT >
1722 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1723 Column<MT,true,true,SF>::assign(
const DenseVector<VT,false>& rhs )
1729 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1733 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1738 ConstIterator_<VT> right( (~rhs).
begin() );
1740 if( useStreaming &&
rows > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased(
this ) )
1742 for( ; i<ipos; i+=SIMDSIZE ) {
1743 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1745 for( ; remainder && i<
rows; ++i ) {
1746 *left = *right; ++left; ++right;
1751 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1752 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1753 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1754 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1755 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1757 for( ; i<ipos; i+=SIMDSIZE ) {
1758 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1760 for( ; remainder && i<
rows; ++i ) {
1761 *left = *right; ++left; ++right;
1781 template<
typename MT
1783 template<
typename VT >
1784 inline void Column<MT,true,true,SF>::assign(
const SparseVector<VT,false>& rhs )
1788 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1789 matrix_(element->index(),col_) = element->value();
1807 template<
typename MT
1809 template<
typename VT >
1810 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1811 Column<MT,true,true,SF>::addAssign(
const DenseVector<VT,false>& rhs )
1815 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1816 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1817 matrix_(i ,col_) += (~rhs)[i ];
1818 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1820 if( ipos < (~rhs).size() )
1821 matrix_(ipos,col_) += (~rhs)[ipos];
1839 template<
typename MT
1841 template<
typename VT >
1842 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1843 Column<MT,true,true,SF>::addAssign(
const DenseVector<VT,false>& rhs )
1849 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1853 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1858 ConstIterator_<VT> right( (~rhs).
begin() );
1860 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1861 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1862 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1863 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1864 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1866 for( ; i<ipos; i+=SIMDSIZE ) {
1867 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1869 for( ; remainder && i<
rows; ++i ) {
1870 *left += *right; ++left; ++right;
1889 template<
typename MT
1891 template<
typename VT >
1892 inline void Column<MT,true,true,SF>::addAssign(
const SparseVector<VT,false>& rhs )
1896 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1897 matrix_(element->index(),col_) += element->value();
1915 template<
typename MT
1917 template<
typename VT >
1918 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1919 Column<MT,true,true,SF>::subAssign(
const DenseVector<VT,false>& rhs )
1923 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1924 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1925 matrix_(i ,col_) -= (~rhs)[i ];
1926 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1928 if( ipos < (~rhs).size() )
1929 matrix_(ipos,col_) -= (~rhs)[ipos];
1947 template<
typename MT
1949 template<
typename VT >
1950 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1951 Column<MT,true,true,SF>::subAssign(
const DenseVector<VT,false>& rhs )
1957 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1961 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1966 ConstIterator_<VT> right( (~rhs).
begin() );
1968 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1969 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1970 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1971 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1972 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1974 for( ; i<ipos; i+=SIMDSIZE ) {
1975 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1977 for( ; remainder && i<
rows; ++i ) {
1978 *left -= *right; ++left; ++right;
1997 template<
typename MT
1999 template<
typename VT >
2000 inline void Column<MT,true,true,SF>::subAssign(
const SparseVector<VT,false>& rhs )
2004 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2005 matrix_(element->index(),col_) -= element->value();
2023 template<
typename MT
2025 template<
typename VT >
2026 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2027 Column<MT,true,true,SF>::multAssign(
const DenseVector<VT,false>& rhs )
2031 const size_t ipos( (~rhs).
size() &
size_t(-2) );
2032 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2033 matrix_(i ,col_) *= (~rhs)[i ];
2034 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
2036 if( ipos < (~rhs).size() )
2037 matrix_(ipos,col_) *= (~rhs)[ipos];
2055 template<
typename MT
2057 template<
typename VT >
2058 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2059 Column<MT,true,true,SF>::multAssign(
const DenseVector<VT,false>& rhs )
2065 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
2069 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
2074 ConstIterator_<VT> right( (~rhs).
begin() );
2076 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2077 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2078 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2079 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2080 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2082 for( ; i<ipos; i+=SIMDSIZE ) {
2083 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2085 for( ; remainder && i<
rows; ++i ) {
2086 *left *= *right; ++left, ++right;
2105 template<
typename MT
2107 template<
typename VT >
2108 inline void Column<MT,true,true,SF>::multAssign(
const SparseVector<VT,false>& rhs )
2116 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2117 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
2135 template<
typename MT
2137 template<
typename VT >
2138 inline DisableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2139 Column<MT,true,true,SF>::divAssign(
const DenseVector<VT,false>& rhs )
2143 const size_t ipos( (~rhs).
size() &
size_t(-2) );
2144 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2145 matrix_(i ,col_) /= (~rhs)[i ];
2146 matrix_(i+1UL,col_) /= (~rhs)[i+1UL];
2148 if( ipos < (~rhs).size() )
2149 matrix_(ipos,col_) /= (~rhs)[ipos];
2167 template<
typename MT
2169 template<
typename VT >
2170 inline EnableIf_< typename Column<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2171 Column<MT,true,true,SF>::divAssign(
const DenseVector<VT,false>& rhs )
2179 const size_t ipos(
rows &
size_t(-SIMDSIZE) );
2184 ConstIterator_<VT> right( (~rhs).
begin() );
2186 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2187 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2188 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2189 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2190 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2192 for( ; i<ipos; i+=SIMDSIZE ) {
2193 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2195 for( ; i<
rows; ++i ) {
2196 *left /= *right; ++left; ++right;
2223 template<
typename MT >
2224 class Column<MT,false,true,false>
2225 :
public View< DenseVector< Column<MT,false,true,false>, false > >
2230 using Operand = If_< IsExpression<MT>, MT, MT& >;
2235 using This = Column<MT,false,true,false>;
2236 using BaseType = DenseVector<This,false>;
2239 using ElementType = ElementType_<MT>;
2244 using ConstReference = ConstReference_<MT>;
2250 using ConstPointer =
const ElementType*;
2253 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* >;
2259 template<
typename MatrixType >
2260 class ColumnIterator
2265 using Reference = If_< IsConst<MatrixType>, ConstReference_<MatrixType>, Reference_<MatrixType> >;
2267 using IteratorCategory = std::random_access_iterator_tag;
2268 using ValueType = RemoveReference_<Reference>;
2269 using PointerType = ValueType*;
2271 using DifferenceType = ptrdiff_t;
2274 using iterator_category = IteratorCategory;
2275 using value_type = ValueType;
2276 using pointer = PointerType;
2277 using reference = ReferenceType;
2278 using difference_type = DifferenceType;
2284 inline ColumnIterator() noexcept
2285 : matrix_(
nullptr )
2298 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2299 : matrix_( &matrix )
2310 template<
typename MatrixType2 >
2311 inline ColumnIterator(
const ColumnIterator<MatrixType2>& it ) noexcept
2312 : matrix_( it.matrix_ )
2314 , column_( it.column_ )
2324 inline ColumnIterator&
operator+=(
size_t inc ) noexcept {
2336 inline ColumnIterator&
operator-=(
size_t dec ) noexcept {
2347 inline ColumnIterator& operator++() noexcept {
2358 inline const ColumnIterator operator++(
int ) noexcept {
2359 const ColumnIterator tmp( *
this );
2370 inline ColumnIterator& operator--() noexcept {
2381 inline const ColumnIterator operator--(
int ) noexcept {
2382 const ColumnIterator tmp( *
this );
2394 inline ReferenceType operator[](
size_t index )
const {
2395 return (*matrix_)(row_+index,column_);
2404 inline ReferenceType
operator*()
const {
2405 return (*matrix_)(row_,column_);
2414 inline PointerType operator->()
const {
2415 return &(*matrix_)(row_,column_);
2425 template<
typename MatrixType2 >
2426 inline bool operator==(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2427 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2437 template<
typename MatrixType2 >
2438 inline bool operator!=(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2439 return !( *
this == rhs );
2449 template<
typename MatrixType2 >
2450 inline bool operator<( const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2451 return ( matrix_ == rhs.matrix_ ) && ( row_ < rhs.row_ ) && ( column_ == rhs.column_ );
2461 template<
typename MatrixType2 >
2462 inline bool operator>(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2463 return ( matrix_ == rhs.matrix_ ) && ( row_ > rhs.row_ ) && ( column_ == rhs.column_ );
2473 template<
typename MatrixType2 >
2474 inline bool operator<=( const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2475 return ( matrix_ == rhs.matrix_ ) && ( row_ <= rhs.row_ ) && ( column_ == rhs.column_ );
2485 template<
typename MatrixType2 >
2486 inline bool operator>=(
const ColumnIterator<MatrixType2>& rhs )
const noexcept {
2487 return ( matrix_ == rhs.matrix_ ) && ( row_ >= rhs.row_ ) && ( column_ == rhs.column_ );
2497 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const noexcept {
2498 return row_ - rhs.row_;
2509 friend inline const ColumnIterator
operator+(
const ColumnIterator& it,
size_t inc ) noexcept {
2510 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2521 friend inline const ColumnIterator
operator+(
size_t inc,
const ColumnIterator& it ) noexcept {
2522 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2533 friend inline const ColumnIterator
operator-(
const ColumnIterator& it,
size_t dec ) noexcept {
2534 return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2540 MatrixType* matrix_;
2546 template<
typename MatrixType2 >
friend class ColumnIterator;
2553 using ConstIterator = ColumnIterator<const MT>;
2561 enum :
bool { simdEnabled =
false };
2564 enum :
bool { smpAssignable = MT::smpAssignable };
2570 explicit inline Column( Operand matrix,
size_t index );
2582 inline Reference operator[](
size_t index );
2583 inline ConstReference operator[](
size_t index )
const;
2585 inline ConstReference at(
size_t index )
const;
2586 inline Pointer data () noexcept;
2587 inline ConstPointer data () const noexcept;
2589 inline ConstIterator begin () const;
2590 inline ConstIterator
cbegin() const;
2592 inline ConstIterator end () const;
2593 inline ConstIterator
cend () const;
2600 inline Column& operator=( const ElementType& rhs );
2601 inline Column& operator=( initializer_list<ElementType> list );
2602 inline Column& operator=( const Column& rhs );
2604 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
2605 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
2606 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
2607 template< typename VT > inline Column& operator*=( const DenseVector<VT,false>& rhs );
2608 template< typename VT > inline Column& operator*=( const SparseVector<VT,false>& rhs );
2609 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
2610 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
2612 template< typename Other >
2613 inline
EnableIf_< IsNumeric<Other>, Column >& operator*=( Other rhs );
2615 template< typename Other >
2616 inline
EnableIf_< IsNumeric<Other>, Column >& operator/=( Other rhs );
2623 inline Operand operand() const noexcept;
2624 inline
size_t column() const noexcept;
2625 inline
size_t size() const noexcept;
2626 inline
size_t spacing() const noexcept;
2627 inline
size_t capacity() const noexcept;
2629 inline
void reset();
2636 template< typename Other > inline Column& scale( const Other& scalar );
2643 template< typename Other >
2644 inline
bool canAlias ( const Other* alias ) const noexcept;
2646 template< typename MT2,
bool SO2,
bool SF2 >
2647 inline
bool canAlias ( const Column<MT2,SO2,true,SF2>* alias ) const noexcept;
2649 template< typename Other >
2650 inline
bool isAliased( const Other* alias ) const noexcept;
2652 template< typename MT2,
bool SO2,
bool SF2 >
2653 inline
bool isAliased( const Column<MT2,SO2,true,SF2>* alias ) const noexcept;
2655 inline
bool isAligned () const noexcept;
2656 inline
bool canSMPAssign() const noexcept;
2658 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2659 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2660 template< typename VT > inline
void addAssign ( const DenseVector <VT,false>& rhs );
2661 template< typename VT > inline
void addAssign ( const SparseVector<VT,false>& rhs );
2662 template< typename VT > inline
void subAssign ( const DenseVector <VT,false>& rhs );
2663 template< typename VT > inline
void subAssign ( const SparseVector<VT,false>& rhs );
2664 template< typename VT > inline
void multAssign( const DenseVector <VT,false>& rhs );
2665 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
2666 template< typename VT > inline
void divAssign ( const DenseVector <VT,false>& rhs );
2680 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Column;
2713 template< typename MT >
2714 inline Column<MT,false,true,false>::Column( Operand matrix,
size_t index )
2718 if( matrix_.columns() <= index ) {
2744 template<
typename MT >
2746 Column<MT,false,true,false>::operator[](
size_t index )
2749 return matrix_(index,col_);
2765 template<
typename MT >
2767 Column<MT,false,true,false>::operator[](
size_t index )
const 2770 return const_cast<const MT&
>( matrix_ )(index,col_);
2787 template<
typename MT >
2789 Column<MT,false,true,false>::at(
size_t index )
2791 if( index >=
size() ) {
2794 return (*
this)[index];
2811 template<
typename MT >
2813 Column<MT,false,true,false>::at(
size_t index )
const 2815 if( index >=
size() ) {
2818 return (*
this)[index];
2833 template<
typename MT >
2834 inline typename Column<MT,false,true,false>::Pointer Column<MT,false,true,false>::data() noexcept
2836 return matrix_.data() + col_;
2851 template<
typename MT >
2852 inline typename Column<MT,false,true,false>::ConstPointer Column<MT,false,true,false>::data() const noexcept
2854 return matrix_.data() + col_;
2868 template<
typename MT >
2871 return Iterator( matrix_, 0UL, col_ );
2885 template<
typename MT >
2903 template<
typename MT >
2921 template<
typename MT >
2938 template<
typename MT >
2956 template<
typename MT >
2985 template<
typename MT >
2986 inline Column<MT,false,true,false>&
2987 Column<MT,false,true,false>::operator=(
const ElementType& rhs )
2989 const size_t ibegin( ( IsLower<MT>::value )
2990 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2994 const size_t iend ( ( IsUpper<MT>::value )
2995 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3000 for(
size_t i=ibegin; i<iend; ++i )
3001 matrix_(i,col_) = rhs;
3022 template<
typename MT >
3023 inline Column<MT,false,true,false>&
3024 Column<MT,false,true,false>::operator=( initializer_list<ElementType> list )
3026 if( list.size() >
size() ) {
3054 template<
typename MT >
3055 inline Column<MT,false,true,false>&
3056 Column<MT,false,true,false>::operator=(
const Column& rhs )
3058 if( &rhs ==
this )
return *
this;
3060 if(
size() != rhs.size() ) {
3064 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
3068 decltype(
auto) left( derestrict( *this ) );
3094 template< typename MT >
3095 template< typename VT >
3096 inline Column<MT,false,true,false>&
3097 Column<MT,false,true,false>::operator=( const Vector<VT,false>& rhs )
3107 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3108 Right right( ~rhs );
3110 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
3114 decltype(
auto) left( derestrict( *this ) );
3116 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3121 if( IsSparseVector<VT>::value )
3148 template<
typename MT >
3149 template<
typename VT >
3150 inline Column<MT,false,true,false>&
3160 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3161 Right right( ~rhs );
3163 if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
3167 decltype(
auto) left( derestrict( *this ) );
3169 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3170 const ResultType_<VT> tmp( right );
3199 template<
typename MT >
3200 template<
typename VT >
3201 inline Column<MT,false,true,false>&
3211 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3212 Right right( ~rhs );
3214 if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
3218 decltype(
auto) left( derestrict( *this ) );
3220 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3221 const ResultType_<VT> tmp( right );
3249 template<
typename MT >
3250 template<
typename VT >
3251 inline Column<MT,false,true,false>&
3261 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3262 Right right( ~rhs );
3264 if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
3268 decltype(
auto) left( derestrict( *this ) );
3270 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3271 const ResultType_<VT> tmp( right );
3299 template<
typename MT >
3300 template<
typename VT >
3301 inline Column<MT,false,true,false>&
3314 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
3318 decltype(
auto) left( derestrict( *this ) );
3342 template< typename MT >
3343 template< typename VT >
3344 inline Column<MT,false,true,false>&
3345 Column<MT,false,true,false>::operator/=( const DenseVector<VT,false>& rhs )
3354 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3355 Right right( ~rhs );
3357 if( !tryDivAssign( matrix_, right, 0UL, col_ ) ) {
3361 decltype(
auto) left( derestrict( *this ) );
3363 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3364 const ResultType_<VT> tmp( right );
3392 template<
typename MT >
3393 template<
typename VT >
3394 inline Column<MT,false,true,false>&
3395 Column<MT,false,true,false>::operator%=(
const Vector<VT,false>& rhs )
3397 using blaze::assign;
3402 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
3408 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3412 const CrossType right( *
this % (~rhs) );
3414 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
3418 decltype(
auto) left( derestrict( *this ) );
3420 assign( left, right );
3441 template< typename MT >
3442 template< typename Other >
3443 inline
EnableIf_< IsNumeric<Other>, Column<MT,false,true,false> >&
3444 Column<MT,false,true,false>::operator*=( Other rhs )
3448 return operator=( (*
this) * rhs );
3467 template<
typename MT >
3468 template<
typename Other >
3469 inline EnableIf_< IsNumeric<Other>, Column<MT,false,true,false> >&
3476 return operator=( (*
this) / rhs );
3496 template<
typename MT >
3497 inline typename Column<MT,false,true,false>::Operand
3498 Column<MT,false,true,false>::operand() const noexcept
3512 template<
typename MT >
3527 template<
typename MT >
3530 return matrix_.rows();
3545 template<
typename MT >
3548 return matrix_.spacing();
3560 template<
typename MT >
3563 return matrix_.rows();
3578 template<
typename MT >
3582 size_t nonzeros( 0UL );
3584 for(
size_t i=0UL; i<
rows; ++i )
3600 template<
typename MT >
3605 const size_t ibegin( ( IsLower<MT>::value )
3606 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3610 const size_t iend ( ( IsUpper<MT>::value )
3611 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3616 for(
size_t i=ibegin; i<iend; ++i )
3617 clear( matrix_(i,col_) );
3644 template<
typename MT >
3645 template<
typename Other >
3646 inline Column<MT,false,true,false>& Column<MT,false,true,false>::scale(
const Other& scalar )
3650 const size_t ibegin( ( IsLower<MT>::value )
3651 ?( ( IsStrictlyLower<MT>::value )
3655 const size_t iend ( ( IsUpper<MT>::value )
3656 ?( ( IsStrictlyUpper<MT>::value )
3661 for(
size_t i=ibegin; i<iend; ++i ) {
3662 matrix_(i,col_) *= scalar;
3690 template<
typename MT >
3691 template<
typename Other >
3692 inline bool Column<MT,false,true,false>::canAlias(
const Other* alias )
const noexcept
3694 return matrix_.isAliased( alias );
3711 template<
typename MT >
3712 template<
typename MT2
3715 inline bool Column<MT,false,true,false>::canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
3717 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3734 template<
typename MT >
3735 template<
typename Other >
3736 inline bool Column<MT,false,true,false>::isAliased(
const Other* alias )
const noexcept
3738 return matrix_.isAliased( alias );
3755 template<
typename MT >
3756 template<
typename MT2
3759 inline bool Column<MT,false,true,false>::isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
3761 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3777 template<
typename MT >
3778 inline bool Column<MT,false,true,false>::isAligned() const noexcept
3797 template<
typename MT >
3798 inline bool Column<MT,false,true,false>::canSMPAssign() const noexcept
3800 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3818 template<
typename MT >
3819 template<
typename VT >
3820 inline void Column<MT,false,true,false>::assign(
const DenseVector<VT,false>& rhs )
3824 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3825 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3826 matrix_(i ,col_) = (~rhs)[i ];
3827 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
3829 if( ipos < (~rhs).size() )
3830 matrix_(ipos,col_) = (~rhs)[ipos];
3848 template<
typename MT >
3849 template<
typename VT >
3850 inline void Column<MT,false,true,false>::assign(
const SparseVector<VT,false>& rhs )
3854 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3855 matrix_(element->index(),col_) = element->value();
3873 template<
typename MT >
3874 template<
typename VT >
3875 inline void Column<MT,false,true,false>::addAssign(
const DenseVector<VT,false>& rhs )
3879 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3880 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3881 matrix_(i ,col_) += (~rhs)[i ];
3882 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
3884 if( ipos < (~rhs).size() )
3885 matrix_(ipos,col_) += (~rhs)[ipos];
3903 template<
typename MT >
3904 template<
typename VT >
3905 inline void Column<MT,false,true,false>::addAssign(
const SparseVector<VT,false>& rhs )
3909 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3910 matrix_(element->index(),col_) += element->value();
3928 template<
typename MT >
3929 template<
typename VT >
3930 inline void Column<MT,false,true,false>::subAssign(
const DenseVector<VT,false>& rhs )
3934 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3935 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3936 matrix_(i ,col_) -= (~rhs)[i ];
3937 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
3939 if( ipos < (~rhs).size() )
3940 matrix_(ipos,col_) -= (~rhs)[ipos];
3958 template<
typename MT >
3959 template<
typename VT >
3960 inline void Column<MT,false,true,false>::subAssign(
const SparseVector<VT,false>& rhs )
3964 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3965 matrix_(element->index(),col_) -= element->value();
3983 template<
typename MT >
3984 template<
typename VT >
3985 inline void Column<MT,false,true,false>::multAssign(
const DenseVector<VT,false>& rhs )
3989 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3990 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3991 matrix_(i ,col_) *= (~rhs)[i ];
3992 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
3994 if( ipos < (~rhs).size() )
3995 matrix_(ipos,col_) *= (~rhs)[ipos];
4013 template<
typename MT >
4014 template<
typename VT >
4015 inline void Column<MT,false,true,false>::multAssign(
const SparseVector<VT,false>& rhs )
4023 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
4024 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
4042 template<
typename MT >
4043 template<
typename VT >
4044 inline void Column<MT,false,true,false>::divAssign(
const DenseVector<VT,false>& rhs )
4048 const size_t ipos( (~rhs).
size() &
size_t(-2) );
4049 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4050 matrix_(i ,col_) /= (~rhs)[i ];
4051 matrix_(i+1UL,col_) /= (~rhs)[i+1UL];
4053 if( ipos < (~rhs).size() )
4054 matrix_(ipos,col_) /= (~rhs)[ipos];
4080 template<
typename MT >
4081 class Column<MT,false,true,true>
4082 :
public View< DenseVector< Column<MT,false,true,true>, false > >
4087 using Operand = If_< IsExpression<MT>, MT, MT& >;
4092 using This = Column<MT,false,true,true>;
4093 using BaseType = DenseVector<This,false>;
4096 using ElementType = ElementType_<MT>;
4097 using SIMDType = SIMDTrait_<ElementType>;
4102 using ConstReference = ConstReference_<MT>;
4108 using ConstPointer =
const ElementType*;
4111 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* >;
4114 using ConstIterator = ConstIterator_<MT>;
4122 enum :
bool { simdEnabled = MT::simdEnabled };
4125 enum :
bool { smpAssignable = MT::smpAssignable };
4131 explicit inline Column( Operand matrix,
size_t index );
4143 inline Reference operator[](
size_t index );
4144 inline ConstReference operator[](
size_t index )
const;
4146 inline ConstReference at(
size_t index )
const;
4147 inline Pointer data () noexcept;
4148 inline ConstPointer data () const noexcept;
4150 inline ConstIterator begin () const;
4151 inline ConstIterator
cbegin() const;
4153 inline ConstIterator end () const;
4154 inline ConstIterator
cend () const;
4161 inline Column& operator=( const ElementType& rhs );
4162 inline Column& operator=( initializer_list<ElementType> list );
4163 inline Column& operator=( const Column& rhs );
4165 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
4166 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
4167 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
4168 template< typename VT > inline Column& operator*=( const DenseVector<VT,false>& rhs );
4169 template< typename VT > inline Column& operator*=( const SparseVector<VT,false>& rhs );
4170 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
4171 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
4173 template< typename Other >
4174 inline
EnableIf_< IsNumeric<Other>, Column >& operator*=( Other rhs );
4176 template< typename Other >
4177 inline
EnableIf_< IsNumeric<Other>, Column >& operator/=( Other rhs );
4184 inline Operand operand() const noexcept;
4185 inline
size_t column() const noexcept;
4186 inline
size_t size() const noexcept;
4187 inline
size_t spacing() const noexcept;
4188 inline
size_t capacity() const noexcept;
4190 inline
void reset();
4197 template< typename Other > inline Column& scale( const Other& scalar );
4204 template< typename VT >
4205 struct VectorizedAssign {
4206 enum :
bool { value = useOptimizedKernels &&
4207 simdEnabled && VT::simdEnabled &&
4208 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
4214 template<
typename VT >
4215 struct VectorizedAddAssign {
4216 enum :
bool { value = useOptimizedKernels &&
4217 simdEnabled && VT::simdEnabled &&
4218 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4219 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
4225 template<
typename VT >
4226 struct VectorizedSubAssign {
4227 enum :
bool { value = useOptimizedKernels &&
4228 simdEnabled && VT::simdEnabled &&
4229 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4230 HasSIMDSub< ElementType, ElementType_<VT> >::value };
4236 template<
typename VT >
4237 struct VectorizedMultAssign {
4238 enum :
bool { value = useOptimizedKernels &&
4239 simdEnabled && VT::simdEnabled &&
4240 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4241 HasSIMDMult< ElementType, ElementType_<VT> >::value };
4247 template<
typename VT >
4248 struct VectorizedDivAssign {
4249 enum :
bool { value = useOptimizedKernels &&
4250 simdEnabled && VT::simdEnabled &&
4251 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4252 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
4265 template<
typename Other >
4266 inline bool canAlias(
const Other* alias )
const noexcept;
4268 template<
typename MT2,
bool SO2,
bool SF2 >
4269 inline bool canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
4271 template<
typename Other >
4272 inline bool isAliased(
const Other* alias )
const noexcept;
4274 template<
typename MT2,
bool SO2,
bool SF2 >
4275 inline bool isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept;
4277 inline bool isAligned () const noexcept;
4278 inline
bool canSMPAssign() const noexcept;
4289 template< typename VT >
4290 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
4292 template< typename VT >
4293 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
4295 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
4297 template< typename VT >
4298 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
4300 template< typename VT >
4301 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
4303 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4305 template< typename VT >
4306 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
4308 template< typename VT >
4309 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
4311 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4313 template< typename VT >
4314 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
4316 template< typename VT >
4317 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
4319 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
4321 template< typename VT >
4322 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
4324 template< typename VT >
4325 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
4339 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Column;
4372 template< typename MT >
4373 inline Column<MT,false,true,true>::Column( Operand matrix,
size_t index )
4377 if( matrix_.columns() <= index ) {
4403 template<
typename MT >
4405 Column<MT,false,true,true>::operator[](
size_t index )
4408 return matrix_(col_,index);
4424 template<
typename MT >
4426 Column<MT,false,true,true>::operator[](
size_t index )
const 4429 return const_cast<const MT&
>( matrix_ )(index,col_);
4446 template<
typename MT >
4448 Column<MT,false,true,true>::at(
size_t index )
4450 if( index >=
size() ) {
4453 return (*
this)[index];
4470 template<
typename MT >
4472 Column<MT,false,true,true>::at(
size_t index )
const 4474 if( index >=
size() ) {
4477 return (*
this)[index];
4492 template<
typename MT >
4493 inline typename Column<MT,false,true,true>::Pointer Column<MT,false,true,true>::data() noexcept
4495 return matrix_.data( col_ );
4510 template<
typename MT >
4511 inline typename Column<MT,false,true,true>::ConstPointer
4512 Column<MT,false,true,true>::data() const noexcept
4514 return matrix_.data( col_ );
4528 template<
typename MT >
4531 return matrix_.begin( col_ );
4545 template<
typename MT >
4548 return matrix_.cbegin( col_ );
4562 template<
typename MT >
4565 return matrix_.cbegin( col_ );
4579 template<
typename MT >
4582 return matrix_.end( col_ );
4596 template<
typename MT >
4599 return matrix_.cend( col_ );
4613 template<
typename MT >
4616 return matrix_.cend( col_ );
4637 template<
typename MT >
4638 inline Column<MT,false,true,true>& Column<MT,false,true,true>::operator=(
const ElementType& rhs )
4640 const size_t jbegin( ( IsUpper<MT>::value )
4641 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4645 const size_t jend ( ( IsLower<MT>::value )
4646 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4651 for(
size_t j=jbegin; j<jend; ++j )
4652 matrix_(col_,j) = rhs;
4673 template<
typename MT >
4674 inline Column<MT,false,true,true>&
4675 Column<MT,false,true,true>::operator=( initializer_list<ElementType> list )
4677 if( list.size() >
size() ) {
4705 template<
typename MT >
4706 inline Column<MT,false,true,true>& Column<MT,false,true,true>::operator=(
const Column& rhs )
4708 if( &rhs ==
this )
return *
this;
4710 if(
size() != rhs.size() ) {
4714 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
4718 decltype(
auto) left( derestrict( *this ) );
4744 template< typename MT >
4745 template< typename VT >
4746 inline Column<MT,false,true,true>&
4747 Column<MT,false,true,true>::operator=( const Vector<VT,false>& rhs )
4756 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4757 Right right( ~rhs );
4759 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4763 decltype(
auto) left( derestrict( *this ) );
4765 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4766 const ResultType_<VT> tmp( right );
4770 if( IsSparseVector<VT>::value )
4797 template<
typename MT >
4798 template<
typename VT >
4799 inline Column<MT,false,true,true>&
4809 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4810 Right right( ~rhs );
4812 if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
4816 decltype(
auto) left( derestrict( *this ) );
4818 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4819 const ResultType_<VT> tmp( right );
4848 template<
typename MT >
4849 template<
typename VT >
4850 inline Column<MT,false,true,true>&
4860 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4861 Right right( ~rhs );
4863 if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
4867 decltype(
auto) left( derestrict( *this ) );
4869 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4870 const ResultType_<VT> tmp( right );
4898 template<
typename MT >
4899 template<
typename VT >
4900 inline Column<MT,false,true,true>&
4910 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4911 Right right( ~rhs );
4913 if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
4917 decltype(
auto) left( derestrict( *this ) );
4919 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4920 const ResultType_<VT> tmp( right );
4948 template<
typename MT >
4949 template<
typename VT >
4950 inline Column<MT,false,true,true>&
4963 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4967 decltype(
auto) left( derestrict( *this ) );
4991 template< typename MT >
4992 template< typename VT >
4993 inline Column<MT,false,true,true>&
4994 Column<MT,false,true,true>::operator/=( const DenseVector<VT,false>& rhs )
5003 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
5004 Right right( ~rhs );
5006 if( !tryDivAssign( matrix_, right, 0UL, col_ ) ) {
5010 decltype(
auto) left( derestrict( *this ) );
5012 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
5013 const ResultType_<VT> tmp( right );
5041 template<
typename MT >
5042 template<
typename VT >
5043 inline Column<MT,false,true,true>&
5044 Column<MT,false,true,true>::operator%=(
const Vector<VT,false>& rhs )
5046 using blaze::assign;
5051 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
5057 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5061 const CrossType right( *
this % (~rhs) );
5063 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
5067 decltype(
auto) left( derestrict( *this ) );
5069 assign( left, right );
5090 template< typename MT >
5091 template< typename Other >
5092 inline
EnableIf_< IsNumeric<Other>, Column<MT,false,true,true> >&
5093 Column<MT,false,true,true>::operator*=( Other rhs )
5097 return operator=( (*
this) * rhs );
5116 template<
typename MT >
5117 template<
typename Other >
5118 inline EnableIf_< IsNumeric<Other>, Column<MT,false,true,true> >&
5125 return operator=( (*
this) / rhs );
5145 template<
typename MT >
5146 inline typename Column<MT,false,true,true>::Operand
5147 Column<MT,false,true,true>::operand() const noexcept
5161 template<
typename MT >
5176 template<
typename MT >
5179 return matrix_.rows();
5194 template<
typename MT >
5197 return matrix_.spacing();
5209 template<
typename MT >
5212 return matrix_.capacity( col_ );
5227 template<
typename MT >
5230 return matrix_.nonZeros( col_ );
5242 template<
typename MT >
5245 matrix_.reset( col_ );
5272 template<
typename MT >
5273 template<
typename Other >
5274 inline Column<MT,false,true,true>& Column<MT,false,true,true>::scale(
const Other& scalar )
5278 const size_t jbegin( ( IsUpper<MT>::value )
5279 ?( ( IsStrictlyUpper<MT>::value )
5283 const size_t jend ( ( IsLower<MT>::value )
5284 ?( ( IsStrictlyLower<MT>::value )
5289 for(
size_t j=jbegin; j<jend; ++j ) {
5290 matrix_(col_,j) *= scalar;
5318 template<
typename MT >
5319 template<
typename Other >
5320 inline bool Column<MT,false,true,true>::canAlias(
const Other* alias )
const noexcept
5322 return matrix_.isAliased( alias );
5339 template<
typename MT >
5340 template<
typename MT2
5343 inline bool Column<MT,false,true,true>::canAlias(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
5345 return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
5362 template<
typename MT >
5363 template<
typename Other >
5364 inline bool Column<MT,false,true,true>::isAliased(
const Other* alias )
const noexcept
5366 return matrix_.isAliased( alias );
5383 template<
typename MT >
5384 template<
typename MT2
5387 inline bool Column<MT,false,true,true>::isAliased(
const Column<MT2,SO2,true,SF2>* alias )
const noexcept
5389 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
5405 template<
typename MT >
5406 inline bool Column<MT,false,true,true>::isAligned() const noexcept
5408 return matrix_.isAligned();
5425 template<
typename MT >
5426 inline bool Column<MT,false,true,true>::canSMPAssign() const noexcept
5428 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5446 template<
typename MT >
5448 Column<MT,false,true,true>::load(
size_t index )
const noexcept
5450 return matrix_.load( col_, index );
5469 template<
typename MT >
5473 return matrix_.loada( col_, index );
5492 template<
typename MT >
5496 return matrix_.loadu( col_, index );
5515 template<
typename MT >
5517 Column<MT,false,true,true>::store(
size_t index,
const SIMDType& value ) noexcept
5519 matrix_.store( col_, index, value );
5539 template<
typename MT >
5543 matrix_.storea( col_, index, value );
5563 template<
typename MT >
5567 matrix_.storeu( col_, index, value );
5587 template<
typename MT >
5591 matrix_.stream( col_, index, value );
5609 template<
typename MT >
5610 template<
typename VT >
5611 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5612 Column<MT,false,true,true>::assign(
const DenseVector<VT,false>& rhs )
5616 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5617 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5618 matrix_(col_,j ) = (~rhs)[j ];
5619 matrix_(col_,j+1UL) = (~rhs)[j+1UL];
5621 if( jpos < (~rhs).size() )
5622 matrix_(col_,jpos) = (~rhs)[jpos];
5640 template<
typename MT >
5641 template<
typename VT >
5642 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5643 Column<MT,false,true,true>::assign(
const DenseVector<VT,false>& rhs )
5649 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5653 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5658 ConstIterator_<VT> right( (~rhs).
begin() );
5660 if( useStreaming &&
columns > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased(
this ) )
5662 for( ; j<jpos; j+=SIMDSIZE ) {
5663 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5665 for( ; remainder && j<
columns; ++j ) {
5666 *left = *right; ++left; ++right;
5671 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5672 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5673 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5674 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5675 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5677 for( ; j<jpos; j+=SIMDSIZE ) {
5678 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5680 for( ; remainder && j<
columns; ++j ) {
5681 *left = *right; ++left; ++right;
5701 template<
typename MT >
5702 template<
typename VT >
5703 inline void Column<MT,false,true,true>::assign(
const SparseVector<VT,false>& rhs )
5707 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5708 matrix_(col_,element->index()) = element->value();
5726 template<
typename MT >
5727 template<
typename VT >
5728 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5729 Column<MT,false,true,true>::addAssign(
const DenseVector<VT,false>& rhs )
5733 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5734 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5735 matrix_(col_,j ) += (~rhs)[j ];
5736 matrix_(col_,j+1UL) += (~rhs)[j+1UL];
5738 if( jpos < (~rhs).size() )
5739 matrix_(col_,jpos) += (~rhs)[jpos];
5757 template<
typename MT >
5758 template<
typename VT >
5759 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5760 Column<MT,false,true,true>::addAssign(
const DenseVector<VT,false>& rhs )
5766 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5770 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5775 ConstIterator_<VT> right( (~rhs).
begin() );
5777 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5778 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5779 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5780 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5781 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5783 for( ; j<jpos; j+=SIMDSIZE ) {
5784 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5786 for( ; remainder && j<
columns; ++j ) {
5787 *left += *right; ++left; ++right;
5806 template<
typename MT >
5807 template<
typename VT >
5808 inline void Column<MT,false,true,true>::addAssign(
const SparseVector<VT,false>& rhs )
5812 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5813 matrix_(col_,element->index()) += element->value();
5831 template<
typename MT >
5832 template<
typename VT >
5833 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5834 Column<MT,false,true,true>::subAssign(
const DenseVector<VT,false>& rhs )
5838 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5839 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5840 matrix_(col_,j ) -= (~rhs)[j ];
5841 matrix_(col_,j+1UL) -= (~rhs)[j+1UL];
5843 if( jpos < (~rhs).size() )
5844 matrix_(col_,jpos) -= (~rhs)[jpos];
5862 template<
typename MT >
5863 template<
typename VT >
5864 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5865 Column<MT,false,true,true>::subAssign(
const DenseVector<VT,false>& rhs )
5871 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5875 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5880 ConstIterator_<VT> right( (~rhs).
begin() );
5882 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5883 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5884 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5885 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5886 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5888 for( ; j<jpos; j+=SIMDSIZE ) {
5889 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5891 for( ; remainder && j<
columns; ++j ) {
5892 *left -= *right; ++left; ++right;
5911 template<
typename MT >
5912 template<
typename VT >
5913 inline void Column<MT,false,true,true>::subAssign(
const SparseVector<VT,false>& rhs )
5917 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5918 matrix_(col_,element->index()) -= element->value();
5936 template<
typename MT >
5937 template<
typename VT >
5938 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5939 Column<MT,false,true,true>::multAssign(
const DenseVector<VT,false>& rhs )
5943 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5944 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5945 matrix_(col_,j ) *= (~rhs)[j ];
5946 matrix_(col_,j+1UL) *= (~rhs)[j+1UL];
5948 if( jpos < (~rhs).size() )
5949 matrix_(col_,jpos) *= (~rhs)[jpos];
5967 template<
typename MT >
5968 template<
typename VT >
5969 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5970 Column<MT,false,true,true>::multAssign(
const DenseVector<VT,false>& rhs )
5976 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5980 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5985 ConstIterator_<VT> right( (~rhs).
begin() );
5987 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5988 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5989 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5990 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5991 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5993 for( ; j<jpos; j+=SIMDSIZE ) {
5994 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5996 for( ; remainder && j<
columns; ++j ) {
5997 *left *= *right; ++left; ++right;
6016 template<
typename MT >
6017 template<
typename VT >
6018 inline void Column<MT,false,true,true>::multAssign(
const SparseVector<VT,false>& rhs )
6026 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
6027 matrix_(col_,element->index()) = tmp[element->index()] * element->value();
6045 template<
typename MT >
6046 template<
typename VT >
6047 inline DisableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6048 Column<MT,false,true,true>::divAssign(
const DenseVector<VT,false>& rhs )
6052 const size_t jpos( (~rhs).
size() &
size_t(-2) );
6053 for(
size_t j=0UL; j<jpos; j+=2UL ) {
6054 matrix_(col_,j ) /= (~rhs)[j ];
6055 matrix_(col_,j+1UL) /= (~rhs)[j+1UL];
6057 if( jpos < (~rhs).size() )
6058 matrix_(col_,jpos) /= (~rhs)[jpos];
6076 template<
typename MT >
6077 template<
typename VT >
6078 inline EnableIf_< typename Column<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6079 Column<MT,false,true,true>::divAssign(
const DenseVector<VT,false>& rhs )
6087 const size_t jpos(
columns &
size_t(-SIMDSIZE) );
6092 ConstIterator_<VT> right( (~rhs).
begin() );
6094 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
6095 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6096 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6097 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6098 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6100 for( ; j<jpos; j+=SIMDSIZE ) {
6101 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6104 *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.
#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:356
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: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
#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:1411
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
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:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
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:560
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
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:224
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Header file for the DenseVector base class.
#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 Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
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:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
#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
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
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:1393
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:133
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:308
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:242
Constraint on the data type.
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:110
Header file for the std::initializer_list aliases.
Constraint on the transpose flag of vector types.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
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.
#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
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#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:102
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
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.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
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:340
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.
#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
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:264
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 the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
Header file for the IsPadded type trait.
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.
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.
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
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.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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:224
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:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
#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
Header file for the HasSIMDDiv type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3083
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
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
Header file for the IsUpper type trait.
Header file for the IsRestricted type trait.
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.