35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_DENSE_H_ 125 template<
typename MT
128 class Column<MT,true,true,SF,CCAs...>
129 :
public View< DenseVector< Column<MT,true,true,SF,CCAs...>, false > >
130 ,
private ColumnData<CCAs...>
134 using DataType = ColumnData<CCAs...>;
135 using Operand = If_< IsExpression<MT>, MT, MT& >;
141 using This = Column<MT,
true,
true,SF,CCAs...>;
143 using BaseType = DenseVector<This,false>;
144 using ViewedType = MT;
148 using SIMDType = SIMDTrait_<ElementType>;
159 using ConstPointer = ConstPointer_<MT>;
162 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
173 enum :
bool { simdEnabled = MT::simdEnabled };
176 enum :
bool { smpAssignable = MT::smpAssignable };
182 template<
typename... RCAs >
183 explicit inline Column( MT& matrix, RCAs... args );
195 inline Reference operator[](
size_t index );
196 inline ConstReference operator[](
size_t index )
const;
198 inline ConstReference at(
size_t index )
const;
199 inline Pointer
data () noexcept;
200 inline ConstPointer
data () const noexcept;
202 inline ConstIterator begin () const;
203 inline ConstIterator
cbegin() const;
205 inline ConstIterator end () const;
206 inline ConstIterator
cend () const;
213 inline Column& operator=( const
ElementType& rhs );
214 inline Column& operator=( initializer_list<
ElementType> list );
215 inline Column& operator=( const Column& rhs );
217 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
218 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
219 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
220 template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
221 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
222 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
231 inline MT& operand() noexcept;
232 inline const MT& operand() const noexcept;
234 inline
size_t size() const noexcept;
235 inline
size_t spacing() const noexcept;
236 inline
size_t capacity() const noexcept;
245 template< typename Other > inline Column& scale( const Other& scalar );
252 template< typename VT >
253 struct VectorizedAssign {
254 enum :
bool { value = useOptimizedKernels &&
255 simdEnabled && VT::simdEnabled &&
256 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
262 template<
typename VT >
263 struct VectorizedAddAssign {
264 enum :
bool { value = useOptimizedKernels &&
265 simdEnabled && VT::simdEnabled &&
266 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
267 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
273 template<
typename VT >
274 struct VectorizedSubAssign {
275 enum :
bool { value = useOptimizedKernels &&
276 simdEnabled && VT::simdEnabled &&
277 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
278 HasSIMDSub< ElementType, ElementType_<VT> >::value };
284 template<
typename VT >
285 struct VectorizedMultAssign {
286 enum :
bool { value = useOptimizedKernels &&
287 simdEnabled && VT::simdEnabled &&
288 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
289 HasSIMDMult< ElementType, ElementType_<VT> >::value };
295 template<
typename VT >
296 struct VectorizedDivAssign {
297 enum :
bool { value = useOptimizedKernels &&
298 simdEnabled && VT::simdEnabled &&
299 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
300 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
313 template<
typename Other >
314 inline bool canAlias(
const Other* alias )
const noexcept;
316 template<
typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
317 inline bool canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept;
319 template<
typename Other >
320 inline bool isAliased(
const Other* alias )
const noexcept;
322 template<
typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
323 inline bool isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept;
325 inline bool isAligned () const noexcept;
326 inline
bool canSMPAssign() const noexcept;
337 template< typename VT >
338 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
340 template< typename VT >
341 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
343 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
345 template< typename VT >
346 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
348 template< typename VT >
349 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
351 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
353 template< typename VT >
354 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
356 template< typename VT >
357 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
359 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
361 template< typename VT >
362 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
364 template< typename VT >
365 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
367 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
369 template< typename VT >
370 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
372 template< typename VT >
373 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
386 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 > friend class Column;
424 template< typename MT
427 template< typename... RCAs >
428 inline Column<MT,true,true,SF,CCAs...>::Column( MT& matrix, RCAs... args )
429 : DataType( args... )
432 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
433 if( matrix_.columns() <=
column() ) {
463 template<
typename MT
466 inline typename Column<MT,
true,
true,SF,CCAs...>
::Reference 467 Column<MT,true,true,SF,CCAs...>::operator[](
size_t index )
470 return matrix_(index,
column());
486 template<
typename MT
490 Column<MT,true,true,SF,CCAs...>::operator[](
size_t index )
const 493 return const_cast<const MT&
>( matrix_ )(index,
column());
510 template<
typename MT
513 inline typename Column<MT,
true,
true,SF,CCAs...>
::Reference 514 Column<MT,true,true,SF,CCAs...>::at(
size_t index )
516 if( index >=
size() ) {
519 return (*
this)[index];
536 template<
typename MT
540 Column<MT,true,true,SF,CCAs...>::at(
size_t index )
const 542 if( index >=
size() ) {
545 return (*
this)[index];
560 template<
typename MT
563 inline typename Column<MT,
true,
true,SF,CCAs...>::Pointer
566 return matrix_.data(
column() );
581 template<
typename MT
584 inline typename Column<MT,
true,
true,SF,CCAs...>::ConstPointer
587 return matrix_.data(
column() );
601 template<
typename MT
604 inline typename Column<MT,
true,
true,SF,CCAs...>
::Iterator 607 return matrix_.begin(
column() );
621 template<
typename MT
627 return matrix_.cbegin(
column() );
641 template<
typename MT
647 return matrix_.cbegin(
column() );
661 template<
typename MT
664 inline typename Column<MT,
true,
true,SF,CCAs...>
::Iterator 667 return matrix_.end(
column() );
681 template<
typename MT
687 return matrix_.cend(
column() );
701 template<
typename MT
707 return matrix_.cend(
column() );
732 template<
typename MT
735 inline Column<MT,
true,
true,SF,CCAs...>&
736 Column<MT,true,true,SF,CCAs...>::operator=(
const ElementType& rhs )
738 decltype(
auto) left( derestrict( matrix_ ) );
740 const
size_t ibegin( ( IsLower<MT>::value )
741 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
745 const
size_t iend ( ( IsUpper<MT>::value )
746 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
751 for(
size_t i=ibegin; i<iend; ++i ) {
752 if( !IsRestricted<MT>::value || IsTriangular<MT>::value || trySet( matrix_, i,
column(), rhs ) )
777 template<
typename MT
780 inline Column<MT,
true,
true,SF,CCAs...>&
781 Column<MT,true,true,SF,CCAs...>::operator=( initializer_list<ElementType> list )
783 if( list.size() >
size() ) {
787 if( IsRestricted<MT>::value ) {
788 const InitializerVector<ElementType,false> tmp( list,
size() );
789 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
794 decltype(
auto) left( derestrict( *this ) );
820 template< typename MT
823 inline Column<MT,true,true,SF,CCAs...>&
824 Column<MT,true,true,SF,CCAs...>::operator=( const Column& rhs )
826 if( &rhs ==
this )
return *
this;
828 if(
size() != rhs.size() ) {
832 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
836 decltype(
auto) left( derestrict( *this ) );
838 if( IsExpression<MT>::value && rhs.canAlias( &matrix_ ) ) {
868 template<
typename MT
871 template<
typename VT >
872 inline Column<MT,
true,
true,SF,CCAs...>&
873 Column<MT,true,true,SF,CCAs...>::operator=(
const Vector<VT,false>& rhs )
882 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
885 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
889 decltype(
auto) left( derestrict( *this ) );
891 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
892 const ResultType_<VT> tmp( right );
896 if( IsSparseVector<VT>::value )
923 template<
typename MT
926 template<
typename VT >
927 inline Column<MT,
true,
true,SF,CCAs...>&
937 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
940 if( !tryAddAssign( matrix_, right, 0UL,
column() ) ) {
944 decltype(
auto) left( derestrict( *this ) );
946 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
947 const ResultType_<VT> tmp( right );
976 template<
typename MT
979 template<
typename VT >
980 inline Column<MT,
true,
true,SF,CCAs...>&
990 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
993 if( !trySubAssign( matrix_, right, 0UL,
column() ) ) {
997 decltype(
auto) left( derestrict( *this ) );
999 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1000 const ResultType_<VT> tmp( right );
1028 template<
typename MT
1031 template<
typename VT >
1032 inline Column<MT,
true,
true,SF,CCAs...>&
1042 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
1043 Right right( ~rhs );
1045 if( !tryMultAssign( matrix_, right, 0UL,
column() ) ) {
1049 decltype(
auto) left( derestrict( *this ) );
1051 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1052 const ResultType_<VT> tmp( right );
1079 template<
typename MT
1082 template<
typename VT >
1083 inline Column<MT,
true,
true,SF,CCAs...>&
1093 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
1094 Right right( ~rhs );
1096 if( !tryDivAssign( matrix_, right, 0UL,
column() ) ) {
1100 decltype(
auto) left( derestrict( *this ) );
1102 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1103 const ResultType_<VT> tmp( right );
1131 template<
typename MT
1134 template<
typename VT >
1135 inline Column<MT,
true,
true,SF,CCAs...>&
1136 Column<MT,true,true,SF,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
1138 using blaze::assign;
1143 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1149 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1153 const CrossType right( *
this % (~rhs) );
1155 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
1159 decltype(
auto) left( derestrict( *this ) );
1161 assign( left, right );
1185 template< typename MT
1188 inline MT& Column<MT,true,true,SF,CCAs...>::operand() noexcept
1202 template<
typename MT
1205 inline const MT& Column<MT,true,true,SF,CCAs...>::operand() const noexcept
1219 template<
typename MT
1224 return matrix_.rows();
1239 template<
typename MT
1244 return matrix_.spacing();
1256 template<
typename MT
1261 return matrix_.capacity(
column() );
1276 template<
typename MT
1281 return matrix_.nonZeros(
column() );
1293 template<
typename MT
1298 matrix_.reset(
column() );
1325 template<
typename MT
1328 template<
typename Other >
1329 inline Column<MT,
true,
true,SF,CCAs...>&
1330 Column<MT,true,true,SF,CCAs...>::scale(
const Other& scalar )
1334 const size_t ibegin( ( IsLower<MT>::value )
1335 ?( ( IsStrictlyLower<MT>::value )
1339 const size_t iend ( ( IsUpper<MT>::value )
1340 ?( ( IsStrictlyUpper<MT>::value )
1345 for(
size_t i=ibegin; i<iend; ++i ) {
1346 matrix_(i,
column()) *= scalar;
1374 template<
typename MT
1377 template<
typename Other >
1378 inline bool Column<MT,true,true,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1380 return matrix_.isAliased( alias );
1397 template<
typename MT
1400 template<
typename MT2
1405 Column<MT,true,true,SF,CCAs...>::canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
1407 return matrix_.isAliased( alias->matrix_ ) && (
column() == alias->column() );
1424 template<
typename MT
1427 template<
typename Other >
1428 inline bool Column<MT,true,true,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1430 return matrix_.isAliased( alias );
1447 template<
typename MT
1450 template<
typename MT2
1455 Column<MT,true,true,SF,CCAs...>::isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
1457 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
1473 template<
typename MT
1476 inline bool Column<MT,true,true,SF,CCAs...>::isAligned() const noexcept
1478 return matrix_.isAligned();
1495 template<
typename MT
1498 inline bool Column<MT,true,true,SF,CCAs...>::canSMPAssign() const noexcept
1500 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1518 template<
typename MT
1522 Column<MT,true,true,SF,CCAs...>::load(
size_t index )
const noexcept
1524 return matrix_.load( index,
column() );
1543 template<
typename MT
1549 return matrix_.loada( index,
column() );
1568 template<
typename MT
1574 return matrix_.loadu( index,
column() );
1593 template<
typename MT
1597 Column<MT,true,true,SF,CCAs...>::store(
size_t index,
const SIMDType& value ) noexcept
1599 matrix_.store( index,
column(), value );
1619 template<
typename MT
1625 matrix_.storea( index,
column(), value );
1645 template<
typename MT
1651 matrix_.storeu( index,
column(), value );
1671 template<
typename MT
1677 matrix_.stream( index,
column(), value );
1695 template<
typename MT
1698 template<
typename VT >
1699 inline DisableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1700 Column<MT,true,true,SF,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
1704 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1705 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1706 matrix_(i ,
column()) = (~rhs)[i ];
1707 matrix_(i+1UL,
column()) = (~rhs)[i+1UL];
1709 if( ipos < (~rhs).size() )
1710 matrix_(ipos,
column()) = (~rhs)[ipos];
1728 template<
typename MT
1731 template<
typename VT >
1732 inline EnableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1733 Column<MT,true,true,SF,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
1739 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1743 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1748 ConstIterator_<VT> right( (~rhs).
begin() );
1750 if( useStreaming &&
rows > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased(
this ) )
1752 for( ; i<ipos; i+=SIMDSIZE ) {
1753 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1755 for( ; remainder && i<
rows; ++i ) {
1756 *left = *right; ++left; ++right;
1761 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1762 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1763 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1764 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1765 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1767 for( ; i<ipos; i+=SIMDSIZE ) {
1768 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1770 for( ; remainder && i<
rows; ++i ) {
1771 *left = *right; ++left; ++right;
1791 template<
typename MT
1794 template<
typename VT >
1795 inline void Column<MT,true,true,SF,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
1799 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1800 matrix_(element->index(),
column()) = element->value();
1818 template<
typename MT
1821 template<
typename VT >
1822 inline DisableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1823 Column<MT,true,true,SF,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
1827 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1828 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1829 matrix_(i ,
column()) += (~rhs)[i ];
1830 matrix_(i+1UL,
column()) += (~rhs)[i+1UL];
1832 if( ipos < (~rhs).size() )
1833 matrix_(ipos,
column()) += (~rhs)[ipos];
1851 template<
typename MT
1854 template<
typename VT >
1855 inline EnableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1856 Column<MT,true,true,SF,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
1862 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1866 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1871 ConstIterator_<VT> right( (~rhs).
begin() );
1873 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1874 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1875 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1876 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1877 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1879 for( ; i<ipos; i+=SIMDSIZE ) {
1880 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1882 for( ; remainder && i<
rows; ++i ) {
1883 *left += *right; ++left; ++right;
1902 template<
typename MT
1905 template<
typename VT >
1906 inline void Column<MT,true,true,SF,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
1910 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1911 matrix_(element->index(),
column()) += element->value();
1929 template<
typename MT
1932 template<
typename VT >
1933 inline DisableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1934 Column<MT,true,true,SF,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
1938 const size_t ipos( (~rhs).
size() &
size_t(-2) );
1939 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1940 matrix_(i ,
column()) -= (~rhs)[i ];
1941 matrix_(i+1UL,
column()) -= (~rhs)[i+1UL];
1943 if( ipos < (~rhs).size() )
1944 matrix_(ipos,
column()) -= (~rhs)[ipos];
1962 template<
typename MT
1965 template<
typename VT >
1966 inline EnableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1967 Column<MT,true,true,SF,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
1973 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1977 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
1982 ConstIterator_<VT> right( (~rhs).
begin() );
1984 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1985 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1986 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1987 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1988 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1990 for( ; i<ipos; i+=SIMDSIZE ) {
1991 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1993 for( ; remainder && i<
rows; ++i ) {
1994 *left -= *right; ++left; ++right;
2013 template<
typename MT
2016 template<
typename VT >
2017 inline void Column<MT,true,true,SF,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
2021 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2022 matrix_(element->index(),
column()) -= element->value();
2040 template<
typename MT
2043 template<
typename VT >
2044 inline DisableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2045 Column<MT,true,true,SF,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
2049 const size_t ipos( (~rhs).
size() &
size_t(-2) );
2050 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2051 matrix_(i ,
column()) *= (~rhs)[i ];
2052 matrix_(i+1UL,
column()) *= (~rhs)[i+1UL];
2054 if( ipos < (~rhs).size() )
2055 matrix_(ipos,
column()) *= (~rhs)[ipos];
2073 template<
typename MT
2076 template<
typename VT >
2077 inline EnableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2078 Column<MT,true,true,SF,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
2084 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
2088 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
2093 ConstIterator_<VT> right( (~rhs).
begin() );
2095 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
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;
2099 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2101 for( ; i<ipos; i+=SIMDSIZE ) {
2102 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2104 for( ; remainder && i<
rows; ++i ) {
2105 *left *= *right; ++left, ++right;
2124 template<
typename MT
2127 template<
typename VT >
2128 inline void Column<MT,true,true,SF,CCAs...>::multAssign(
const SparseVector<VT,false>& rhs )
2136 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
2137 const size_t index( element->index() );
2138 for( ; i<index; ++i )
2140 matrix_(i,
column()) *= element->value();
2144 for( ; i<
size(); ++i ) {
2164 template<
typename MT
2167 template<
typename VT >
2168 inline DisableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2169 Column<MT,true,true,SF,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
2173 const size_t ipos( (~rhs).
size() &
size_t(-2) );
2174 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2175 matrix_(i ,
column()) /= (~rhs)[i ];
2176 matrix_(i+1UL,
column()) /= (~rhs)[i+1UL];
2178 if( ipos < (~rhs).size() )
2179 matrix_(ipos,
column()) /= (~rhs)[ipos];
2197 template<
typename MT
2200 template<
typename VT >
2201 inline EnableIf_<
typename Column<MT,
true,
true,SF,CCAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2202 Column<MT,true,true,SF,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
2210 const size_t ipos(
rows &
size_t(-SIMDSIZE) );
2215 ConstIterator_<VT> right( (~rhs).
begin() );
2217 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2218 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
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;
2223 for( ; i<ipos; i+=SIMDSIZE ) {
2224 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2226 for( ; i<
rows; ++i ) {
2227 *left /= *right; ++left; ++right;
2254 template<
typename MT
2256 class Column<MT,false,true,false,CCAs...>
2257 :
public View< DenseVector< Column<MT,false,true,false,CCAs...>, false > >
2258 ,
private ColumnData<CCAs...>
2262 using DataType = ColumnData<CCAs...>;
2263 using Operand = If_< IsExpression<MT>, MT, MT& >;
2269 using This = Column<MT,
false,
true,
false,CCAs...>;
2271 using BaseType = DenseVector<This,false>;
2272 using ViewedType = MT;
2275 using ElementType = ElementType_<MT>;
2280 using ConstReference = ConstReference_<MT>;
2286 using ConstPointer = ConstPointer_<MT>;
2289 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
2295 template<
typename MatrixType
2296 ,
typename IteratorType >
2297 class ColumnIterator
2302 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
2305 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
2308 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
2311 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
2314 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
2317 using iterator_category = IteratorCategory;
2318 using value_type = ValueType;
2319 using pointer = PointerType;
2320 using reference = ReferenceType;
2321 using difference_type = DifferenceType;
2327 inline ColumnIterator() noexcept
2328 : matrix_(
nullptr )
2342 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2343 : matrix_( &matrix )
2348 if( row_ != matrix_->rows() )
2349 pos_ = matrix_->begin( row_ ) + column_;
2358 template<
typename MatrixType2,
typename IteratorType2 >
2359 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it ) noexcept
2360 : matrix_( it.matrix_ )
2362 , column_( it.column_ )
2373 inline ColumnIterator&
operator+=(
size_t inc ) noexcept {
2376 if( row_ != matrix_->rows() )
2377 pos_ = matrix_->begin( row_ ) + column_;
2389 inline ColumnIterator&
operator-=(
size_t dec ) noexcept {
2392 if( row_ != matrix_->rows() )
2393 pos_ = matrix_->begin( row_ ) + column_;
2404 inline ColumnIterator& operator++() noexcept {
2407 if( row_ != matrix_->rows() )
2408 pos_ = matrix_->begin( row_ ) + column_;
2419 inline const ColumnIterator operator++(
int ) noexcept {
2420 const ColumnIterator tmp( *
this );
2431 inline ColumnIterator& operator--() noexcept {
2434 if( row_ != matrix_->rows() )
2435 pos_ = matrix_->begin( row_ ) + column_;
2446 inline const ColumnIterator operator--(
int ) noexcept {
2447 const ColumnIterator tmp( *
this );
2459 inline ReferenceType operator[](
size_t index )
const {
2461 const IteratorType pos( matrix_->begin( row_+index ) + column_ );
2471 inline ReferenceType
operator*()
const {
2481 inline PointerType operator->()
const {
2492 template<
typename MatrixType2,
typename IteratorType2 >
2493 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2494 return row_ == rhs.row_;
2504 template<
typename MatrixType2,
typename IteratorType2 >
2505 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2506 return !( *
this == rhs );
2516 template<
typename MatrixType2,
typename IteratorType2 >
2517 inline bool operator<( const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2518 return row_ < rhs.row_;
2528 template<
typename MatrixType2,
typename IteratorType2 >
2529 inline bool operator>(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2530 return row_ > rhs.row_;
2540 template<
typename MatrixType2,
typename IteratorType2 >
2541 inline bool operator<=( const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2542 return row_ <= rhs.row_;
2552 template<
typename MatrixType2,
typename IteratorType2 >
2553 inline bool operator>=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2554 return row_ >= rhs.row_;
2564 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const noexcept {
2565 return row_ - rhs.row_;
2576 friend inline const ColumnIterator
operator+(
const ColumnIterator& it,
size_t inc ) noexcept {
2577 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2588 friend inline const ColumnIterator
operator+(
size_t inc,
const ColumnIterator& it ) noexcept {
2589 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2600 friend inline const ColumnIterator
operator-(
const ColumnIterator& it,
size_t dec ) noexcept {
2601 return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2607 MatrixType* matrix_;
2614 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2621 using ConstIterator = ColumnIterator< const MT, ConstIterator_<MT> >;
2629 enum :
bool { simdEnabled =
false };
2632 enum :
bool { smpAssignable = MT::smpAssignable };
2638 template<
typename... RCAs >
2639 explicit inline Column( MT& matrix, RCAs... args );
2651 inline Reference operator[](
size_t index );
2652 inline ConstReference operator[](
size_t index )
const;
2654 inline ConstReference at(
size_t index )
const;
2655 inline Pointer
data () noexcept;
2656 inline ConstPointer
data () const noexcept;
2658 inline ConstIterator begin () const;
2659 inline ConstIterator
cbegin() const;
2661 inline ConstIterator end () const;
2662 inline ConstIterator
cend () const;
2669 inline Column& operator=( const ElementType& rhs );
2670 inline Column& operator=( initializer_list<ElementType> list );
2671 inline Column& operator=( const Column& rhs );
2673 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
2674 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
2675 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
2676 template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
2677 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
2678 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
2687 inline MT& operand() noexcept;
2688 inline const MT& operand() const noexcept;
2690 inline
size_t size() const noexcept;
2691 inline
size_t spacing() const noexcept;
2692 inline
size_t capacity() const noexcept;
2694 inline
void reset();
2701 template< typename Other > inline Column& scale( const Other& scalar );
2708 template< typename Other >
2709 inline
bool canAlias ( const Other* alias ) const noexcept;
2711 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
2712 inline
bool canAlias ( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
2714 template< typename Other >
2715 inline
bool isAliased( const Other* alias ) const noexcept;
2717 template< typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
2718 inline
bool isAliased( const Column<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
2720 inline
bool isAligned () const noexcept;
2721 inline
bool canSMPAssign() const noexcept;
2723 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2724 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2725 template< typename VT > inline
void addAssign ( const DenseVector <VT,false>& rhs );
2726 template< typename VT > inline
void addAssign ( const SparseVector<VT,false>& rhs );
2727 template< typename VT > inline
void subAssign ( const DenseVector <VT,false>& rhs );
2728 template< typename VT > inline
void subAssign ( const SparseVector<VT,false>& rhs );
2729 template< typename VT > inline
void multAssign( const DenseVector <VT,false>& rhs );
2730 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
2731 template< typename VT > inline
void divAssign ( const DenseVector <VT,false>& rhs );
2744 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 > friend class Column;
2783 template< typename MT
2785 template< typename... RCAs >
2786 inline Column<MT,false,true,false,CCAs...>::Column( MT& matrix, RCAs... args )
2787 : DataType( args... )
2788 , matrix_ ( matrix )
2790 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
2791 if( matrix_.columns() <=
column() ) {
2821 template<
typename MT
2823 inline typename Column<MT,
false,
true,
false,CCAs...>
::Reference 2824 Column<MT,false,true,false,CCAs...>::operator[](
size_t index )
2827 return matrix_(index,
column());
2843 template<
typename MT
2846 Column<MT,false,true,false,CCAs...>::operator[](
size_t index )
const 2849 return const_cast<const MT&
>( matrix_ )(index,
column());
2866 template<
typename MT
2868 inline typename Column<MT,
false,
true,
false,CCAs...>
::Reference 2869 Column<MT,false,true,false,CCAs...>::at(
size_t index )
2871 if( index >=
size() ) {
2874 return (*
this)[index];
2891 template<
typename MT
2894 Column<MT,false,true,false,CCAs...>::at(
size_t index )
const 2896 if( index >=
size() ) {
2899 return (*
this)[index];
2914 template<
typename MT
2916 inline typename Column<MT,
false,
true,
false,CCAs...>::Pointer
2919 return matrix_.data() +
column();
2934 template<
typename MT
2936 inline typename Column<MT,
false,
true,
false,CCAs...>::ConstPointer
2939 return matrix_.data() +
column();
2953 template<
typename MT
2955 inline typename Column<MT,
false,
true,
false,CCAs...>
::Iterator 2972 template<
typename MT
2991 template<
typename MT
3010 template<
typename MT
3012 inline typename Column<MT,
false,
true,
false,CCAs...>
::Iterator 3029 template<
typename MT
3048 template<
typename MT
3078 template<
typename MT
3080 inline Column<MT,
false,
true,
false,CCAs...>&
3081 Column<MT,false,true,false,CCAs...>::operator=(
const ElementType& rhs )
3083 decltype(
auto) left( derestrict( matrix_ ) );
3085 const
size_t ibegin( ( IsLower<MT>::value )
3086 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3090 const
size_t iend ( ( IsUpper<MT>::value )
3091 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3096 for(
size_t i=ibegin; i<iend; ++i ) {
3097 if( !IsRestricted<MT>::value || IsTriangular<MT>::value || trySet( matrix_, i,
column(), rhs ) )
3122 template<
typename MT
3124 inline Column<MT,
false,
true,
false,CCAs...>&
3125 Column<MT,false,true,false,CCAs...>::operator=( initializer_list<ElementType> list )
3127 if( list.size() >
size() ) {
3131 if( IsRestricted<MT>::value ) {
3132 const InitializerVector<ElementType,false> tmp( list,
size() );
3133 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3138 decltype(
auto) left( derestrict( *this ) );
3140 std::fill(
std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
3164 template< typename MT
3166 inline Column<MT,false,true,false,CCAs...>&
3167 Column<MT,false,true,false,CCAs...>::operator=( const Column& rhs )
3169 if( &rhs ==
this )
return *
this;
3171 if(
size() != rhs.size() ) {
3175 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
3179 decltype(
auto) left( derestrict( *this ) );
3181 if( IsExpression<MT>::value && rhs.canAlias( &matrix_ ) ) {
3211 template<
typename MT
3213 template<
typename VT >
3214 inline Column<MT,
false,
true,
false,CCAs...>&
3215 Column<MT,false,true,false,CCAs...>::operator=(
const Vector<VT,false>& rhs )
3225 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3226 Right right( ~rhs );
3228 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
3232 decltype(
auto) left( derestrict( *this ) );
3234 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3239 if( IsSparseVector<VT>::value )
3266 template<
typename MT
3268 template<
typename VT >
3269 inline Column<MT,
false,
true,
false,CCAs...>&
3279 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3280 Right right( ~rhs );
3282 if( !tryAddAssign( matrix_, right, 0UL,
column() ) ) {
3286 decltype(
auto) left( derestrict( *this ) );
3288 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3289 const ResultType_<VT> tmp( right );
3318 template<
typename MT
3320 template<
typename VT >
3321 inline Column<MT,
false,
true,
false,CCAs...>&
3331 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3332 Right right( ~rhs );
3334 if( !trySubAssign( matrix_, right, 0UL,
column() ) ) {
3338 decltype(
auto) left( derestrict( *this ) );
3340 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3341 const ResultType_<VT> tmp( right );
3369 template<
typename MT
3371 template<
typename VT >
3372 inline Column<MT,
false,
true,
false,CCAs...>&
3382 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3383 Right right( ~rhs );
3385 if( !tryMultAssign( matrix_, right, 0UL,
column() ) ) {
3389 decltype(
auto) left( derestrict( *this ) );
3391 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3392 const ResultType_<VT> tmp( right );
3419 template<
typename MT
3421 template<
typename VT >
3422 inline Column<MT,
false,
true,
false,CCAs...>&
3432 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3433 Right right( ~rhs );
3435 if( !tryDivAssign( matrix_, right, 0UL,
column() ) ) {
3439 decltype(
auto) left( derestrict( *this ) );
3441 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3442 const ResultType_<VT> tmp( right );
3470 template<
typename MT
3472 template<
typename VT >
3473 inline Column<MT,
false,
true,
false,CCAs...>&
3474 Column<MT,false,true,false,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
3476 using blaze::assign;
3481 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
3487 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3491 const CrossType right( *
this % (~rhs) );
3493 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
3497 decltype(
auto) left( derestrict( *this ) );
3499 assign( left, right );
3523 template< typename MT
3525 inline MT& Column<MT,false,true,false,CCAs...>::operand() noexcept
3539 template<
typename MT
3541 inline const MT& Column<MT,false,true,false,CCAs...>::operand() const noexcept
3555 template<
typename MT
3559 return matrix_.rows();
3574 template<
typename MT
3578 return matrix_.spacing();
3590 template<
typename MT
3594 return matrix_.rows();
3609 template<
typename MT
3614 size_t nonzeros( 0UL );
3616 for(
size_t i=0UL; i<
rows; ++i )
3632 template<
typename MT
3638 const size_t ibegin( ( IsLower<MT>::value )
3639 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3643 const size_t iend ( ( IsUpper<MT>::value )
3644 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3649 for(
size_t i=ibegin; i<iend; ++i )
3677 template<
typename MT
3679 template<
typename Other >
3680 inline Column<MT,
false,
true,
false,CCAs...>&
3681 Column<MT,false,true,false,CCAs...>::scale(
const Other& scalar )
3685 const size_t ibegin( ( IsLower<MT>::value )
3686 ?( ( IsStrictlyLower<MT>::value )
3690 const size_t iend ( ( IsUpper<MT>::value )
3691 ?( ( IsStrictlyUpper<MT>::value )
3696 for(
size_t i=ibegin; i<iend; ++i ) {
3697 matrix_(i,
column()) *= scalar;
3725 template<
typename MT
3727 template<
typename Other >
3728 inline bool Column<MT,false,true,false,CCAs...>::canAlias(
const Other* alias )
const noexcept
3730 return matrix_.isAliased( alias );
3747 template<
typename MT
3749 template<
typename MT2
3754 Column<MT,false,true,false,CCAs...>::canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
3756 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
3773 template<
typename MT
3775 template<
typename Other >
3776 inline bool Column<MT,false,true,false,CCAs...>::isAliased(
const Other* alias )
const noexcept
3778 return matrix_.isAliased( alias );
3795 template<
typename MT
3797 template<
typename MT2
3802 Column<MT,false,true,false,CCAs...>::isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
3804 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
3820 template<
typename MT
3822 inline bool Column<MT,false,true,false,CCAs...>::isAligned() const noexcept
3841 template<
typename MT
3843 inline bool Column<MT,false,true,false,CCAs...>::canSMPAssign() const noexcept
3845 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3863 template<
typename MT
3865 template<
typename VT >
3866 inline void Column<MT,false,true,false,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
3870 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3871 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3872 matrix_(i ,
column()) = (~rhs)[i ];
3873 matrix_(i+1UL,
column()) = (~rhs)[i+1UL];
3875 if( ipos < (~rhs).size() )
3876 matrix_(ipos,
column()) = (~rhs)[ipos];
3894 template<
typename MT
3896 template<
typename VT >
3897 inline void Column<MT,false,true,false,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
3901 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3902 matrix_(element->index(),
column()) = element->value();
3920 template<
typename MT
3922 template<
typename VT >
3923 inline void Column<MT,false,true,false,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
3927 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3928 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3929 matrix_(i ,
column()) += (~rhs)[i ];
3930 matrix_(i+1UL,
column()) += (~rhs)[i+1UL];
3932 if( ipos < (~rhs).size() )
3933 matrix_(ipos,
column()) += (~rhs)[ipos];
3951 template<
typename MT
3953 template<
typename VT >
3954 inline void Column<MT,false,true,false,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
3958 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3959 matrix_(element->index(),
column()) += element->value();
3977 template<
typename MT
3979 template<
typename VT >
3980 inline void Column<MT,false,true,false,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
3984 const size_t ipos( (~rhs).
size() &
size_t(-2) );
3985 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3986 matrix_(i ,
column()) -= (~rhs)[i ];
3987 matrix_(i+1UL,
column()) -= (~rhs)[i+1UL];
3989 if( ipos < (~rhs).size() )
3990 matrix_(ipos,
column()) -= (~rhs)[ipos];
4008 template<
typename MT
4010 template<
typename VT >
4011 inline void Column<MT,false,true,false,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
4015 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
4016 matrix_(element->index(),
column()) -= element->value();
4034 template<
typename MT
4036 template<
typename VT >
4037 inline void Column<MT,false,true,false,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
4041 const size_t ipos( (~rhs).
size() &
size_t(-2) );
4042 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4043 matrix_(i ,
column()) *= (~rhs)[i ];
4044 matrix_(i+1UL,
column()) *= (~rhs)[i+1UL];
4046 if( ipos < (~rhs).size() )
4047 matrix_(ipos,
column()) *= (~rhs)[ipos];
4065 template<
typename MT
4067 template<
typename VT >
4068 inline void Column<MT,false,true,false,CCAs...>::multAssign(
const SparseVector<VT,false>& rhs )
4076 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
4077 const size_t index( element->index() );
4078 for( ; i<index; ++i )
4080 matrix_(i,
column()) *= element->value();
4084 for( ; i<
size(); ++i ) {
4104 template<
typename MT
4106 template<
typename VT >
4107 inline void Column<MT,false,true,false,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
4111 const size_t ipos( (~rhs).
size() &
size_t(-2) );
4112 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4113 matrix_(i ,
column()) /= (~rhs)[i ];
4114 matrix_(i+1UL,
column()) /= (~rhs)[i+1UL];
4116 if( ipos < (~rhs).size() )
4117 matrix_(ipos,
column()) /= (~rhs)[ipos];
4143 template<
typename MT
4145 class Column<MT,false,true,true,CCAs...>
4146 :
public View< DenseVector< Column<MT,false,true,true,CCAs...>, false > >
4147 ,
private ColumnData<CCAs...>
4151 using DataType = ColumnData<CCAs...>;
4152 using Operand = If_< IsExpression<MT>, MT, MT& >;
4158 using This = Column<MT,
false,
true,
true,CCAs...>;
4160 using BaseType = DenseVector<This,false>;
4161 using ViewedType = MT;
4164 using ElementType = ElementType_<MT>;
4165 using SIMDType = SIMDTrait_<ElementType>;
4170 using ConstReference = ConstReference_<MT>;
4176 using ConstPointer = ConstPointer_<MT>;
4179 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
4182 using ConstIterator = ConstIterator_<MT>;
4190 enum :
bool { simdEnabled = MT::simdEnabled };
4193 enum :
bool { smpAssignable = MT::smpAssignable };
4199 template<
typename... RCAs >
4200 explicit inline Column( MT& matrix, RCAs... args );
4212 inline Reference operator[](
size_t index );
4213 inline ConstReference operator[](
size_t index )
const;
4215 inline ConstReference at(
size_t index )
const;
4216 inline Pointer
data () noexcept;
4217 inline ConstPointer
data () const noexcept;
4219 inline ConstIterator begin () const;
4220 inline ConstIterator
cbegin() const;
4222 inline ConstIterator end () const;
4223 inline ConstIterator
cend () const;
4230 inline Column& operator=( const ElementType& rhs );
4231 inline Column& operator=( initializer_list<ElementType> list );
4232 inline Column& operator=( const Column& rhs );
4234 template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
4235 template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
4236 template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
4237 template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
4238 template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
4239 template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
4246 using DataType::column;
4248 inline MT& operand() noexcept;
4249 inline const MT& operand() const noexcept;
4251 inline
size_t size() const noexcept;
4252 inline
size_t spacing() const noexcept;
4253 inline
size_t capacity() const noexcept;
4255 inline
void reset();
4262 template< typename Other > inline Column& scale( const Other& scalar );
4269 template< typename VT >
4270 struct VectorizedAssign {
4271 enum :
bool { value = useOptimizedKernels &&
4272 simdEnabled && VT::simdEnabled &&
4273 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
4279 template<
typename VT >
4280 struct VectorizedAddAssign {
4281 enum :
bool { value = useOptimizedKernels &&
4282 simdEnabled && VT::simdEnabled &&
4283 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4284 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
4290 template<
typename VT >
4291 struct VectorizedSubAssign {
4292 enum :
bool { value = useOptimizedKernels &&
4293 simdEnabled && VT::simdEnabled &&
4294 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4295 HasSIMDSub< ElementType, ElementType_<VT> >::value };
4301 template<
typename VT >
4302 struct VectorizedMultAssign {
4303 enum :
bool { value = useOptimizedKernels &&
4304 simdEnabled && VT::simdEnabled &&
4305 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4306 HasSIMDMult< ElementType, ElementType_<VT> >::value };
4312 template<
typename VT >
4313 struct VectorizedDivAssign {
4314 enum :
bool { value = useOptimizedKernels &&
4315 simdEnabled && VT::simdEnabled &&
4316 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4317 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
4330 template<
typename Other >
4331 inline bool canAlias(
const Other* alias )
const noexcept;
4333 template<
typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
4334 inline bool canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept;
4336 template<
typename Other >
4337 inline bool isAliased(
const Other* alias )
const noexcept;
4339 template<
typename MT2,
bool SO2,
bool SF2,
size_t... CCAs2 >
4340 inline bool isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept;
4342 inline bool isAligned () const noexcept;
4343 inline
bool canSMPAssign() const noexcept;
4354 template< typename VT >
4355 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
4357 template< typename VT >
4358 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,false>& rhs );
4360 template< typename VT > inline
void assign( const SparseVector<VT,false>& rhs );
4362 template< typename VT >
4363 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
4365 template< typename VT >
4366 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,false>& rhs );
4368 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4370 template< typename VT >
4371 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
4373 template< typename VT >
4374 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,false>& rhs );
4376 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4378 template< typename VT >
4379 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
4381 template< typename VT >
4382 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,false>& rhs );
4384 template< typename VT > inline
void multAssign( const SparseVector<VT,false>& rhs );
4386 template< typename VT >
4387 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
4389 template< typename VT >
4390 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,false>& rhs );
4403 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 > friend class Column;
4442 template< typename MT
4444 template< typename... RCAs >
4445 inline Column<MT,false,true,true,CCAs...>::Column( MT& matrix, RCAs... args )
4446 : DataType( args... )
4447 , matrix_ ( matrix )
4449 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
4450 if( matrix_.columns() <=
column() ) {
4480 template<
typename MT
4482 inline typename Column<MT,
false,
true,
true,CCAs...>
::Reference 4483 Column<MT,false,true,true,CCAs...>::operator[](
size_t index )
4486 return matrix_(
column(),index);
4502 template<
typename MT
4505 Column<MT,false,true,true,CCAs...>::operator[](
size_t index )
const 4508 return const_cast<const MT&
>( matrix_ )(
column(),index);
4525 template<
typename MT
4527 inline typename Column<MT,
false,
true,
true,CCAs...>
::Reference 4528 Column<MT,false,true,true,CCAs...>::at(
size_t index )
4530 if( index >=
size() ) {
4533 return (*
this)[index];
4550 template<
typename MT
4553 Column<MT,false,true,true,CCAs...>::at(
size_t index )
const 4555 if( index >=
size() ) {
4558 return (*
this)[index];
4573 template<
typename MT
4575 inline typename Column<MT,
false,
true,
true,CCAs...>::Pointer
4578 return matrix_.data(
column() );
4593 template<
typename MT
4595 inline typename Column<MT,
false,
true,
true,CCAs...>::ConstPointer
4598 return matrix_.data(
column() );
4612 template<
typename MT
4614 inline typename Column<MT,
false,
true,
true,CCAs...>
::Iterator 4617 return matrix_.begin(
column() );
4631 template<
typename MT
4636 return matrix_.cbegin(
column() );
4650 template<
typename MT
4655 return matrix_.cbegin(
column() );
4669 template<
typename MT
4671 inline typename Column<MT,
false,
true,
true,CCAs...>
::Iterator 4674 return matrix_.end(
column() );
4688 template<
typename MT
4693 return matrix_.cend(
column() );
4707 template<
typename MT
4712 return matrix_.cend(
column() );
4733 template<
typename MT
4735 inline Column<MT,
false,
true,
true,CCAs...>&
4736 Column<MT,false,true,true,CCAs...>::operator=(
const ElementType& rhs )
4738 decltype(
auto) left( derestrict( matrix_ ) );
4740 const
size_t jbegin( ( IsUpper<MT>::value )
4741 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4745 const
size_t jend ( ( IsLower<MT>::value )
4746 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4751 for(
size_t j=jbegin; j<jend; ++j ) {
4752 if( !IsRestricted<MT>::value || IsTriangular<MT>::value || trySet( matrix_,
column(), j, rhs ) )
4777 template<
typename MT
4779 inline Column<MT,
false,
true,
true,CCAs...>&
4780 Column<MT,false,true,true,CCAs...>::operator=( initializer_list<ElementType> list )
4782 if( list.size() >
size() ) {
4786 if( IsRestricted<MT>::value ) {
4787 const InitializerVector<ElementType,false> tmp( list,
size() );
4788 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4793 decltype(
auto) left( derestrict( *this ) );
4795 std::fill(
std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
4819 template< typename MT
4821 inline Column<MT,false,true,true,CCAs...>&
4822 Column<MT,false,true,true,CCAs...>::operator=( const Column& rhs )
4824 if( &rhs ==
this )
return *
this;
4826 if(
size() != rhs.size() ) {
4830 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
4834 decltype(
auto) left( derestrict( *this ) );
4836 if( IsExpression<MT>::value && rhs.canAlias( &matrix_ ) ) {
4866 template<
typename MT
4868 template<
typename VT >
4869 inline Column<MT,
false,
true,
true,CCAs...>&
4870 Column<MT,false,true,true,CCAs...>::operator=(
const Vector<VT,false>& rhs )
4879 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4880 Right right( ~rhs );
4882 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4886 decltype(
auto) left( derestrict( *this ) );
4888 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4889 const ResultType_<VT> tmp( right );
4893 if( IsSparseVector<VT>::value )
4920 template<
typename MT
4922 template<
typename VT >
4923 inline Column<MT,
false,
true,
true,CCAs...>&
4933 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4934 Right right( ~rhs );
4936 if( !tryAddAssign( matrix_, right, 0UL,
column() ) ) {
4940 decltype(
auto) left( derestrict( *this ) );
4942 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4943 const ResultType_<VT> tmp( right );
4972 template<
typename MT
4974 template<
typename VT >
4975 inline Column<MT,
false,
true,
true,CCAs...>&
4985 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4986 Right right( ~rhs );
4988 if( !trySubAssign( matrix_, right, 0UL,
column() ) ) {
4992 decltype(
auto) left( derestrict( *this ) );
4994 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4995 const ResultType_<VT> tmp( right );
5023 template<
typename MT
5025 template<
typename VT >
5026 inline Column<MT,
false,
true,
true,CCAs...>&
5036 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
5037 Right right( ~rhs );
5039 if( !tryMultAssign( matrix_, right, 0UL,
column() ) ) {
5043 decltype(
auto) left( derestrict( *this ) );
5045 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
5046 const ResultType_<VT> tmp( right );
5073 template<
typename MT
5075 template<
typename VT >
5076 inline Column<MT,
false,
true,
true,CCAs...>&
5086 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
5087 Right right( ~rhs );
5089 if( !tryDivAssign( matrix_, right, 0UL,
column() ) ) {
5093 decltype(
auto) left( derestrict( *this ) );
5095 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
5096 const ResultType_<VT> tmp( right );
5124 template<
typename MT
5126 template<
typename VT >
5127 inline Column<MT,
false,
true,
true,CCAs...>&
5128 Column<MT,false,true,true,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
5130 using blaze::assign;
5135 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
5141 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5145 const CrossType right( *
this % (~rhs) );
5147 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
5151 decltype(
auto) left( derestrict( *this ) );
5153 assign( left, right );
5177 template< typename MT
5179 inline MT& Column<MT,false,true,true,CCAs...>::operand() noexcept
5193 template<
typename MT
5195 inline const MT& Column<MT,false,true,true,CCAs...>::operand() const noexcept
5209 template<
typename MT
5213 return matrix_.rows();
5228 template<
typename MT
5232 return matrix_.spacing();
5244 template<
typename MT
5248 return matrix_.capacity(
column() );
5263 template<
typename MT
5267 return matrix_.nonZeros(
column() );
5279 template<
typename MT
5283 matrix_.reset(
column() );
5310 template<
typename MT
5312 template<
typename Other >
5313 inline Column<MT,
false,
true,
true,CCAs...>&
5314 Column<MT,false,true,true,CCAs...>::scale(
const Other& scalar )
5318 const size_t jbegin( ( IsUpper<MT>::value )
5319 ?( ( IsStrictlyUpper<MT>::value )
5323 const size_t jend ( ( IsLower<MT>::value )
5324 ?( ( IsStrictlyLower<MT>::value )
5329 for(
size_t j=jbegin; j<jend; ++j ) {
5330 matrix_(
column(),j) *= scalar;
5358 template<
typename MT
5360 template<
typename Other >
5361 inline bool Column<MT,false,true,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
5363 return matrix_.isAliased( alias );
5380 template<
typename MT
5382 template<
typename MT2
5387 Column<MT,false,true,true,CCAs...>::canAlias(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
5389 return matrix_.isAliased( alias->matrix_ ) && (
column() == alias->column() );
5406 template<
typename MT
5408 template<
typename Other >
5409 inline bool Column<MT,false,true,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
5411 return matrix_.isAliased( alias );
5428 template<
typename MT
5430 template<
typename MT2
5435 Column<MT,false,true,true,CCAs...>::isAliased(
const Column<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
5437 return matrix_.isAliased( &alias->matrix_ ) && (
column() == alias->column() );
5453 template<
typename MT
5455 inline bool Column<MT,false,true,true,CCAs...>::isAligned() const noexcept
5457 return matrix_.isAligned();
5474 template<
typename MT
5476 inline bool Column<MT,false,true,true,CCAs...>::canSMPAssign() const noexcept
5478 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5496 template<
typename MT
5499 Column<MT,false,true,true,CCAs...>::load(
size_t index )
const noexcept
5501 return matrix_.load(
column(), index );
5520 template<
typename MT
5525 return matrix_.loada(
column(), index );
5544 template<
typename MT
5549 return matrix_.loadu(
column(), index );
5568 template<
typename MT
5571 Column<MT,false,true,true,CCAs...>::store(
size_t index,
const SIMDType& value ) noexcept
5573 matrix_.store(
column(), index, value );
5593 template<
typename MT
5598 matrix_.storea(
column(), index, value );
5618 template<
typename MT
5623 matrix_.storeu(
column(), index, value );
5643 template<
typename MT
5648 matrix_.stream(
column(), index, value );
5666 template<
typename MT
5668 template<
typename VT >
5669 inline DisableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5670 Column<MT,false,true,true,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
5674 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5675 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5676 matrix_(
column(),j ) = (~rhs)[j ];
5677 matrix_(
column(),j+1UL) = (~rhs)[j+1UL];
5679 if( jpos < (~rhs).size() )
5680 matrix_(
column(),jpos) = (~rhs)[jpos];
5698 template<
typename MT
5700 template<
typename VT >
5701 inline EnableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5702 Column<MT,false,true,true,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
5708 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5712 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5717 ConstIterator_<VT> right( (~rhs).
begin() );
5719 if( useStreaming &&
columns > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased(
this ) )
5721 for( ; j<jpos; j+=SIMDSIZE ) {
5722 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5724 for( ; remainder && j<
columns; ++j ) {
5725 *left = *right; ++left; ++right;
5730 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5731 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5732 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5733 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5734 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5736 for( ; j<jpos; j+=SIMDSIZE ) {
5737 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5739 for( ; remainder && j<
columns; ++j ) {
5740 *left = *right; ++left; ++right;
5760 template<
typename MT
5762 template<
typename VT >
5763 inline void Column<MT,false,true,true,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
5767 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5768 matrix_(
column(),element->index()) = element->value();
5786 template<
typename MT
5788 template<
typename VT >
5789 inline DisableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5790 Column<MT,false,true,true,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
5794 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5795 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5796 matrix_(
column(),j ) += (~rhs)[j ];
5797 matrix_(
column(),j+1UL) += (~rhs)[j+1UL];
5799 if( jpos < (~rhs).size() )
5800 matrix_(
column(),jpos) += (~rhs)[jpos];
5818 template<
typename MT
5820 template<
typename VT >
5821 inline EnableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5822 Column<MT,false,true,true,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
5828 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5832 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5837 ConstIterator_<VT> right( (~rhs).
begin() );
5839 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5840 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5841 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5842 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5843 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5845 for( ; j<jpos; j+=SIMDSIZE ) {
5846 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5848 for( ; remainder && j<
columns; ++j ) {
5849 *left += *right; ++left; ++right;
5868 template<
typename MT
5870 template<
typename VT >
5871 inline void Column<MT,false,true,true,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
5875 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5876 matrix_(
column(),element->index()) += element->value();
5894 template<
typename MT
5896 template<
typename VT >
5897 inline DisableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5898 Column<MT,false,true,true,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
5902 const size_t jpos( (~rhs).
size() &
size_t(-2) );
5903 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5904 matrix_(
column(),j ) -= (~rhs)[j ];
5905 matrix_(
column(),j+1UL) -= (~rhs)[j+1UL];
5907 if( jpos < (~rhs).size() )
5908 matrix_(
column(),jpos) -= (~rhs)[jpos];
5926 template<
typename MT
5928 template<
typename VT >
5929 inline EnableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5930 Column<MT,false,true,true,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
5936 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5940 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
5945 ConstIterator_<VT> right( (~rhs).
begin() );
5947 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
5948 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5949 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5950 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5951 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5953 for( ; j<jpos; j+=SIMDSIZE ) {
5954 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5956 for( ; remainder && j<
columns; ++j ) {
5957 *left -= *right; ++left; ++right;
5976 template<
typename MT
5978 template<
typename VT >
5979 inline void Column<MT,false,true,true,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
5983 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5984 matrix_(
column(),element->index()) -= element->value();
6002 template<
typename MT
6004 template<
typename VT >
6005 inline DisableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
6006 Column<MT,false,true,true,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
6010 const size_t jpos( (~rhs).
size() &
size_t(-2) );
6011 for(
size_t j=0UL; j<jpos; j+=2UL ) {
6012 matrix_(
column(),j ) *= (~rhs)[j ];
6013 matrix_(
column(),j+1UL) *= (~rhs)[j+1UL];
6015 if( jpos < (~rhs).size() )
6016 matrix_(
column(),jpos) *= (~rhs)[jpos];
6034 template<
typename MT
6036 template<
typename VT >
6037 inline EnableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
6038 Column<MT,false,true,true,CCAs...>::multAssign(
const DenseVector<VT,false>& rhs )
6044 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
6048 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
6053 ConstIterator_<VT> right( (~rhs).
begin() );
6055 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
6056 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6057 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6058 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6059 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6061 for( ; j<jpos; j+=SIMDSIZE ) {
6062 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6064 for( ; remainder && j<
columns; ++j ) {
6065 *left *= *right; ++left; ++right;
6084 template<
typename MT
6086 template<
typename VT >
6087 inline void Column<MT,false,true,true,CCAs...>::multAssign(
const SparseVector<VT,false>& rhs )
6095 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
6096 const size_t index( element->index() );
6097 for( ; j<index; ++j )
6099 matrix_(
column(),j) *= element->value();
6103 for( ; j<
size(); ++j ) {
6123 template<
typename MT
6125 template<
typename VT >
6126 inline DisableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6127 Column<MT,false,true,true,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
6131 const size_t jpos( (~rhs).
size() &
size_t(-2) );
6132 for(
size_t j=0UL; j<jpos; j+=2UL ) {
6133 matrix_(
column(),j ) /= (~rhs)[j ];
6134 matrix_(
column(),j+1UL) /= (~rhs)[j+1UL];
6136 if( jpos < (~rhs).size() )
6137 matrix_(
column(),jpos) /= (~rhs)[jpos];
6155 template<
typename MT
6157 template<
typename VT >
6158 inline EnableIf_<
typename Column<MT,
false,
true,
true,CCAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6159 Column<MT,false,true,true,CCAs...>::divAssign(
const DenseVector<VT,false>& rhs )
6167 const size_t jpos(
columns &
size_t(-SIMDSIZE) );
6172 ConstIterator_<VT> right( (~rhs).
begin() );
6174 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
6175 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6176 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6177 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6178 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6180 for( ; j<jpos; j+=SIMDSIZE ) {
6181 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6184 *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.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Header file for the blaze::checked and blaze::unchecked instances.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
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:522
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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
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:588
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:701
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
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:3078
Header file for the DenseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#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:3083
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
#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:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
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
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
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:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
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:252
Constraint on the transpose flag of vector types.
Constraint on the data type.
typename ColumnTrait< MT, CCAs... >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:144
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:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#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.
Header file for the implementation of a vector representation of an initializer list.
#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:3075
#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:3079
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:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
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:506
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.
Header file for the IsTriangular type trait.
#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:430
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
Header file for the IsPadded type trait.
Constraint on the data type.
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.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
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.
Header file for the HasMutableDataAccess type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Header file for the IsReference type trait.
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:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
Header file for the HasSIMDDiv type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
Header file for the implementation of the ColumnData class template.
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsRestricted type trait.
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.
Constraint on the data type.