35 #ifndef _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
36 #define _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
307 template<
typename MT
308 ,
bool SO = IsColumnMajorMatrix<MT>::value >
363 enum { vectorizable = MT::vectorizable };
366 enum { smpAssignable = MT::smpAssignable };
372 explicit inline DenseColumn( MT& matrix,
size_t index );
403 template<
typename VT >
inline DenseColumn& operator+=(
const Vector<VT,false>& rhs );
404 template<
typename VT >
inline DenseColumn& operator-=(
const Vector<VT,false>& rhs );
405 template<
typename VT >
inline DenseColumn& operator*=(
const Vector<VT,false>& rhs );
407 template<
typename Other >
408 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
409 operator*=( Other rhs );
411 template<
typename Other >
412 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
413 operator/=( Other rhs );
420 inline size_t size()
const;
424 template<
typename Other >
inline DenseColumn& scale(
const Other& scalar );
431 template<
typename VT >
433 struct VectorizedAssign {
434 enum { value = vectorizable && VT::vectorizable &&
435 IsSame<ElementType,typename VT::ElementType>::value };
442 template<
typename VT >
444 struct VectorizedAddAssign {
445 enum { value = vectorizable && VT::vectorizable &&
446 IsSame<ElementType,typename VT::ElementType>::value &&
447 IntrinsicTrait<ElementType>::addition };
454 template<
typename VT >
456 struct VectorizedSubAssign {
457 enum { value = vectorizable && VT::vectorizable &&
458 IsSame<ElementType,typename VT::ElementType>::value &&
459 IntrinsicTrait<ElementType>::subtraction };
466 template<
typename VT >
468 struct VectorizedMultAssign {
469 enum { value = vectorizable && VT::vectorizable &&
470 IsSame<ElementType,typename VT::ElementType>::value &&
471 IntrinsicTrait<ElementType>::multiplication };
480 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
481 template<
typename MT2,
bool SO2 >
inline bool canAlias (
const DenseColumn<MT2,SO2>* alias )
const;
482 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
483 template<
typename MT2,
bool SO2 >
inline bool isAliased(
const DenseColumn<MT2,SO2>* 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 );
547 template<
typename MT2,
bool SO2 >
friend class DenseColumn;
549 template<
typename MT2,
bool SO2 >
581 template<
typename MT
587 if(
matrix_.columns() <= index )
588 throw std::invalid_argument(
"Invalid column access index" );
607 template<
typename MT
612 return matrix_(index,col_);
623 template<
typename MT
628 return matrix_(index,col_);
640 template<
typename MT
644 return matrix_.data( col_ );
656 template<
typename MT
660 return matrix_.data( col_ );
672 template<
typename MT
676 return matrix_.begin( col_ );
688 template<
typename MT
692 return matrix_.cbegin( col_ );
704 template<
typename MT
708 return matrix_.cbegin( col_ );
720 template<
typename MT
724 return matrix_.end( col_ );
736 template<
typename MT
740 return matrix_.cend( col_ );
752 template<
typename MT
756 return matrix_.cend( col_ );
775 template<
typename MT
779 const size_t rows( size() );
781 for(
size_t i=0UL; i<
rows; ++i )
782 matrix_(i,col_) = rhs;
799 template<
typename MT
803 if( &rhs ==
this )
return *
this;
805 if( size() != rhs.
size() )
806 throw std::invalid_argument(
"Column sizes do not match" );
808 const size_t rows( size() );
810 for(
size_t i=0UL; i<
rows; ++i )
811 matrix_(i,col_) = rhs[i];
828 template<
typename MT
830 template<
typename VT >
836 if( size() != (~rhs).size() )
837 throw std::invalid_argument(
"Vector sizes do not match" );
839 if( (~rhs).canAlias( &matrix_ ) ) {
864 template<
typename MT
866 template<
typename VT >
872 if( size() != (~rhs).size() )
873 throw std::invalid_argument(
"Vector sizes do not match" );
875 if( (~rhs).canAlias( &matrix_ ) ) {
898 template<
typename MT
900 template<
typename VT >
906 if( size() != (~rhs).size() )
907 throw std::invalid_argument(
"Vector sizes do not match" );
909 if( (~rhs).canAlias( &matrix_ ) ) {
933 template<
typename MT
935 template<
typename VT >
941 if( size() != (~rhs).size() )
942 throw std::invalid_argument(
"Vector sizes do not match" );
964 template<
typename MT
966 template<
typename Other >
970 return operator=( (*
this) * rhs );
984 template<
typename MT
986 template<
typename Other >
992 return operator=( (*
this) / rhs );
1010 template<
typename MT
1014 return matrix_.rows();
1024 template<
typename MT
1028 return matrix_.capacity( col_ );
1041 template<
typename MT
1045 return matrix_.nonZeros( col_ );
1055 template<
typename MT
1059 matrix_.reset( col_ );
1070 template<
typename MT
1072 template<
typename Other >
1075 for(
size_t j=0UL; j<size(); ++j ) {
1076 matrix_(j,col_) *= scalar;
1101 template<
typename MT
1103 template<
typename Other >
1106 return matrix_.isAliased( alias );
1121 template<
typename MT
1123 template<
typename MT2
1127 return matrix_.isAliased( alias->
matrix_ ) && ( col_ == alias->
col_ );
1142 template<
typename MT
1144 template<
typename Other >
1147 return matrix_.isAliased( alias );
1162 template<
typename MT
1164 template<
typename MT2
1168 return matrix_.isAliased( &alias->
matrix_ ) && ( col_ == alias->
col_ );
1182 template<
typename MT
1186 return matrix_.isAligned();
1201 template<
typename MT
1222 template<
typename MT
1226 return matrix_.load( index, col_ );
1243 template<
typename MT
1247 return matrix_.loadu( index, col_ );
1265 template<
typename MT
1269 matrix_.store( index, col_, value );
1287 template<
typename MT
1291 matrix_.storeu( index, col_, value );
1309 template<
typename MT
1313 matrix_.stream( index, col_, value );
1329 template<
typename MT
1331 template<
typename VT >
1337 const size_t iend( (~rhs).size() &
size_t(-2) );
1338 for(
size_t i=0UL; i<iend; i+=2UL ) {
1339 matrix_(i ,col_) = (~rhs)[i ];
1340 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1342 if( iend < (~rhs).size() )
1343 matrix_(iend,col_) = (~rhs)[iend];
1359 template<
typename MT
1361 template<
typename VT >
1369 const size_t rows( size() );
1373 for(
size_t i=0UL; i<
rows; i+=IT::size ) {
1374 matrix_.stream( i, col_, (~rhs).
load(i) );
1379 const size_t iend( rows &
size_t(-IT::size*4) );
1383 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1384 matrix_.store( i , col_, it.load() ); it+=IT::size;
1385 matrix_.store( i+IT::size , col_, it.load() ); it+=IT::size;
1386 matrix_.store( i+IT::size*2UL, col_, it.load() ); it+=IT::size;
1387 matrix_.store( i+IT::size*3UL, col_, it.load() ); it+=IT::size;
1389 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1390 matrix_.store( i, col_, it.load() );
1408 template<
typename MT
1410 template<
typename VT >
1415 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1416 matrix_(element->index(),col_) = element->value();
1432 template<
typename MT
1434 template<
typename VT >
1440 const size_t iend( (~rhs).size() &
size_t(-2) );
1441 for(
size_t i=0UL; i<iend; i+=2UL ) {
1442 matrix_(i ,col_) += (~rhs)[i ];
1443 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1445 if( iend < (~rhs).size() )
1446 matrix_(iend,col_) += (~rhs)[iend];
1462 template<
typename MT
1464 template<
typename VT >
1472 const size_t rows( size() );
1474 const size_t iend( rows &
size_t(-IT::size*4) );
1478 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1479 matrix_.store( i , col_, matrix_.load(i ,col_) + it.load() ); it += IT::size;
1480 matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) + it.load() ); it += IT::size;
1481 matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) + it.load() ); it += IT::size;
1482 matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) + it.load() ); it += IT::size;
1484 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1485 matrix_.store( i, col_, matrix_.load(i,col_) + it.load() );
1502 template<
typename MT
1504 template<
typename VT >
1509 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1510 matrix_(element->index(),col_) += element->value();
1526 template<
typename MT
1528 template<
typename VT >
1534 const size_t iend( (~rhs).size() &
size_t(-2) );
1535 for(
size_t i=0UL; i<iend; i+=2UL ) {
1536 matrix_(i ,col_) -= (~rhs)[i ];
1537 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1539 if( iend < (~rhs).size() )
1540 matrix_(iend,col_) -= (~rhs)[iend];
1556 template<
typename MT
1558 template<
typename VT >
1566 const size_t rows( size() );
1568 const size_t iend( rows &
size_t(-IT::size*4) );
1572 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1573 matrix_.store( i , col_, matrix_.load(i ,col_) - it.load() ); it += IT::size;
1574 matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) - it.load() ); it += IT::size;
1575 matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) - it.load() ); it += IT::size;
1576 matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) - it.load() ); it += IT::size;
1578 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1579 matrix_.store( i, col_, matrix_.load(i,col_) - it.load() );
1596 template<
typename MT
1598 template<
typename VT >
1603 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1604 matrix_(element->index(),col_) -= element->value();
1620 template<
typename MT
1622 template<
typename VT >
1628 const size_t iend( (~rhs).size() &
size_t(-2) );
1629 for(
size_t i=0UL; i<iend; i+=2UL ) {
1630 matrix_(i ,col_) *= (~rhs)[i ];
1631 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
1633 if( iend < (~rhs).size() )
1634 matrix_(iend,col_) *= (~rhs)[iend];
1650 template<
typename MT
1652 template<
typename VT >
1660 const size_t rows( size() );
1662 const size_t iend( rows &
size_t(-IT::size*4) );
1666 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1667 matrix_.store( i , col_, matrix_.load(i ,col_) * it.load() ); it += IT::size;
1668 matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) * it.load() ); it += IT::size;
1669 matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) * it.load() ); it += IT::size;
1670 matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) * it.load() ); it += IT::size;
1672 for(
size_t i=iend; i<
rows; i+=IT::size, it+=IT::size ) {
1673 matrix_.store( i, col_, matrix_.load(i,col_) * it.load() );
1690 template<
typename MT
1692 template<
typename VT >
1701 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1702 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
1727 template<
typename MT >
1750 typedef DenseColumn<MT,false>
This;
1751 typedef typename ColumnTrait<MT>::Type
ResultType;
1761 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1767 template<
typename MatrixType >
1768 class ColumnIterator
1778 enum { returnConst = IsConst<MatrixType>::value };
1784 typedef typename SelectType< returnConst, typename MT::ConstReference, typename MT::Reference >::Type
Reference;
1786 typedef std::random_access_iterator_tag IteratorCategory;
1787 typedef RemoveReference<Reference> ValueType;
1788 typedef ValueType* PointerType;
1790 typedef ptrdiff_t DifferenceType;
1793 typedef IteratorCategory iterator_category;
1794 typedef ValueType value_type;
1795 typedef PointerType pointer;
1796 typedef ReferenceType reference;
1797 typedef DifferenceType difference_type;
1807 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
1819 template<
typename MatrixType2 >
1820 inline ColumnIterator(
const ColumnIterator<MatrixType2>& it )
1823 , column_( it.column_ )
1833 inline ColumnIterator& operator+=(
size_t inc ) {
1845 inline ColumnIterator& operator-=(
size_t dec ) {
1856 inline ColumnIterator& operator++() {
1867 inline const ColumnIterator operator++(
int ) {
1868 const ColumnIterator tmp( *
this );
1879 inline ColumnIterator& operator--() {
1890 inline const ColumnIterator operator--(
int ) {
1891 const ColumnIterator tmp( *
this );
1903 inline ReferenceType
operator[](
size_t index )
const {
1904 return (*
matrix_)(row_+index,column_);
1913 inline ReferenceType
operator*()
const {
1914 return (*
matrix_)(row_,column_);
1923 inline PointerType operator->()
const {
1924 return &(*matrix_)(row_,column_);
1934 template<
typename MatrixType2 >
1935 inline bool operator==(
const ColumnIterator<MatrixType2>& rhs )
const {
1936 return (
matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1946 template<
typename MatrixType2 >
1947 inline bool operator!=(
const ColumnIterator<MatrixType2>& rhs )
const {
1948 return !( *
this == rhs );
1958 template<
typename MatrixType2 >
1959 inline bool operator<( const ColumnIterator<MatrixType2>& rhs )
const {
1960 return (
matrix_ == rhs.matrix_ ) && ( row_ < rhs.row_ ) && ( column_ == rhs.column_ );
1970 template<
typename MatrixType2 >
1971 inline bool operator>(
const ColumnIterator<MatrixType2>& rhs )
const {
1972 return (
matrix_ == rhs.matrix_ ) && ( row_ > rhs.row_ ) && ( column_ == rhs.column_ );
1982 template<
typename MatrixType2 >
1983 inline bool operator<=( const ColumnIterator<MatrixType2>& rhs )
const {
1984 return (
matrix_ == rhs.matrix_ ) && ( row_ <= rhs.row_ ) && ( column_ == rhs.column_ );
1994 template<
typename MatrixType2 >
1995 inline bool operator>=(
const ColumnIterator<MatrixType2>& rhs )
const {
1996 return (
matrix_ == rhs.matrix_ ) && ( row_ >= rhs.row_ ) && ( column_ == rhs.column_ );
2006 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2007 return row_ - rhs.row_;
2018 friend inline const ColumnIterator
operator+(
const ColumnIterator& it,
size_t inc ) {
2019 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2030 friend inline const ColumnIterator
operator+(
size_t inc,
const ColumnIterator& it ) {
2031 return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2042 friend inline const ColumnIterator
operator-(
const ColumnIterator& it,
size_t dec ) {
2043 return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2055 template<
typename MatrixType2 >
friend class ColumnIterator;
2065 typedef typename SelectType< useConst, ConstIterator, ColumnIterator<MT> >::Type
Iterator;
2070 enum { vectorizable = 0 };
2073 enum { smpAssignable = MT::smpAssignable };
2079 explicit inline DenseColumn( MT& matrix,
size_t index );
2108 template<
typename VT >
inline DenseColumn& operator+=(
const Vector<VT,false>& rhs );
2109 template<
typename VT >
inline DenseColumn& operator-=(
const Vector<VT,false>& rhs );
2110 template<
typename VT >
inline DenseColumn& operator*=(
const Vector<VT,false>& rhs );
2112 template<
typename Other >
2113 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
2114 operator*=( Other rhs );
2116 template<
typename Other >
2117 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
2118 operator/=( Other rhs );
2125 inline size_t size()
const;
2128 inline void reset();
2129 template<
typename Other >
inline DenseColumn& scale(
const Other& scalar );
2137 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2138 template<
typename MT2,
bool SO2 >
inline bool canAlias (
const DenseColumn<MT2,SO2>* alias )
const;
2139 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2140 template<
typename MT2,
bool SO2 >
inline bool isAliased(
const DenseColumn<MT2,SO2>* alias )
const;
2145 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
2146 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
2147 template<
typename VT >
inline void addAssign (
const DenseVector <VT,false>& rhs );
2148 template<
typename VT >
inline void addAssign (
const SparseVector<VT,false>& rhs );
2149 template<
typename VT >
inline void subAssign (
const DenseVector <VT,false>& rhs );
2150 template<
typename VT >
inline void subAssign (
const SparseVector<VT,false>& rhs );
2151 template<
typename VT >
inline void multAssign(
const DenseVector <VT,false>& rhs );
2152 template<
typename VT >
inline void multAssign(
const SparseVector<VT,false>& rhs );
2166 template<
typename MT2,
bool SO2 >
friend class DenseColumn;
2168 template<
typename MT2,
bool SO2 >
2169 friend bool isSame(
const DenseColumn<MT2,SO2>& a,
const DenseColumn<MT2,SO2>& b );
2199 template<
typename MT >
2204 if(
matrix_.columns() <= index )
2205 throw std::invalid_argument(
"Invalid column access index" );
2226 template<
typename MT >
2230 return matrix_(index,col_);
2243 template<
typename MT >
2247 return matrix_(index,col_);
2261 template<
typename MT >
2264 return Iterator( matrix_, 0UL, col_ );
2278 template<
typename MT >
2295 template<
typename MT >
2312 template<
typename MT >
2315 return Iterator( matrix_, size(), col_ );
2329 template<
typename MT >
2346 template<
typename MT >
2370 template<
typename MT >
2373 const size_t rows( size() );
2375 for(
size_t i=0UL; i<
rows; ++i )
2376 matrix_(i,col_) = rhs;
2395 template<
typename MT >
2398 if( &rhs ==
this )
return *
this;
2400 if( size() != rhs.size() )
2401 throw std::invalid_argument(
"Column sizes do not match" );
2403 const size_t rows( size() );
2405 for(
size_t i=0UL; i<
rows; ++i )
2406 matrix_(i,col_) = rhs[i];
2425 template<
typename MT >
2426 template<
typename VT >
2433 if( size() != (~rhs).size() )
2434 throw std::invalid_argument(
"Vector sizes do not match" );
2436 if( (~rhs).canAlias( &matrix_ ) ) {
2441 if( IsSparseVector<VT>::value )
2463 template<
typename MT >
2464 template<
typename VT >
2465 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator+=(
const Vector<VT,false>& rhs )
2470 if( size() != (~rhs).size() )
2471 throw std::invalid_argument(
"Vector sizes do not match" );
2473 if( (~rhs).canAlias( &matrix_ ) ) {
2498 template<
typename MT >
2499 template<
typename VT >
2500 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator-=(
const Vector<VT,false>& rhs )
2505 if( size() != (~rhs).size() )
2506 throw std::invalid_argument(
"Vector sizes do not match" );
2508 if( (~rhs).canAlias( &matrix_ ) ) {
2534 template<
typename MT >
2535 template<
typename VT >
2536 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator*=(
const Vector<VT,false>& rhs )
2541 if( size() != (~rhs).size() )
2542 throw std::invalid_argument(
"Vector sizes do not match" );
2544 if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
2566 template<
typename MT >
2567 template<
typename Other >
2568 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2569 DenseColumn<MT,false>::operator*=( Other rhs )
2571 for(
size_t i=0UL; i<size(); ++i )
2572 matrix_(i,col_) *= rhs;
2589 template<
typename MT >
2590 template<
typename Other >
2591 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2592 DenseColumn<MT,false>::operator/=( Other rhs )
2596 typedef typename DivTrait<ElementType,Other>::Type DT;
2597 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2601 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2602 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2603 for(
size_t i=0UL; i<size(); ++i )
2604 matrix_(i,col_) *= tmp;
2607 for(
size_t i=0UL; i<size(); ++i )
2608 matrix_(i,col_) /= rhs;
2631 template<
typename MT >
2634 return matrix_.rows();
2646 template<
typename MT >
2649 return matrix_.rows();
2664 template<
typename MT >
2667 const size_t rows( size() );
2668 size_t nonzeros( 0UL );
2670 for(
size_t i=0UL; i<
rows; ++i )
2686 template<
typename MT >
2690 const size_t rows( size() );
2691 for(
size_t i=0UL; i<
rows; ++i )
2692 reset( matrix_(i,col_) );
2705 template<
typename MT >
2706 template<
typename Other >
2707 inline DenseColumn<MT,false>& DenseColumn<MT,false>::scale(
const Other& scalar )
2709 for(
size_t i=0UL; i<size(); ++i ) {
2710 matrix_(i,col_) *= scalar;
2737 template<
typename MT >
2738 template<
typename Other >
2741 return matrix_.isAliased( alias );
2758 template<
typename MT >
2759 template<
typename MT2
2763 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
2780 template<
typename MT >
2781 template<
typename Other >
2784 return matrix_.isAliased( alias );
2801 template<
typename MT >
2802 template<
typename MT2
2806 return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
2822 template<
typename MT >
2842 template<
typename MT >
2863 template<
typename MT >
2864 template<
typename VT >
2869 const size_t iend( (~rhs).size() &
size_t(-2) );
2870 for(
size_t i=0UL; i<iend; i+=2UL ) {
2871 matrix_(i ,col_) = (~rhs)[i ];
2872 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
2874 if( iend < (~rhs).size() )
2875 matrix_(iend,col_) = (~rhs)[iend];
2893 template<
typename MT >
2894 template<
typename VT >
2899 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2900 matrix_(element->index(),col_) = element->value();
2918 template<
typename MT >
2919 template<
typename VT >
2924 const size_t iend( (~rhs).size() &
size_t(-2) );
2925 for(
size_t i=0UL; i<iend; i+=2UL ) {
2926 matrix_(i ,col_) += (~rhs)[i ];
2927 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
2929 if( iend < (~rhs).size() )
2930 matrix_(iend,col_) += (~rhs)[iend];
2948 template<
typename MT >
2949 template<
typename VT >
2954 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2955 matrix_(element->index(),col_) += element->value();
2973 template<
typename MT >
2974 template<
typename VT >
2979 const size_t iend( (~rhs).size() &
size_t(-2) );
2980 for(
size_t i=0UL; i<iend; i+=2UL ) {
2981 matrix_(i ,col_) -= (~rhs)[i ];
2982 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
2984 if( iend < (~rhs).size() )
2985 matrix_(iend,col_) -= (~rhs)[iend];
3003 template<
typename MT >
3004 template<
typename VT >
3009 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3010 matrix_(element->index(),col_) -= element->value();
3028 template<
typename MT >
3029 template<
typename VT >
3034 const size_t iend( (~rhs).size() &
size_t(-2) );
3035 for(
size_t i=0UL; i<iend; i+=2UL ) {
3036 matrix_(i ,col_) *= (~rhs)[i ];
3037 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
3039 if( iend < (~rhs).size() )
3040 matrix_(iend,col_) *= (~rhs)[iend];
3058 template<
typename MT >
3059 template<
typename VT >
3068 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3069 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
3090 template<
typename MT,
bool SO >
3093 template<
typename MT,
bool SO >
3096 template<
typename MT,
bool SO >
3099 template<
typename MT,
bool SO >
3100 inline bool isSame(
const DenseColumn<MT,SO>& a,
const DenseColumn<MT,SO>& b );
3112 template<
typename MT
3130 template<
typename MT
3157 template<
typename MT
3161 for(
size_t i=0UL; i<column.
size(); ++i )
3162 if( !
isDefault( column[i] ) )
return false;
3180 template<
typename MT,
bool SO >
3198 template<
typename MT,
bool SO >
3199 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:346
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseColumn.h:349
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4599
#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:4329
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:152
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:1012
#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:4642
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
#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:179
Header file for the IsSame and IsStrictlySame type traits.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseColumn.h:336
MT::ElementType ElementType
Type of the column elements.
Definition: DenseColumn.h:337
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:1311
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:339
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
#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:355
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4615
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:409
Header file for the column base class.
size_t nonZeros() const
Returns the number of non-zero elements in the column.
Definition: DenseColumn.h:1043
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseColumn.h:315
DenseColumn & operator=(const ElementType &rhs)
Homogenous assignment to all column elements.
Definition: DenseColumn.h:777
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:122
Iterator end()
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:722
void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1267
SelectType< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant row value.
Definition: DenseColumn.h:352
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:706
Reference operator[](size_t index)
Subscript operator for the direct access to the column elements.
Definition: DenseColumn.h:609
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:583
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
IT::Type IntrinsicType
Intrinsic type of the column elements.
Definition: DenseColumn.h:338
bool canAlias(const Other *alias) const
Returns whether the dense column can alias with the given address alias.
Definition: DenseColumn.h:1104
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:1224
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: DenseColumn.h:343
Reference to a specific column of a dense matrix.The DenseColumn template represents a reference to a...
Definition: DenseColumn.h:309
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:1245
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:271
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:1289
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:1026
#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:335
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
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:361
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2410
System settings for streaming (non-temporal stores)
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseColumn.h:358
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:1184
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:92
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:2407
Header file for the IsConst type trait.
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the column element type.
Definition: DenseColumn.h:318
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:1203
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:301
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:331
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
DenseColumn< MT, SO > This
Type of this DenseColumn instance.
Definition: DenseColumn.h:334
Header file for the column trait.
Header file for the isDefault shim.
void reset()
Reset to the default initial values.
Definition: DenseColumn.h:1057
Pointer data()
Low-level data access to the column elements.
Definition: DenseColumn.h:642
#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:754
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:151
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:250
Iterator begin()
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:674
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
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:2403
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:2409
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a plain dense ve...
Definition: Thresholds.h:207
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:1145
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:154
#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:340
Header file for the FunctionTrace class.