35 #ifndef _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
36 #define _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
309 template<
typename MT
310 ,
bool SO = IsColumnMajorMatrix<MT>::value >
365 enum { vectorizable = MT::vectorizable };
368 enum { smpAssignable = MT::smpAssignable };
374 explicit inline DenseColumn( MT& matrix,
size_t index );
405 template<
typename VT >
inline DenseColumn& operator+=(
const Vector<VT,false>& rhs );
406 template<
typename VT >
inline DenseColumn& operator-=(
const Vector<VT,false>& rhs );
407 template<
typename VT >
inline DenseColumn& operator*=(
const Vector<VT,false>& rhs );
409 template<
typename Other >
410 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
411 operator*=( Other rhs );
413 template<
typename Other >
414 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
415 operator/=( Other rhs );
422 inline size_t size()
const;
426 template<
typename Other >
inline DenseColumn& scale(
const Other& scalar );
433 template<
typename VT >
435 struct VectorizedAssign {
436 enum { value = vectorizable && VT::vectorizable &&
437 IsSame<ElementType,typename VT::ElementType>::value };
444 template<
typename VT >
446 struct VectorizedAddAssign {
447 enum { value = vectorizable && VT::vectorizable &&
448 IsSame<ElementType,typename VT::ElementType>::value &&
449 IntrinsicTrait<ElementType>::addition };
456 template<
typename VT >
458 struct VectorizedSubAssign {
459 enum { value = vectorizable && VT::vectorizable &&
460 IsSame<ElementType,typename VT::ElementType>::value &&
461 IntrinsicTrait<ElementType>::subtraction };
468 template<
typename VT >
470 struct VectorizedMultAssign {
471 enum { value = vectorizable && VT::vectorizable &&
472 IsSame<ElementType,typename VT::ElementType>::value &&
473 IntrinsicTrait<ElementType>::multiplication };
482 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
483 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
494 template<
typename VT >
495 inline typename DisableIf< VectorizedAssign<VT> >::Type
496 assign(
const DenseVector<VT,false>& rhs );
498 template<
typename VT >
499 inline typename EnableIf< VectorizedAssign<VT> >::Type
500 assign(
const DenseVector<VT,false>& rhs );
502 template<
typename VT >
inline void assign(
const SparseVector<VT,false>& rhs );
504 template<
typename VT >
505 inline typename DisableIf< VectorizedAddAssign<VT> >::Type
506 addAssign(
const DenseVector<VT,false>& rhs );
508 template<
typename VT >
509 inline typename EnableIf< VectorizedAddAssign<VT> >::Type
510 addAssign(
const DenseVector<VT,false>& rhs );
512 template<
typename VT >
inline void addAssign(
const SparseVector<VT,false>& rhs );
514 template<
typename VT >
515 inline typename DisableIf< VectorizedSubAssign<VT> >::Type
516 subAssign(
const DenseVector<VT,false>& rhs );
518 template<
typename VT >
519 inline typename EnableIf< VectorizedSubAssign<VT> >::Type
520 subAssign(
const DenseVector<VT,false>& rhs );
522 template<
typename VT >
inline void subAssign(
const SparseVector<VT,false>& rhs );
524 template<
typename VT >
525 inline typename DisableIf< VectorizedMultAssign<VT> >::Type
526 multAssign(
const DenseVector<VT,false>& rhs );
528 template<
typename VT >
529 inline typename EnableIf< VectorizedMultAssign<VT> >::Type
530 multAssign(
const DenseVector<VT,false>& rhs );
532 template<
typename VT >
inline void multAssign(
const SparseVector<VT,false>& rhs );
572 template<
typename MT
578 if(
matrix_.columns() <= index )
579 throw std::invalid_argument(
"Invalid column access index" );
598 template<
typename MT
603 return matrix_(index,col_);
614 template<
typename MT
619 return matrix_(index,col_);
631 template<
typename MT
635 return matrix_.data( col_ );
647 template<
typename MT
651 return matrix_.data( col_ );
663 template<
typename MT
667 return matrix_.begin( col_ );
679 template<
typename MT
683 return matrix_.cbegin( col_ );
695 template<
typename MT
699 return matrix_.cbegin( col_ );
711 template<
typename MT
715 return matrix_.end( col_ );
727 template<
typename MT
731 return matrix_.cend( col_ );
743 template<
typename MT
747 return matrix_.cend( col_ );
766 template<
typename MT
770 const size_t rows( size() );
772 for(
size_t i=0UL; i<
rows; ++i )
773 matrix_(i,col_) = rhs;
790 template<
typename MT
794 if( &rhs ==
this )
return *
this;
796 if( size() != rhs.
size() )
797 throw std::invalid_argument(
"Column sizes do not match" );
799 const size_t rows( size() );
801 for(
size_t i=0UL; i<
rows; ++i )
802 matrix_(i,col_) = rhs[i];
819 template<
typename MT
821 template<
typename VT >
827 if( size() != (~rhs).size() )
828 throw std::invalid_argument(
"Vector sizes do not match" );
830 if( (~rhs).canAlias( &matrix_ ) ) {
855 template<
typename MT
857 template<
typename VT >
863 if( size() != (~rhs).size() )
864 throw std::invalid_argument(
"Vector sizes do not match" );
866 if( (~rhs).canAlias( &matrix_ ) ) {
889 template<
typename MT
891 template<
typename VT >
897 if( size() != (~rhs).size() )
898 throw std::invalid_argument(
"Vector sizes do not match" );
900 if( (~rhs).canAlias( &matrix_ ) ) {
924 template<
typename MT
926 template<
typename VT >
932 if( size() != (~rhs).size() )
933 throw std::invalid_argument(
"Vector sizes do not match" );
955 template<
typename MT
957 template<
typename Other >
961 return operator=( (*
this) * rhs );
975 template<
typename MT
977 template<
typename Other >
983 return operator=( (*
this) / rhs );
1001 template<
typename MT
1005 return matrix_.rows();
1015 template<
typename MT
1019 return matrix_.capacity( col_ );
1032 template<
typename MT
1036 return matrix_.nonZeros( col_ );
1046 template<
typename MT
1050 matrix_.reset( col_ );
1061 template<
typename MT
1063 template<
typename Other >
1066 for(
size_t j=0UL; j<size(); ++j ) {
1067 matrix_(j,col_) *= scalar;
1092 template<
typename MT
1094 template<
typename Other >
1097 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1112 template<
typename MT
1114 template<
typename Other >
1117 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1131 template<
typename MT
1135 return matrix_.isAligned();
1150 template<
typename MT
1171 template<
typename MT
1175 return matrix_.load( index, col_ );
1192 template<
typename MT
1196 return matrix_.loadu( index, col_ );
1214 template<
typename MT
1218 matrix_.store( index, col_, value );
1236 template<
typename MT
1240 matrix_.storeu( index, col_, value );
1258 template<
typename MT
1262 matrix_.stream( index, col_, value );
1278 template<
typename MT
1280 template<
typename VT >
1286 const size_t iend( (~rhs).size() &
size_t(-2) );
1287 for(
size_t i=0UL; i<iend; i+=2UL ) {
1288 matrix_(i ,col_) = (~rhs)[i ];
1289 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1291 if( iend < (~rhs).size() )
1292 matrix_(iend,col_) = (~rhs)[iend];
1308 template<
typename MT
1310 template<
typename VT >
1318 const size_t rows( size() );
1322 for(
size_t i=0UL; i<
rows; i+=IT::size ) {
1323 matrix_.stream( i, col_, (~rhs).
load(i) );
1328 const size_t iend( rows &
size_t(-IT::size*4) );
1332 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1333 matrix_.store( i , col_, it.load() ); it+=IT::size;
1334 matrix_.store( i+IT::size , col_, it.load() ); it+=IT::size;
1335 matrix_.store( i+IT::size*2UL, col_, it.load() ); it+=IT::size;
1336 matrix_.store( i+IT::size*3UL, col_, it.load() ); it+=IT::size;
1338 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1339 matrix_.store( i, col_, it.load() );
1357 template<
typename MT
1359 template<
typename VT >
1364 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1365 matrix_(element->index(),col_) = element->value();
1381 template<
typename MT
1383 template<
typename VT >
1389 const size_t iend( (~rhs).size() &
size_t(-2) );
1390 for(
size_t i=0UL; i<iend; i+=2UL ) {
1391 matrix_(i ,col_) += (~rhs)[i ];
1392 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1394 if( iend < (~rhs).size() )
1395 matrix_(iend,col_) += (~rhs)[iend];
1411 template<
typename MT
1413 template<
typename VT >
1421 const size_t rows( size() );
1423 const size_t iend( rows &
size_t(-IT::size*4) );
1427 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1428 matrix_.store( i , col_, matrix_.load(i ,col_) + it.load() ); it += IT::size;
1429 matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) + it.load() ); it += IT::size;
1430 matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) + it.load() ); it += IT::size;
1431 matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) + it.load() ); it += IT::size;
1433 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1434 matrix_.store( i, col_, matrix_.load(i,col_) + it.load() );
1451 template<
typename MT
1453 template<
typename VT >
1458 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1459 matrix_(element->index(),col_) += element->value();
1475 template<
typename MT
1477 template<
typename VT >
1483 const size_t iend( (~rhs).size() &
size_t(-2) );
1484 for(
size_t i=0UL; i<iend; i+=2UL ) {
1485 matrix_(i ,col_) -= (~rhs)[i ];
1486 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1488 if( iend < (~rhs).size() )
1489 matrix_(iend,col_) -= (~rhs)[iend];
1505 template<
typename MT
1507 template<
typename VT >
1515 const size_t rows( size() );
1517 const size_t iend( rows &
size_t(-IT::size*4) );
1521 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1522 matrix_.store( i , col_, matrix_.load(i ,col_) - it.load() ); it += IT::size;
1523 matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) - it.load() ); it += IT::size;
1524 matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) - it.load() ); it += IT::size;
1525 matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) - it.load() ); it += IT::size;
1527 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1528 matrix_.store( i, col_, matrix_.load(i,col_) - it.load() );
1545 template<
typename MT
1547 template<
typename VT >
1552 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1553 matrix_(element->index(),col_) -= element->value();
1569 template<
typename MT
1571 template<
typename VT >
1577 const size_t iend( (~rhs).size() &
size_t(-2) );
1578 for(
size_t i=0UL; i<iend; i+=2UL ) {
1579 matrix_(i ,col_) *= (~rhs)[i ];
1580 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
1582 if( iend < (~rhs).size() )
1583 matrix_(iend,col_) *= (~rhs)[iend];
1599 template<
typename MT
1601 template<
typename VT >
1609 const size_t rows( size() );
1611 const size_t iend( rows &
size_t(-IT::size*4) );
1615 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1616 matrix_.store( i , col_, matrix_.load(i ,col_) * it.load() ); it += IT::size;
1617 matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) * it.load() ); it += IT::size;
1618 matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) * it.load() ); it += IT::size;
1619 matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) * it.load() ); it += IT::size;
1621 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1622 matrix_.store( i, col_, matrix_.load(i,col_) * it.load() );
1639 template<
typename MT
1641 template<
typename VT >
1650 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1651 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
1676 template<
typename MT >
1699 typedef DenseColumn<MT,false>
This;
1700 typedef typename ColumnTrait<MT>::Type
ResultType;
1710 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1716 template<
typename MatrixType >
1717 class ColumnIterator
1727 enum { returnConst = IsConst<MatrixType>::value };
1733 typedef typename SelectType< returnConst, typename MT::ConstReference, typename MT::Reference >::Type
Reference;
1735 typedef std::random_access_iterator_tag IteratorCategory;
1736 typedef RemoveReference<Reference> ValueType;
1737 typedef ValueType* PointerType;
1739 typedef ptrdiff_t DifferenceType;
1742 typedef IteratorCategory iterator_category;
1743 typedef ValueType value_type;
1744 typedef PointerType pointer;
1745 typedef ReferenceType reference;
1746 typedef DifferenceType difference_type;
1756 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
1768 template<
typename MatrixType2 >
1769 inline ColumnIterator(
const ColumnIterator<MatrixType2>& it )
1772 , column_( it.column_ )
1782 inline ColumnIterator& operator+=(
size_t inc ) {
1794 inline ColumnIterator& operator-=(
size_t dec ) {
1805 inline ColumnIterator& operator++() {
1816 inline const ColumnIterator operator++(
int ) {
1817 const ColumnIterator tmp( *
this );
1828 inline ColumnIterator& operator--() {
1839 inline const ColumnIterator operator--(
int ) {
1840 const ColumnIterator tmp( *
this );
1852 inline ReferenceType
operator[](
size_t index )
const {
1853 return (*
matrix_)(row_+index,column_);
1862 inline ReferenceType
operator*()
const {
1863 return (*
matrix_)(row_,column_);
1872 inline PointerType operator->()
const {
1873 return &(*matrix_)(row_,column_);
1883 template<
typename MatrixType2 >
1884 inline bool operator==(
const ColumnIterator<MatrixType2>& rhs )
const {
1885 return (
matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1895 template<
typename MatrixType2 >
1896 inline bool operator!=(
const ColumnIterator<MatrixType2>& rhs )
const {
1897 return !( *
this == rhs );
1907 template<
typename MatrixType2 >
1908 inline bool operator<( const ColumnIterator<MatrixType2>& rhs )
const {
1909 return (
matrix_ == rhs.matrix_ ) && ( row_ < rhs.row_ ) && ( column_ == rhs.column_ );
1919 template<
typename MatrixType2 >
1920 inline bool operator>(
const ColumnIterator<MatrixType2>& rhs )
const {
1921 return (
matrix_ == rhs.matrix_ ) && ( row_ > rhs.row_ ) && ( column_ == rhs.column_ );
1931 template<
typename MatrixType2 >
1932 inline bool operator<=( const ColumnIterator<MatrixType2>& rhs )
const {
1933 return (
matrix_ == rhs.matrix_ ) && ( row_ <= rhs.row_ ) && ( column_ == rhs.column_ );
1943 template<
typename MatrixType2 >
1944 inline bool operator>=(
const ColumnIterator<MatrixType2>& rhs )
const {
1945 return (
matrix_ == rhs.matrix_ ) && ( row_ >= rhs.row_ ) && ( column_ == rhs.column_ );
1955 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
1956 return row_ - rhs.row_;
1967 friend inline const ColumnIterator
operator+(
const ColumnIterator& it,
size_t inc ) {
1968 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
1979 friend inline const ColumnIterator
operator+(
size_t inc,
const ColumnIterator& it ) {
1980 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
1991 friend inline const ColumnIterator
operator-(
const ColumnIterator& it,
size_t dec ) {
1992 return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2004 template<
typename MatrixType2 >
friend class ColumnIterator;
2014 typedef typename SelectType< useConst, ConstIterator, ColumnIterator<MT> >::Type
Iterator;
2019 enum { vectorizable = 0 };
2022 enum { smpAssignable = MT::smpAssignable };
2028 explicit inline DenseColumn( MT& matrix,
size_t index );
2057 template<
typename VT >
inline DenseColumn& operator+=(
const Vector<VT,false>& rhs );
2058 template<
typename VT >
inline DenseColumn& operator-=(
const Vector<VT,false>& rhs );
2059 template<
typename VT >
inline DenseColumn& operator*=(
const Vector<VT,false>& rhs );
2061 template<
typename Other >
2062 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
2063 operator*=( Other rhs );
2065 template<
typename Other >
2066 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
2067 operator/=( Other rhs );
2074 inline size_t size()
const;
2077 inline void reset();
2078 template<
typename Other >
inline DenseColumn& scale(
const Other& scalar );
2086 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2087 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2092 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
2093 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
2094 template<
typename VT >
inline void addAssign (
const DenseVector <VT,false>& rhs );
2095 template<
typename VT >
inline void addAssign (
const SparseVector<VT,false>& rhs );
2096 template<
typename VT >
inline void subAssign (
const DenseVector <VT,false>& rhs );
2097 template<
typename VT >
inline void subAssign (
const SparseVector<VT,false>& rhs );
2098 template<
typename VT >
inline void multAssign(
const DenseVector <VT,false>& rhs );
2099 template<
typename VT >
inline void multAssign(
const SparseVector<VT,false>& rhs );
2139 template<
typename MT >
2144 if(
matrix_.columns() <= index )
2145 throw std::invalid_argument(
"Invalid column access index" );
2166 template<
typename MT >
2170 return matrix_(index,col_);
2183 template<
typename MT >
2187 return matrix_(index,col_);
2201 template<
typename MT >
2204 return Iterator( matrix_, 0UL, col_ );
2218 template<
typename MT >
2235 template<
typename MT >
2252 template<
typename MT >
2255 return Iterator( matrix_, size(), col_ );
2269 template<
typename MT >
2286 template<
typename MT >
2310 template<
typename MT >
2313 const size_t rows( size() );
2315 for(
size_t i=0UL; i<
rows; ++i )
2316 matrix_(i,col_) = rhs;
2335 template<
typename MT >
2338 if( &rhs ==
this )
return *
this;
2340 if( size() != rhs.size() )
2341 throw std::invalid_argument(
"Column sizes do not match" );
2343 const size_t rows( size() );
2345 for(
size_t i=0UL; i<
rows; ++i )
2346 matrix_(i,col_) = rhs[i];
2365 template<
typename MT >
2366 template<
typename VT >
2373 if( size() != (~rhs).size() )
2374 throw std::invalid_argument(
"Vector sizes do not match" );
2376 if( (~rhs).canAlias( &matrix_ ) ) {
2381 if( IsSparseVector<VT>::value )
2403 template<
typename MT >
2404 template<
typename VT >
2405 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator+=(
const Vector<VT,false>& rhs )
2410 if( size() != (~rhs).size() )
2411 throw std::invalid_argument(
"Vector sizes do not match" );
2413 if( (~rhs).canAlias( &matrix_ ) ) {
2438 template<
typename MT >
2439 template<
typename VT >
2440 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator-=(
const Vector<VT,false>& rhs )
2445 if( size() != (~rhs).size() )
2446 throw std::invalid_argument(
"Vector sizes do not match" );
2448 if( (~rhs).canAlias( &matrix_ ) ) {
2474 template<
typename MT >
2475 template<
typename VT >
2476 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator*=(
const Vector<VT,false>& rhs )
2481 if( size() != (~rhs).size() )
2482 throw std::invalid_argument(
"Vector sizes do not match" );
2484 if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
2506 template<
typename MT >
2507 template<
typename Other >
2508 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2509 DenseColumn<MT,false>::operator*=( Other rhs )
2511 for(
size_t i=0UL; i<size(); ++i )
2512 matrix_(i,col_) *= rhs;
2529 template<
typename MT >
2530 template<
typename Other >
2531 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2532 DenseColumn<MT,false>::operator/=( Other rhs )
2536 typedef typename DivTrait<ElementType,Other>::Type DT;
2537 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2541 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2542 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2543 for(
size_t i=0UL; i<size(); ++i )
2544 matrix_(i,col_) *= tmp;
2547 for(
size_t i=0UL; i<size(); ++i )
2548 matrix_(i,col_) /= rhs;
2571 template<
typename MT >
2574 return matrix_.rows();
2586 template<
typename MT >
2589 return matrix_.rows();
2604 template<
typename MT >
2607 const size_t rows( size() );
2608 size_t nonzeros( 0UL );
2610 for(
size_t i=0UL; i<
rows; ++i )
2626 template<
typename MT >
2630 const size_t rows( size() );
2631 for(
size_t i=0UL; i<
rows; ++i )
2632 reset( matrix_(i,col_) );
2645 template<
typename MT >
2646 template<
typename Other >
2647 inline DenseColumn<MT,false>& DenseColumn<MT,false>::scale(
const Other& scalar )
2649 for(
size_t i=0UL; i<size(); ++i ) {
2650 matrix_(i,col_) *= scalar;
2677 template<
typename MT >
2678 template<
typename Other >
2681 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2698 template<
typename MT >
2699 template<
typename Other >
2702 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2718 template<
typename MT >
2738 template<
typename MT >
2759 template<
typename MT >
2760 template<
typename VT >
2765 const size_t iend( (~rhs).size() &
size_t(-2) );
2766 for(
size_t i=0UL; i<iend; i+=2UL ) {
2767 matrix_(i ,col_) = (~rhs)[i ];
2768 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
2770 if( iend < (~rhs).size() )
2771 matrix_(iend,col_) = (~rhs)[iend];
2789 template<
typename MT >
2790 template<
typename VT >
2795 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2796 matrix_(element->index(),col_) = element->value();
2814 template<
typename MT >
2815 template<
typename VT >
2820 const size_t iend( (~rhs).size() &
size_t(-2) );
2821 for(
size_t i=0UL; i<iend; i+=2UL ) {
2822 matrix_(i ,col_) += (~rhs)[i ];
2823 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
2825 if( iend < (~rhs).size() )
2826 matrix_(iend,col_) += (~rhs)[iend];
2844 template<
typename MT >
2845 template<
typename VT >
2850 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2851 matrix_(element->index(),col_) += element->value();
2869 template<
typename MT >
2870 template<
typename VT >
2875 const size_t iend( (~rhs).size() &
size_t(-2) );
2876 for(
size_t i=0UL; i<iend; i+=2UL ) {
2877 matrix_(i ,col_) -= (~rhs)[i ];
2878 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
2880 if( iend < (~rhs).size() )
2881 matrix_(iend,col_) -= (~rhs)[iend];
2899 template<
typename MT >
2900 template<
typename VT >
2905 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2906 matrix_(element->index(),col_) -= element->value();
2924 template<
typename MT >
2925 template<
typename VT >
2930 const size_t iend( (~rhs).size() &
size_t(-2) );
2931 for(
size_t i=0UL; i<iend; i+=2UL ) {
2932 matrix_(i ,col_) *= (~rhs)[i ];
2933 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
2935 if( iend < (~rhs).size() )
2936 matrix_(iend,col_) *= (~rhs)[iend];
2954 template<
typename MT >
2955 template<
typename VT >
2964 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2965 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
2986 template<
typename MT,
bool SO >
2989 template<
typename MT,
bool SO >
2992 template<
typename MT,
bool SO >
3005 template<
typename MT
3023 template<
typename MT
3050 template<
typename MT
3054 for(
size_t i=0UL; i<column.
size(); ++i )
3055 if( !
isDefault( column[i] ) )
return false;
3071 template<
typename MT,
bool SO >
3072 struct SubvectorTrait< DenseColumn<MT,SO> >
Constraint on the data type.
Constraint on the data type.
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant column value.
Definition: DenseColumn.h:348
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseColumn.h:351
const size_t OPENMP_DVECASSIGN_THRESHOLD
OpenMP dense vector assignment threshold.This threshold specifies when an assignment of a plain dense...
Definition: Thresholds.h:200
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#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
EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:222
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4075
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:151
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:114
size_t size() const
Returns the current size/dimension of the column.
Definition: DenseColumn.h:1003
#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: TransposeFlag.h:159
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:197
#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:118
#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:79
void smpMultAssign(DenseVector< 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:178
Header file for the IsSame and IsStrictlySame type traits.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseColumn.h:338
MT::ElementType ElementType
Type of the column elements.
Definition: DenseColumn.h:339
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
Header file for the IsColumnMajorMatrix type trait.
void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1260
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:103
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
Header file for the DenseVector base class.
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:442
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseColumn.h:341
#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:118
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseColumn.h:357
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4595
Header file for the column base class.
size_t nonZeros() const
Returns the number of non-zero elements in the column.
Definition: DenseColumn.h:1034
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseColumn.h:317
DenseColumn & operator=(const ElementType &rhs)
Homogenous assignment to all column elements.
Definition: DenseColumn.h:768
Constraint on the data type.
void smpAddAssign(DenseMatrix< 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:121
Iterator end()
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:713
void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1216
SelectType< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a constant row value.
Definition: DenseColumn.h:354
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
ConstIterator cbegin() const
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:697
Reference operator[](size_t index)
Subscript operator for the direct access to the column elements.
Definition: DenseColumn.h:600
Header file for the dense vector SMP implementation.
Header file for nested template disabiguation.
Header file for the IsFloatingPoint type trait.
#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: StorageOrder.h:161
DenseColumn(MT &matrix, size_t index)
The constructor for DenseColumn.
Definition: DenseColumn.h:574
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
IT::Type IntrinsicType
Intrinsic type of the column elements.
Definition: DenseColumn.h:340
bool canAlias(const Other *alias) const
Returns whether the dense column can alias with the given address alias.
Definition: DenseColumn.h:1095
const size_t col_
The index of the column in the matrix.
Definition: DenseColumn.h:541
Header file for the Or class template.
IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1173
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: DenseColumn.h:345
Reference to a specific column of a dense matrix.The DenseColumn template represents a reference to a...
Definition: DenseColumn.h:311
Base class for all columns.The Column class serves as a tag for all columns (i.e. dense and sparse co...
Definition: Column.h:64
IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1194
Header file for the subvector trait.
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:179
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Compile time check for sparse vector types.This type trait tests whether or not the given template pa...
Definition: IsSparseVector.h:103
void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1238
Constraint on the data type.
Constraint on the data type.
size_t capacity() const
Returns the maximum capacity of the dense column.
Definition: DenseColumn.h:1017
#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:79
Constraints on the storage order of matrix types.
Constraint on the data type.
ColumnTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseColumn.h:337
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2382
void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:269
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2386
System settings for streaming (non-temporal stores)
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseColumn.h:360
Header file for the EnableIf class template.
Operand matrix_
The dense matrix containing the column.
Definition: DenseColumn.h:540
bool isAligned() const
Returns whether the dense column is properly aligned in memory.
Definition: DenseColumn.h:1133
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:91
Header file for the IsNumeric type trait.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:103
Header file for the IsSparseVector type trait.
#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: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2383
Header file for the IsConst type trait.
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the column element type.
Definition: DenseColumn.h:320
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Header file for run time assertion macros.
bool canSMPAssign() const
Returns whether the dense column can be used in SMP assignments.
Definition: DenseColumn.h:1152
Header file for the division trait.
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:209
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Header file for the reset shim.
Header file for the cache size of the target architecture.
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:239
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2387
DenseColumn< MT, SO > This
Type of this DenseColumn instance.
Definition: DenseColumn.h:336
Header file for the column trait.
Header file for the isDefault shim.
void reset()
Reset to the default initial values.
Definition: DenseColumn.h:1048
Pointer data()
Low-level data access to the column elements.
Definition: DenseColumn.h:633
#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:118
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
Header file for all intrinsic functionality.
#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:79
ConstIterator cend() const
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:745
Header file for the IsRowMajorMatrix type trait.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:147
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:248
Iterator begin()
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:665
Header file for the sparse vector SMP implementation.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2379
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2385
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
bool isAliased(const Other *alias) const
Returns whether the dense column is aliased with the given address alias.
Definition: DenseColumn.h:1115
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:138
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the IsExpression type trait class.
const DenseColumn & CompositeType
Data type for composite expression templates.
Definition: DenseColumn.h:342
Header file for the FunctionTrace class.