22 #ifndef _BLAZE_MATH_VIEWS_DENSEROW_H_
23 #define _BLAZE_MATH_VIEWS_DENSEROW_H_
288 template<
typename MT
289 ,
bool SO = IsRowMajorMatrix<MT>::value >
340 enum { vectorizable = MT::vectorizable };
346 explicit inline DenseRow( 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 DenseRow& 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,true>& rhs );
462 template<
typename VT >
463 inline typename EnableIf< VectorizedAssign<VT> >::Type
464 assign(
const DenseVector<VT,true>& rhs );
466 template<
typename VT >
inline void assign(
const SparseVector<VT,true>& rhs );
468 template<
typename VT >
469 inline typename DisableIf< VectorizedAddAssign<VT> >::Type
470 addAssign(
const DenseVector<VT,true>& rhs );
472 template<
typename VT >
473 inline typename EnableIf< VectorizedAddAssign<VT> >::Type
474 addAssign(
const DenseVector<VT,true>& rhs );
476 template<
typename VT >
inline void addAssign(
const SparseVector<VT,true>& rhs );
478 template<
typename VT >
479 inline typename DisableIf< VectorizedSubAssign<VT> >::Type
480 subAssign(
const DenseVector<VT,true>& rhs );
482 template<
typename VT >
483 inline typename EnableIf< VectorizedSubAssign<VT> >::Type
484 subAssign(
const DenseVector<VT,true>& rhs );
486 template<
typename VT >
inline void subAssign(
const SparseVector<VT,true>& rhs );
488 template<
typename VT >
489 inline typename DisableIf< VectorizedMultAssign<VT> >::Type
490 multAssign(
const DenseVector<VT,true>& rhs );
492 template<
typename VT >
493 inline typename EnableIf< VectorizedMultAssign<VT> >::Type
494 multAssign(
const DenseVector<VT,true>& rhs );
496 template<
typename VT >
inline void multAssign(
const SparseVector<VT,true>& rhs );
535 template<
typename MT
542 throw std::invalid_argument(
"Invalid row access index" );
561 template<
typename MT
566 return matrix_(row_,index);
577 template<
typename MT
582 return matrix_(row_,index);
592 template<
typename MT
596 return matrix_.data( row_ );
606 template<
typename MT
610 return matrix_.data( row_ );
622 template<
typename MT
626 return matrix_.begin( row_ );
638 template<
typename MT
642 return matrix_.begin( row_ );
654 template<
typename MT
658 return matrix_.begin( row_ );
670 template<
typename MT
674 return matrix_.end( row_ );
686 template<
typename MT
690 return matrix_.end( row_ );
702 template<
typename MT
706 return matrix_.end( row_ );
725 template<
typename MT
729 const size_t columns( size() );
731 for(
size_t j=0UL; j<
columns; ++j )
732 matrix_(row_,j) = rhs;
749 template<
typename MT
753 if( &rhs ==
this )
return *
this;
755 if( size() != rhs.
size() )
756 throw std::invalid_argument(
"Row sizes do not match" );
758 const size_t columns( size() );
760 for(
size_t j=0UL; j<
columns; ++j )
761 matrix_(row_,j) = rhs[j];
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( &matrix_ ) ) {
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( &matrix_ ) ) {
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( &matrix_ ) ) {
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_.columns();
982 template<
typename MT
986 return matrix_.capacity( row_ );
999 template<
typename MT
1003 return matrix_.nonZeros( row_ );
1013 template<
typename MT
1017 matrix_.reset( row_ );
1028 template<
typename MT
1030 template<
typename Other >
1033 for(
size_t j=0UL; j<size(); ++j ) {
1034 matrix_(row_,j) *= 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( row_, index );
1120 template<
typename MT
1122 template<
typename VT >
1128 const size_t jend( (~rhs).size() &
size_t(-2) );
1129 for(
size_t j=0UL; j<jend; j+=2UL ) {
1130 matrix_(row_,j ) = (~rhs)[j ];
1131 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1133 if( jend < (~rhs).size() )
1134 matrix_(row_,jend) = (~rhs)[jend];
1150 template<
typename MT
1152 template<
typename VT >
1160 const size_t columns( size() );
1164 for(
size_t j=0UL; j<
columns; j+=IT::size ) {
1165 stream( &matrix_(row_,j), (~rhs).
get(j) );
1170 BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == ( columns &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1171 const size_t jend( columns &
size_t(-IT::size*4) );
1173 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1174 store( &matrix_(row_,j ), (~rhs).
get(j ) );
1175 store( &matrix_(row_,j+IT::size ), (~rhs).
get(j+IT::size ) );
1176 store( &matrix_(row_,j+IT::size*2UL), (~rhs).
get(j+IT::size*2UL) );
1177 store( &matrix_(row_,j+IT::size*3UL), (~rhs).
get(j+IT::size*3UL) );
1179 for(
size_t j=jend; j<
columns; j+=IT::size ) {
1180 store( &matrix_(row_,j), (~rhs).
get(j) );
1198 template<
typename MT
1200 template<
typename VT >
1205 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1206 matrix_(row_,element->index()) = element->value();
1222 template<
typename MT
1224 template<
typename VT >
1230 const size_t jend( (~rhs).size() &
size_t(-2) );
1231 for(
size_t j=0UL; j<jend; j+=2UL ) {
1232 matrix_(row_,j ) += (~rhs)[j ];
1233 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1235 if( jend < (~rhs).size() )
1236 matrix_(row_,jend) += (~rhs)[jend];
1252 template<
typename MT
1254 template<
typename VT >
1262 const size_t columns( size() );
1264 BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == ( columns &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1265 const size_t jend( columns &
size_t(-IT::size*4) );
1267 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1268 store( &matrix_(row_,j ),
load( &matrix_(row_,j ) ) + (~rhs).
get(j ) );
1269 store( &matrix_(row_,j+IT::size ),
load( &matrix_(row_,j+IT::size ) ) + (~rhs).
get(j+IT::size ) );
1270 store( &matrix_(row_,j+IT::size*2UL),
load( &matrix_(row_,j+IT::size*2UL) ) + (~rhs).
get(j+IT::size*2UL) );
1271 store( &matrix_(row_,j+IT::size*3UL),
load( &matrix_(row_,j+IT::size*3UL) ) + (~rhs).
get(j+IT::size*3UL) );
1273 for(
size_t j=jend; j<
columns; j+=IT::size ) {
1274 store( &matrix_(row_,j),
load( &matrix_(row_,j) ) + (~rhs).
get(j) );
1291 template<
typename MT
1293 template<
typename VT >
1298 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1299 matrix_(row_,element->index()) += element->value();
1315 template<
typename MT
1317 template<
typename VT >
1323 const size_t jend( (~rhs).size() &
size_t(-2) );
1324 for(
size_t j=0UL; j<jend; j+=2UL ) {
1325 matrix_(row_,j ) -= (~rhs)[j ];
1326 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
1328 if( jend < (~rhs).size() )
1329 matrix_(row_,jend) -= (~rhs)[jend];
1345 template<
typename MT
1347 template<
typename VT >
1355 const size_t columns( size() );
1357 BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == ( columns &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1358 const size_t jend( columns &
size_t(-IT::size*4) );
1360 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1361 store( &matrix_(row_,j ),
load( &matrix_(row_,j ) ) - (~rhs).
get(j ) );
1362 store( &matrix_(row_,j+IT::size ),
load( &matrix_(row_,j+IT::size ) ) - (~rhs).
get(j+IT::size ) );
1363 store( &matrix_(row_,j+IT::size*2UL),
load( &matrix_(row_,j+IT::size*2UL) ) - (~rhs).
get(j+IT::size*2UL) );
1364 store( &matrix_(row_,j+IT::size*3UL),
load( &matrix_(row_,j+IT::size*3UL) ) - (~rhs).
get(j+IT::size*3UL) );
1366 for(
size_t j=jend; j<
columns; j+=IT::size ) {
1367 store( &matrix_(row_,j),
load( &matrix_(row_,j) ) - (~rhs).
get(j) );
1384 template<
typename MT
1386 template<
typename VT >
1391 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1392 matrix_(row_,element->index()) -= element->value();
1408 template<
typename MT
1410 template<
typename VT >
1416 const size_t jend( (~rhs).size() &
size_t(-2) );
1417 for(
size_t j=0UL; j<jend; j+=2UL ) {
1418 matrix_(row_,j ) *= (~rhs)[j ];
1419 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
1421 if( jend < (~rhs).size() )
1422 matrix_(row_,jend) *= (~rhs)[jend];
1438 template<
typename MT
1440 template<
typename VT >
1448 const size_t columns( size() );
1450 BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == ( columns &
size_t(-IT::size*4) ),
"Invalid end calculation" );
1451 const size_t jend( columns &
size_t(-IT::size*4) );
1453 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1454 store( &matrix_(row_,j ),
load( &matrix_(row_,j ) ) * (~rhs).
get(j ) );
1455 store( &matrix_(row_,j+IT::size ),
load( &matrix_(row_,j+IT::size ) ) * (~rhs).
get(j+IT::size ) );
1456 store( &matrix_(row_,j+IT::size*2UL),
load( &matrix_(row_,j+IT::size*2UL) ) * (~rhs).
get(j+IT::size*2UL) );
1457 store( &matrix_(row_,j+IT::size*3UL),
load( &matrix_(row_,j+IT::size*3UL) ) * (~rhs).
get(j+IT::size*3UL) );
1459 for(
size_t j=jend; j<
columns; j+=IT::size ) {
1460 store( &matrix_(row_,j),
load( &matrix_(row_,j) ) * (~rhs).
get(j) );
1477 template<
typename MT
1479 template<
typename VT >
1488 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1489 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
1514 template<
typename MT >
1532 typedef DenseRow<MT,false>
This;
1533 typedef typename RowTrait<MT>::Type
ResultType;
1543 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1549 template<
typename MatrixType >
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 RowIterator( MatrixType& matrix,
size_t row,
size_t column )
1601 template<
typename MatrixType2 >
1602 inline RowIterator(
const RowIterator<MatrixType2>& it )
1605 , column_( it.column_ )
1614 inline RowIterator& operator++() {
1625 inline const RowIterator operator++(
int ) {
1626 const RowIterator tmp( *
this );
1637 inline ReferenceType
operator*()
const {
1647 inline PointerType operator->()
const {
1658 template<
typename MatrixType2 >
1659 inline bool operator==(
const RowIterator<MatrixType2>& rhs )
const {
1660 return ( &
matrix_ == &rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1670 template<
typename MatrixType2 >
1671 inline bool operator!=(
const RowIterator<MatrixType2>& rhs )
const {
1672 return !( *
this == rhs );
1682 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
1683 return column_ - rhs.column_;
1696 template<
typename MatrixType2 >
friend class RowIterator;
1707 typedef typename SelectType< useConst, ConstIterator, RowIterator<MT> >::Type
Iterator;
1712 enum { vectorizable = 0 };
1718 explicit inline DenseRow( MT& matrix,
size_t index );
1746 template<
typename VT >
inline DenseRow&
operator= (
const Vector<VT,true>& rhs );
1747 template<
typename VT >
inline DenseRow& operator+=(
const Vector<VT,true>& rhs );
1748 template<
typename VT >
inline DenseRow& operator-=(
const Vector<VT,true>& rhs );
1749 template<
typename VT >
inline DenseRow& operator*=(
const Vector<VT,true>& rhs );
1751 template<
typename Other >
1752 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
1753 operator*=( Other rhs );
1755 template<
typename Other >
1756 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
1757 operator/=( Other rhs );
1764 inline size_t size()
const;
1767 inline void reset();
1768 template<
typename Other >
inline DenseRow& 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,true>& rhs );
1779 template<
typename VT >
inline void assign (
const SparseVector<VT,true>& rhs );
1780 template<
typename VT >
inline void addAssign (
const DenseVector <VT,true>& rhs );
1781 template<
typename VT >
inline void addAssign (
const SparseVector<VT,true>& rhs );
1782 template<
typename VT >
inline void subAssign (
const DenseVector <VT,true>& rhs );
1783 template<
typename VT >
inline void subAssign (
const SparseVector<VT,true>& rhs );
1784 template<
typename VT >
inline void multAssign(
const DenseVector <VT,true>& rhs );
1785 template<
typename VT >
inline void multAssign(
const SparseVector<VT,true>& rhs );
1826 template<
typename MT >
1832 throw std::invalid_argument(
"Invalid row access index" );
1853 template<
typename MT >
1857 return matrix_(row_,index);
1870 template<
typename MT >
1874 return matrix_(row_,index);
1888 template<
typename MT >
1891 return Iterator( matrix_, row_, 0UL );
1905 template<
typename MT >
1908 return ConstIterator( matrix_, row_, 0UL );
1922 template<
typename MT >
1925 return ConstIterator( matrix_, row_, 0UL );
1939 template<
typename MT >
1942 return Iterator( matrix_, row_, size() );
1956 template<
typename MT >
1959 return ConstIterator( matrix_, row_, size() );
1973 template<
typename MT >
1976 return ConstIterator( matrix_, row_, size() );
1997 template<
typename MT >
2000 const size_t columns( size() );
2002 for(
size_t j=0UL; j<
columns; ++j )
2003 matrix_(row_,j) = rhs;
2022 template<
typename MT >
2025 if( &rhs ==
this )
return *
this;
2027 if( size() != rhs.size() )
2028 throw std::invalid_argument(
"Row sizes do not match" );
2030 const size_t columns( size() );
2032 for(
size_t j=0UL; j<
columns; ++j )
2033 matrix_(row_,j) = rhs[j];
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( &matrix_ ) ) {
2062 const ResultType tmp( ~rhs );
2066 if( IsSparseVector<VT>::value )
2088 template<
typename MT >
2089 template<
typename VT >
2090 inline DenseRow<MT,false>& DenseRow<MT,false>::operator+=(
const Vector<VT,true>& rhs )
2097 if( size() != (~rhs).size() )
2098 throw std::invalid_argument(
"Vector sizes do not match" );
2100 if( (~rhs).canAlias( &matrix_ ) ) {
2101 const typename VT::ResultType tmp( ~rhs );
2125 template<
typename MT >
2126 template<
typename VT >
2127 inline DenseRow<MT,false>& DenseRow<MT,false>::operator-=(
const Vector<VT,true>& rhs )
2134 if( size() != (~rhs).size() )
2135 throw std::invalid_argument(
"Vector sizes do not match" );
2137 if( (~rhs).canAlias( &matrix_ ) ) {
2138 const typename VT::ResultType tmp( ~rhs );
2163 template<
typename MT >
2164 template<
typename VT >
2165 inline DenseRow<MT,false>& DenseRow<MT,false>::operator*=(
const Vector<VT,true>& rhs )
2172 if( size() != (~rhs).size() )
2173 throw std::invalid_argument(
"Vector sizes do not match" );
2175 if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
2176 const typename VT::ResultType tmp( ~rhs );
2197 template<
typename MT >
2198 template<
typename Other >
2199 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false> >::Type&
2200 DenseRow<MT,false>::operator*=( Other rhs )
2202 return operator=( (*
this) * rhs );
2218 template<
typename MT >
2219 template<
typename Other >
2220 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false> >::Type&
2221 DenseRow<MT,false>::operator/=( Other rhs )
2225 return operator=( (*
this) / rhs );
2245 template<
typename MT >
2248 return matrix_.columns();
2260 template<
typename MT >
2263 return matrix_.columns();
2278 template<
typename MT >
2281 const size_t columns( size() );
2282 size_t nonzeros( 0UL );
2284 for(
size_t j=0UL; j<
columns; ++j )
2300 template<
typename MT >
2304 const size_t columns( size() );
2305 for(
size_t j=0UL; j<
columns; ++j )
2306 reset( matrix_(row_,j) );
2319 template<
typename MT >
2320 template<
typename Other >
2321 inline DenseRow<MT,false>& DenseRow<MT,false>::scale(
const Other& scalar )
2323 for(
size_t j=0UL; j<size(); ++j ) {
2324 matrix_(row_,j) *= 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 jend( (~rhs).size() &
size_t(-2) );
2401 for(
size_t j=0UL; j<jend; j+=2UL ) {
2402 matrix_(row_,j ) = (~rhs)[j ];
2403 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
2405 if( jend < (~rhs).size() )
2406 matrix_(row_,jend) = (~rhs)[jend];
2424 template<
typename MT >
2425 template<
typename VT >
2430 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2431 matrix_(row_,element->index()) = element->value();
2449 template<
typename MT >
2450 template<
typename VT >
2455 const size_t jend( (~rhs).size() &
size_t(-2) );
2456 for(
size_t j=0UL; j<jend; j+=2UL ) {
2457 matrix_(row_,j ) += (~rhs)[j ];
2458 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
2460 if( jend < (~rhs).size() )
2461 matrix_(row_,jend) += (~rhs)[jend];
2479 template<
typename MT >
2480 template<
typename VT >
2485 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2486 matrix_(row_,element->index()) += element->value();
2504 template<
typename MT >
2505 template<
typename VT >
2510 const size_t jend( (~rhs).size() &
size_t(-2) );
2511 for(
size_t j=0UL; j<jend; j+=2UL ) {
2512 matrix_(row_,j ) -= (~rhs)[j ];
2513 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
2515 if( jend < (~rhs).size() )
2516 matrix_(row_,jend) -= (~rhs)[jend];
2534 template<
typename MT >
2535 template<
typename VT >
2540 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2541 matrix_(row_,element->index()) -= element->value();
2559 template<
typename MT >
2560 template<
typename VT >
2565 const size_t jend( (~rhs).size() &
size_t(-2) );
2566 for(
size_t j=0UL; j<jend; j+=2UL ) {
2567 matrix_(row_,j ) *= (~rhs)[j ];
2568 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
2570 if( jend < (~rhs).size() )
2571 matrix_(row_,jend) *= (~rhs)[jend];
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_(row_,element->index()) = tmp[element->index()] * element->value();
2621 template<
typename MT,
bool SO >
2622 inline void reset( DenseRow<MT,SO>&
row );
2624 template<
typename MT,
bool SO >
2625 inline void clear( DenseRow<MT,SO>&
row );
2627 template<
typename MT,
bool SO >
2628 inline bool isnan(
const DenseRow<MT,SO>&
row );
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<row.
size(); ++i ) {
2689 if(
isnan( row[i] ) )
return true;
2714 template<
typename MT
2718 for(
size_t i=0UL; i<row.
size(); ++i )
2719 if( !
isDefault( row[i] ) )
return false;
2752 template<
typename MT
2754 inline typename DisableIf< IsExpression<MT>, DenseRow<MT> >::Type
2783 template<
typename MT
2785 inline typename DisableIf< IsExpression<MT>, DenseRow<const MT> >::Type
2815 template<
typename MT
2817 inline typename EnableIf< IsMatMatAddExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2818 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2822 return row( (~dm).leftOperand(), index ) +
row( (~dm).rightOperand(), index );
2840 template<
typename MT
2842 inline typename EnableIf< IsMatMatSubExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2843 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2847 return row( (~dm).leftOperand(), index ) -
row( (~dm).rightOperand(), index );
2865 template<
typename MT
2867 inline typename EnableIf< IsMatMatMultExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2868 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2872 return row( (~dm).leftOperand(), index ) * (~dm).rightOperand();
2889 template<
typename MT
2891 inline typename EnableIf< IsVecTVecMultExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2892 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2896 return (~dm).leftOperand()[index] * (~dm).rightOperand();
2914 template<
typename MT
2916 inline typename EnableIf< IsMatScalarMultExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2917 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2921 return row( (~dm).leftOperand(), index ) * (~dm).rightOperand();
2939 template<
typename MT
2941 inline typename EnableIf< IsMatScalarDivExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2942 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2946 return row( (~dm).leftOperand(), index ) / (~dm).rightOperand();
2964 template<
typename MT
2966 inline typename EnableIf< IsMatAbsExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2967 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2971 return abs(
row( (~dm).operand(), index ) );
2989 template<
typename MT
2991 inline typename EnableIf< IsMatEvalExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
2992 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
2996 return eval(
row( (~dm).operand(), index ) );
3014 template<
typename MT
3016 inline typename EnableIf< IsMatTransExpr<MT>,
typename RowExprTrait<MT>::Type >::Type
3017 row(
const DenseMatrix<MT,SO>& dm,
size_t index )
3037 template<
typename T1,
bool SO,
typename T2,
size_t N >
3038 struct AddTrait< DenseRow<T1,SO>, StaticVector<T2,N,true> >
3040 typedef typename AddTrait< typename DenseRow<T1,SO>::ResultType,
3041 StaticVector<T2,N,true> >::Type Type;
3044 template<
typename T1,
size_t N,
typename T2,
bool SO >
3045 struct AddTrait< StaticVector<T1,N,true>, DenseRow<T2,SO> >
3047 typedef typename AddTrait< StaticVector<T1,N,true>,
3048 typename DenseRow<T2,SO>::ResultType >::Type Type;
3051 template<
typename T1,
bool SO,
typename T2 >
3052 struct AddTrait< DenseRow<T1,SO>, DynamicVector<T2,true> >
3054 typedef typename AddTrait< typename DenseRow<T1,SO>::ResultType,
3055 DynamicVector<T2,true> >::Type Type;
3058 template<
typename T1,
typename T2,
bool SO >
3059 struct AddTrait< DynamicVector<T1,true>, DenseRow<T2,SO> >
3061 typedef typename AddTrait< DynamicVector<T1,true>,
3062 typename DenseRow<T2,SO>::ResultType >::Type Type;
3065 template<
typename T1,
bool SO,
typename T2 >
3066 struct AddTrait< DenseRow<T1,SO>, CompressedVector<T2,true> >
3068 typedef typename AddTrait< typename DenseRow<T1,SO>::ResultType,
3069 CompressedVector<T2,true> >::Type Type;
3072 template<
typename T1,
typename T2,
bool SO >
3073 struct AddTrait< CompressedVector<T1,true>, DenseRow<T2,SO> >
3075 typedef typename AddTrait< CompressedVector<T1,true>,
3076 typename DenseRow<T2,SO>::ResultType >::Type Type;
3079 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3080 struct AddTrait< DenseRow<T1,SO1>, DenseRow<T2,SO2> >
3082 typedef typename AddTrait< typename DenseRow<T1,SO1>::ResultType,
3083 typename DenseRow<T2,SO2>::ResultType >::Type Type;
3099 template<
typename T1,
bool SO,
typename T2,
size_t N >
3100 struct SubTrait< DenseRow<T1,SO>, StaticVector<T2,N,true> >
3102 typedef typename SubTrait< typename DenseRow<T1,SO>::ResultType,
3103 StaticVector<T2,N,true> >::Type Type;
3106 template<
typename T1,
size_t N,
typename T2,
bool SO >
3107 struct SubTrait< StaticVector<T1,N,true>, DenseRow<T2,SO> >
3109 typedef typename SubTrait< StaticVector<T1,N,true>,
3110 typename DenseRow<T2,SO>::ResultType >::Type Type;
3113 template<
typename T1,
bool SO,
typename T2 >
3114 struct SubTrait< DenseRow<T1,SO>, DynamicVector<T2,true> >
3116 typedef typename SubTrait< typename DenseRow<T1,SO>::ResultType,
3117 DynamicVector<T2,true> >::Type Type;
3120 template<
typename T1,
typename T2,
bool SO >
3121 struct SubTrait< DynamicVector<T1,true>, DenseRow<T2,SO> >
3123 typedef typename SubTrait< DynamicVector<T1,true>,
3124 typename DenseRow<T2,SO>::ResultType >::Type Type;
3127 template<
typename T1,
bool SO,
typename T2 >
3128 struct SubTrait< DenseRow<T1,SO>, CompressedVector<T2,true> >
3130 typedef typename SubTrait< typename DenseRow<T1,SO>::ResultType,
3131 CompressedVector<T2,true> >::Type Type;
3134 template<
typename T1,
typename T2,
bool SO >
3135 struct SubTrait< CompressedVector<T1,true>, DenseRow<T2,SO> >
3137 typedef typename SubTrait< CompressedVector<T1,true>,
3138 typename DenseRow<T2,SO>::ResultType >::Type Type;
3141 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3142 struct SubTrait< DenseRow<T1,SO1>, DenseRow<T2,SO2> >
3144 typedef typename SubTrait< typename DenseRow<T1,SO1>::ResultType,
3145 typename DenseRow<T2,SO2>::ResultType >::Type Type;
3161 template<
typename T1,
bool SO,
typename T2 >
3162 struct MultTrait< DenseRow<T1,SO>, T2 >
3164 typedef typename MultTrait< typename DenseRow<T1,SO>::ResultType, T2 >::Type Type;
3168 template<
typename T1,
typename T2,
bool SO >
3169 struct MultTrait< T1, DenseRow<T2,SO> >
3171 typedef typename MultTrait< T1, typename DenseRow<T2,SO>::ResultType >::Type Type;
3175 template<
typename T1,
bool SO,
typename T2,
size_t N,
bool TF >
3176 struct MultTrait< DenseRow<T1,SO>, StaticVector<T2,N,TF> >
3178 typedef typename MultTrait< typename DenseRow<T1,SO>::ResultType,
3179 StaticVector<T2,N,TF> >::Type Type;
3182 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool SO >
3183 struct MultTrait< StaticVector<T1,N,TF>, DenseRow<T2,SO> >
3185 typedef typename MultTrait< StaticVector<T1,N,TF>,
3186 typename DenseRow<T2,SO>::ResultType >::Type Type;
3189 template<
typename T1,
bool SO,
typename T2,
bool TF >
3190 struct MultTrait< DenseRow<T1,SO>, DynamicVector<T2,TF> >
3192 typedef typename MultTrait< typename DenseRow<T1,SO>::ResultType,
3193 DynamicVector<T2,TF> >::Type Type;
3196 template<
typename T1,
bool TF,
typename T2,
bool SO >
3197 struct MultTrait< DynamicVector<T1,TF>, DenseRow<T2,SO> >
3199 typedef typename MultTrait< DynamicVector<T1,TF>,
3200 typename DenseRow<T2,SO>::ResultType >::Type Type;
3203 template<
typename T1,
bool SO,
typename T2,
bool TF >
3204 struct MultTrait< DenseRow<T1,SO>, CompressedVector<T2,TF> >
3206 typedef typename MultTrait< typename DenseRow<T1,SO>::ResultType,
3207 CompressedVector<T2,TF> >::Type Type;
3210 template<
typename T1,
bool TF,
typename T2,
bool SO >
3211 struct MultTrait< CompressedVector<T1,TF>, DenseRow<T2,SO> >
3213 typedef typename MultTrait< CompressedVector<T1,TF>,
3214 typename DenseRow<T2,SO>::ResultType >::Type Type;
3217 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3218 struct MultTrait< DenseRow<T1,SO1>, DenseRow<T2,SO2> >
3220 typedef typename MultTrait< typename DenseRow<T1,SO1>::ResultType,
3221 typename DenseRow<T2,SO2>::ResultType >::Type Type;
3224 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
3225 struct MultTrait< DenseRow<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
3227 typedef typename MultTrait< typename DenseRow<T1,SO1>::ResultType,
3228 StaticMatrix<T2,M,N,SO2> >::Type Type;
3231 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3232 struct MultTrait< DenseRow<T1,SO1>, DynamicMatrix<T2,SO2> >
3234 typedef typename MultTrait< typename DenseRow<T1,SO1>::ResultType,
3235 DynamicMatrix<T2,SO2> >::Type Type;
3238 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
3239 struct MultTrait< DenseRow<T1,SO1>, CompressedMatrix<T2,SO2> >
3241 typedef typename MultTrait< typename DenseRow<T1,SO1>::ResultType,
3242 CompressedMatrix<T2,SO2> >::Type Type;
3258 template<
typename T1,
bool SO,
typename T2 >
3259 struct DivTrait< DenseRow<T1,SO>, T2 >
3261 typedef typename DivTrait< typename DenseRow<T1,SO>::ResultType, T2 >::Type Type;