22 #ifndef _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
23 #define _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
288 template<
typename MT
289 ,
bool SO = IsColumnMajorMatrix<MT>::value >
340 enum { vectorizable = MT::vectorizable };
346 explicit inline DenseColumn( MT& matrix,
size_t index );
381 template<
typename Other >
383 operator*=( Other rhs );
385 template<
typename Other >
387 operator/=( Other rhs );
394 inline size_t size()
const;
398 template<
typename Other >
inline DenseColumn& scale(
const Other& scalar );
406 template<
typename VT >
407 struct VectorizedAssign {
408 enum { value = vectorizable && VT::vectorizable &&
417 template<
typename VT >
418 struct VectorizedAddAssign {
419 enum { value = vectorizable && VT::vectorizable &&
420 IsSame<ElementType,typename VT::ElementType>::value &&
421 IntrinsicTrait<ElementType>::addition };
429 template<
typename VT >
430 struct VectorizedSubAssign {
431 enum { value = vectorizable && VT::vectorizable &&
432 IsSame<ElementType,typename VT::ElementType>::value &&
433 IntrinsicTrait<ElementType>::subtraction };
441 template<
typename VT >
442 struct VectorizedMultAssign {
443 enum { value = vectorizable && VT::vectorizable &&
444 IsSame<ElementType,typename VT::ElementType>::value &&
445 IntrinsicTrait<ElementType>::multiplication };
454 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
455 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
458 template<
typename VT >
459 inline typename DisableIf< VectorizedAssign<VT> >::Type
460 assign(
const DenseVector<VT,false>& rhs );
462 template<
typename VT >
463 inline typename EnableIf< VectorizedAssign<VT> >::Type
464 assign(
const DenseVector<VT,false>& rhs );
466 template<
typename VT >
inline void assign(
const SparseVector<VT,false>& rhs );
468 template<
typename VT >
469 inline typename DisableIf< VectorizedAddAssign<VT> >::Type
470 addAssign(
const DenseVector<VT,false>& rhs );
472 template<
typename VT >
473 inline typename EnableIf< VectorizedAddAssign<VT> >::Type
474 addAssign(
const DenseVector<VT,false>& rhs );
476 template<
typename VT >
inline void addAssign(
const SparseVector<VT,false>& rhs );
478 template<
typename VT >
479 inline typename DisableIf< VectorizedSubAssign<VT> >::Type
480 subAssign(
const DenseVector<VT,false>& rhs );
482 template<
typename VT >
483 inline typename EnableIf< VectorizedSubAssign<VT> >::Type
484 subAssign(
const DenseVector<VT,false>& rhs );
486 template<
typename VT >
inline void subAssign(
const SparseVector<VT,false>& rhs );
488 template<
typename VT >
489 inline typename DisableIf< VectorizedMultAssign<VT> >::Type
490 multAssign(
const DenseVector<VT,false>& rhs );
492 template<
typename VT >
493 inline typename EnableIf< VectorizedMultAssign<VT> >::Type
494 multAssign(
const DenseVector<VT,false>& rhs );
496 template<
typename VT >
inline void multAssign(
const SparseVector<VT,false>& rhs );
535 template<
typename MT
541 if(
matrix_.columns() <= index )
542 throw std::invalid_argument(
"Invalid column access index" );
561 template<
typename MT
566 return matrix_(index,col_);
577 template<
typename MT
582 return matrix_(index,col_);
592 template<
typename MT
596 return matrix_.data( col_ );
606 template<
typename MT
610 return matrix_.data( col_ );
622 template<
typename MT
626 return matrix_.begin( col_ );
638 template<
typename MT
642 return matrix_.begin( col_ );
654 template<
typename MT
658 return matrix_.begin( col_ );
670 template<
typename MT
674 return matrix_.end( col_ );
686 template<
typename MT
690 return matrix_.end( col_ );
702 template<
typename MT
706 return matrix_.end( col_ );
725 template<
typename MT
729 const size_t rows( size() );
731 for(
size_t i=0UL; i<
rows; ++i )
732 matrix_(i,col_) = rhs;
749 template<
typename MT
753 if( &rhs ==
this )
return *
this;
755 if( size() != rhs.
size() )
756 throw std::invalid_argument(
"Column sizes do not match" );
758 const size_t rows( size() );
760 for(
size_t i=0UL; i<
rows; ++i )
761 matrix_(i,col_) = rhs[i];
778 template<
typename MT
780 template<
typename VT >
788 if( size() != (~rhs).size() )
789 throw std::invalid_argument(
"Vector sizes do not match" );
791 if( (~rhs).canAlias(
this ) ) {
792 const typename VT::ResultType tmp( ~rhs );
816 template<
typename MT
818 template<
typename VT >
826 if( size() != (~rhs).size() )
827 throw std::invalid_argument(
"Vector sizes do not match" );
829 if( (~rhs).canAlias(
this ) ) {
830 const typename VT::ResultType tmp( ~rhs );
852 template<
typename MT
854 template<
typename VT >
862 if( size() != (~rhs).size() )
863 throw std::invalid_argument(
"Vector sizes do not match" );
865 if( (~rhs).canAlias(
this ) ) {
866 const typename VT::ResultType tmp( ~rhs );
889 template<
typename MT
891 template<
typename VT >
899 if( size() != (~rhs).size() )
900 throw std::invalid_argument(
"Vector sizes do not match" );
903 const typename VT::ResultType tmp( ~rhs );
922 template<
typename MT
924 template<
typename Other >
928 return operator=( (*
this) * rhs );
942 template<
typename MT
944 template<
typename Other >
950 return operator=( (*
this) / rhs );
968 template<
typename MT
972 return matrix_.rows();
982 template<
typename MT
986 return matrix_.capacity( col_ );
999 template<
typename MT
1003 return matrix_.nonZeros( col_ );
1013 template<
typename MT
1017 matrix_.reset( col_ );
1028 template<
typename MT
1030 template<
typename Other >
1033 for(
size_t j=0UL; j<size(); ++j ) {
1034 matrix_(j,col_) *= scalar;
1059 template<
typename MT
1061 template<
typename Other >
1064 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1079 template<
typename MT
1081 template<
typename Other >
1084 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1100 template<
typename MT
1104 return matrix_.get( index, col_ );
1120 template<
typename MT
1122 template<
typename VT >
1128 const size_t iend( (~rhs).size() &
size_t(-2) );
1129 for(
size_t i=0UL; i<iend; i+=2UL ) {
1130 matrix_(i ,col_) = (~rhs)[i ];
1131 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1133 if( iend < (~rhs).size() )
1134 matrix_(iend,col_) = (~rhs)[iend];
1150 template<
typename MT
1152 template<
typename VT >
1160 const size_t rows( size() );
1164 for(
size_t i=0UL; i<
rows; i+=IT::size ) {
1165 stream( &matrix_(i,col_), (~rhs).
get(i) );
1170 BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1171 const size_t iend( rows &
size_t(-IT::size*4) );
1173 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1174 store( &matrix_(i ,col_), (~rhs).
get(i ) );
1175 store( &matrix_(i+IT::size ,col_), (~rhs).
get(i+IT::size ) );
1176 store( &matrix_(i+IT::size*2UL,col_), (~rhs).
get(i+IT::size*2UL) );
1177 store( &matrix_(i+IT::size*3UL,col_), (~rhs).
get(i+IT::size*3UL) );
1179 for(
size_t i=iend; i<
rows; i+=IT::size ) {
1180 store( &matrix_(i,col_), (~rhs).
get(i) );
1198 template<
typename MT
1200 template<
typename VT >
1205 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1206 matrix_(element->index(),col_) = element->value();
1222 template<
typename MT
1224 template<
typename VT >
1230 const size_t iend( (~rhs).size() &
size_t(-2) );
1231 for(
size_t i=0UL; i<iend; i+=2UL ) {
1232 matrix_(i ,col_) += (~rhs)[i ];
1233 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1235 if( iend < (~rhs).size() )
1236 matrix_(iend,col_) += (~rhs)[iend];
1252 template<
typename MT
1254 template<
typename VT >
1262 const size_t rows( size() );
1264 BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1265 const size_t iend( rows &
size_t(-IT::size*4) );
1267 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1268 store( &matrix_(i ,col_),
load( &matrix_(i ,col_) ) + (~rhs).
get(i ) );
1269 store( &matrix_(i+IT::size ,col_),
load( &matrix_(i+IT::size ,col_) ) + (~rhs).
get(i+IT::size ) );
1270 store( &matrix_(i+IT::size*2UL,col_),
load( &matrix_(i+IT::size*2UL,col_) ) + (~rhs).
get(i+IT::size*2UL) );
1271 store( &matrix_(i+IT::size*3UL,col_),
load( &matrix_(i+IT::size*3UL,col_) ) + (~rhs).
get(i+IT::size*3UL) );
1273 for(
size_t i=iend; i<
rows; i+=IT::size ) {
1274 store( &matrix_(i,col_),
load( &matrix_(i,col_) ) + (~rhs).
get(i) );
1291 template<
typename MT
1293 template<
typename VT >
1298 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1299 matrix_(element->index(),col_) += element->value();
1315 template<
typename MT
1317 template<
typename VT >
1323 const size_t iend( (~rhs).size() &
size_t(-2) );
1324 for(
size_t i=0UL; i<iend; i+=2UL ) {
1325 matrix_(i ,col_) -= (~rhs)[i ];
1326 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1328 if( iend < (~rhs).size() )
1329 matrix_(iend,col_) -= (~rhs)[iend];
1345 template<
typename MT
1347 template<
typename VT >
1355 const size_t rows( size() );
1357 BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1358 const size_t iend( rows &
size_t(-IT::size*4) );
1360 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1361 store( &matrix_(i ,col_),
load( &matrix_(i ,col_) ) - (~rhs).
get(i ) );
1362 store( &matrix_(i+IT::size ,col_),
load( &matrix_(i+IT::size ,col_) ) - (~rhs).
get(i+IT::size ) );
1363 store( &matrix_(i+IT::size*2UL,col_),
load( &matrix_(i+IT::size*2UL,col_) ) - (~rhs).
get(i+IT::size*2UL) );
1364 store( &matrix_(i+IT::size*3UL,col_),
load( &matrix_(i+IT::size*3UL,col_) ) - (~rhs).
get(i+IT::size*3UL) );
1366 for(
size_t i=iend; i<
rows; i+=IT::size ) {
1367 store( &matrix_(i,col_),
load( &matrix_(i,col_) ) - (~rhs).
get(i) );
1384 template<
typename MT
1386 template<
typename VT >
1391 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1392 matrix_(element->index(),col_) -= element->value();
1408 template<
typename MT
1410 template<
typename VT >
1416 const size_t iend( (~rhs).size() &
size_t(-2) );
1417 for(
size_t i=0UL; i<iend; i+=2UL ) {
1418 matrix_(i ,col_) *= (~rhs)[i ];
1419 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
1421 if( iend < (~rhs).size() )
1422 matrix_(iend,col_) *= (~rhs)[iend];
1438 template<
typename MT
1440 template<
typename VT >
1448 const size_t rows( size() );
1450 BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1451 const size_t iend( rows &
size_t(-IT::size*4) );
1453 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1454 store( &matrix_(i ,col_),
load( &matrix_(i ,col_) ) * (~rhs).
get(i ) );
1455 store( &matrix_(i+IT::size ,col_),
load( &matrix_(i+IT::size ,col_) ) * (~rhs).
get(i+IT::size ) );
1456 store( &matrix_(i+IT::size*2UL,col_),
load( &matrix_(i+IT::size*2UL,col_) ) * (~rhs).
get(i+IT::size*2UL) );
1457 store( &matrix_(i+IT::size*3UL,col_),
load( &matrix_(i+IT::size*3UL,col_) ) * (~rhs).
get(i+IT::size*3UL) );
1459 for(
size_t i=iend; i<
rows; i+=IT::size ) {
1460 store( &matrix_(i,col_),
load( &matrix_(i,col_) ) * (~rhs).
get(i) );
1477 template<
typename MT
1479 template<
typename VT >
1488 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1489 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
1514 template<
typename MT >
1532 typedef DenseColumn<MT,false>
This;
1533 typedef typename ColumnTrait<MT>::Type
ResultType;
1543 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1549 template<
typename MatrixType >
1550 class ColumnIterator
1560 enum { returnConst = IsConst<MatrixType>::value };
1566 typedef typename SelectType< returnConst, typename MT::ConstReference, typename MT::Reference >::Type
Reference;
1568 typedef std::forward_iterator_tag IteratorCategory;
1569 typedef RemoveReference<Reference> ValueType;
1570 typedef ValueType* PointerType;
1572 typedef ptrdiff_t DifferenceType;
1575 typedef IteratorCategory iterator_category;
1576 typedef ValueType value_type;
1577 typedef PointerType pointer;
1578 typedef ReferenceType reference;
1579 typedef DifferenceType difference_type;
1589 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
1601 template<
typename MatrixType2 >
1602 inline ColumnIterator(
const ColumnIterator<MatrixType2>& it )
1605 , column_( it.column_ )
1614 inline ColumnIterator& operator++() {
1625 inline const ColumnIterator operator++(
int ) {
1626 const ColumnIterator tmp( *
this );
1637 inline ReferenceType
operator*()
const {
1647 inline PointerType operator->()
const {
1648 return &
matrix_(row_,column_);
1658 template<
typename MatrixType2 >
1659 inline bool operator==(
const ColumnIterator<MatrixType2>& rhs )
const {
1660 return ( &
matrix_ == &rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1670 template<
typename MatrixType2 >
1671 inline bool operator!=(
const ColumnIterator<MatrixType2>& rhs )
const {
1672 return !( *
this == rhs );
1682 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
1683 return row_ - rhs.row_;
1696 template<
typename MatrixType2 >
friend class ColumnIterator;
1707 typedef typename SelectType< useConst, ConstIterator, ColumnIterator<MT> >::Type
Iterator;
1712 enum { vectorizable = 0 };
1718 explicit inline DenseColumn( MT& matrix,
size_t index );
1747 template<
typename VT >
inline DenseColumn& operator+=(
const Vector<VT,false>& rhs );
1748 template<
typename VT >
inline DenseColumn& operator-=(
const Vector<VT,false>& rhs );
1749 template<
typename VT >
inline DenseColumn& operator*=(
const Vector<VT,false>& rhs );
1751 template<
typename Other >
1752 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
1753 operator*=( Other rhs );
1755 template<
typename Other >
1756 inline typename EnableIf< IsNumeric<Other>,
DenseColumn >::Type&
1757 operator/=( Other rhs );
1764 inline size_t size()
const;
1767 inline void reset();
1768 template<
typename Other >
inline DenseColumn& scale(
const Other& scalar );
1776 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
1777 template<
typename Other >
inline bool isAliased (
const Other* alias )
const;
1778 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
1779 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
1780 template<
typename VT >
inline void addAssign (
const DenseVector <VT,false>& rhs );
1781 template<
typename VT >
inline void addAssign (
const SparseVector<VT,false>& rhs );
1782 template<
typename VT >
inline void subAssign (
const DenseVector <VT,false>& rhs );
1783 template<
typename VT >
inline void subAssign (
const SparseVector<VT,false>& rhs );
1784 template<
typename VT >
inline void multAssign(
const DenseVector <VT,false>& rhs );
1785 template<
typename VT >
inline void multAssign(
const SparseVector<VT,false>& rhs );
1826 template<
typename MT >
1831 if(
matrix_.columns() <= index )
1832 throw std::invalid_argument(
"Invalid column access index" );
1853 template<
typename MT >
1857 return matrix_(index,col_);
1870 template<
typename MT >
1874 return matrix_(index,col_);
1888 template<
typename MT >
1891 return Iterator( matrix_, 0UL, col_ );
1905 template<
typename MT >
1908 return ConstIterator( matrix_, 0UL, col_ );
1922 template<
typename MT >
1925 return ConstIterator( matrix_, 0UL, col_ );
1939 template<
typename MT >
1942 return Iterator( matrix_, size(), col_ );
1956 template<
typename MT >
1959 return ConstIterator( matrix_, size(), col_ );
1973 template<
typename MT >
1976 return ConstIterator( matrix_, size(), col_ );
1997 template<
typename MT >
2000 const size_t rows( size() );
2002 for(
size_t i=0UL; i<
rows; ++i )
2003 matrix_(i,col_) = rhs;
2022 template<
typename MT >
2025 if( &rhs ==
this )
return *
this;
2027 if( size() != rhs.size() )
2028 throw std::invalid_argument(
"Column sizes do not match" );
2030 const size_t rows( size() );
2032 for(
size_t i=0UL; i<
rows; ++i )
2033 matrix_(i,col_) = rhs[i];
2052 template<
typename MT >
2053 template<
typename VT >
2058 if( size() != (~rhs).size() )
2059 throw std::invalid_argument(
"Vector sizes do not match" );
2061 if( (~rhs).canAlias(
this ) ) {
2062 const ResultType tmp( ~rhs );
2066 if( IsSparseVector<VT>::value )
2088 template<
typename MT >
2089 template<
typename VT >
2090 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator+=(
const Vector<VT,false>& rhs )
2097 if( size() != (~rhs).size() )
2098 throw std::invalid_argument(
"Vector sizes do not match" );
2100 if( (~rhs).canAlias(
this ) ) {
2101 const typename VT::ResultType tmp( ~rhs );
2125 template<
typename MT >
2126 template<
typename VT >
2127 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator-=(
const Vector<VT,false>& rhs )
2134 if( size() != (~rhs).size() )
2135 throw std::invalid_argument(
"Vector sizes do not match" );
2137 if( (~rhs).canAlias(
this ) ) {
2138 const typename VT::ResultType tmp( ~rhs );
2163 template<
typename MT >
2164 template<
typename VT >
2165 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator*=(
const Vector<VT,false>& rhs )
2172 if( size() != (~rhs).size() )
2173 throw std::invalid_argument(
"Vector sizes do not match" );
2175 if( (~rhs).canAlias(
this ) || IsSparseVector<VT>::value ) {
2176 const typename VT::ResultType tmp( ~rhs );
2197 template<
typename MT >
2198 template<
typename Other >
2199 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2200 DenseColumn<MT,false>::operator*=( Other rhs )
2202 return operator=( (*
this) * rhs );
2218 template<
typename MT >
2219 template<
typename Other >
2220 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2221 DenseColumn<MT,false>::operator/=( Other rhs )
2225 return operator=( (*
this) / rhs );
2245 template<
typename MT >
2248 return matrix_.rows();
2260 template<
typename MT >
2263 return matrix_.rows();
2278 template<
typename MT >
2281 const size_t rows( size() );
2282 size_t nonzeros( 0UL );
2284 for(
size_t i=0UL; i<
rows; ++i )
2300 template<
typename MT >
2304 const size_t rows( size() );
2305 for(
size_t i=0UL; i<
rows; ++i )
2306 reset( matrix_(i,col_) );
2319 template<
typename MT >
2320 template<
typename Other >
2321 inline DenseColumn<MT,false>& DenseColumn<MT,false>::scale(
const Other& scalar )
2323 for(
size_t i=0UL; i<size(); ++i ) {
2324 matrix_(i,col_) *= scalar;
2351 template<
typename MT >
2352 template<
typename Other >
2355 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2372 template<
typename MT >
2373 template<
typename Other >
2376 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2394 template<
typename MT >
2395 template<
typename VT >
2400 const size_t iend( (~rhs).size() &
size_t(-2) );
2401 for(
size_t i=0UL; i<iend; i+=2UL ) {
2402 matrix_(i ,col_) = (~rhs)[i ];
2403 matrix_(i+1UL,col_) = (~rhs)[i+1UL];
2405 if( iend < (~rhs).size() )
2406 matrix_(iend,col_) = (~rhs)[iend];
2424 template<
typename MT >
2425 template<
typename VT >
2430 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2431 matrix_(element->index(),col_) = element->value();
2449 template<
typename MT >
2450 template<
typename VT >
2455 const size_t iend( (~rhs).size() &
size_t(-2) );
2456 for(
size_t i=0UL; i<iend; i+=2UL ) {
2457 matrix_(i ,col_) += (~rhs)[i ];
2458 matrix_(i+1UL,col_) += (~rhs)[i+1UL];
2460 if( iend < (~rhs).size() )
2461 matrix_(iend,col_) += (~rhs)[iend];
2479 template<
typename MT >
2480 template<
typename VT >
2485 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2486 matrix_(element->index(),col_) += element->value();
2504 template<
typename MT >
2505 template<
typename VT >
2510 const size_t iend( (~rhs).size() &
size_t(-2) );
2511 for(
size_t i=0UL; i<iend; i+=2UL ) {
2512 matrix_(i ,col_) -= (~rhs)[i ];
2513 matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
2515 if( iend < (~rhs).size() )
2516 matrix_(iend,col_) -= (~rhs)[iend];
2534 template<
typename MT >
2535 template<
typename VT >
2540 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2541 matrix_(element->index(),col_) -= element->value();
2559 template<
typename MT >
2560 template<
typename VT >
2565 const size_t iend( (~rhs).size() &
size_t(-2) );
2566 for(
size_t i=0UL; i<iend; i+=2UL ) {
2567 matrix_(i ,col_) *= (~rhs)[i ];
2568 matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
2570 if( iend < (~rhs).size() )
2571 matrix_(iend,col_) *= (~rhs)[iend];
2589 template<
typename MT >
2590 template<
typename VT >
2595 const ResultType tmp( *
this );
2599 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2600 matrix_(element->index(),col_) = tmp[element->index()] * element->value();
2621 template<
typename MT,
bool SO >
2624 template<
typename MT,
bool SO >
2627 template<
typename MT,
bool SO >
2628 inline bool isnan(
const DenseColumn<MT,SO>&
column );
2630 template<
typename MT,
bool SO >
2643 template<
typename MT
2659 template<
typename MT
2684 template<
typename MT
2688 for(
size_t i=0UL; i<column.
size(); ++i ) {
2689 if(
isnan( column[i] ) )
return true;
2714 template<
typename MT
2718 for(
size_t i=0UL; i<column.
size(); ++i )
2719 if( !
isDefault( column[i] ) )
return false;
2752 template<
typename MT
2754 inline typename DisableIf< IsExpression<MT>, DenseColumn<MT> >::Type
2783 template<
typename MT
2785 inline typename DisableIf< IsExpression<MT>, DenseColumn<const MT> >::Type
2815 template<
typename MT
2817 inline typename EnableIf< IsMatMatAddExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2818 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2822 return column( (~dm).leftOperand(), index ) +
column( (~dm).rightOperand(), index );
2840 template<
typename MT
2842 inline typename EnableIf< IsMatMatSubExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2843 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2847 return column( (~dm).leftOperand(), index ) -
column( (~dm).rightOperand(), index );
2865 template<
typename MT
2867 inline typename EnableIf< IsMatMatMultExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2868 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2872 return (~dm).leftOperand() *
column( (~dm).rightOperand(), index );
2890 template<
typename MT
2892 inline typename EnableIf< IsVecTVecMultExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2893 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2897 return (~dm).leftOperand() * (~dm).rightOperand()[index];
2915 template<
typename MT
2917 inline typename EnableIf< IsMatScalarMultExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2918 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2922 return column( (~dm).leftOperand(), index ) * (~dm).rightOperand();
2940 template<
typename MT
2942 inline typename EnableIf< IsMatScalarDivExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2943 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2947 return column( (~dm).leftOperand(), index ) / (~dm).rightOperand();
2965 template<
typename MT
2967 inline typename EnableIf< IsMatAbsExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2968 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2972 return abs(
column( (~dm).operand(), index ) );
2990 template<
typename MT
2992 inline typename EnableIf< IsMatEvalExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
2993 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
2997 return eval(
column( (~dm).operand(), index ) );
3015 template<
typename MT
3017 inline typename EnableIf< IsMatTransExpr<MT>,
typename ColumnExprTrait<MT>::Type >::Type
3018 column(
const DenseMatrix<MT,SO>& dm,
size_t index )
3022 return trans(
row( (~dm).operand(), index ) );
3038 template<
typename T1,
bool SO,
typename T2,
size_t N >
3039 struct AddTrait< DenseColumn<T1,SO>, StaticVector<T2,N,false> >
3041 typedef typename AddTrait< typename DenseColumn<T1,SO>::ResultType,
3042 StaticVector<T2,N,false> >::Type Type;
3045 template<
typename T1,
size_t N,
typename T2,
bool SO >
3046 struct AddTrait< StaticVector<T1,N,false>, DenseColumn<T2,SO> >
3048 typedef typename AddTrait< StaticVector<T1,N,false>,
3049 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3052 template<
typename T1,
bool SO,
typename T2 >
3053 struct AddTrait< DenseColumn<T1,SO>, DynamicVector<T2,false> >
3055 typedef typename AddTrait< typename DenseColumn<T1,SO>::ResultType,
3056 DynamicVector<T2,false> >::Type Type;
3059 template<
typename T1,
typename T2,
bool SO >
3060 struct AddTrait< DynamicVector<T1,false>, DenseColumn<T2,SO> >
3062 typedef typename AddTrait< DynamicVector<T1,false>,
3063 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3066 template<
typename T1,
bool SO,
typename T2 >
3067 struct AddTrait< DenseColumn<T1,SO>, CompressedVector<T2,false> >
3069 typedef typename AddTrait< typename DenseColumn<T1,SO>::ResultType,
3070 CompressedVector<T2,false> >::Type Type;
3073 template<
typename T1,
typename T2,
bool SO >
3074 struct AddTrait< CompressedVector<T1,false>, DenseColumn<T2,SO> >
3076 typedef typename AddTrait< CompressedVector<T1,false>,
3077 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3080 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3081 struct AddTrait< DenseColumn<T1,SO1>, DenseColumn<T2,SO2> >
3083 typedef typename AddTrait< typename DenseColumn<T1,SO1>::ResultType,
3084 typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3100 template<
typename T1,
bool SO,
typename T2,
size_t N >
3101 struct SubTrait< DenseColumn<T1,SO>, StaticVector<T2,N,false> >
3103 typedef typename SubTrait< typename DenseColumn<T1,SO>::ResultType,
3104 StaticVector<T2,N,false> >::Type Type;
3107 template<
typename T1,
size_t N,
typename T2,
bool SO >
3108 struct SubTrait< StaticVector<T1,N,false>, DenseColumn<T2,SO> >
3110 typedef typename SubTrait< StaticVector<T1,N,false>,
3111 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3114 template<
typename T1,
bool SO,
typename T2 >
3115 struct SubTrait< DenseColumn<T1,SO>, DynamicVector<T2,false> >
3117 typedef typename SubTrait< typename DenseColumn<T1,SO>::ResultType,
3118 DynamicVector<T2,false> >::Type Type;
3121 template<
typename T1,
typename T2,
bool SO >
3122 struct SubTrait< DynamicVector<T1,false>, DenseColumn<T2,SO> >
3124 typedef typename SubTrait< DynamicVector<T1,false>,
3125 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3128 template<
typename T1,
bool SO,
typename T2 >
3129 struct SubTrait< DenseColumn<T1,SO>, CompressedVector<T2,false> >
3131 typedef typename SubTrait< typename DenseColumn<T1,SO>::ResultType,
3132 CompressedVector<T2,false> >::Type Type;
3135 template<
typename T1,
typename T2,
bool SO >
3136 struct SubTrait< CompressedVector<T1,false>, DenseColumn<T2,SO> >
3138 typedef typename SubTrait< CompressedVector<T1,false>,
3139 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3142 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3143 struct SubTrait< DenseColumn<T1,SO1>, DenseColumn<T2,SO2> >
3145 typedef typename SubTrait< typename DenseColumn<T1,SO1>::ResultType,
3146 typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3162 template<
typename T1,
bool SO,
typename T2 >
3163 struct MultTrait< DenseColumn<T1,SO>, T2 >
3165 typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType, T2 >::Type Type;
3169 template<
typename T1,
typename T2,
bool SO >
3170 struct MultTrait< T1, DenseColumn<T2,SO> >
3172 typedef typename MultTrait< T1, typename DenseColumn<T2,SO>::ResultType >::Type Type;
3176 template<
typename T1,
bool SO,
typename T2,
size_t N,
bool TF >
3177 struct MultTrait< DenseColumn<T1,SO>, StaticVector<T2,N,TF> >
3179 typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType,
3180 StaticVector<T2,N,TF> >::Type Type;
3183 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool SO >
3184 struct MultTrait< StaticVector<T1,N,TF>, DenseColumn<T2,SO> >
3186 typedef typename MultTrait< StaticVector<T1,N,TF>,
3187 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3190 template<
typename T1,
bool SO,
typename T2,
bool TF >
3191 struct MultTrait< DenseColumn<T1,SO>, DynamicVector<T2,TF> >
3193 typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType,
3194 DynamicVector<T2,TF> >::Type Type;
3197 template<
typename T1,
bool TF,
typename T2,
bool SO >
3198 struct MultTrait< DynamicVector<T1,TF>, DenseColumn<T2,SO> >
3200 typedef typename MultTrait< DynamicVector<T1,TF>,
3201 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3204 template<
typename T1,
bool SO,
typename T2,
bool TF >
3205 struct MultTrait< DenseColumn<T1,SO>, CompressedVector<T2,TF> >
3207 typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType,
3208 CompressedVector<T2,TF> >::Type Type;
3211 template<
typename T1,
bool TF,
typename T2,
bool SO >
3212 struct MultTrait< CompressedVector<T1,TF>, DenseColumn<T2,SO> >
3214 typedef typename MultTrait< CompressedVector<T1,TF>,
3215 typename DenseColumn<T2,SO>::ResultType >::Type Type;
3218 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3219 struct MultTrait< DenseColumn<T1,SO1>, DenseColumn<T2,SO2> >
3221 typedef typename MultTrait< typename DenseColumn<T1,SO1>::ResultType,
3222 typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3225 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
3226 struct MultTrait< StaticMatrix<T1,M,N,SO1>, DenseColumn<T2,SO2> >
3228 typedef typename MultTrait< StaticMatrix<T1,M,N,SO1>,
3229 typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3232 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3233 struct MultTrait< DynamicMatrix<T1,SO1>, DenseColumn<T2,SO2> >
3235 typedef typename MultTrait< DynamicMatrix<T1,SO1>,
3236 typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3239 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3240 struct MultTrait< CompressedMatrix<T1,SO1>, DenseColumn<T2,SO2> >
3242 typedef typename MultTrait< CompressedMatrix<T1,SO1>,
3243 typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3259 template<
typename T1,
bool SO,
typename T2 >
3260 struct DivTrait< DenseColumn<T1,SO>, T2 >
3262 typedef typename DivTrait< typename DenseColumn<T1,SO>::ResultType, T2 >::Type Type;