35 #ifndef _BLAZE_MATH_VIEWS_DENSEROW_H_
36 #define _BLAZE_MATH_VIEWS_DENSEROW_H_
335 template<
typename MT
336 ,
bool SO = IsRowMajorMatrix<MT>::value
337 ,
bool SF = IsSymmetric<MT>::value >
392 enum { vectorizable = MT::vectorizable };
395 enum { smpAssignable = MT::smpAssignable };
401 explicit inline DenseRow( MT& matrix,
size_t index );
414 inline ConstReference
operator[](
size_t index )
const;
415 inline Pointer
data ();
416 inline ConstPointer
data ()
const;
417 inline Iterator
begin ();
418 inline ConstIterator
begin ()
const;
419 inline ConstIterator
cbegin()
const;
420 inline Iterator
end ();
421 inline ConstIterator
end ()
const;
422 inline ConstIterator
cend ()
const;
432 template<
typename VT >
inline DenseRow&
operator= (
const Vector<VT,true>& rhs );
433 template<
typename VT >
inline DenseRow& operator+=(
const Vector<VT,true>& rhs );
434 template<
typename VT >
inline DenseRow& operator-=(
const Vector<VT,true>& rhs );
435 template<
typename VT >
inline DenseRow& operator*=(
const Vector<VT,true>& rhs );
437 template<
typename Other >
438 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
439 operator*=( Other rhs );
441 template<
typename Other >
442 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
443 operator/=( Other rhs );
450 inline size_t size()
const;
454 template<
typename Other >
inline DenseRow& scale(
const Other& scalar );
461 template<
typename VT >
463 struct VectorizedAssign {
464 enum { value = vectorizable && VT::vectorizable &&
465 IsSame<ElementType,typename VT::ElementType>::value };
472 template<
typename VT >
474 struct VectorizedAddAssign {
475 enum { value = vectorizable && VT::vectorizable &&
476 IsSame<ElementType,typename VT::ElementType>::value &&
477 IntrinsicTrait<ElementType>::addition };
484 template<
typename VT >
486 struct VectorizedSubAssign {
487 enum { value = vectorizable && VT::vectorizable &&
488 IsSame<ElementType,typename VT::ElementType>::value &&
489 IntrinsicTrait<ElementType>::subtraction };
496 template<
typename VT >
498 struct VectorizedMultAssign {
499 enum { value = vectorizable && VT::vectorizable &&
500 IsSame<ElementType,typename VT::ElementType>::value &&
501 IntrinsicTrait<ElementType>::multiplication };
510 template<
typename Other >
511 inline bool canAlias(
const Other* alias )
const;
513 template<
typename MT2,
bool SO2,
bool SF2 >
514 inline bool canAlias(
const DenseRow<MT2,SO2,SF2>* alias )
const;
516 template<
typename Other >
517 inline bool isAliased(
const Other* alias )
const;
519 template<
typename MT2,
bool SO2,
bool SF2 >
520 inline bool isAliased(
const DenseRow<MT2,SO2,SF2>* alias )
const;
532 template<
typename VT >
533 inline typename DisableIf< VectorizedAssign<VT> >::Type
534 assign(
const DenseVector<VT,true>& rhs );
536 template<
typename VT >
537 inline typename EnableIf< VectorizedAssign<VT> >::Type
538 assign(
const DenseVector<VT,true>& rhs );
540 template<
typename VT >
inline void assign(
const SparseVector<VT,true>& rhs );
542 template<
typename VT >
543 inline typename DisableIf< VectorizedAddAssign<VT> >::Type
544 addAssign(
const DenseVector<VT,true>& rhs );
546 template<
typename VT >
547 inline typename EnableIf< VectorizedAddAssign<VT> >::Type
548 addAssign(
const DenseVector<VT,true>& rhs );
550 template<
typename VT >
inline void addAssign(
const SparseVector<VT,true>& rhs );
552 template<
typename VT >
553 inline typename DisableIf< VectorizedSubAssign<VT> >::Type
554 subAssign(
const DenseVector<VT,true>& rhs );
556 template<
typename VT >
557 inline typename EnableIf< VectorizedSubAssign<VT> >::Type
558 subAssign(
const DenseVector<VT,true>& rhs );
560 template<
typename VT >
inline void subAssign(
const SparseVector<VT,true>& rhs );
562 template<
typename VT >
563 inline typename DisableIf< VectorizedMultAssign<VT> >::Type
564 multAssign(
const DenseVector<VT,true>& rhs );
566 template<
typename VT >
567 inline typename EnableIf< VectorizedMultAssign<VT> >::Type
568 multAssign(
const DenseVector<VT,true>& rhs );
570 template<
typename VT >
inline void multAssign(
const SparseVector<VT,true>& rhs );
578 template<
typename MT2,
bool SO2,
typename VT >
579 inline typename EnableIf< Not< IsRestricted<MT2> >,
bool >::Type
580 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const Vector<VT,true>& rhs );
582 template<
typename MT2,
bool SO2,
typename VT >
583 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
584 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
586 template<
typename MT2,
bool SO2,
typename VT >
587 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
588 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
590 template<
typename MT2,
bool SO2,
typename VT >
591 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
592 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
594 template<
typename MT2,
bool SO2,
typename VT >
595 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
596 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
598 template<
typename MT2,
bool SO2,
typename VT >
599 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
600 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
602 template<
typename MT2,
bool SO2,
typename VT >
603 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
604 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
618 template<
typename MT2,
bool SO2,
bool SF2 >
friend class DenseRow;
620 template<
typename MT2,
bool SO2,
bool SF2 >
623 template<
typename MT2,
bool SO2,
bool SF2 >
659 template<
typename MT
667 throw std::invalid_argument(
"Invalid row access index" );
686 template<
typename MT
692 return matrix_(row_,index);
703 template<
typename MT
710 return matrix_(row_,index);
722 template<
typename MT
727 return matrix_.data( row_ );
739 template<
typename MT
744 return matrix_.data( row_ );
756 template<
typename MT
761 return matrix_.begin( row_ );
773 template<
typename MT
778 return matrix_.cbegin( row_ );
790 template<
typename MT
795 return matrix_.cbegin( row_ );
807 template<
typename MT
812 return matrix_.end( row_ );
824 template<
typename MT
829 return matrix_.cend( row_ );
841 template<
typename MT
846 return matrix_.cend( row_ );
869 template<
typename MT
885 for(
size_t j=jbegin; j<jend; ++j )
886 matrix_(row_,j) = rhs;
906 template<
typename MT
911 if( &rhs ==
this )
return *
this;
914 throw std::invalid_argument(
"Row sizes do not match" );
916 if( !preservesInvariant( matrix_, rhs ) )
917 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
944 template<
typename MT
947 template<
typename VT >
954 throw std::invalid_argument(
"Vector sizes do not match" );
959 if( !preservesInvariant( matrix_, right ) )
960 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
996 template<
typename MT
999 template<
typename VT >
1006 throw std::invalid_argument(
"Vector sizes do not match" );
1009 Right right( ~rhs );
1011 if( !preservesInvariant( matrix_, right ) )
1012 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
1045 template<
typename MT
1048 template<
typename VT >
1055 throw std::invalid_argument(
"Vector sizes do not match" );
1058 Right right( ~rhs );
1060 if( !preservesInvariant( matrix_, right ) )
1061 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
1092 template<
typename MT
1095 template<
typename VT >
1102 throw std::invalid_argument(
"Vector sizes do not match" );
1132 template<
typename MT
1135 template<
typename Other >
1141 return operator=( (*
this) * rhs );
1158 template<
typename MT
1161 template<
typename Other >
1169 return operator=( (*
this) / rhs );
1187 template<
typename MT
1192 return matrix_.columns();
1202 template<
typename MT
1207 return matrix_.capacity( row_ );
1220 template<
typename MT
1225 return matrix_.nonZeros( row_ );
1235 template<
typename MT
1240 matrix_.reset( row_ );
1255 template<
typename MT
1258 template<
typename Other >
1274 for(
size_t j=jbegin; j<jend; ++j ) {
1275 matrix_(row_,j) *= scalar;
1294 template<
typename MT
1297 template<
typename MT2
1321 template<
typename MT
1324 template<
typename MT2
1339 for(
size_t i=ibegin; i<
size(); ++i ) {
1360 template<
typename MT
1363 template<
typename MT2
1366 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
1376 const RhsIterator last( (~rhs).
end() );
1377 RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( row_ ):( row_+1UL ) ) );
1380 if( element == last || element->index() != row_ || !
isOne( element->value() ) )
1385 for( ; element!=last; ++element ) {
1406 template<
typename MT
1409 template<
typename MT2
1421 for(
size_t i=0UL; i<iend; ++i ) {
1445 template<
typename MT
1448 template<
typename MT2
1451 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
1465 for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
1486 template<
typename MT
1489 template<
typename MT2
1499 for(
size_t i=0UL; i<row_; ++i ) {
1504 for(
size_t i=row_+1UL; i<
size(); ++i ) {
1525 template<
typename MT
1528 template<
typename MT2
1531 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
1540 for( RhsIterator element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1541 if( element->index() != row_ && !
isDefault( element->value() ) )
1568 template<
typename MT
1571 template<
typename Other >
1574 return matrix_.isAliased( alias );
1589 template<
typename MT
1592 template<
typename MT2
1597 return matrix_.isAliased( &alias->
matrix_ ) && ( row_ == alias->
row_ );
1612 template<
typename MT
1615 template<
typename Other >
1618 return matrix_.isAliased( alias );
1633 template<
typename MT
1636 template<
typename MT2
1641 return matrix_.isAliased( &alias->
matrix_ ) && ( row_ == alias->
row_ );
1655 template<
typename MT
1660 return matrix_.isAligned();
1675 template<
typename MT
1697 template<
typename MT
1703 return matrix_.load( row_, index );
1720 template<
typename MT
1726 return matrix_.loadu( row_, index );
1744 template<
typename MT
1749 matrix_.store( row_, index, value );
1767 template<
typename MT
1772 matrix_.storeu( row_, index, value );
1790 template<
typename MT
1795 matrix_.stream( row_, index, value );
1811 template<
typename MT
1814 template<
typename VT >
1822 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1823 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1824 matrix_(row_,j ) = (~rhs)[j ];
1825 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1827 if( jpos < (~rhs).size() )
1828 matrix_(row_,jpos) = (~rhs)[jpos];
1844 template<
typename MT
1847 template<
typename VT >
1861 matrix_.stream( row_, j, (~rhs).
load(j) );
1866 const size_t jpos( columns &
size_t(-
IT::size*4) );
1870 for(
size_t j=0UL; j<jpos; j+=
IT::size*4UL ) {
1871 matrix_.store( row_, j , it.load() ); it +=
IT::size;
1877 matrix_.store( row_, j, it.load() );
1895 template<
typename MT
1898 template<
typename VT >
1906 matrix_(row_,element->index()) = element->value();
1922 template<
typename MT
1925 template<
typename VT >
1933 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1934 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1935 matrix_(row_,j ) += (~rhs)[j ];
1936 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1938 if( jpos < (~rhs).size() )
1939 matrix_(row_,jpos) += (~rhs)[jpos];
1955 template<
typename MT
1958 template<
typename VT >
1969 const size_t jpos( columns &
size_t(-
IT::size*4) );
1973 for(
size_t j=0UL; j<jpos; j+=
IT::size*4UL ) {
1974 matrix_.store( row_, j , matrix_.load(row_,j ) + it.load() ); it +=
IT::size;
1980 matrix_.store( row_, j, matrix_.load(row_,j) + it.load() );
1997 template<
typename MT
2000 template<
typename VT >
2008 matrix_(row_,element->index()) += element->value();
2024 template<
typename MT
2027 template<
typename VT >
2035 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2036 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2037 matrix_(row_,j ) -= (~rhs)[j ];
2038 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
2040 if( jpos < (~rhs).size() )
2041 matrix_(row_,jpos) -= (~rhs)[jpos];
2057 template<
typename MT
2060 template<
typename VT >
2071 const size_t jpos( columns &
size_t(-
IT::size*4) );
2075 for(
size_t j=0UL; j<jpos; j+=
IT::size*4UL ) {
2076 matrix_.store( row_, j , matrix_.load(row_,j ) - it.load() ); it +=
IT::size;
2082 matrix_.store( row_, j, matrix_.load(row_,j) - it.load() );
2099 template<
typename MT
2102 template<
typename VT >
2110 matrix_(row_,element->index()) -= element->value();
2126 template<
typename MT
2129 template<
typename VT >
2137 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2138 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2139 matrix_(row_,j ) *= (~rhs)[j ];
2140 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
2142 if( jpos < (~rhs).size() )
2143 matrix_(row_,jpos) *= (~rhs)[jpos];
2159 template<
typename MT
2162 template<
typename VT >
2173 const size_t jpos( columns &
size_t(-
IT::size*4) );
2177 for(
size_t j=0UL; j<jpos; j+=
IT::size*4UL ) {
2178 matrix_.store( row_, j , matrix_.load(row_,j ) * it.load() ); it +=
IT::size;
2184 matrix_.store( row_, j, matrix_.load(row_,j) * it.load() );
2201 template<
typename MT
2204 template<
typename VT >
2216 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
2241 template<
typename MT >
2264 typedef DenseRow<MT,false,false>
This;
2265 typedef typename RowTrait<MT>::Type
ResultType;
2275 typedef typename IfTrue< useConst, ConstReference, typename MT::Reference >::Type
Reference;
2281 template<
typename MatrixType >
2292 enum { returnConst = IsConst<MatrixType>::value };
2298 typedef typename IfTrue< returnConst
2302 typedef std::random_access_iterator_tag IteratorCategory;
2303 typedef RemoveReference<Reference> ValueType;
2304 typedef ValueType* PointerType;
2305 typedef Reference ReferenceType;
2306 typedef ptrdiff_t DifferenceType;
2309 typedef IteratorCategory iterator_category;
2310 typedef ValueType value_type;
2311 typedef PointerType pointer;
2312 typedef ReferenceType reference;
2313 typedef DifferenceType difference_type;
2319 inline RowIterator()
2333 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
2345 template<
typename MatrixType2 >
2346 inline RowIterator(
const RowIterator<MatrixType2>& it )
2349 , column_( it.column_ )
2359 inline RowIterator& operator+=(
size_t inc ) {
2371 inline RowIterator& operator-=(
size_t dec ) {
2382 inline RowIterator& operator++() {
2393 inline const RowIterator operator++(
int ) {
2394 const RowIterator tmp( *
this );
2405 inline RowIterator& operator--() {
2416 inline const RowIterator operator--(
int ) {
2417 const RowIterator tmp( *
this );
2429 inline ReferenceType
operator[](
size_t index )
const {
2439 inline ReferenceType
operator*()
const {
2449 inline PointerType operator->()
const {
2450 return &(*matrix_)(
row_,column_);
2460 template<
typename MatrixType2 >
2461 inline bool operator==(
const RowIterator<MatrixType2>& rhs )
const {
2462 return (
matrix_ == rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2472 template<
typename MatrixType2 >
2473 inline bool operator!=(
const RowIterator<MatrixType2>& rhs )
const {
2474 return !( *
this == rhs );
2484 template<
typename MatrixType2 >
2485 inline bool operator<( const RowIterator<MatrixType2>& rhs )
const {
2486 return (
matrix_ == rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ < rhs.column_ );
2496 template<
typename MatrixType2 >
2497 inline bool operator>(
const RowIterator<MatrixType2>& rhs )
const {
2498 return (
matrix_ == rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ > rhs.column_ );
2508 template<
typename MatrixType2 >
2509 inline bool operator<=( const RowIterator<MatrixType2>& rhs )
const {
2510 return (
matrix_ == rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ <= rhs.column_ );
2520 template<
typename MatrixType2 >
2521 inline bool operator>=(
const RowIterator<MatrixType2>& rhs )
const {
2522 return (
matrix_ == rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ >= rhs.column_ );
2532 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
2533 return column_ - rhs.column_;
2544 friend inline const RowIterator
operator+(
const RowIterator& it,
size_t inc ) {
2545 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2556 friend inline const RowIterator
operator+(
size_t inc,
const RowIterator& it ) {
2557 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2568 friend inline const RowIterator
operator-(
const RowIterator& it,
size_t dec ) {
2569 return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2581 template<
typename MatrixType2 >
friend class RowIterator;
2591 typedef typename IfTrue< useConst, ConstIterator, RowIterator<MT> >::Type
Iterator;
2596 enum { vectorizable = 0 };
2599 enum { smpAssignable = MT::smpAssignable };
2605 explicit inline DenseRow( MT& matrix,
size_t index );
2618 inline ConstReference
operator[](
size_t index )
const;
2619 inline Iterator
begin ();
2620 inline ConstIterator
begin ()
const;
2621 inline ConstIterator
cbegin()
const;
2622 inline Iterator
end ();
2623 inline ConstIterator
end ()
const;
2624 inline ConstIterator
cend ()
const;
2634 template<
typename VT >
inline DenseRow&
operator= (
const Vector<VT,true>& rhs );
2635 template<
typename VT >
inline DenseRow& operator+=(
const Vector<VT,true>& rhs );
2636 template<
typename VT >
inline DenseRow& operator-=(
const Vector<VT,true>& rhs );
2637 template<
typename VT >
inline DenseRow& operator*=(
const Vector<VT,true>& rhs );
2639 template<
typename Other >
2640 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
2641 operator*=( Other rhs );
2643 template<
typename Other >
2644 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
2645 operator/=( Other rhs );
2652 inline size_t size()
const;
2655 inline void reset();
2656 template<
typename Other >
inline DenseRow& scale(
const Other& scalar );
2664 template<
typename Other >
2665 inline bool canAlias(
const Other* alias )
const;
2667 template<
typename MT2,
bool SO2,
bool SF2 >
2668 inline bool canAlias(
const DenseRow<MT2,SO2,SF2>* alias )
const;
2670 template<
typename Other >
2671 inline bool isAliased(
const Other* alias )
const;
2673 template<
typename MT2,
bool SO2,
bool SF2 >
2674 inline bool isAliased(
const DenseRow<MT2,SO2,SF2>* alias )
const;
2679 template<
typename VT >
inline void assign (
const DenseVector <VT,true>& rhs );
2680 template<
typename VT >
inline void assign (
const SparseVector<VT,true>& rhs );
2681 template<
typename VT >
inline void addAssign (
const DenseVector <VT,true>& rhs );
2682 template<
typename VT >
inline void addAssign (
const SparseVector<VT,true>& rhs );
2683 template<
typename VT >
inline void subAssign (
const DenseVector <VT,true>& rhs );
2684 template<
typename VT >
inline void subAssign (
const SparseVector<VT,true>& rhs );
2685 template<
typename VT >
inline void multAssign(
const DenseVector <VT,true>& rhs );
2686 template<
typename VT >
inline void multAssign(
const SparseVector<VT,true>& rhs );
2694 template<
typename MT2,
bool SO2,
typename VT >
2695 inline typename EnableIf< Not< IsRestricted<MT2> >,
bool >::Type
2696 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const Vector<VT,true>& rhs );
2698 template<
typename MT2,
bool SO2,
typename VT >
2699 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
2700 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
2702 template<
typename MT2,
bool SO2,
typename VT >
2703 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
2704 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
2706 template<
typename MT2,
bool SO2,
typename VT >
2707 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
2708 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
2710 template<
typename MT2,
bool SO2,
typename VT >
2711 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
2712 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
2714 template<
typename MT2,
bool SO2,
typename VT >
2715 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
2716 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
2718 template<
typename MT2,
bool SO2,
typename VT >
2719 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
2720 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
2733 template<
typename MT2,
bool SO2,
bool SF2 >
friend class DenseRow;
2735 template<
typename MT2,
bool SO2,
bool SF2 >
2736 friend bool isSame(
const DenseRow<MT2,SO2,SF2>& a,
const DenseRow<MT2,SO2,SF2>& b );
2738 template<
typename MT2,
bool SO2,
bool SF2 >
2739 friend typename DerestrictTrait< DenseRow<MT2,SO2,SF2> >::Type
2740 derestrict( DenseRow<MT2,SO2,SF2>& dm );
2751 BLAZE_STATIC_ASSERT( !IsRestricted<MT>::value || IsLower<MT>::value || IsUpper<MT>::value );
2774 template<
typename MT >
2780 throw std::invalid_argument(
"Invalid row access index" );
2801 template<
typename MT >
2806 return matrix_(row_,index);
2819 template<
typename MT >
2824 return matrix_(row_,index);
2838 template<
typename MT >
2841 return Iterator( matrix_, row_, 0UL );
2855 template<
typename MT >
2872 template<
typename MT >
2889 template<
typename MT >
2906 template<
typename MT >
2923 template<
typename MT >
2951 template<
typename MT >
2954 const size_t jbegin( ( IsUpper<MT>::value )
2955 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2959 const size_t jend ( ( IsLower<MT>::value )
2960 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2965 for(
size_t j=jbegin; j<jend; ++j )
2966 matrix_(row_,j) = rhs;
2988 template<
typename MT >
2991 if( &rhs ==
this )
return *
this;
2993 if(
size() != rhs.size() )
2994 throw std::invalid_argument(
"Row sizes do not match" );
2996 if( !preservesInvariant( matrix_, rhs ) )
2997 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
2999 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
3026 template<
typename MT >
3027 template<
typename VT >
3035 throw std::invalid_argument(
"Vector sizes do not match" );
3037 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
3038 Right right( ~rhs );
3040 if( !preservesInvariant( matrix_, right ) )
3041 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
3043 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
3045 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3046 const ResultType tmp( right );
3050 if( IsSparseVector<VT>::value )
3078 template<
typename MT >
3079 template<
typename VT >
3080 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator+=(
const Vector<VT,true>& rhs )
3086 throw std::invalid_argument(
"Vector sizes do not match" );
3088 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
3089 Right right( ~rhs );
3091 if( !preservesInvariant( matrix_, right ) )
3092 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
3094 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
3096 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3127 template<
typename MT >
3128 template<
typename VT >
3129 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator-=(
const Vector<VT,true>& rhs )
3135 throw std::invalid_argument(
"Vector sizes do not match" );
3137 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
3138 Right right( ~rhs );
3140 if( !preservesInvariant( matrix_, right ) )
3141 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
3143 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
3145 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3174 template<
typename MT >
3175 template<
typename VT >
3176 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator*=(
const Vector<VT,true>& rhs )
3182 throw std::invalid_argument(
"Vector sizes do not match" );
3184 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
3186 if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
3187 const ResultType tmp( *
this * (~rhs) );
3214 template<
typename MT >
3215 template<
typename Other >
3216 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,false> >::Type&
3217 DenseRow<MT,false,false>::operator*=( Other rhs )
3221 return operator=( (*
this) * rhs );
3240 template<
typename MT >
3241 template<
typename Other >
3242 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,false> >::Type&
3243 DenseRow<MT,false,false>::operator/=( Other rhs )
3249 return operator=( (*
this) / rhs );
3269 template<
typename MT >
3272 return matrix_.columns();
3284 template<
typename MT >
3287 return matrix_.columns();
3302 template<
typename MT >
3306 size_t nonzeros( 0UL );
3308 for(
size_t j=0UL; j<
columns; ++j )
3324 template<
typename MT >
3329 const size_t jbegin( ( IsUpper<MT>::value )
3330 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3334 const size_t jend ( ( IsLower<MT>::value )
3335 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3340 for(
size_t j=jbegin; j<jend; ++j )
3341 clear( matrix_(row_,j) );
3358 template<
typename MT >
3359 template<
typename Other >
3360 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::scale(
const Other& scalar )
3364 const size_t jbegin( ( IsUpper<MT>::value )
3365 ?( ( IsStrictlyUpper<MT>::value )
3369 const size_t jend ( ( IsLower<MT>::value )
3370 ?( ( IsStrictlyLower<MT>::value )
3375 for(
size_t j=jbegin; j<jend; ++j ) {
3376 matrix_(row_,j) *= scalar;
3397 template<
typename MT >
3398 template<
typename MT2
3401 inline typename EnableIf< Not< IsRestricted<MT2> >,
bool >::Type
3402 DenseRow<MT,false,false>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const Vector<VT,true>& rhs )
3424 template<
typename MT >
3425 template<
typename MT2
3428 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
3429 DenseRow<MT,false,false>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs )
3435 if( IsUniLower<MT2>::value && !
isOne( (~rhs)[row_] ) )
3438 const size_t ibegin( ( IsStrictlyLower<MT2>::value )?( row_ ):( row_+1UL ) );
3440 for(
size_t i=ibegin; i<
size(); ++i ) {
3463 template<
typename MT >
3464 template<
typename MT2
3467 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
3468 DenseRow<MT,false,false>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs )
3476 const bool checkDiagonal( IsUniLower<MT2>::value || IsStrictlyLower<MT2>::value );
3477 const RhsIterator last( (~rhs).
end() );
3478 RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( row_ ):( row_+1UL ) ) );
3480 if( IsUniLower<MT2>::value ) {
3481 if( element == last || element->index() != row_ || !
isOne( element->value() ) )
3486 for( ; element!=last; ++element ) {
3509 template<
typename MT >
3510 template<
typename MT2
3513 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
3514 DenseRow<MT,false,false>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs )
3520 const size_t iend( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) );
3522 for(
size_t i=0UL; i<iend; ++i ) {
3527 if( IsUniUpper<MT2>::value && !
isOne( (~rhs)[row_] ) )
3548 template<
typename MT >
3549 template<
typename MT2
3552 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
3553 DenseRow<MT,false,false>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs )
3561 const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) ) );
3563 if( IsUniUpper<MT2>::value && ( last == (~rhs).
end() || last->index() != row_ || !
isOne( last->value() ) ) )
3566 for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
3589 template<
typename MT >
3590 template<
typename MT2
3593 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
3594 DenseRow<MT,false,false>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs )
3600 for(
size_t i=0UL; i<row_; ++i ) {
3605 for(
size_t i=row_+1UL; i<
size(); ++i ) {
3628 template<
typename MT >
3629 template<
typename MT2
3632 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
3633 DenseRow<MT,false,false>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs )
3641 for( RhsIterator element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3642 if( element->index() != row_ && !
isDefault( element->value() ) )
3671 template<
typename MT >
3672 template<
typename Other >
3675 return matrix_.isAliased( alias );
3692 template<
typename MT >
3693 template<
typename MT2
3698 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3715 template<
typename MT >
3716 template<
typename Other >
3719 return matrix_.isAliased( alias );
3736 template<
typename MT >
3737 template<
typename MT2
3742 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3758 template<
typename MT >
3778 template<
typename MT >
3799 template<
typename MT >
3800 template<
typename VT >
3807 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3808 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3809 matrix_(row_,j ) = (~rhs)[j ];
3810 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
3812 if( jpos < (~rhs).size() )
3813 matrix_(row_,jpos) = (~rhs)[jpos];
3831 template<
typename MT >
3832 template<
typename VT >
3840 matrix_(row_,element->index()) = element->value();
3858 template<
typename MT >
3859 template<
typename VT >
3866 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3867 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3868 matrix_(row_,j ) += (~rhs)[j ];
3869 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
3871 if( jpos < (~rhs).size() )
3872 matrix_(row_,jpos) += (~rhs)[jpos];
3890 template<
typename MT >
3891 template<
typename VT >
3899 matrix_(row_,element->index()) += element->value();
3917 template<
typename MT >
3918 template<
typename VT >
3925 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3926 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3927 matrix_(row_,j ) -= (~rhs)[j ];
3928 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
3930 if( jpos < (~rhs).size() )
3931 matrix_(row_,jpos) -= (~rhs)[jpos];
3949 template<
typename MT >
3950 template<
typename VT >
3958 matrix_(row_,element->index()) -= element->value();
3976 template<
typename MT >
3977 template<
typename VT >
3984 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3985 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3986 matrix_(row_,j ) *= (~rhs)[j ];
3987 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
3989 if( jpos < (~rhs).size() )
3990 matrix_(row_,jpos) *= (~rhs)[jpos];
4008 template<
typename MT >
4009 template<
typename VT >
4016 const ResultType tmp(
serial( *
this ) );
4021 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
4047 template<
typename MT >
4048 class DenseRow<MT,false,true> :
public DenseVector< DenseRow<MT,false,true>, true >
4054 typedef typename If< IsExpression<MT>, MT, MT& >::Type
Operand;
4057 typedef IntrinsicTrait<typename MT::ElementType>
IT;
4068 enum { useConst = IsConst<MT>::value };
4073 typedef DenseRow<MT,false,true>
This;
4074 typedef typename RowTrait<MT>::Type
ResultType;
4085 typedef typename IfTrue< useConst, ConstReference, typename MT::Reference >::Type
Reference;
4091 typedef typename IfTrue< useConst, ConstPointer, ElementType* >::Type
Pointer;
4097 typedef typename IfTrue< useConst, ConstIterator, typename MT::Iterator >::Type
Iterator;
4102 enum { vectorizable = MT::vectorizable };
4105 enum { smpAssignable = MT::smpAssignable };
4111 explicit inline DenseRow( MT& matrix,
size_t index );
4124 inline ConstReference
operator[](
size_t index )
const;
4125 inline Pointer
data ();
4126 inline ConstPointer
data ()
const;
4127 inline Iterator
begin ();
4128 inline ConstIterator
begin ()
const;
4129 inline ConstIterator
cbegin()
const;
4130 inline Iterator
end ();
4131 inline ConstIterator
end ()
const;
4132 inline ConstIterator
cend ()
const;
4142 template<
typename VT >
inline DenseRow&
operator= (
const Vector<VT,true>& rhs );
4143 template<
typename VT >
inline DenseRow& operator+=(
const Vector<VT,true>& rhs );
4144 template<
typename VT >
inline DenseRow& operator-=(
const Vector<VT,true>& rhs );
4145 template<
typename VT >
inline DenseRow& operator*=(
const Vector<VT,true>& rhs );
4147 template<
typename Other >
4148 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
4149 operator*=( Other rhs );
4151 template<
typename Other >
4152 inline typename EnableIf< IsNumeric<Other>,
DenseRow >::Type&
4153 operator/=( Other rhs );
4160 inline size_t size()
const;
4163 inline void reset();
4164 template<
typename Other >
inline DenseRow& scale(
const Other& scalar );
4171 template<
typename VT >
4172 struct VectorizedAssign {
4173 enum { value = vectorizable && VT::vectorizable &&
4174 IsSame<ElementType,typename VT::ElementType>::value };
4180 template<
typename VT >
4181 struct VectorizedAddAssign {
4182 enum { value = vectorizable && VT::vectorizable &&
4183 IsSame<ElementType,typename VT::ElementType>::value &&
4184 IntrinsicTrait<ElementType>::addition };
4190 template<
typename VT >
4191 struct VectorizedSubAssign {
4192 enum { value = vectorizable && VT::vectorizable &&
4193 IsSame<ElementType,typename VT::ElementType>::value &&
4194 IntrinsicTrait<ElementType>::subtraction };
4200 template<
typename VT >
4201 struct VectorizedMultAssign {
4202 enum { value = vectorizable && VT::vectorizable &&
4203 IsSame<ElementType,typename VT::ElementType>::value &&
4204 IntrinsicTrait<ElementType>::multiplication };
4212 template<
typename Other >
4213 inline bool canAlias(
const Other* alias )
const;
4215 template<
typename MT2,
bool SO2,
bool SF2 >
4216 inline bool canAlias(
const DenseRow<MT2,SO2,SF2>* alias )
const;
4218 template<
typename Other >
4219 inline bool isAliased(
const Other* alias )
const;
4221 template<
typename MT2,
bool SO2,
bool SF2 >
4222 inline bool isAliased(
const DenseRow<MT2,SO2,SF2>* alias )
const;
4234 template<
typename VT >
4235 inline typename DisableIf< VectorizedAssign<VT> >::Type
4236 assign(
const DenseVector<VT,true>& rhs );
4238 template<
typename VT >
4239 inline typename EnableIf< VectorizedAssign<VT> >::Type
4240 assign(
const DenseVector<VT,true>& rhs );
4242 template<
typename VT >
inline void assign(
const SparseVector<VT,true>& rhs );
4244 template<
typename VT >
4245 inline typename DisableIf< VectorizedAddAssign<VT> >::Type
4246 addAssign(
const DenseVector<VT,true>& rhs );
4248 template<
typename VT >
4249 inline typename EnableIf< VectorizedAddAssign<VT> >::Type
4250 addAssign(
const DenseVector<VT,true>& rhs );
4252 template<
typename VT >
inline void addAssign(
const SparseVector<VT,true>& rhs );
4254 template<
typename VT >
4255 inline typename DisableIf< VectorizedSubAssign<VT> >::Type
4256 subAssign(
const DenseVector<VT,true>& rhs );
4258 template<
typename VT >
4259 inline typename EnableIf< VectorizedSubAssign<VT> >::Type
4260 subAssign(
const DenseVector<VT,true>& rhs );
4262 template<
typename VT >
inline void subAssign(
const SparseVector<VT,true>& rhs );
4264 template<
typename VT >
4265 inline typename DisableIf< VectorizedMultAssign<VT> >::Type
4266 multAssign(
const DenseVector<VT,true>& rhs );
4268 template<
typename VT >
4269 inline typename EnableIf< VectorizedMultAssign<VT> >::Type
4270 multAssign(
const DenseVector<VT,true>& rhs );
4272 template<
typename VT >
inline void multAssign(
const SparseVector<VT,true>& rhs );
4280 template<
typename MT2,
bool SO2,
typename VT >
4281 inline typename EnableIf< Not< IsRestricted<MT2> >,
bool >::Type
4282 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const Vector<VT,true>& rhs );
4284 template<
typename MT2,
bool SO2,
typename VT >
4285 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
4286 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
4288 template<
typename MT2,
bool SO2,
typename VT >
4289 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
4290 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
4292 template<
typename MT2,
bool SO2,
typename VT >
4293 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
4294 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
4296 template<
typename MT2,
bool SO2,
typename VT >
4297 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
4298 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
4300 template<
typename MT2,
bool SO2,
typename VT >
4301 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
4302 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs );
4304 template<
typename MT2,
bool SO2,
typename VT >
4305 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
4306 preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs );
4319 template<
typename MT2,
bool SO2,
bool SF2 >
friend class DenseRow;
4321 template<
typename MT2,
bool SO2,
bool SF2 >
4322 friend bool isSame(
const DenseRow<MT2,SO2,SF2>& a,
const DenseRow<MT2,SO2,SF2>& b );
4324 template<
typename MT2,
bool SO2,
bool SF2 >
4325 friend typename DerestrictTrait< DenseRow<MT2,SO2,SF2> >::Type
4326 derestrict( DenseRow<MT2,SO2,SF2>& dm );
4337 BLAZE_STATIC_ASSERT( !IsRestricted<MT>::value || IsLower<MT>::value || IsUpper<MT>::value );
4360 template<
typename MT >
4366 throw std::invalid_argument(
"Invalid row access index" );
4387 template<
typename MT >
4392 return matrix_(index,row_);
4405 template<
typename MT >
4410 return matrix_(index,row_);
4424 template<
typename MT >
4427 return matrix_.data( row_ );
4441 template<
typename MT >
4444 return matrix_.data( row_ );
4458 template<
typename MT >
4461 return matrix_.begin( row_ );
4475 template<
typename MT >
4478 return matrix_.cbegin( row_ );
4492 template<
typename MT >
4495 return matrix_.cbegin( row_ );
4509 template<
typename MT >
4512 return matrix_.end( row_ );
4526 template<
typename MT >
4529 return matrix_.cend( row_ );
4543 template<
typename MT >
4546 return matrix_.cend( row_ );
4567 template<
typename MT >
4570 const size_t ibegin( ( IsLower<MT>::value )
4571 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4575 const size_t iend ( ( IsUpper<MT>::value )
4576 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4581 for(
size_t i=ibegin; i<iend; ++i )
4582 matrix_(i,row_) = rhs;
4604 template<
typename MT >
4607 if( &rhs ==
this )
return *
this;
4609 if(
size() != rhs.size() )
4610 throw std::invalid_argument(
"Row sizes do not match" );
4612 if( !preservesInvariant( matrix_, rhs ) )
4613 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
4615 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4642 template<
typename MT >
4643 template<
typename VT >
4650 throw std::invalid_argument(
"Vector sizes do not match" );
4652 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
4653 Right right( ~rhs );
4655 if( !preservesInvariant( matrix_, right ) )
4656 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
4658 if( IsSparseVector<VT>::value )
4661 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4663 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4694 template<
typename MT >
4695 template<
typename VT >
4696 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator+=(
const Vector<VT,true>& rhs )
4702 throw std::invalid_argument(
"Vector sizes do not match" );
4704 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
4705 Right right( ~rhs );
4707 if( !preservesInvariant( matrix_, right ) )
4708 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
4710 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4712 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4743 template<
typename MT >
4744 template<
typename VT >
4745 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator-=(
const Vector<VT,true>& rhs )
4751 throw std::invalid_argument(
"Vector sizes do not match" );
4753 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
4754 Right right( ~rhs );
4756 if( !preservesInvariant( matrix_, right ) )
4757 throw std::invalid_argument(
"Invalid assignment to restricted matrix" );
4759 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4761 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4790 template<
typename MT >
4791 template<
typename VT >
4792 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator*=(
const Vector<VT,true>& rhs )
4798 throw std::invalid_argument(
"Vector sizes do not match" );
4800 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4802 if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
4803 const ResultType tmp( *
this * (~rhs) );
4830 template<
typename MT >
4831 template<
typename Other >
4832 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,true> >::Type&
4833 DenseRow<MT,false,true>::operator*=( Other rhs )
4837 return operator=( (*
this) * rhs );
4856 template<
typename MT >
4857 template<
typename Other >
4858 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,true> >::Type&
4859 DenseRow<MT,false,true>::operator/=( Other rhs )
4865 return operator=( (*
this) / rhs );
4885 template<
typename MT >
4888 return matrix_.columns();
4900 template<
typename MT >
4903 return matrix_.capacity( row_ );
4918 template<
typename MT >
4921 return matrix_.nonZeros( row_ );
4933 template<
typename MT >
4936 matrix_.reset( row_ );
4953 template<
typename MT >
4954 template<
typename Other >
4955 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::scale(
const Other& scalar )
4959 const size_t ibegin( ( IsLower<MT>::value )
4960 ?( ( IsStrictlyLower<MT>::value )
4964 const size_t iend ( ( IsUpper<MT>::value )
4965 ?( ( IsStrictlyUpper<MT>::value )
4970 for(
size_t i=ibegin; i<iend; ++i ) {
4971 matrix_(i,row_) *= scalar;
4992 template<
typename MT >
4993 template<
typename MT2
4996 inline typename EnableIf< Not< IsRestricted<MT2> >,
bool >::Type
4997 DenseRow<MT,false,true>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const Vector<VT,true>& rhs )
5019 template<
typename MT >
5020 template<
typename MT2
5023 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
5024 DenseRow<MT,false,true>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs )
5030 if( IsUniLower<MT2>::value && !
isOne( (~rhs)[row_] ) )
5033 const size_t ibegin( ( IsStrictlyLower<MT2>::value )?( row_ ):( row_+1UL ) );
5035 for(
size_t i=ibegin; i<
size(); ++i ) {
5058 template<
typename MT >
5059 template<
typename MT2
5062 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
5063 DenseRow<MT,false,true>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs )
5071 const bool checkDiagonal( IsUniLower<MT2>::value || IsStrictlyLower<MT2>::value );
5072 const RhsIterator last( (~rhs).
end() );
5073 RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( row_ ):( row_+1UL ) ) );
5075 if( IsUniLower<MT2>::value ) {
5076 if( element == last || element->index() != row_ || !
isOne( element->value() ) )
5081 for( ; element!=last; ++element ) {
5104 template<
typename MT >
5105 template<
typename MT2
5108 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
5109 DenseRow<MT,false,true>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs )
5115 const size_t iend( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) );
5117 for(
size_t i=0UL; i<iend; ++i ) {
5122 if( IsUniUpper<MT2>::value && !
isOne( (~rhs)[row_] ) )
5143 template<
typename MT >
5144 template<
typename MT2
5147 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >,
bool >::Type
5148 DenseRow<MT,false,true>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs )
5156 const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) ) );
5158 if( IsUniUpper<MT2>::value && ( last == (~rhs).
end() || last->index() != row_ || !
isOne( last->value() ) ) )
5161 for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
5184 template<
typename MT >
5185 template<
typename MT2
5188 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
5189 DenseRow<MT,false,true>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const DenseVector<VT,true>& rhs )
5195 for(
size_t i=0UL; i<row_; ++i ) {
5200 for(
size_t i=row_+1UL; i<
size(); ++i ) {
5223 template<
typename MT >
5224 template<
typename MT2
5227 inline typename EnableIf< IsDiagonal<MT2>,
bool >::Type
5228 DenseRow<MT,false,true>::preservesInvariant(
const DenseMatrix<MT2,SO2>& lhs,
const SparseVector<VT,true>& rhs )
5236 for( RhsIterator element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5237 if( element->index() != row_ && !
isDefault( element->value() ) )
5266 template<
typename MT >
5267 template<
typename Other >
5270 return matrix_.isAliased( alias );
5287 template<
typename MT >
5288 template<
typename MT2
5293 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5310 template<
typename MT >
5311 template<
typename Other >
5314 return matrix_.isAliased( alias );
5331 template<
typename MT >
5332 template<
typename MT2
5337 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5353 template<
typename MT >
5356 return matrix_.isAligned();
5373 template<
typename MT >
5395 template<
typename MT >
5399 return matrix_.load( index, row_ );
5418 template<
typename MT >
5422 return matrix_.loadu( index, row_ );
5442 template<
typename MT >
5445 matrix_.store( index, row_, value );
5465 template<
typename MT >
5468 matrix_.storeu( index, row_, value );
5488 template<
typename MT >
5491 matrix_.stream( index, row_, value );
5509 template<
typename MT >
5510 template<
typename VT >
5511 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5518 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5519 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5520 matrix_(i ,row_) = (~rhs)[i ];
5521 matrix_(i+1UL,row_) = (~rhs)[i+1UL];
5523 if( ipos < (~rhs).size() )
5524 matrix_(ipos,row_) = (~rhs)[ipos];
5542 template<
typename MT >
5543 template<
typename VT >
5544 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5557 matrix_.stream( i, row_, (~rhs).
load(i) );
5562 const size_t ipos( rows &
size_t(-
IT::size*4) );
5566 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
5567 matrix_.store( i , row_, it.load() ); it +=
IT::size;
5573 matrix_.store( i, row_, it.load() );
5593 template<
typename MT >
5594 template<
typename VT >
5602 matrix_(element->index(),row_) = element->value();
5620 template<
typename MT >
5621 template<
typename VT >
5622 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5629 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5630 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5631 matrix_(i ,row_) += (~rhs)[i ];
5632 matrix_(i+1UL,row_) += (~rhs)[i+1UL];
5634 if( ipos < (~rhs).size() )
5635 matrix_(ipos,row_) += (~rhs)[ipos];
5653 template<
typename MT >
5654 template<
typename VT >
5655 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5665 const size_t ipos( rows &
size_t(-
IT::size*4) );
5669 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
5670 matrix_.store( i , row_, matrix_.load(i ,row_) + it.load() ); it +=
IT::size;
5676 matrix_.store( i, row_, matrix_.load(i,row_) + it.load() );
5695 template<
typename MT >
5696 template<
typename VT >
5704 matrix_(element->index(),row_) += element->value();
5722 template<
typename MT >
5723 template<
typename VT >
5724 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5731 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5732 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5733 matrix_(i ,row_) -= (~rhs)[i ];
5734 matrix_(i+1UL,row_) -= (~rhs)[i+1UL];
5736 if( ipos < (~rhs).size() )
5737 matrix_(ipos,row_) -= (~rhs)[ipos];
5755 template<
typename MT >
5756 template<
typename VT >
5757 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5767 const size_t ipos( rows &
size_t(-
IT::size*4) );
5771 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
5772 matrix_.store( i , row_, matrix_.load(i ,row_) - it.load() ); it +=
IT::size;
5778 matrix_.store( i, row_, matrix_.load(i,row_) - it.load() );
5797 template<
typename MT >
5798 template<
typename VT >
5806 matrix_(element->index(),row_) -= element->value();
5824 template<
typename MT >
5825 template<
typename VT >
5826 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5833 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5834 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5835 matrix_(i ,row_) *= (~rhs)[i ];
5836 matrix_(i+1UL,row_) *= (~rhs)[i+1UL];
5838 if( ipos < (~rhs).size() )
5839 matrix_(ipos,row_) *= (~rhs)[ipos];
5857 template<
typename MT >
5858 template<
typename VT >
5859 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5869 const size_t ipos( rows &
size_t(-
IT::size*4) );
5873 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
5874 matrix_.store( i , row_, matrix_.load(i ,row_) * it.load() ); it +=
IT::size;
5880 matrix_.store( i, row_, matrix_.load(i,row_) * it.load() );
5899 template<
typename MT >
5900 template<
typename VT >
5907 const ResultType tmp(
serial( *
this ) );
5912 matrix_(element->index(),row_) = tmp[element->index()] * element->value();
5933 template<
typename MT,
bool SO,
bool SF >
5934 inline void reset( DenseRow<MT,SO,SF>&
row );
5936 template<
typename MT,
bool SO,
bool SF >
5937 inline void clear( DenseRow<MT,SO,SF>&
row );
5939 template<
typename MT,
bool SO,
bool SF >
5940 inline bool isDefault(
const DenseRow<MT,SO,SF>&
row );
5942 template<
typename MT,
bool SO,
bool SF >
5943 inline bool isSame(
const DenseRow<MT,SO,SF>& a,
const DenseRow<MT,SO,SF>& b );
5955 template<
typename MT
5974 template<
typename MT
6002 template<
typename MT
6007 for(
size_t i=0UL; i<row.size(); ++i )
6008 if( !
isDefault( row[i] ) )
return false;
6026 template<
typename MT
6031 return (
isSame( a.matrix_, b.matrix_ ) && ( a.row_ == b.row_ ) );
6051 template<
typename MT
6054 inline typename DerestrictTrait< DenseRow<MT,SO,SF> >::Type
6055 derestrict( DenseRow<MT,SO,SF>&
row )
6057 typedef typename DerestrictTrait< DenseRow<MT,SO,SF> >::Type
ReturnType;
6058 return ReturnType( derestrict( row.matrix_ ), row.row_ );
6074 template<
typename MT,
bool SO,
bool SF >
6075 struct IsRestricted< DenseRow<MT,SO,SF> > :
public If< IsRestricted<MT>, TrueType, FalseType >::Type
6077 enum { value = IsRestricted<MT>::value };
6094 template<
typename MT,
bool SO,
bool SF >
6095 struct DerestrictTrait< DenseRow<MT,SO,SF> >
6097 typedef DenseRow< typename RemoveReference< typename DerestrictTrait<MT>::Type >::Type > Type;
6113 template<
typename MT,
bool SO,
bool SF >
6114 struct HasConstDataAccess< DenseRow<MT,SO,SF> >
6115 :
public If< HasConstDataAccess<MT>, TrueType, FalseType >::Type
6117 enum { value = HasConstDataAccess<MT>::value };
6134 template<
typename MT,
bool SO,
bool SF >
6135 struct HasMutableDataAccess< DenseRow<MT,SO,SF> >
6136 :
public If< HasMutableDataAccess<MT>, TrueType, FalseType >::Type
6138 enum { value = HasMutableDataAccess<MT>::value };
6139 typedef typename If< HasMutableDataAccess<MT>,
TrueType,
FalseType >::Type Type;
6155 template<
typename MT,
bool SO,
bool SF >
6156 struct SubvectorTrait< DenseRow<MT,SO,SF> >
Pointer data()
Low-level data access to the row elements.
Definition: DenseRow.h:725
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE 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:879
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
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:8247
ConstIterator cend() const
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:844
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
Operand matrix_
The dense matrix containing the row.
Definition: DenseRow.h:611
Header file for the row trait.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:258
ConstIterator cbegin() const
Returns an iterator to the first element of the row.
Definition: DenseRow.h:793
IfTrue< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant row value.
Definition: DenseRow.h:375
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
Header file for the row base class.
Header file for the IsDiagonal type trait.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseRow.h:365
#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
BLAZE_ALWAYS_INLINE 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:946
BLAZE_ALWAYS_INLINE void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense row.
Definition: DenseRow.h:1793
Header file for the IsSame and IsStrictlySame type traits.
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
size_t nonZeros() const
Returns the number of non-zero elements in the row.
Definition: DenseRow.h:1223
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
Reference operator[](size_t index)
Subscript operator for the direct access to the row elements.
Definition: DenseRow.h:689
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
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the And class template.
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.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:118
If< IsExpression< MT >, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseRow.h:344
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
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1724
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:78
size_t size() const
Returns the current size/dimension of the row.
Definition: DenseRow.h:1190
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
#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
Header file for the RequiresEvaluation type trait.
Header file for the IsUniLower type trait.
MT::ElementType ElementType
Type of the row elements.
Definition: DenseRow.h:366
void reset()
Reset to the default initial values.
Definition: DenseRow.h:1238
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:964
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
bool canAlias(const Other *alias) const
Returns whether the dense row can alias with the given address alias.
Definition: DenseRow.h:1572
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Constraint on the data type.
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Constraint on the data type.
Base template for the RowTrait class.
Definition: RowTrait.h:115
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:85
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
Constraint on the data type.
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:116
Header file for the Or class template.
IfTrue< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseRow.h:387
bool isAligned() const
Returns whether the dense row is properly aligned in memory.
Definition: DenseRow.h:1658
BLAZE_ALWAYS_INLINE 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:635
Header file for the subvector trait.
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseRow.h:384
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseRow.h:378
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
Iterator begin()
Returns an iterator to the first element of the row.
Definition: DenseRow.h:759
IT::Type IntrinsicType
Intrinsic type of the row elements.
Definition: DenseRow.h:367
Header file for the IsLower type trait.
Constraint on the data type.
Constraint on the data type.
#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
const size_t row_
The index of the row in the matrix.
Definition: DenseRow.h:612
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1197
Constraints on the storage order of matrix types.
Constraint on the data type.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:195
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
System settings for streaming (non-temporal stores)
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:841
Header file for the isOne shim.
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:85
Header file for the DerestrictTrait class template.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type load(const T *address)
Loads a vector of 2-byte integral values.
Definition: Load.h:79
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
DenseRow & operator=(const ElementType &rhs)
Homogenous assignment to all row elements.
Definition: DenseRow.h:872
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
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseVector type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
#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:2506
Header file for the IsConst type trait.
RowTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseRow.h:364
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
Base class for all rows.The Row class serves as a tag for all rows (i.e. dense and sparse rows)...
Definition: Row.h:63
Header file for run time assertion macros.
bool canSMPAssign() const
Returns whether the dense row can be used in SMP assignments.
Definition: DenseRow.h:1678
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the row element type.
Definition: DenseRow.h:347
const DenseRow & CompositeType
Data type for composite expression templates.
Definition: DenseRow.h:369
BLAZE_ALWAYS_INLINE 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:742
Header file for the division trait.
DenseRow< MT, SO, SF > This
Type of this DenseRow instance.
Definition: DenseRow.h:363
DenseRow(MT &matrix, size_t index)
The constructor for DenseRow.
Definition: DenseRow.h:662
bool isAliased(const Other *alias) const
Returns whether the dense row is aliased with the given address alias.
Definition: DenseRow.h:1616
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESTRICTED(T)
Constraint on the data type.In case the given data type T does have a restricted data access...
Definition: Restricted.h:118
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
Reference to a specific row of a dense matrix.The DenseRow template represents a reference to a speci...
Definition: DenseRow.h:338
Header file for the cache size of the target architecture.
Compile time type negation.The Not class template negates the given compile time condition. In case the given condition would evaluate to true, the nested member enumeration is set to false and vice versa:
Definition: Not.h:70
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
Iterator end()
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:810
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1747
#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
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
Header file for the IsReference type trait.
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.
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
#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
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
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:260
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1701
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
size_t capacity() const
Returns the maximum capacity of the dense row.
Definition: DenseRow.h:1205
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:2502
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Compile time type check.This class tests whether the given template parameter T is a reference type (...
Definition: IsReference.h:94
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: TransposeFlag.h:81
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
MT::ConstReference ConstReference
Reference to a constant row value.
Definition: DenseRow.h:372
Header file for the IsUpper type trait.
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a simple dense v...
Definition: Thresholds.h:207
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143
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
EnableIf< IsNumeric< Type >, bool >::Type isOne(const Type &v)
Returns whether the given value/object represents the numeric value 1.
Definition: IsOne.h:80
Header file for the IsRestricted type trait.
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1770
System settings for the inline keywords.
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Compile time type selection.The IfTrue class template selects one of the two given types T1 and T2 de...
Definition: If.h:59
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE 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:849
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseRow.h:368
Header file for a safe C++ NULL pointer implementation.
IfTrue< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant row value.
Definition: DenseRow.h:381