35#ifndef _BLAZE_MATH_VIEWS_COLUMN_DENSE_H_
36#define _BLAZE_MATH_VIEWS_COLUMN_DENSE_H_
123class Column<MT,true,true,SF,CCAs...>
124 :
public View< DenseVector< Column<MT,true,true,SF,CCAs...>, false > >
125 ,
private ColumnData<CCAs...>
129 using DataType = ColumnData<CCAs...>;
130 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
136 using This = Column<MT,
true,
true,SF,CCAs...>;
139 using BaseType = View< DenseVector<This,false> >;
141 using ViewedType = MT;
143 using TransposeType = TransposeType_t<ResultType>;
144 using ElementType = ElementType_t<MT>;
145 using SIMDType = SIMDTrait_t<ElementType>;
146 using ReturnType = ReturnType_t<MT>;
147 using CompositeType =
const Column&;
150 using ConstReference = ConstReference_t<MT>;
153 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
156 using ConstPointer = ConstPointer_t<MT>;
159 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
162 using ConstIterator = ConstIterator_t<MT>;
165 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
170 static constexpr bool simdEnabled = MT::simdEnabled;
173 static constexpr bool smpAssignable = MT::smpAssignable;
176 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
182 template<
typename... RCAs >
183 explicit inline Column( MT& matrix, RCAs... args );
185 Column(
const Column& ) =
default;
199 inline Reference operator[](
size_t index );
200 inline ConstReference operator[](
size_t index )
const;
201 inline Reference at(
size_t index );
202 inline ConstReference at(
size_t index )
const;
203 inline Pointer
data () noexcept;
204 inline ConstPointer
data () const noexcept;
205 inline Iterator
begin ();
206 inline ConstIterator
begin () const;
207 inline ConstIterator
cbegin() const;
208 inline Iterator
end ();
209 inline ConstIterator
end () const;
210 inline ConstIterator
cend () const;
217 inline Column& operator=( const ElementType& rhs );
219 inline Column& operator=( const Column& rhs );
221 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
222 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
223 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
224 template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
225 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
226 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
235 inline MT& operand() noexcept;
236 inline const MT& operand() const noexcept;
238 inline
size_t size() const noexcept;
239 inline
size_t spacing() const noexcept;
240 inline
size_t capacity() const noexcept;
249 template< typename Other > inline Column& scale( const Other& scalar );
256 template< typename VT >
257 static constexpr
bool VectorizedAssign_v =
258 ( useOptimizedKernels &&
259 simdEnabled && VT::simdEnabled &&
265 template< typename VT >
266 static constexpr
bool VectorizedAddAssign_v =
267 ( VectorizedAssign_v<VT> &&
273 template< typename VT >
274 static constexpr
bool VectorizedSubAssign_v =
275 ( VectorizedAssign_v<VT> &&
281 template< typename VT >
282 static constexpr
bool VectorizedMultAssign_v =
283 ( VectorizedAssign_v<VT> &&
289 template< typename VT >
290 static constexpr
bool VectorizedDivAssign_v =
291 ( VectorizedAssign_v<VT> &&
297 static constexpr
size_t SIMDSIZE = SIMDTrait<ElementType>::
size;
304 template< typename Other >
305 inline
bool canAlias( const Other* alias ) const noexcept;
307 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
308 inline
bool canAlias( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
310 template< typename Other >
311 inline
bool isAliased( const Other* alias ) const noexcept;
313 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
314 inline
bool isAliased( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
316 inline
bool isAligned () const noexcept;
317 inline
bool canSMPAssign() const noexcept;
328 template< typename VT >
329 inline auto assign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedAssign_v<VT> >;
331 template< typename VT >
332 inline auto assign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedAssign_v<VT> >;
334 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
336 template< typename VT >
337 inline auto addAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedAddAssign_v<VT> >;
339 template< typename VT >
340 inline auto addAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedAddAssign_v<VT> >;
342 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
344 template< typename VT >
345 inline auto subAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedSubAssign_v<VT> >;
347 template< typename VT >
348 inline auto subAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedSubAssign_v<VT> >;
350 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
352 template< typename VT >
353 inline auto multAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedMultAssign_v<VT> >;
355 template< typename VT >
356 inline auto multAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedMultAssign_v<VT> >;
358 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
360 template< typename VT >
361 inline auto divAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedDivAssign_v<VT> >;
363 template< typename VT >
364 inline auto divAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedDivAssign_v<VT> >;
377 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 > friend class Column;
418template< typename... RCAs >
419inline Column<MT,true,true,SF,CCAs...>::Column( MT& matrix, RCAs... args )
420 : DataType( args... )
424 if( matrix_.columns() <=
column() ) {
457inline typename Column<MT,
true,
true,SF,CCAs...>::Reference
458 Column<MT,true,true,SF,CCAs...>::operator[](
size_t index )
461 return matrix_(index,
column());
480inline typename Column<MT,
true,
true,SF,CCAs...>::ConstReference
481 Column<MT,true,true,SF,CCAs...>::operator[](
size_t index )
const
484 return const_cast<const MT&
>( matrix_ )(index,
column());
504inline typename Column<MT,
true,
true,SF,CCAs...>::Reference
505 Column<MT,true,true,SF,CCAs...>::at(
size_t index )
507 if( index >=
size() ) {
510 return (*
this)[index];
530inline typename Column<MT,
true,
true,SF,CCAs...>::ConstReference
531 Column<MT,true,true,SF,CCAs...>::at(
size_t index )
const
533 if( index >=
size() ) {
536 return (*
this)[index];
554inline typename Column<MT,
true,
true,SF,CCAs...>::Pointer
557 return matrix_.data(
column() );
575inline typename Column<MT,
true,
true,SF,CCAs...>::ConstPointer
578 return matrix_.data(
column() );
595inline typename Column<MT,
true,
true,SF,CCAs...>::Iterator
598 return matrix_.begin(
column() );
615inline typename Column<MT,
true,
true,SF,CCAs...>::ConstIterator
618 return matrix_.cbegin(
column() );
635inline typename Column<MT,
true,
true,SF,CCAs...>::ConstIterator
638 return matrix_.cbegin(
column() );
655inline typename Column<MT,
true,
true,SF,CCAs...>::Iterator
658 return matrix_.end(
column() );
675inline typename Column<MT,
true,
true,SF,CCAs...>::ConstIterator
678 return matrix_.cend(
column() );
695inline typename Column<MT,
true,
true,SF,CCAs...>::ConstIterator
698 return matrix_.cend(
column() );
726inline Column<MT,
true,
true,SF,CCAs...>&
727 Column<MT,true,true,SF,CCAs...>::operator=(
const ElementType& rhs )
729 decltype(
auto) left( derestrict( matrix_ ) );
731 const size_t ibegin( ( IsLower_v<MT> )
732 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
736 const size_t iend ( ( IsUpper_v<MT> )
737 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
742 for(
size_t i=ibegin; i<iend; ++i ) {
743 if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, i,
column(), rhs ) )
771inline Column<MT,
true,
true,SF,CCAs...>&
774 if( list.size() >
size() ) {
778 if( IsRestricted_v<MT> ) {
779 const InitializerVector<ElementType,false> tmp( list,
size() );
780 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
785 decltype(
auto) left( derestrict( *
this ) );
787 std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
814inline Column<MT,
true,
true,SF,CCAs...>&
815 Column<MT,true,true,SF,CCAs...>::operator=(
const Column& rhs )
817 if( &rhs ==
this )
return *
this;
819 if(
size() != rhs.size() ) {
823 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
827 decltype(
auto) left( derestrict( *
this ) );
829 if( IsExpression_v<MT> && rhs.canAlias(
this ) ) {
830 const ResultType tmp( rhs );
862template<
typename VT >
863inline Column<MT,
true,
true,SF,CCAs...>&
864 Column<MT,true,true,SF,CCAs...>::operator=(
const Vector<VT,false>& rhs )
869 if(
size() != (*rhs).size() ) {
873 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
876 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
880 decltype(
auto) left( derestrict( *
this ) );
882 if( IsReference_v<Right> && right.canAlias(
this ) ) {
883 const ResultType_t<VT> tmp( right );
887 if( IsSparseVector_v<VT> )
917template<
typename VT >
918inline Column<MT,
true,
true,SF,CCAs...>&
924 if(
size() != (*rhs).size() ) {
928 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
931 if( !tryAddAssign( matrix_, right, 0UL,
column() ) ) {
935 decltype(
auto) left( derestrict( *
this ) );
937 if( IsReference_v<Right> && right.canAlias(
this ) ) {
938 const ResultType_t<VT> tmp( right );
970template<
typename VT >
971inline Column<MT,
true,
true,SF,CCAs...>&
977 if(
size() != (*rhs).size() ) {
981 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
984 if( !trySubAssign( matrix_, right, 0UL,
column() ) ) {
988 decltype(
auto) left( derestrict( *
this ) );
990 if( IsReference_v<Right> && right.canAlias(
this ) ) {
991 const ResultType_t<VT> tmp( right );
1019template<
typename MT
1022template<
typename VT >
1023inline Column<MT,
true,
true,SF,CCAs...>&
1029 if(
size() != (*rhs).size() ) {
1033 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
1034 Right right( *rhs );
1036 if( !tryMultAssign( matrix_, right, 0UL,
column() ) ) {
1040 decltype(
auto) left( derestrict( *
this ) );
1042 if( IsReference_v<Right> && right.canAlias(
this ) ) {
1043 const ResultType_t<VT> tmp( right );
1070template<
typename MT
1073template<
typename VT >
1074inline Column<MT,
true,
true,SF,CCAs...>&
1080 if(
size() != (*rhs).size() ) {
1084 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
1085 Right right( *rhs );
1087 if( !tryDivAssign( matrix_, right, 0UL,
column() ) ) {
1091 decltype(
auto) left( derestrict( *
this ) );
1093 if( IsReference_v<Right> && right.canAlias(
this ) ) {
1094 const ResultType_t<VT> tmp( right );
1122template<
typename MT
1125template<
typename VT >
1126inline Column<MT,
true,
true,SF,CCAs...>&
1127 Column<MT,true,true,SF,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
1129 using blaze::assign;
1134 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1140 if(
size() != 3UL || (*rhs).size() != 3UL ) {
1144 const CrossType right( *
this % (*rhs) );
1146 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
1150 decltype(
auto) left( derestrict( *
this ) );
1152 assign( left, right );
1176template<
typename MT
1179inline MT& Column<MT,true,true,SF,CCAs...>::operand() noexcept
1193template<
typename MT
1196inline const MT& Column<MT,true,true,SF,CCAs...>::operand() const noexcept
1210template<
typename MT
1215 return matrix_.rows();
1230template<
typename MT
1235 return matrix_.spacing();
1247template<
typename MT
1252 return matrix_.capacity(
column() );
1267template<
typename MT
1272 return matrix_.nonZeros(
column() );
1284template<
typename MT
1289 matrix_.reset(
column() );
1316template<
typename MT
1319template<
typename Other >
1320inline Column<MT,
true,
true,SF,CCAs...>&
1321 Column<MT,true,true,SF,CCAs...>::scale(
const Other& scalar )
1325 const size_t ibegin( ( IsLower_v<MT> )
1326 ?( ( IsStrictlyLower_v<MT> )
1330 const size_t iend ( ( IsUpper_v<MT> )
1331 ?( ( IsStrictlyUpper_v<MT> )
1336 for(
size_t i=ibegin; i<iend; ++i ) {
1337 matrix_(i,
column()) *= scalar;
1365template<
typename MT
1368template<
typename Other >
1369inline bool Column<MT,true,true,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1371 return matrix_.isAliased( &unview( *alias ) );
1388template<
typename MT
1391template<
typename MT2
1396 Column<MT,true,true,SF,CCAs...>::canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
1398 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
1415template<
typename MT
1418template<
typename Other >
1419inline bool Column<MT,true,true,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1421 return matrix_.isAliased( &unview( *alias ) );
1438template<
typename MT
1441template<
typename MT2
1446 Column<MT,true,true,SF,CCAs...>::isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
1448 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
1464template<
typename MT
1467inline bool Column<MT,true,true,SF,CCAs...>::isAligned() const noexcept
1469 return matrix_.isAligned();
1486template<
typename MT
1489inline bool Column<MT,true,true,SF,CCAs...>::canSMPAssign() const noexcept
1491 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1509template<
typename MT
1513 Column<MT,true,true,SF,CCAs...>::load(
size_t index )
const noexcept
1515 return matrix_.load( index,
column() );
1534template<
typename MT
1540 return matrix_.loada( index,
column() );
1559template<
typename MT
1565 return matrix_.loadu( index,
column() );
1584template<
typename MT
1588 Column<MT,true,true,SF,CCAs...>::store(
size_t index,
const SIMDType& value )
noexcept
1590 matrix_.store( index,
column(), value );
1610template<
typename MT
1616 matrix_.storea( index,
column(), value );
1636template<
typename MT
1642 matrix_.storeu( index,
column(), value );
1662template<
typename MT
1668 matrix_.stream( index,
column(), value );
1686template<
typename MT
1689template<
typename VT >
1690inline auto Column<MT,true,true,SF,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
1691 -> DisableIf_t< VectorizedAssign_v<VT> >
1695 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
1698 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1699 matrix_(i ,
column()) = (*rhs)[i ];
1700 matrix_(i+1UL,
column()) = (*rhs)[i+1UL];
1702 if( ipos < (*rhs).size() )
1703 matrix_(ipos,
column()) = (*rhs)[ipos];
1721template<
typename MT
1724template<
typename VT >
1725inline auto Column<MT,true,true,SF,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
1726 -> EnableIf_t< VectorizedAssign_v<VT> >
1732 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1740 Iterator left(
begin() );
1741 ConstIterator_t<VT> right( (*rhs).begin() );
1743 if( useStreaming &&
rows > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(*rhs).isAliased(
this ) )
1745 for( ; i<ipos; i+=SIMDSIZE ) {
1746 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1748 for( ; remainder && i<
rows; ++i ) {
1749 *left = *right; ++left; ++right;
1754 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1755 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1756 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1757 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1758 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1760 for( ; i<ipos; i+=SIMDSIZE ) {
1761 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1763 for( ; remainder && i<
rows; ++i ) {
1764 *left = *right; ++left; ++right;
1784template<
typename MT
1787template<
typename VT >
1788inline void Column<MT,true,true,SF,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
1792 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
1793 matrix_(element->index(),
column()) = element->value();
1811template<
typename MT
1814template<
typename VT >
1815inline auto Column<MT,true,true,SF,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
1816 -> DisableIf_t< VectorizedAddAssign_v<VT> >
1820 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
1823 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1824 matrix_(i ,
column()) += (*rhs)[i ];
1825 matrix_(i+1UL,
column()) += (*rhs)[i+1UL];
1827 if( ipos < (*rhs).size() )
1828 matrix_(ipos,
column()) += (*rhs)[ipos];
1846template<
typename MT
1849template<
typename VT >
1850inline auto Column<MT,true,true,SF,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
1851 -> EnableIf_t< VectorizedAddAssign_v<VT> >
1857 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1865 Iterator left(
begin() );
1866 ConstIterator_t<VT> right( (*rhs).begin() );
1868 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1869 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1870 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1871 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1872 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1874 for( ; i<ipos; i+=SIMDSIZE ) {
1875 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1877 for( ; remainder && i<
rows; ++i ) {
1878 *left += *right; ++left; ++right;
1897template<
typename MT
1900template<
typename VT >
1901inline void Column<MT,true,true,SF,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
1905 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
1906 matrix_(element->index(),
column()) += element->value();
1924template<
typename MT
1927template<
typename VT >
1928inline auto Column<MT,true,true,SF,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
1929 -> DisableIf_t< VectorizedSubAssign_v<VT> >
1933 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
1936 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1937 matrix_(i ,
column()) -= (*rhs)[i ];
1938 matrix_(i+1UL,
column()) -= (*rhs)[i+1UL];
1940 if( ipos < (*rhs).size() )
1941 matrix_(ipos,
column()) -= (*rhs)[ipos];
1959template<
typename MT
1962template<
typename VT >
1963inline auto Column<MT,true,true,SF,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
1964 -> EnableIf_t< VectorizedSubAssign_v<VT> >
1970 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1978 Iterator left(
begin() );
1979 ConstIterator_t<VT> right( (*rhs).begin() );
1981 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1982 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1983 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1984 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1985 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1987 for( ; i<ipos; i+=SIMDSIZE ) {
1988 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1990 for( ; remainder && i<
rows; ++i ) {
1991 *left -= *right; ++left; ++right;
2010template<
typename MT
2013template<
typename VT >
2014inline void Column<MT,true,true,SF,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
2018 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2019 matrix_(element->index(),
column()) -= element->value();
2037template<
typename MT
2040template<
typename VT >
2041inline auto Column<MT,true,true,SF,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
2042 -> DisableIf_t< VectorizedMultAssign_v<VT> >
2046 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
2049 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2050 matrix_(i ,
column()) *= (*rhs)[i ];
2051 matrix_(i+1UL,
column()) *= (*rhs)[i+1UL];
2053 if( ipos < (*rhs).size() )
2054 matrix_(ipos,
column()) *= (*rhs)[ipos];
2072template<
typename MT
2075template<
typename VT >
2076inline auto Column<MT,true,true,SF,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
2077 -> EnableIf_t< VectorizedMultAssign_v<VT> >
2083 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
2091 Iterator left(
begin() );
2092 ConstIterator_t<VT> right( (*rhs).begin() );
2094 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2095 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2096 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2097 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2098 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2100 for( ; i<ipos; i+=SIMDSIZE ) {
2101 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2103 for( ; remainder && i<
rows; ++i ) {
2104 *left *= *right; ++left, ++right;
2123template<
typename MT
2126template<
typename VT >
2127inline void Column<MT,true,true,SF,CCAs...>::multAssign(
const SparseVector<VT,false>& rhs )
2135 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
2136 const size_t index( element->index() );
2137 for( ; i<index; ++i )
2139 matrix_(i,
column()) *= element->value();
2143 for( ; i<
size(); ++i ) {
2163template<
typename MT
2166template<
typename VT >
2167inline auto Column<MT,true,true,SF,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
2168 -> DisableIf_t< VectorizedDivAssign_v<VT> >
2172 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
2175 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2176 matrix_(i ,
column()) /= (*rhs)[i ];
2177 matrix_(i+1UL,
column()) /= (*rhs)[i+1UL];
2179 if( ipos < (*rhs).size() )
2180 matrix_(ipos,
column()) /= (*rhs)[ipos];
2198template<
typename MT
2201template<
typename VT >
2202inline auto Column<MT,true,true,SF,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
2203 -> EnableIf_t< VectorizedDivAssign_v<VT> >
2215 Iterator left(
begin() );
2216 ConstIterator_t<VT> right( (*rhs).begin() );
2218 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2219 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2220 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2221 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2222 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2224 for( ; i<ipos; i+=SIMDSIZE ) {
2225 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2227 for( ; i<
rows; ++i ) {
2228 *left /= *right; ++left; ++right;
2255template<
typename MT
2257class Column<MT,false,true,false,CCAs...>
2258 :
public View< DenseVector< Column<MT,false,true,false,CCAs...>, false > >
2259 ,
private ColumnData<CCAs...>
2263 using DataType = ColumnData<CCAs...>;
2264 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2270 using This = Column<MT,
false,
true,
false,CCAs...>;
2273 using BaseType = View< DenseVector<This,false> >;
2275 using ViewedType = MT;
2277 using TransposeType = TransposeType_t<ResultType>;
2278 using ElementType = ElementType_t<MT>;
2279 using ReturnType = ReturnType_t<MT>;
2280 using CompositeType =
const Column&;
2283 using ConstReference = ConstReference_t<MT>;
2286 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2289 using ConstPointer = ConstPointer_t<MT>;
2292 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
2298 template<
typename MatrixType
2299 ,
typename IteratorType >
2300 class ColumnIterator
2305 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
2308 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
2311 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
2314 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
2317 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
2320 using iterator_category = IteratorCategory;
2321 using value_type = ValueType;
2322 using pointer = PointerType;
2323 using reference = ReferenceType;
2324 using difference_type = DifferenceType;
2330 inline ColumnIterator() noexcept
2331 : matrix_(
nullptr )
2345 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2346 : matrix_( &matrix )
2351 if( row_ != matrix_->rows() )
2352 pos_ = matrix_->begin( row_ ) + column_;
2361 template<
typename MatrixType2,
typename IteratorType2 >
2362 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it ) noexcept
2363 : matrix_( it.matrix_ )
2365 , column_( it.column_ )
2376 inline ColumnIterator&
operator+=(
size_t inc )
noexcept {
2379 if( row_ != matrix_->rows() )
2380 pos_ = matrix_->begin( row_ ) + column_;
2392 inline ColumnIterator&
operator-=(
size_t dec )
noexcept {
2395 if( row_ != matrix_->rows() )
2396 pos_ = matrix_->begin( row_ ) + column_;
2407 inline ColumnIterator& operator++() noexcept {
2410 if( row_ != matrix_->rows() )
2411 pos_ = matrix_->begin( row_ ) + column_;
2422 inline const ColumnIterator operator++(
int )
noexcept {
2423 const ColumnIterator tmp( *
this );
2434 inline ColumnIterator& operator--() noexcept {
2437 if( row_ != matrix_->rows() )
2438 pos_ = matrix_->begin( row_ ) + column_;
2449 inline const ColumnIterator operator--(
int )
noexcept {
2450 const ColumnIterator tmp( *
this );
2462 inline ReferenceType operator[](
size_t index )
const {
2464 const IteratorType pos( matrix_->begin( row_+index ) + column_ );
2474 inline ReferenceType
operator*()
const {
2484 inline PointerType operator->()
const {
2495 template<
typename MatrixType2,
typename IteratorType2 >
2496 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2497 return row_ == rhs.row_;
2507 template<
typename MatrixType2,
typename IteratorType2 >
2508 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2509 return !( *
this == rhs );
2519 template<
typename MatrixType2,
typename IteratorType2 >
2520 inline bool operator<(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2521 return row_ < rhs.row_;
2531 template<
typename MatrixType2,
typename IteratorType2 >
2532 inline bool operator>(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2533 return row_ > rhs.row_;
2543 template<
typename MatrixType2,
typename IteratorType2 >
2544 inline bool operator<=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2545 return row_ <= rhs.row_;
2555 template<
typename MatrixType2,
typename IteratorType2 >
2556 inline bool operator>=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2557 return row_ >= rhs.row_;
2567 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const noexcept {
2568 return row_ - rhs.row_;
2579 friend inline const ColumnIterator
operator+(
const ColumnIterator& it,
size_t inc )
noexcept {
2580 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2591 friend inline const ColumnIterator
operator+(
size_t inc,
const ColumnIterator& it )
noexcept {
2592 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2603 friend inline const ColumnIterator
operator-(
const ColumnIterator& it,
size_t dec )
noexcept {
2604 return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2610 MatrixType* matrix_;
2617 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2624 using ConstIterator = ColumnIterator< const MT, ConstIterator_t<MT> >;
2627 using Iterator = If_t< IsConst_v<MT>, ConstIterator, ColumnIterator< MT, Iterator_t<MT> > >;
2632 static constexpr bool simdEnabled =
false;
2635 static constexpr bool smpAssignable = MT::smpAssignable;
2638 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2644 template<
typename... RCAs >
2645 explicit inline Column( MT& matrix, RCAs... args );
2647 Column(
const Column& ) =
default;
2654 ~Column() =
default;
2661 inline Reference operator[](
size_t index );
2662 inline ConstReference operator[](
size_t index )
const;
2663 inline Reference at(
size_t index );
2664 inline ConstReference at(
size_t index )
const;
2665 inline Pointer
data () noexcept;
2666 inline ConstPointer
data () const noexcept;
2667 inline Iterator
begin ();
2668 inline ConstIterator
begin () const;
2669 inline ConstIterator
cbegin() const;
2670 inline Iterator
end ();
2671 inline ConstIterator
end () const;
2672 inline ConstIterator
cend () const;
2679 inline Column& operator=( const ElementType& rhs );
2681 inline Column& operator=( const Column& rhs );
2683 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
2684 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
2685 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
2686 template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
2687 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
2688 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
2697 inline MT& operand() noexcept;
2698 inline const MT& operand() const noexcept;
2700 inline
size_t size() const noexcept;
2701 inline
size_t spacing() const noexcept;
2702 inline
size_t capacity() const noexcept;
2704 inline
void reset();
2711 template< typename Other > inline Column& scale( const Other& scalar );
2718 template< typename Other >
2719 inline
bool canAlias ( const Other* alias ) const noexcept;
2721 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
2722 inline
bool canAlias ( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
2724 template< typename Other >
2725 inline
bool isAliased( const Other* alias ) const noexcept;
2727 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
2728 inline
bool isAliased( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
2730 inline
bool isAligned () const noexcept;
2731 inline
bool canSMPAssign() const noexcept;
2733 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2734 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2735 template< typename VT > inline
void addAssign ( const DenseVector <VT,false>& rhs );
2736 template< typename VT > inline
void addAssign ( const SparseVector<VT,false>& rhs );
2737 template< typename VT > inline
void subAssign ( const DenseVector <VT,false>& rhs );
2738 template< typename VT > inline
void subAssign ( const SparseVector<VT,false>& rhs );
2739 template< typename VT > inline
void multAssign( const DenseVector <VT,false>& rhs );
2740 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
2741 template< typename VT > inline
void divAssign ( const DenseVector <VT,false>& rhs );
2754 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 > friend class Column;
2793template< typename MT
2795template< typename... RCAs >
2796inline Column<MT,false,true,false,CCAs...>::Column( MT& matrix, RCAs... args )
2797 : DataType( args... )
2798 , matrix_ ( matrix )
2801 if( matrix_.columns() <=
column() ) {
2831template<
typename MT
2833inline typename Column<MT,
false,
true,
false,CCAs...>::Reference
2834 Column<MT,false,true,false,CCAs...>::operator[](
size_t index )
2837 return matrix_(index,
column());
2853template<
typename MT
2855inline typename Column<MT,
false,
true,
false,CCAs...>::ConstReference
2856 Column<MT,false,true,false,CCAs...>::operator[](
size_t index )
const
2859 return const_cast<const MT&
>( matrix_ )(index,
column());
2876template<
typename MT
2878inline typename Column<MT,
false,
true,
false,CCAs...>::Reference
2879 Column<MT,false,true,false,CCAs...>::at(
size_t index )
2881 if( index >=
size() ) {
2884 return (*
this)[index];
2901template<
typename MT
2903inline typename Column<MT,
false,
true,
false,CCAs...>::ConstReference
2904 Column<MT,false,true,false,CCAs...>::at(
size_t index )
const
2906 if( index >=
size() ) {
2909 return (*
this)[index];
2924template<
typename MT
2926inline typename Column<MT,
false,
true,
false,CCAs...>::Pointer
2929 return matrix_.data() +
column();
2944template<
typename MT
2946inline typename Column<MT,
false,
true,
false,CCAs...>::ConstPointer
2949 return matrix_.data() +
column();
2963template<
typename MT
2965inline typename Column<MT,
false,
true,
false,CCAs...>::Iterator
2968 return Iterator( matrix_, 0UL,
column() );
2982template<
typename MT
2984inline typename Column<MT,
false,
true,
false,CCAs...>::ConstIterator
2987 return ConstIterator( matrix_, 0UL,
column() );
3001template<
typename MT
3003inline typename Column<MT,
false,
true,
false,CCAs...>::ConstIterator
3006 return ConstIterator( matrix_, 0UL,
column() );
3020template<
typename MT
3022inline typename Column<MT,
false,
true,
false,CCAs...>::Iterator
3025 return Iterator( matrix_,
size(),
column() );
3039template<
typename MT
3041inline typename Column<MT,
false,
true,
false,CCAs...>::ConstIterator
3044 return ConstIterator( matrix_,
size(),
column() );
3058template<
typename MT
3060inline typename Column<MT,
false,
true,
false,CCAs...>::ConstIterator
3063 return ConstIterator( matrix_,
size(),
column() );
3088template<
typename MT
3090inline Column<MT,
false,
true,
false,CCAs...>&
3091 Column<MT,false,true,false,CCAs...>::operator=(
const ElementType& rhs )
3093 decltype(
auto) left( derestrict( matrix_ ) );
3095 const size_t ibegin( ( IsLower_v<MT> )
3096 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3100 const size_t iend ( ( IsUpper_v<MT> )
3101 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3106 for(
size_t i=ibegin; i<iend; ++i ) {
3107 if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, i,
column(), rhs ) )
3132template<
typename MT
3134inline Column<MT,
false,
true,
false,CCAs...>&
3137 if( list.size() >
size() ) {
3141 if( IsRestricted_v<MT> ) {
3142 const InitializerVector<ElementType,false> tmp( list,
size() );
3143 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3148 decltype(
auto) left( derestrict( *
this ) );
3150 std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
3174template<
typename MT
3176inline Column<MT,
false,
true,
false,CCAs...>&
3177 Column<MT,false,true,false,CCAs...>::operator=(
const Column& rhs )
3179 if( &rhs ==
this )
return *
this;
3181 if(
size() != rhs.size() ) {
3185 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
3189 decltype(
auto) left( derestrict( *
this ) );
3191 if( IsExpression_v<MT> && rhs.canAlias(
this ) ) {
3192 const ResultType tmp( rhs );
3221template<
typename MT
3223template<
typename VT >
3224inline Column<MT,
false,
true,
false,CCAs...>&
3225 Column<MT,false,true,false,CCAs...>::operator=(
const Vector<VT,false>& rhs )
3231 if(
size() != (*rhs).size() ) {
3235 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3236 Right right( *rhs );
3238 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
3242 decltype(
auto) left( derestrict( *
this ) );
3244 if( IsReference_v<Right> && right.canAlias(
this ) ) {
3245 const ResultType tmp( right );
3249 if( IsSparseVector_v<VT> )
3276template<
typename MT
3278template<
typename VT >
3279inline Column<MT,
false,
true,
false,CCAs...>&
3285 if(
size() != (*rhs).size() ) {
3289 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3290 Right right( *rhs );
3292 if( !tryAddAssign( matrix_, right, 0UL,
column() ) ) {
3296 decltype(
auto) left( derestrict( *
this ) );
3298 if( IsReference_v<Right> && right.canAlias(
this ) ) {
3299 const ResultType_t<VT> tmp( right );
3328template<
typename MT
3330template<
typename VT >
3331inline Column<MT,
false,
true,
false,CCAs...>&
3337 if(
size() != (*rhs).size() ) {
3341 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3342 Right right( *rhs );
3344 if( !trySubAssign( matrix_, right, 0UL,
column() ) ) {
3348 decltype(
auto) left( derestrict( *
this ) );
3350 if( IsReference_v<Right> && right.canAlias(
this ) ) {
3351 const ResultType_t<VT> tmp( right );
3379template<
typename MT
3381template<
typename VT >
3382inline Column<MT,
false,
true,
false,CCAs...>&
3388 if(
size() != (*rhs).size() ) {
3392 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3393 Right right( *rhs );
3395 if( !tryMultAssign( matrix_, right, 0UL,
column() ) ) {
3399 decltype(
auto) left( derestrict( *
this ) );
3401 if( IsReference_v<Right> && right.canAlias(
this ) ) {
3402 const ResultType_t<VT> tmp( right );
3429template<
typename MT
3431template<
typename VT >
3432inline Column<MT,
false,
true,
false,CCAs...>&
3438 if(
size() != (*rhs).size() ) {
3442 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3443 Right right( *rhs );
3445 if( !tryDivAssign( matrix_, right, 0UL,
column() ) ) {
3449 decltype(
auto) left( derestrict( *
this ) );
3451 if( IsReference_v<Right> && right.canAlias(
this ) ) {
3452 const ResultType_t<VT> tmp( right );
3480template<
typename MT
3482template<
typename VT >
3483inline Column<MT,
false,
true,
false,CCAs...>&
3484 Column<MT,false,true,false,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
3486 using blaze::assign;
3491 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3497 if(
size() != 3UL || (*rhs).size() != 3UL ) {
3501 const CrossType right( *
this % (*rhs) );
3503 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
3507 decltype(
auto) left( derestrict( *
this ) );
3509 assign( left, right );
3533template<
typename MT
3535inline MT& Column<MT,false,true,false,CCAs...>::operand() noexcept
3549template<
typename MT
3551inline const MT& Column<MT,false,true,false,CCAs...>::operand() const noexcept
3565template<
typename MT
3569 return matrix_.rows();
3584template<
typename MT
3588 return matrix_.spacing();
3600template<
typename MT
3604 return matrix_.rows();
3619template<
typename MT
3624 size_t nonzeros( 0UL );
3626 for(
size_t i=0UL; i<
rows; ++i )
3642template<
typename MT
3648 const size_t ibegin( ( IsLower_v<MT> )
3649 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3653 const size_t iend ( ( IsUpper_v<MT> )
3654 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3659 for(
size_t i=ibegin; i<iend; ++i )
3687template<
typename MT
3689template<
typename Other >
3690inline Column<MT,
false,
true,
false,CCAs...>&
3691 Column<MT,false,true,false,CCAs...>::scale(
const Other& scalar )
3695 const size_t ibegin( ( IsLower_v<MT> )
3696 ?( ( IsStrictlyLower_v<MT> )
3700 const size_t iend ( ( IsUpper_v<MT> )
3701 ?( ( IsStrictlyUpper_v<MT> )
3706 for(
size_t i=ibegin; i<iend; ++i ) {
3707 matrix_(i,
column()) *= scalar;
3735template<
typename MT
3737template<
typename Other >
3738inline bool Column<MT,false,true,false,CCAs...>::canAlias(
const Other* alias )
const noexcept
3740 return matrix_.isAliased( &unview( *alias ) );
3757template<
typename MT
3759template<
typename MT2
3764 Column<MT,false,true,false,CCAs...>::canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
3766 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
3783template<
typename MT
3785template<
typename Other >
3786inline bool Column<MT,false,true,false,CCAs...>::isAliased(
const Other* alias )
const noexcept
3788 return matrix_.isAliased( &unview( *alias ) );
3805template<
typename MT
3807template<
typename MT2
3812 Column<MT,false,true,false,CCAs...>::isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
3814 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
3830template<
typename MT
3832inline bool Column<MT,false,true,false,CCAs...>::isAligned() const noexcept
3851template<
typename MT
3853inline bool Column<MT,false,true,false,CCAs...>::canSMPAssign() const noexcept
3855 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3873template<
typename MT
3875template<
typename VT >
3876inline void Column<MT,false,true,false,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
3880 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
3883 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3884 matrix_(i ,
column()) = (*rhs)[i ];
3885 matrix_(i+1UL,
column()) = (*rhs)[i+1UL];
3887 if( ipos < (*rhs).size() )
3888 matrix_(ipos,
column()) = (*rhs)[ipos];
3906template<
typename MT
3908template<
typename VT >
3909inline void Column<MT,false,true,false,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
3913 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
3914 matrix_(element->index(),
column()) = element->value();
3932template<
typename MT
3934template<
typename VT >
3935inline void Column<MT,false,true,false,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
3939 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
3942 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3943 matrix_(i ,
column()) += (*rhs)[i ];
3944 matrix_(i+1UL,
column()) += (*rhs)[i+1UL];
3946 if( ipos < (*rhs).size() )
3947 matrix_(ipos,
column()) += (*rhs)[ipos];
3965template<
typename MT
3967template<
typename VT >
3968inline void Column<MT,false,true,false,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
3972 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
3973 matrix_(element->index(),
column()) += element->value();
3991template<
typename MT
3993template<
typename VT >
3994inline void Column<MT,false,true,false,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
3998 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
4001 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4002 matrix_(i ,
column()) -= (*rhs)[i ];
4003 matrix_(i+1UL,
column()) -= (*rhs)[i+1UL];
4005 if( ipos < (*rhs).size() )
4006 matrix_(ipos,
column()) -= (*rhs)[ipos];
4024template<
typename MT
4026template<
typename VT >
4027inline void Column<MT,false,true,false,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
4031 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
4032 matrix_(element->index(),
column()) -= element->value();
4050template<
typename MT
4052template<
typename VT >
4053inline void Column<MT,false,true,false,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
4057 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
4060 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4061 matrix_(i ,
column()) *= (*rhs)[i ];
4062 matrix_(i+1UL,
column()) *= (*rhs)[i+1UL];
4064 if( ipos < (*rhs).size() )
4065 matrix_(ipos,
column()) *= (*rhs)[ipos];
4083template<
typename MT
4085template<
typename VT >
4086inline void Column<MT,false,true,false,CCAs...>::multAssign(
const SparseVector<VT,false>& rhs )
4094 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
4095 const size_t index( element->index() );
4096 for( ; i<index; ++i )
4098 matrix_(i,
column()) *= element->value();
4102 for( ; i<
size(); ++i ) {
4122template<
typename MT
4124template<
typename VT >
4125inline void Column<MT,false,true,false,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
4129 const size_t ipos(
prevMultiple( (*rhs).size(), 2UL ) );
4132 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4133 matrix_(i ,
column()) /= (*rhs)[i ];
4134 matrix_(i+1UL,
column()) /= (*rhs)[i+1UL];
4136 if( ipos < (*rhs).size() )
4137 matrix_(ipos,
column()) /= (*rhs)[ipos];
4163template<
typename MT
4165class Column<MT,false,true,true,CCAs...>
4166 :
public View< DenseVector< Column<MT,false,true,true,CCAs...>, false > >
4167 ,
private ColumnData<CCAs...>
4171 using DataType = ColumnData<CCAs...>;
4172 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4178 using This = Column<MT,
false,
true,
true,CCAs...>;
4181 using BaseType = View< DenseVector<This,false> >;
4183 using ViewedType = MT;
4185 using TransposeType = TransposeType_t<ResultType>;
4186 using ElementType = ElementType_t<MT>;
4187 using SIMDType = SIMDTrait_t<ElementType>;
4188 using ReturnType = ReturnType_t<MT>;
4189 using CompositeType =
const Column&;
4192 using ConstReference = ConstReference_t<MT>;
4195 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4198 using ConstPointer = ConstPointer_t<MT>;
4201 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
4204 using ConstIterator = ConstIterator_t<MT>;
4207 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4212 static constexpr bool simdEnabled = MT::simdEnabled;
4215 static constexpr bool smpAssignable = MT::smpAssignable;
4218 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
4224 template<
typename... RCAs >
4225 explicit inline Column( MT& matrix, RCAs... args );
4227 Column(
const Column& ) =
default;
4234 ~Column() =
default;
4241 inline Reference operator[](
size_t index );
4242 inline ConstReference operator[](
size_t index )
const;
4243 inline Reference at(
size_t index );
4244 inline ConstReference at(
size_t index )
const;
4245 inline Pointer
data () noexcept;
4246 inline ConstPointer
data () const noexcept;
4247 inline Iterator
begin ();
4248 inline ConstIterator
begin () const;
4249 inline ConstIterator
cbegin() const;
4250 inline Iterator
end ();
4251 inline ConstIterator
end () const;
4252 inline ConstIterator
cend () const;
4259 inline Column& operator=( const ElementType& rhs );
4261 inline Column& operator=( const Column& rhs );
4263 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
4264 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
4265 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
4266 template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
4267 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
4268 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
4277 inline MT& operand() noexcept;
4278 inline const MT& operand() const noexcept;
4280 inline
size_t size() const noexcept;
4281 inline
size_t spacing() const noexcept;
4282 inline
size_t capacity() const noexcept;
4284 inline
void reset();
4291 template< typename Other > inline Column& scale( const Other& scalar );
4298 template< typename VT >
4299 static constexpr
bool VectorizedAssign_v =
4300 ( useOptimizedKernels &&
4301 simdEnabled && VT::simdEnabled &&
4307 template< typename VT >
4308 static constexpr
bool VectorizedAddAssign_v =
4309 ( VectorizedAssign_v<VT> &&
4315 template< typename VT >
4316 static constexpr
bool VectorizedSubAssign_v =
4317 ( VectorizedAssign_v<VT> &&
4323 template< typename VT >
4324 static constexpr
bool VectorizedMultAssign_v =
4325 ( VectorizedAssign_v<VT> &&
4331 template< typename VT >
4332 static constexpr
bool VectorizedDivAssign_v =
4333 ( VectorizedAssign_v<VT> &&
4339 static constexpr
size_t SIMDSIZE = SIMDTrait<ElementType>::
size;
4346 template< typename Other >
4347 inline
bool canAlias( const Other* alias ) const noexcept;
4349 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
4350 inline
bool canAlias( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
4352 template< typename Other >
4353 inline
bool isAliased( const Other* alias ) const noexcept;
4355 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
4356 inline
bool isAliased( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
4358 inline
bool isAligned () const noexcept;
4359 inline
bool canSMPAssign() const noexcept;
4370 template< typename VT >
4371 inline auto assign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedAssign_v<VT> >;
4373 template< typename VT >
4374 inline auto assign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedAssign_v<VT> >;
4376 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
4378 template< typename VT >
4379 inline auto addAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedAddAssign_v<VT> >;
4381 template< typename VT >
4382 inline auto addAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedAddAssign_v<VT> >;
4384 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4386 template< typename VT >
4387 inline auto subAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedSubAssign_v<VT> >;
4389 template< typename VT >
4390 inline auto subAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedSubAssign_v<VT> >;
4392 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4394 template< typename VT >
4395 inline auto multAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedMultAssign_v<VT> >;
4397 template< typename VT >
4398 inline auto multAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedMultAssign_v<VT> >;
4400 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
4402 template< typename VT >
4403 inline auto divAssign( const DenseVector<VT,false>& rhs ) ->
DisableIf_t< VectorizedDivAssign_v<VT> >;
4405 template< typename VT >
4406 inline auto divAssign( const DenseVector<VT,false>& rhs ) ->
EnableIf_t< VectorizedDivAssign_v<VT> >;
4419 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 > friend class Column;
4458template< typename MT
4460template< typename... RCAs >
4461inline Column<MT,false,true,true,CCAs...>::Column( MT& matrix, RCAs... args )
4462 : DataType( args... )
4463 , matrix_ ( matrix )
4466 if( matrix_.columns() <=
column() ) {
4496template<
typename MT
4498inline typename Column<MT,
false,
true,
true,CCAs...>::Reference
4499 Column<MT,false,true,true,CCAs...>::operator[](
size_t index )
4502 return matrix_(
column(),index);
4518template<
typename MT
4520inline typename Column<MT,
false,
true,
true,CCAs...>::ConstReference
4521 Column<MT,false,true,true,CCAs...>::operator[](
size_t index )
const
4524 return const_cast<const MT&
>( matrix_ )(
column(),index);
4541template<
typename MT
4543inline typename Column<MT,
false,
true,
true,CCAs...>::Reference
4544 Column<MT,false,true,true,CCAs...>::at(
size_t index )
4546 if( index >=
size() ) {
4549 return (*
this)[index];
4566template<
typename MT
4568inline typename Column<MT,
false,
true,
true,CCAs...>::ConstReference
4569 Column<MT,false,true,true,CCAs...>::at(
size_t index )
const
4571 if( index >=
size() ) {
4574 return (*
this)[index];
4589template<
typename MT
4591inline typename Column<MT,
false,
true,
true,CCAs...>::Pointer
4594 return matrix_.data(
column() );
4609template<
typename MT
4611inline typename Column<MT,
false,
true,
true,CCAs...>::ConstPointer
4614 return matrix_.data(
column() );
4628template<
typename MT
4630inline typename Column<MT,
false,
true,
true,CCAs...>::Iterator
4633 return matrix_.begin(
column() );
4647template<
typename MT
4649inline typename Column<MT,
false,
true,
true,CCAs...>::ConstIterator
4652 return matrix_.cbegin(
column() );
4666template<
typename MT
4668inline typename Column<MT,
false,
true,
true,CCAs...>::ConstIterator
4671 return matrix_.cbegin(
column() );
4685template<
typename MT
4687inline typename Column<MT,
false,
true,
true,CCAs...>::Iterator
4690 return matrix_.end(
column() );
4704template<
typename MT
4706inline typename Column<MT,
false,
true,
true,CCAs...>::ConstIterator
4709 return matrix_.cend(
column() );
4723template<
typename MT
4725inline typename Column<MT,
false,
true,
true,CCAs...>::ConstIterator
4728 return matrix_.cend(
column() );
4749template<
typename MT
4751inline Column<MT,
false,
true,
true,CCAs...>&
4752 Column<MT,false,true,true,CCAs...>::operator=(
const ElementType& rhs )
4754 decltype(
auto) left( derestrict( matrix_ ) );
4756 const size_t jbegin( ( IsUpper_v<MT> )
4757 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
4761 const size_t jend ( ( IsLower_v<MT> )
4762 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
4767 for(
size_t j=jbegin; j<jend; ++j ) {
4768 if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_,
column(), j, rhs ) )
4793template<
typename MT
4795inline Column<MT,
false,
true,
true,CCAs...>&
4798 if( list.size() >
size() ) {
4802 if( IsRestricted_v<MT> ) {
4803 const InitializerVector<ElementType,false> tmp( list,
size() );
4804 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4809 decltype(
auto) left( derestrict( *
this ) );
4811 std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
4835template<
typename MT
4837inline Column<MT,
false,
true,
true,CCAs...>&
4838 Column<MT,false,true,true,CCAs...>::operator=(
const Column& rhs )
4840 if( &rhs ==
this )
return *
this;
4842 if(
size() != rhs.size() ) {
4846 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
4850 decltype(
auto) left( derestrict( *
this ) );
4852 if( IsExpression_v<MT> && rhs.canAlias(
this ) ) {
4853 const ResultType tmp( rhs );
4882template<
typename MT
4884template<
typename VT >
4885inline Column<MT,
false,
true,
true,CCAs...>&
4886 Column<MT,false,true,true,CCAs...>::operator=(
const Vector<VT,false>& rhs )
4891 if(
size() != (*rhs).size() ) {
4895 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4896 Right right( *rhs );
4898 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4902 decltype(
auto) left( derestrict( *
this ) );
4904 if( IsReference_v<Right> && right.canAlias(
this ) ) {
4905 const ResultType_t<VT> tmp( right );
4909 if( IsSparseVector_v<VT> )
4936template<
typename MT
4938template<
typename VT >
4939inline Column<MT,
false,
true,
true,CCAs...>&
4945 if(
size() != (*rhs).size() ) {
4949 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4950 Right right( *rhs );
4952 if( !tryAddAssign( matrix_, right, 0UL,
column() ) ) {
4956 decltype(
auto) left( derestrict( *
this ) );
4958 if( IsReference_v<Right> && right.canAlias(
this ) ) {
4959 const ResultType_t<VT> tmp( right );
4988template<
typename MT
4990template<
typename VT >
4991inline Column<MT,
false,
true,
true,CCAs...>&
4997 if(
size() != (*rhs).size() ) {
5001 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
5002 Right right( *rhs );
5004 if( !trySubAssign( matrix_, right, 0UL,
column() ) ) {
5008 decltype(
auto) left( derestrict( *
this ) );
5010 if( IsReference_v<Right> && right.canAlias(
this ) ) {
5011 const ResultType_t<VT> tmp( right );
5039template<
typename MT
5041template<
typename VT >
5042inline Column<MT,
false,
true,
true,CCAs...>&
5048 if(
size() != (*rhs).size() ) {
5052 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
5053 Right right( *rhs );
5055 if( !tryMultAssign( matrix_, right, 0UL,
column() ) ) {
5059 decltype(
auto) left( derestrict( *
this ) );
5061 if( IsReference_v<Right> && right.canAlias(
this ) ) {
5062 const ResultType_t<VT> tmp( right );
5089template<
typename MT
5091template<
typename VT >
5092inline Column<MT,
false,
true,
true,CCAs...>&
5098 if(
size() != (*rhs).size() ) {
5102 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
5103 Right right( *rhs );
5105 if( !tryDivAssign( matrix_, right, 0UL,
column() ) ) {
5109 decltype(
auto) left( derestrict( *
this ) );
5111 if( IsReference_v<Right> && right.canAlias(
this ) ) {
5112 const ResultType_t<VT> tmp( right );
5140template<
typename MT
5142template<
typename VT >
5143inline Column<MT,
false,
true,
true,CCAs...>&
5144 Column<MT,false,true,true,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
5146 using blaze::assign;
5151 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5157 if(
size() != 3UL || (*rhs).size() != 3UL ) {
5161 const CrossType right( *
this % (*rhs) );
5163 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
5167 decltype(
auto) left( derestrict( *
this ) );
5169 assign( left, right );
5193template<
typename MT
5195inline MT& Column<MT,false,true,true,CCAs...>::operand() noexcept
5209template<
typename MT
5211inline const MT& Column<MT,false,true,true,CCAs...>::operand() const noexcept
5225template<
typename MT
5229 return matrix_.rows();
5244template<
typename MT
5248 return matrix_.spacing();
5260template<
typename MT
5264 return matrix_.capacity(
column() );
5279template<
typename MT
5283 return matrix_.nonZeros(
column() );
5295template<
typename MT
5299 matrix_.reset(
column() );
5326template<
typename MT
5328template<
typename Other >
5329inline Column<MT,
false,
true,
true,CCAs...>&
5330 Column<MT,false,true,true,CCAs...>::scale(
const Other& scalar )
5334 const size_t jbegin( ( IsUpper_v<MT> )
5335 ?( ( IsStrictlyUpper_v<MT> )
5339 const size_t jend ( ( IsLower_v<MT> )
5340 ?( ( IsStrictlyLower_v<MT> )
5345 for(
size_t j=jbegin; j<jend; ++j ) {
5346 matrix_(
column(),j) *= scalar;
5374template<
typename MT
5376template<
typename Other >
5377inline bool Column<MT,false,true,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
5379 return matrix_.isAliased( &unview( *alias ) );
5396template<
typename MT
5398template<
typename MT2
5403 Column<MT,false,true,true,CCAs...>::canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
5405 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
5422template<
typename MT
5424template<
typename Other >
5425inline bool Column<MT,false,true,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
5427 return matrix_.isAliased( &unview( *alias ) );
5444template<
typename MT
5446template<
typename MT2
5451 Column<MT,false,true,true,CCAs...>::isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
5453 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
5469template<
typename MT
5471inline bool Column<MT,false,true,true,CCAs...>::isAligned() const noexcept
5473 return matrix_.isAligned();
5490template<
typename MT
5492inline bool Column<MT,false,true,true,CCAs...>::canSMPAssign() const noexcept
5494 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5512template<
typename MT
5515 Column<MT,false,true,true,CCAs...>::load(
size_t index )
const noexcept
5517 return matrix_.load(
column(), index );
5536template<
typename MT
5541 return matrix_.loada(
column(), index );
5560template<
typename MT
5565 return matrix_.loadu(
column(), index );
5584template<
typename MT
5587 Column<MT,false,true,true,CCAs...>::store(
size_t index,
const SIMDType& value )
noexcept
5589 matrix_.store(
column(), index, value );
5609template<
typename MT
5614 matrix_.storea(
column(), index, value );
5634template<
typename MT
5639 matrix_.storeu(
column(), index, value );
5659template<
typename MT
5664 matrix_.stream(
column(), index, value );
5682template<
typename MT
5684template<
typename VT >
5685inline auto Column<MT,false,true,true,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
5686 -> DisableIf_t< VectorizedAssign_v<VT> >
5690 const size_t jpos(
prevMultiple( (*rhs).size(), 2UL ) );
5693 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5694 matrix_(
column(),j ) = (*rhs)[j ];
5695 matrix_(
column(),j+1UL) = (*rhs)[j+1UL];
5697 if( jpos < (*rhs).size() )
5698 matrix_(
column(),jpos) = (*rhs)[jpos];
5716template<
typename MT
5718template<
typename VT >
5719inline auto Column<MT,false,true,true,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
5720 -> EnableIf_t< VectorizedAssign_v<VT> >
5726 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5734 Iterator left(
begin() );
5735 ConstIterator_t<VT> right( (*rhs).begin() );
5737 if( useStreaming &&
columns > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(*rhs).isAliased(
this ) )
5739 for( ; j<jpos; j+=SIMDSIZE ) {
5740 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5742 for( ; remainder && j<
columns; ++j ) {
5743 *left = *right; ++left; ++right;
5748 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5749 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5750 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5751 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5752 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5754 for( ; j<jpos; j+=SIMDSIZE ) {
5755 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5757 for( ; remainder && j<
columns; ++j ) {
5758 *left = *right; ++left; ++right;
5778template<
typename MT
5780template<
typename VT >
5781inline void Column<MT,false,true,true,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
5785 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
5786 matrix_(
column(),element->index()) = element->value();
5804template<
typename MT
5806template<
typename VT >
5807inline auto Column<MT,false,true,true,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
5808 -> DisableIf_t< VectorizedAddAssign_v<VT> >
5812 const size_t jpos(
prevMultiple( (*rhs).size(), 2UL ) );
5815 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5816 matrix_(
column(),j ) += (*rhs)[j ];
5817 matrix_(
column(),j+1UL) += (*rhs)[j+1UL];
5819 if( jpos < (*rhs).size() )
5820 matrix_(
column(),jpos) += (*rhs)[jpos];
5838template<
typename MT
5840template<
typename VT >
5841inline auto Column<MT,false,true,true,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
5842 -> EnableIf_t< VectorizedAddAssign_v<VT> >
5848 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5856 Iterator left(
begin() );
5857 ConstIterator_t<VT> right( (*rhs).begin() );
5859 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5860 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5861 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5862 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5863 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5865 for( ; j<jpos; j+=SIMDSIZE ) {
5866 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5868 for( ; remainder && j<
columns; ++j ) {
5869 *left += *right; ++left; ++right;
5888template<
typename MT
5890template<
typename VT >
5891inline void Column<MT,false,true,true,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
5895 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
5896 matrix_(
column(),element->index()) += element->value();
5914template<
typename MT
5916template<
typename VT >
5917inline auto Column<MT,false,true,true,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
5918 -> DisableIf_t< VectorizedSubAssign_v<VT> >
5922 const size_t jpos(
prevMultiple( (*rhs).size(), 2UL ) );
5925 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5926 matrix_(
column(),j ) -= (*rhs)[j ];
5927 matrix_(
column(),j+1UL) -= (*rhs)[j+1UL];
5929 if( jpos < (*rhs).size() )
5930 matrix_(
column(),jpos) -= (*rhs)[jpos];
5948template<
typename MT
5950template<
typename VT >
5951inline auto Column<MT,false,true,true,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
5952 -> EnableIf_t< VectorizedSubAssign_v<VT> >
5958 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5966 Iterator left(
begin() );
5967 ConstIterator_t<VT> right( (*rhs).begin() );
5969 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5970 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5971 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5972 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5973 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5975 for( ; j<jpos; j+=SIMDSIZE ) {
5976 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5978 for( ; remainder && j<
columns; ++j ) {
5979 *left -= *right; ++left; ++right;
5998template<
typename MT
6000template<
typename VT >
6001inline void Column<MT,false,true,true,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
6005 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element )
6006 matrix_(
column(),element->index()) -= element->value();
6024template<
typename MT
6026template<
typename VT >
6027inline auto Column<MT,false,true,true,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
6028 -> DisableIf_t< VectorizedMultAssign_v<VT> >
6032 const size_t jpos(
prevMultiple( (*rhs).size(), 2UL ) );
6035 for(
size_t j=0UL; j<jpos; j+=2UL ) {
6036 matrix_(
column(),j ) *= (*rhs)[j ];
6037 matrix_(
column(),j+1UL) *= (*rhs)[j+1UL];
6039 if( jpos < (*rhs).size() )
6040 matrix_(
column(),jpos) *= (*rhs)[jpos];
6058template<
typename MT
6060template<
typename VT >
6061inline auto Column<MT,false,true,true,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
6062 -> EnableIf_t< VectorizedMultAssign_v<VT> >
6068 constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
6076 Iterator left(
begin() );
6077 ConstIterator_t<VT> right( (*rhs).begin() );
6079 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
6080 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6081 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6082 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6083 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6085 for( ; j<jpos; j+=SIMDSIZE ) {
6086 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6088 for( ; remainder && j<
columns; ++j ) {
6089 *left *= *right; ++left; ++right;
6108template<
typename MT
6110template<
typename VT >
6111inline void Column<MT,false,true,true,CCAs...>::multAssign(
const SparseVector<VT,false>& rhs )
6119 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
6120 const size_t index( element->index() );
6121 for( ; j<index; ++j )
6123 matrix_(
column(),j) *= element->value();
6127 for( ; j<
size(); ++j ) {
6147template<
typename MT
6149template<
typename VT >
6150inline auto Column<MT,false,true,true,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
6151 -> DisableIf_t< VectorizedDivAssign_v<VT> >
6155 const size_t jpos(
prevMultiple( (*rhs).size(), 2UL ) );
6158 for(
size_t j=0UL; j<jpos; j+=2UL ) {
6159 matrix_(
column(),j ) /= (*rhs)[j ];
6160 matrix_(
column(),j+1UL) /= (*rhs)[j+1UL];
6162 if( jpos < (*rhs).size() )
6163 matrix_(
column(),jpos) /= (*rhs)[jpos];
6181template<
typename MT
6183template<
typename VT >
6184inline auto Column<MT,false,true,true,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
6185 -> EnableIf_t< VectorizedDivAssign_v<VT> >
6197 Iterator left(
begin() );
6198 ConstIterator_t<VT> right( (*rhs).begin() );
6200 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
6201 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6202 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6203 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6204 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6206 for( ; j<jpos; j+=SIMDSIZE ) {
6207 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6210 *left /= *right; ++left; ++right;
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the ColumnData class template.
Constraints on the storage order of matrix types.
Header file for the column trait.
Constraint on the transpose flag of vector types.
Header file for the cross product trait.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:751
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:719
Header file for the EnableIf class template.
Header file for the HasMutableDataAccess type trait.
Header file for the HasSIMDAdd type trait.
Header file for the HasSIMDDiv type trait.
Header file for the HasSIMDMult type trait.
Header file for the HasSIMDSub type trait.
Header file for the If class template.
Header file for the IsConst type trait.
Header file for the isDefault shim.
Header file for the IsExpression type trait class.
Header file for the IsLower type trait.
Header file for the IsPadded type trait.
Header file for the IsReference type trait.
Header file for the IsRestricted type trait.
Header file for the IsSIMDCombinable type trait.
Header file for the IsSparseVector type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsTriangular type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUpper type trait.
Constraint on the data type.
Header file for the prevMultiple shim.
Constraint on the data type.
Constraints on the storage order of matrix types.
Header file for all SIMD functionality.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Initializer list type of the Blaze library.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of a vector representation of an initializer list.
Header file for the DenseVector base class.
Header file for the View base class.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.
Definition: Vectorizable.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:574
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:182
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:386
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:510
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:265
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:9640
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:448
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition: DiagonalMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: RowMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.
Definition: TransExpr.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:60
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.
Definition: ColumnVector.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: UniTriangular.h:81
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.h:61
typename ColumnTrait< MT, CCAs... >::Type ColumnTrait_t
Auxiliary alias declaration for the ColumnTrait type trait.
Definition: ColumnTrait.h:144
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.
Definition: HasSIMDSub.h:187
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.
Definition: IsSIMDCombinable.h:137
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.
Definition: HasSIMDAdd.h:187
constexpr bool HasSIMDDiv_v
Auxiliary variable template for the HasSIMDDiv type trait.
Definition: HasSIMDDiv.h:173
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.
Definition: HasSIMDMult.h:188
BLAZE_ALWAYS_INLINE constexpr auto prevMultiple(T1 value, T2 factor) noexcept
Rounds down an integral value to the previous multiple of a given factor.
Definition: PrevMultiple.h:68
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:446
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:408
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition: Matrix.h:960
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:628
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:644
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:730
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:562
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:660
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:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:518
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< 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:74
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:221
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:192
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
constexpr bool isChecked(const Ts &... args)
Extracting blaze::Check arguments from a given list of arguments.
Definition: Check.h:225
Header file for the exception macros of the math module.
Header file for the extended initializer_list functionality.
Header file for the clear shim.
Header file for the reset shim.
Header file for the cache size of the target architecture.
System settings for the inline keywords.
System settings for performance optimizations.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for basic type definitions.
Header file for the implementation of the Column base template.