35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 111 template<
typename MT
113 class Column<MT,true,false,SF>
114 :
public View< SparseVector< Column<MT,true,false,SF>, false > >
119 using Operand = If_< IsExpression<MT>, MT, MT& >;
124 using This = Column<MT,true,false,SF>;
125 using BaseType = SparseVector<This,false>;
147 enum :
bool { smpAssignable =
false };
153 explicit inline Column( Operand matrix,
size_t index );
165 inline Reference operator[](
size_t index );
166 inline ConstReference operator[](
size_t index )
const;
168 inline ConstReference at(
size_t index )
const;
170 inline ConstIterator
begin ()
const;
171 inline ConstIterator
cbegin()
const;
173 inline ConstIterator
end ()
const;
174 inline ConstIterator
cend ()
const;
181 inline Column& operator=(
const Column& rhs );
183 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
184 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
185 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
186 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
187 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
188 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
189 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
190 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
191 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
193 template<
typename Other >
194 inline EnableIf_< IsNumeric<Other>, Column >&
operator*=( Other rhs );
196 template<
typename Other >
197 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
204 inline Operand operand() const noexcept;
205 inline
size_t column() const noexcept;
206 inline
size_t size() const noexcept;
207 inline
size_t capacity() const noexcept;
210 inline
void reserve(
size_t n );
219 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
226 inline
void erase(
size_t index );
230 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
231 inline
void erase( Pred predicate );
233 template< typename Pred >
241 inline
Iterator find (
size_t index );
242 inline ConstIterator find (
size_t index ) const;
243 inline
Iterator lowerBound(
size_t index );
244 inline ConstIterator lowerBound(
size_t index ) const;
245 inline
Iterator upperBound(
size_t index );
246 inline ConstIterator upperBound(
size_t index ) const;
253 template< typename Other > inline Column& scale( const Other& scalar );
260 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
261 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
263 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
264 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
265 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
266 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
267 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
268 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
276 inline
size_t extendCapacity() const noexcept;
317 template< typename MT
319 inline Column<MT,true,false,SF>::Column( Operand matrix,
size_t index )
323 if( matrix_.columns() <= index ) {
349 template<
typename MT
352 Column<MT,true,false,SF>::operator[](
size_t index )
355 return matrix_(index,col_);
371 template<
typename MT
374 Column<MT,true,false,SF>::operator[](
size_t index )
const 377 return const_cast<const MT&
>( matrix_ )(index,col_);
394 template<
typename MT
397 Column<MT,true,false,SF>::at(
size_t index )
399 if( index >=
size() ) {
402 return (*
this)[index];
419 template<
typename MT
422 Column<MT,true,false,SF>::at(
size_t index )
const 424 if( index >=
size() ) {
427 return (*
this)[index];
441 template<
typename MT
445 return matrix_.begin( col_ );
459 template<
typename MT
463 return matrix_.cbegin( col_ );
477 template<
typename MT
481 return matrix_.cbegin( col_ );
495 template<
typename MT
499 return matrix_.end( col_ );
513 template<
typename MT
517 return matrix_.cend( col_ );
531 template<
typename MT
535 return matrix_.cend( col_ );
563 template<
typename MT
565 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const Column& rhs )
573 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
576 if(
size() != rhs.size() ) {
580 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
584 decltype(
auto) left( derestrict( *this ) );
586 if( rhs.canAlias( &matrix_ ) ) {
589 left.reserve( tmp.nonZeros() );
594 left.reserve( rhs.nonZeros() );
620 template<
typename MT
622 template<
typename VT >
623 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const DenseVector<VT,false>& rhs )
635 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
638 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
642 decltype(
auto) left( derestrict( *this ) );
644 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
645 const ResultType_<VT> tmp( right );
651 assign( left, right );
676 template<
typename MT
678 template<
typename VT >
679 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const SparseVector<VT,false>& rhs )
691 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
694 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
698 decltype(
auto) left( derestrict( *this ) );
700 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
701 const ResultType_<VT> tmp( right );
703 left.reserve( tmp.nonZeros() );
708 left.reserve( right.nonZeros() );
709 assign( left, right );
734 template<
typename MT
736 template<
typename VT >
748 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
758 const AddType tmp( *
this + (~rhs) );
760 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
764 decltype(
auto) left( derestrict( *this ) );
791 template< typename MT
793 template< typename VT >
794 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator+=( const SparseVector<VT,false>& rhs )
805 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
815 const AddType tmp( *
this + (~rhs) );
817 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
821 decltype(
auto) left( derestrict( *this ) );
850 template< typename MT
852 template< typename VT >
853 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator-=( const DenseVector<VT,false>& rhs )
864 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
874 const SubType tmp( *
this - (~rhs) );
876 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
880 decltype(
auto) left( derestrict( *this ) );
908 template< typename MT
910 template< typename VT >
911 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator-=( const SparseVector<VT,false>& rhs )
922 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
932 const SubType tmp( *
this - (~rhs) );
934 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
938 decltype(
auto) left( derestrict( *this ) );
941 left.reserve( tmp.nonZeros() );
965 template< typename MT
967 template< typename VT >
968 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator*=( const Vector<VT,false>& rhs )
978 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
987 const MultType tmp( *
this * (~rhs) );
989 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
993 decltype(
auto) left( derestrict( *this ) );
1018 template< typename MT
1020 template< typename VT >
1021 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator/=( const DenseVector<VT,false>& rhs )
1023 using blaze::assign;
1032 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
1042 const DivType tmp( *
this / (~rhs) );
1044 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1048 decltype(
auto) left( derestrict( *this ) );
1051 assign( left, tmp );
1074 template< typename MT
1076 template< typename VT >
1077 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator%=( const Vector<VT,false>& rhs )
1079 using blaze::assign;
1084 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1090 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1094 const CrossType tmp( *
this % (~rhs) );
1096 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1100 decltype(
auto) left( derestrict( *this ) );
1103 assign( left, tmp );
1128 template< typename MT
1130 template< typename Other >
1131 inline
EnableIf_<IsNumeric<Other>, Column<MT,true,false,SF> >&
1132 Column<MT,true,false,SF>::operator*=( Other rhs )
1137 element->value() *= rhs;
1162 template<
typename MT
1164 template<
typename Other >
1165 inline EnableIf_<IsNumeric<Other>, Column<MT,true,false,SF> >&
1172 using DT = DivTrait_<ElementType,Other>;
1173 using Tmp = If_< IsNumeric<DT>, DT, Other >;
1177 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
1178 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1180 element->value() *= tmp;
1184 element->value() /= rhs;
1207 template<
typename MT
1209 inline typename Column<MT,true,false,SF>::Operand
1210 Column<MT,true,false,SF>::operand() const noexcept
1224 template<
typename MT
1240 template<
typename MT
1244 return matrix_.rows();
1256 template<
typename MT
1260 return matrix_.capacity( col_ );
1275 template<
typename MT
1279 return matrix_.nonZeros( col_ );
1291 template<
typename MT
1295 matrix_.reset( col_ );
1311 template<
typename MT
1313 void Column<MT,true,false,SF>::reserve(
size_t n )
1315 matrix_.reserve( col_, n );
1330 template<
typename MT
1332 inline size_t Column<MT,true,false,SF>::extendCapacity() const noexcept
1337 size_t nonzeros( 2UL*
capacity()+1UL );
1338 nonzeros =
max( nonzeros, 7UL );
1339 nonzeros =
min( nonzeros,
size() );
1369 template<
typename MT
1374 return matrix_.set( index, col_, value );
1393 template<
typename MT
1396 Column<MT,true,false,SF>::insert(
size_t index,
const ElementType& value )
1398 return matrix_.insert( index, col_, value );
1429 template<
typename MT
1431 inline void Column<MT,true,false,SF>::append(
size_t index,
const ElementType& value,
bool check )
1433 matrix_.append( index, col_, value, check );
1456 template<
typename MT
1458 inline void Column<MT,true,false,SF>::erase(
size_t index )
1460 matrix_.erase( index, col_ );
1475 template<
typename MT
1479 return matrix_.erase( col_, pos );
1495 template<
typename MT
1500 return matrix_.erase( col_, first, last );
1529 template<
typename MT
1531 template<
typename Pred
1533 inline void Column<MT,true,false,SF>::erase( Pred predicate )
1535 matrix_.erase( col_,
begin(),
end(), predicate );
1566 template<
typename MT
1568 template<
typename Pred >
1569 inline void Column<MT,true,false,SF>::erase(
Iterator first,
Iterator last, Pred predicate )
1571 matrix_.erase( col_, first, last, predicate );
1599 template<
typename MT
1603 return matrix_.find( index, col_ );
1623 template<
typename MT
1626 Column<MT,true,false,SF>::find(
size_t index )
const 1628 return matrix_.find( index, col_ );
1647 template<
typename MT
1651 return matrix_.lowerBound( index, col_ );
1670 template<
typename MT
1673 Column<MT,true,false,SF>::lowerBound(
size_t index )
const 1675 return matrix_.lowerBound( index, col_ );
1694 template<
typename MT
1698 return matrix_.upperBound( index, col_ );
1717 template<
typename MT
1720 Column<MT,true,false,SF>::upperBound(
size_t index )
const 1722 return matrix_.upperBound( index, col_ );
1749 template<
typename MT
1751 template<
typename Other >
1752 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::scale(
const Other& scalar )
1757 element->value() *= scalar;
1783 template<
typename MT
1785 template<
typename Other >
1786 inline bool Column<MT,true,false,SF>::canAlias(
const Other* alias )
const noexcept
1788 return matrix_.isAliased( alias );
1805 template<
typename MT
1807 template<
typename Other >
1808 inline bool Column<MT,true,false,SF>::isAliased(
const Other* alias )
const noexcept
1810 return matrix_.isAliased( alias );
1828 template<
typename MT
1830 template<
typename VT >
1831 inline void Column<MT,true,false,SF>::assign(
const DenseVector<VT,false>& rhs )
1836 for(
size_t i=0UL; i<
size(); ++i )
1838 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
1839 matrix_.reserve( col_, extendCapacity() );
1841 matrix_.append( i, col_, (~rhs)[i],
true );
1860 template<
typename MT
1862 template<
typename VT >
1863 inline void Column<MT,true,false,SF>::assign(
const SparseVector<VT,false>& rhs )
1868 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1869 matrix_.append( element->index(), col_, element->value(), true );
1888 template<
typename MT
1890 template<
typename VT >
1891 inline void Column<MT,true,false,SF>::addAssign(
const DenseVector<VT,false>& rhs )
1893 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1901 const AddType tmp(
serial( *
this + (~rhs) ) );
1902 matrix_.reset( col_ );
1921 template<
typename MT
1923 template<
typename VT >
1924 inline void Column<MT,true,false,SF>::addAssign(
const SparseVector<VT,false>& rhs )
1926 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1934 const AddType tmp(
serial( *
this + (~rhs) ) );
1935 matrix_.reset( col_ );
1936 matrix_.reserve( col_, tmp.nonZeros() );
1955 template<
typename MT
1957 template<
typename VT >
1958 inline void Column<MT,true,false,SF>::subAssign(
const DenseVector<VT,false>& rhs )
1960 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
1968 const SubType tmp(
serial( *
this - (~rhs) ) );
1969 matrix_.reset( col_ );
1988 template<
typename MT
1990 template<
typename VT >
1991 inline void Column<MT,true,false,SF>::subAssign(
const SparseVector<VT,false>& rhs )
1993 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2001 const SubType tmp(
serial( *
this - (~rhs) ) );
2002 matrix_.reset( col_ );
2003 matrix_.reserve( col_, tmp.nonZeros() );
2030 template<
typename MT >
2031 class Column<MT,false,false,false>
2032 :
public View< SparseVector< Column<MT,false,false,false>, false > >
2037 using Operand = If_< IsExpression<MT>, MT, MT& >;
2042 using This = Column<MT,false,false,false>;
2043 using BaseType = SparseVector<This,false>;
2051 using ConstReference = ConstReference_<MT>;
2060 template<
typename MatrixType
2061 ,
typename IteratorType >
2063 :
private SparseElement
2072 inline ColumnElement( IteratorType pos,
size_t row )
2084 template<
typename T >
inline ColumnElement& operator=(
const T& v ) {
2096 template<
typename T >
inline ColumnElement&
operator+=(
const T& v ) {
2108 template<
typename T >
inline ColumnElement&
operator-=(
const T& v ) {
2120 template<
typename T >
inline ColumnElement&
operator*=(
const T& v ) {
2132 template<
typename T >
inline ColumnElement&
operator/=(
const T& v ) {
2143 inline const ColumnElement* operator->()
const {
2153 inline decltype(
auto) value()
const {
2154 return pos_->value();
2163 inline size_t index()
const {
2179 template<
typename MatrixType
2180 ,
typename IteratorType >
2181 class ColumnIterator
2185 using IteratorCategory = std::forward_iterator_tag;
2186 using ValueType = ColumnElement<MatrixType,IteratorType>;
2187 using PointerType = ValueType;
2188 using ReferenceType = ValueType;
2189 using DifferenceType = ptrdiff_t;
2192 using iterator_category = IteratorCategory;
2193 using value_type = ValueType;
2194 using pointer = PointerType;
2195 using reference = ReferenceType;
2196 using difference_type = DifferenceType;
2202 inline ColumnIterator()
2203 : matrix_( nullptr )
2217 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
2218 : matrix_( &matrix )
2223 for( ; row_<matrix_->rows(); ++row_ ) {
2224 pos_ = matrix_->find( row_, column_ );
2225 if( pos_ != matrix_->end( row_ ) )
break;
2238 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2239 : matrix_( &matrix )
2253 template<
typename MatrixType2,
typename IteratorType2 >
2254 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
2255 : matrix_( it.matrix_ )
2257 , column_( it.column_ )
2267 inline ColumnIterator& operator++() {
2269 for( ; row_<matrix_->rows(); ++row_ ) {
2270 pos_ = matrix_->find( row_, column_ );
2271 if( pos_ != matrix_->end( row_ ) )
break;
2283 inline const ColumnIterator operator++(
int ) {
2284 const ColumnIterator tmp( *
this );
2295 inline ReferenceType
operator*()
const {
2296 return ReferenceType( pos_, row_ );
2305 inline PointerType operator->()
const {
2306 return PointerType( pos_, row_ );
2316 template<
typename MatrixType2,
typename IteratorType2 >
2317 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2318 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2328 template<
typename MatrixType2,
typename IteratorType2 >
2329 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2330 return !( *
this == rhs );
2340 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2341 size_t counter( 0UL );
2342 for(
size_t i=rhs.row_; i<row_; ++i ) {
2343 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2352 MatrixType* matrix_;
2359 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2360 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
friend class Column;
2367 using ConstIterator = ColumnIterator< const MT, ConstIterator_<MT> >;
2375 enum :
bool { smpAssignable =
false };
2381 explicit inline Column( Operand matrix,
size_t index );
2393 inline Reference operator[](
size_t index );
2394 inline ConstReference operator[](
size_t index )
const;
2396 inline ConstReference at(
size_t index )
const;
2398 inline ConstIterator
begin ()
const;
2399 inline ConstIterator
cbegin()
const;
2401 inline ConstIterator
end ()
const;
2402 inline ConstIterator
cend ()
const;
2409 inline Column& operator= (
const Column& rhs );
2410 template<
typename VT >
inline Column& operator= (
const Vector<VT,false>& rhs );
2411 template<
typename VT >
inline Column&
operator+=(
const Vector<VT,false>& rhs );
2412 template<
typename VT >
inline Column&
operator-=(
const Vector<VT,false>& rhs );
2413 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
2414 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
2415 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
2417 template<
typename Other >
2418 inline EnableIf_<IsNumeric<Other>, Column >&
operator*=( Other rhs );
2420 template<
typename Other >
2421 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
2428 inline Operand operand() const noexcept;
2429 inline
size_t column() const noexcept;
2430 inline
size_t size() const;
2432 inline
size_t nonZeros() const;
2433 inline
void reset();
2434 inline
void reserve(
size_t n );
2443 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
2450 inline
void erase(
size_t index );
2454 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
2455 inline
void erase( Pred predicate );
2457 template< typename Pred >
2465 inline
Iterator find (
size_t index );
2466 inline ConstIterator find (
size_t index ) const;
2467 inline
Iterator lowerBound(
size_t index );
2468 inline ConstIterator lowerBound(
size_t index ) const;
2469 inline
Iterator upperBound(
size_t index );
2470 inline ConstIterator upperBound(
size_t index ) const;
2477 template< typename Other > inline Column& scale( const Other& scalar );
2484 template< typename Other > inline
bool canAlias ( const Other* alias ) const;
2485 template< typename Other > inline
bool isAliased( const Other* alias ) const;
2487 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2488 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2489 template< typename VT > inline
void addAssign( const Vector<VT,false>& rhs );
2490 template< typename VT > inline
void subAssign( const Vector<VT,false>& rhs );
2533 template< typename MT >
2534 inline Column<MT,false,false,false>::Column( Operand matrix,
size_t index )
2538 if( matrix_.columns() <= index ) {
2564 template<
typename MT >
2566 Column<MT,false,false,false>::operator[](
size_t index )
2569 return matrix_(index,col_);
2585 template<
typename MT >
2587 Column<MT,false,false,false>::operator[](
size_t index )
const 2590 return const_cast<const MT&
>( matrix_ )(index,col_);
2607 template<
typename MT >
2609 Column<MT,false,false,false>::at(
size_t index )
2611 if( index >=
size() ) {
2614 return (*
this)[index];
2631 template<
typename MT >
2633 Column<MT,false,false,false>::at(
size_t index )
const 2635 if( index >=
size() ) {
2638 return (*
this)[index];
2652 template<
typename MT >
2655 return Iterator( matrix_, 0UL, col_ );
2669 template<
typename MT >
2687 template<
typename MT >
2705 template<
typename MT >
2722 template<
typename MT >
2740 template<
typename MT >
2772 template<
typename MT >
2773 inline Column<MT,false,false,false>&
2774 Column<MT,false,false,false>::operator=(
const Column& rhs )
2776 using blaze::assign;
2782 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
2785 if(
size() != rhs.size() ) {
2789 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
2793 decltype(
auto) left( derestrict( *this ) );
2795 if( rhs.canAlias( &matrix_ ) ) {
2797 assign( left, tmp );
2800 assign( left, rhs );
2825 template<
typename MT >
2826 template<
typename VT >
2827 inline Column<MT,false,false,false>&
2828 Column<MT,false,false,false>::operator=(
const Vector<VT,false>& rhs )
2830 using blaze::assign;
2836 const CompositeType_<VT> tmp( ~rhs );
2838 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2842 decltype(
auto) left( derestrict( *this ) );
2844 assign( left, tmp );
2868 template< typename MT >
2869 template< typename VT >
2870 inline Column<MT,false,false,false>&
2871 Column<MT,false,false,false>::operator+=( const Vector<VT,false>& rhs )
2873 using blaze::assign;
2881 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
2890 const AddType tmp( *
this + (~rhs) );
2892 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2896 decltype(
auto) left( derestrict( *this ) );
2898 assign( left, tmp );
2922 template< typename MT >
2923 template< typename VT >
2924 inline Column<MT,false,false,false>&
2925 Column<MT,false,false,false>::operator-=( const Vector<VT,false>& rhs )
2927 using blaze::assign;
2935 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2944 const SubType tmp( *
this - (~rhs) );
2946 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2950 decltype(
auto) left( derestrict( *this ) );
2952 assign( left, tmp );
2975 template< typename MT >
2976 template< typename VT >
2977 inline Column<MT,false,false,false>&
2978 Column<MT,false,false,false>::operator*=( const Vector<VT,false>& rhs )
2980 using blaze::assign;
2988 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
2997 const MultType tmp( *
this * (~rhs) );
2999 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
3003 decltype(
auto) left( derestrict( *this ) );
3005 assign( left, tmp );
3027 template< typename MT >
3028 template< typename VT >
3029 inline Column<MT,false,false,false>&
3030 Column<MT,false,false,false>::operator/=( const DenseVector<VT,false>& rhs )
3032 using blaze::assign;
3041 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
3051 const DivType tmp( *
this / (~rhs) );
3053 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
3057 decltype(
auto) left( derestrict( *this ) );
3059 assign( left, tmp );
3082 template< typename MT >
3083 template< typename VT >
3084 inline Column<MT,false,false,false>&
3085 Column<MT,false,false,false>::operator%=( const Vector<VT,false>& rhs )
3087 using blaze::assign;
3092 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
3098 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3102 const CrossType tmp( *
this % (~rhs) );
3104 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
3108 decltype(
auto) left( derestrict( *this ) );
3110 assign( left, tmp );
3135 template< typename MT >
3136 template< typename Other >
3137 inline
EnableIf_<IsNumeric<Other>, Column<MT,false,false,false> >&
3138 Column<MT,false,false,false>::operator*=( Other rhs )
3143 element->value() *= rhs;
3168 template<
typename MT >
3169 template<
typename Other >
3170 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,false> >&
3177 using DT = DivTrait_<ElementType,Other>;
3178 using Tmp = If_< IsNumeric<DT>, DT, Other >;
3182 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
3183 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
3185 element->value() *= tmp;
3189 element->value() /= rhs;
3212 template<
typename MT >
3213 inline typename Column<MT,false,false,false>::Operand
3214 Column<MT,false,false,false>::operand() const noexcept
3228 template<
typename MT >
3243 template<
typename MT >
3246 return matrix_.rows();
3258 template<
typename MT >
3261 return matrix_.rows();
3276 template<
typename MT >
3279 size_t counter( 0UL );
3280 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
3295 template<
typename MT >
3298 const size_t ibegin( ( IsLower<MT>::value )
3299 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3303 const size_t iend ( ( IsUpper<MT>::value )
3304 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3309 for(
size_t i=ibegin; i<iend; ++i ) {
3310 matrix_.erase( i, col_ );
3327 template<
typename MT >
3328 void Column<MT,false,false,false>::reserve(
size_t n )
3358 template<
typename MT >
3362 return Iterator( matrix_, index, col_, matrix_.set( index, col_, value ) );
3381 template<
typename MT >
3383 Column<MT,false,false,false>::insert(
size_t index,
const ElementType& value )
3385 return Iterator( matrix_, index, col_, matrix_.insert( index, col_, value ) );
3416 template<
typename MT >
3417 inline void Column<MT,false,false,false>::append(
size_t index,
const ElementType& value,
bool check )
3420 matrix_.insert( index, col_, value );
3443 template<
typename MT >
3444 inline void Column<MT,false,false,false>::erase(
size_t index )
3446 matrix_.erase( index, col_ );
3461 template<
typename MT >
3463 Column<MT,false,false,false>::erase(
Iterator pos )
3465 const size_t row( pos.row_ );
3470 matrix_.erase( row, pos.pos_ );
3471 return Iterator( matrix_, row+1UL, col_ );
3487 template<
typename MT >
3491 for( ; first!=last; ++first ) {
3492 matrix_.erase( first.row_, first.pos_ );
3523 template<
typename MT >
3524 template<
typename Pred
3526 inline void Column<MT,false,false,false>::erase( Pred predicate )
3529 if( predicate( element->value() ) )
3530 matrix_.erase( element.row_, element.pos_ );
3563 template<
typename MT >
3564 template<
typename Pred >
3565 inline void Column<MT,false,false,false>::erase(
Iterator first,
Iterator last, Pred predicate )
3567 for( ; first!=last; ++first ) {
3568 if( predicate( first->value() ) )
3569 matrix_.erase( first.row_, first.pos_ );
3598 template<
typename MT >
3600 Column<MT,false,false,false>::find(
size_t index )
3602 const Iterator_<MT> pos( matrix_.find( index, col_ ) );
3604 if( pos != matrix_.end( index ) )
3605 return Iterator( matrix_, index, col_, pos );
3627 template<
typename MT >
3629 Column<MT,false,false,false>::find(
size_t index )
const 3631 const ConstIterator_<MT> pos( matrix_.find( index, col_ ) );
3633 if( pos != matrix_.end( index ) )
3655 template<
typename MT >
3657 Column<MT,false,false,false>::lowerBound(
size_t index )
3659 for(
size_t i=index; i<
size(); ++i )
3661 const Iterator_<MT> pos( matrix_.find( i, col_ ) );
3663 if( pos != matrix_.end( i ) )
3664 return Iterator( matrix_, i, col_, pos );
3686 template<
typename MT >
3688 Column<MT,false,false,false>::lowerBound(
size_t index )
const 3690 for(
size_t i=index; i<
size(); ++i )
3692 const ConstIterator_<MT> pos( matrix_.find( i, col_ ) );
3694 if( pos != matrix_.end( i ) )
3717 template<
typename MT >
3719 Column<MT,false,false,false>::upperBound(
size_t index )
3721 for(
size_t i=index+1UL; i<
size(); ++i )
3723 const Iterator_<MT> pos( matrix_.find( i, col_ ) );
3725 if( pos != matrix_.end( i ) )
3726 return Iterator( matrix_, i, col_, pos );
3748 template<
typename MT >
3750 Column<MT,false,false,false>::upperBound(
size_t index )
const 3752 for(
size_t i=index+1UL; i<
size(); ++i )
3754 const ConstIterator_<MT> pos( matrix_.find( i, col_ ) );
3756 if( pos != matrix_.end( i ) )
3787 template<
typename MT >
3788 template<
typename Other >
3789 inline Column<MT,false,false,false>& Column<MT,false,false,false>::scale(
const Other& scalar )
3794 element->value() *= scalar;
3820 template<
typename MT >
3821 template<
typename Other >
3822 inline bool Column<MT,false,false,false>::canAlias(
const Other* alias )
const 3824 return matrix_.isAliased( alias );
3837 template<
typename MT >
3838 template<
typename Other >
3839 inline bool Column<MT,false,false,false>::isAliased(
const Other* alias )
const 3841 return matrix_.isAliased( alias );
3859 template<
typename MT >
3860 template<
typename VT >
3861 inline void Column<MT,false,false,false>::assign(
const DenseVector<VT,false>& rhs )
3865 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3866 matrix_(i,col_) = (~rhs)[i];
3885 template<
typename MT >
3886 template<
typename VT >
3887 inline void Column<MT,false,false,false>::assign(
const SparseVector<VT,false>& rhs )
3893 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3894 for( ; i<element->index(); ++i )
3895 matrix_.erase( i, col_ );
3896 matrix_(i++,col_) = element->value();
3898 for( ; i<
size(); ++i ) {
3899 matrix_.erase( i, col_ );
3918 template<
typename MT >
3919 template<
typename VT >
3920 inline void Column<MT,false,false,false>::addAssign(
const Vector<VT,false>& rhs )
3922 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
3929 const AddType tmp(
serial( *
this + (~rhs) ) );
3948 template<
typename MT >
3949 template<
typename VT >
3950 inline void Column<MT,false,false,false>::subAssign(
const Vector<VT,false>& rhs )
3952 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
3959 const SubType tmp(
serial( *
this - (~rhs) ) );
3986 template<
typename MT >
3987 class Column<MT,false,false,true>
3988 :
public View< SparseVector< Column<MT,false,false,true>, false > >
3993 using Operand = If_< IsExpression<MT>, MT, MT& >;
3998 using This = Column<MT,false,false,true>;
3999 using BaseType = SparseVector<This,false>;
4007 using ConstReference = ConstReference_<MT>;
4013 using ConstIterator = ConstIterator_<MT>;
4021 enum :
bool { smpAssignable =
false };
4027 explicit inline Column( Operand matrix,
size_t index );
4039 inline Reference operator[](
size_t index );
4040 inline ConstReference operator[](
size_t index )
const;
4042 inline ConstReference at(
size_t index )
const;
4044 inline ConstIterator
begin ()
const;
4045 inline ConstIterator
cbegin()
const;
4047 inline ConstIterator
end ()
const;
4048 inline ConstIterator
cend ()
const;
4055 inline Column& operator=(
const Column& rhs );
4057 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
4058 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
4059 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
4060 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
4061 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
4062 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
4063 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
4064 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
4065 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
4067 template<
typename Other >
4068 inline EnableIf_<IsNumeric<Other>, Column >&
operator*=( Other rhs );
4070 template<
typename Other >
4071 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
4078 inline Operand operand() const noexcept;
4079 inline
size_t column() const noexcept;
4080 inline
size_t size() const noexcept;
4081 inline
size_t capacity() const noexcept;
4082 inline
size_t nonZeros() const;
4083 inline
void reset();
4084 inline
void reserve(
size_t n );
4093 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
4100 inline
void erase(
size_t index );
4104 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
4105 inline
void erase( Pred predicate );
4107 template< typename Pred >
4115 inline
Iterator find (
size_t index );
4116 inline ConstIterator find (
size_t index ) const;
4117 inline
Iterator lowerBound(
size_t index );
4118 inline ConstIterator lowerBound(
size_t index ) const;
4119 inline
Iterator upperBound(
size_t index );
4120 inline ConstIterator upperBound(
size_t index ) const;
4127 template< typename Other > inline Column& scale( const Other& scalar );
4134 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4135 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4137 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
4138 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
4139 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
4140 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4141 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
4142 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4150 inline
size_t extendCapacity() const noexcept;
4192 template< typename MT >
4193 inline Column<MT,false,false,true>::Column( Operand matrix,
size_t index )
4197 if( matrix_.columns() <= index ) {
4223 template<
typename MT >
4225 Column<MT,false,false,true>::operator[](
size_t index )
4228 return matrix_(col_,index);
4244 template<
typename MT >
4246 Column<MT,false,false,true>::operator[](
size_t index )
const 4249 return const_cast<const MT&
>( matrix_ )(col_,index);
4266 template<
typename MT >
4268 Column<MT,false,false,true>::at(
size_t index )
4270 if( index >=
size() ) {
4273 return (*
this)[index];
4290 template<
typename MT >
4292 Column<MT,false,false,true>::at(
size_t index )
const 4294 if( index >=
size() ) {
4297 return (*
this)[index];
4311 template<
typename MT >
4314 return matrix_.begin( col_ );
4328 template<
typename MT >
4332 return matrix_.cbegin( col_ );
4346 template<
typename MT >
4350 return matrix_.cbegin( col_ );
4364 template<
typename MT >
4367 return matrix_.end( col_ );
4381 template<
typename MT >
4385 return matrix_.cend( col_ );
4399 template<
typename MT >
4403 return matrix_.cend( col_ );
4431 template<
typename MT >
4432 inline Column<MT,false,false,true>& Column<MT,false,false,true>::operator=(
const Column& rhs )
4434 using blaze::assign;
4440 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
4443 if(
size() != rhs.size() ) {
4447 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
4451 decltype(
auto) left( derestrict( *this ) );
4453 if( rhs.canAlias( &matrix_ ) ) {
4456 left.reserve( tmp.nonZeros() );
4457 assign( left, tmp );
4461 left.reserve( rhs.nonZeros() );
4462 assign( left, rhs );
4487 template<
typename MT >
4488 template<
typename VT >
4489 inline Column<MT,false,false,true>&
4490 Column<MT,false,false,true>::operator=(
const DenseVector<VT,false>& rhs )
4492 using blaze::assign;
4502 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4503 Right right( ~rhs );
4505 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4509 decltype(
auto) left( derestrict( *this ) );
4511 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4512 const ResultType_<VT> tmp( right );
4514 assign( left, tmp );
4518 assign( left, right );
4543 template<
typename MT >
4544 template<
typename VT >
4545 inline Column<MT,false,false,true>&
4546 Column<MT,false,false,true>::operator=(
const SparseVector<VT,false>& rhs )
4548 using blaze::assign;
4558 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4559 Right right( ~rhs );
4561 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4565 decltype(
auto) left( derestrict( *this ) );
4567 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4568 const ResultType_<VT> tmp( right);
4570 left.reserve( tmp.nonZeros() );
4571 assign( left, tmp );
4575 left.reserve( right.nonZeros() );
4576 assign( left, right );
4601 template<
typename MT >
4602 template<
typename VT >
4603 inline Column<MT,false,false,true>&
4606 using blaze::assign;
4615 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4625 const AddType tmp( *
this + (~rhs) );
4627 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4631 decltype(
auto) left( derestrict( *this ) );
4634 assign( left, tmp );
4658 template< typename MT >
4659 template< typename VT >
4660 inline Column<MT,false,false,true>&
4661 Column<MT,false,false,true>::operator+=( const SparseVector<VT,false>& rhs )
4663 using blaze::assign;
4672 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4682 const AddType tmp( *
this + (~rhs) );
4684 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4688 decltype(
auto) left( derestrict( *this ) );
4691 left.reserve( tmp.nonZeros() );
4692 assign( left, tmp );
4717 template< typename MT >
4718 template< typename VT >
4719 inline Column<MT,false,false,true>&
4720 Column<MT,false,false,true>::operator-=( const DenseVector<VT,false>& rhs )
4722 using blaze::assign;
4731 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4741 const SubType tmp( *
this - (~rhs) );
4743 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4747 decltype(
auto) left( derestrict( *this ) );
4750 assign( left, tmp );
4775 template< typename MT >
4776 template< typename VT >
4777 inline Column<MT,false,false,true>&
4778 Column<MT,false,false,true>::operator-=( const SparseVector<VT,false>& rhs )
4780 using blaze::assign;
4789 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4799 const SubType tmp( *
this - (~rhs) );
4801 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4805 decltype(
auto) left( derestrict( *this ) );
4808 left.reserve( tmp.nonZeros() );
4809 assign( left, tmp );
4832 template< typename MT >
4833 template< typename VT >
4834 inline Column<MT,false,false,true>&
4835 Column<MT,false,false,true>::operator*=( const Vector<VT,false>& rhs )
4837 using blaze::assign;
4845 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
4854 const MultType tmp( *
this * (~rhs) );
4856 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4860 decltype(
auto) left( derestrict( *this ) );
4863 assign( left, tmp );
4885 template< typename MT >
4886 template< typename VT >
4887 inline Column<MT,false,false,true>&
4888 Column<MT,false,false,true>::operator/=( const DenseVector<VT,false>& rhs )
4890 using blaze::assign;
4899 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
4909 const DivType tmp( *
this / (~rhs) );
4911 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4915 decltype(
auto) left( derestrict( *this ) );
4918 assign( left, tmp );
4941 template< typename MT >
4942 template< typename VT >
4943 inline Column<MT,false,false,true>&
4944 Column<MT,false,false,true>::operator%=( const Vector<VT,false>& rhs )
4946 using blaze::assign;
4951 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
4957 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
4961 const CrossType tmp( *
this % (~rhs) );
4963 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4967 decltype(
auto) left( derestrict( *this ) );
4970 assign( left, tmp );
4995 template< typename MT >
4996 template< typename Other >
4997 inline
EnableIf_<IsNumeric<Other>, Column<MT,false,false,true> >&
4998 Column<MT,false,false,true>::operator*=( Other rhs )
5003 element->value() *= rhs;
5028 template<
typename MT >
5029 template<
typename Other >
5030 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,true> >&
5037 using DT = DivTrait_<ElementType,Other>;
5038 using Tmp = If_< IsNumeric<DT>, DT, Other >;
5042 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
5043 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
5045 element->value() *= tmp;
5049 element->value() /= rhs;
5072 template<
typename MT >
5073 inline typename Column<MT,false,false,true>::Operand
5074 Column<MT,false,false,true>::operand() const noexcept
5088 template<
typename MT >
5103 template<
typename MT >
5106 return matrix_.rows();
5118 template<
typename MT >
5121 return matrix_.capacity( col_ );
5136 template<
typename MT >
5139 return matrix_.nonZeros( col_ );
5151 template<
typename MT >
5154 matrix_.reset( col_ );
5170 template<
typename MT >
5171 void Column<MT,false,false,true>::reserve(
size_t n )
5173 matrix_.reserve( col_, n );
5188 template<
typename MT >
5189 inline size_t Column<MT,false,false,true>::extendCapacity() const noexcept
5194 size_t nonzeros( 2UL*
capacity()+1UL );
5195 nonzeros =
max( nonzeros, 7UL );
5196 nonzeros =
min( nonzeros,
size() );
5226 template<
typename MT >
5230 return matrix_.set( col_, index, value );
5249 template<
typename MT >
5251 Column<MT,false,false,true>::insert(
size_t index,
const ElementType& value )
5253 return matrix_.insert( col_, index, value );
5284 template<
typename MT >
5285 inline void Column<MT,false,false,true>::append(
size_t index,
const ElementType& value,
bool check )
5287 matrix_.append( col_, index, value, check );
5310 template<
typename MT >
5311 inline void Column<MT,false,false,true>::erase(
size_t index )
5313 matrix_.erase( col_, index );
5328 template<
typename MT >
5330 Column<MT,false,false,true>::erase(
Iterator pos )
5332 return matrix_.erase( col_, pos );
5348 template<
typename MT >
5352 return matrix_.erase( col_, first, last );
5381 template<
typename MT >
5382 template<
typename Pred
5384 inline void Column<MT,false,false,true>::erase( Pred predicate )
5386 matrix_.erase( col_,
begin(),
end(), predicate );
5417 template<
typename MT >
5418 template<
typename Pred >
5419 inline void Column<MT,false,false,true>::erase(
Iterator first,
Iterator last, Pred predicate )
5421 matrix_.erase( col_, first, last, predicate );
5449 template<
typename MT >
5451 Column<MT,false,false,true>::find(
size_t index )
5453 return matrix_.find( col_, index );
5473 template<
typename MT >
5475 Column<MT,false,false,true>::find(
size_t index )
const 5477 return matrix_.find( col_, index );
5496 template<
typename MT >
5498 Column<MT,false,false,true>::lowerBound(
size_t index )
5500 return matrix_.lowerBound( col_, index );
5519 template<
typename MT >
5521 Column<MT,false,false,true>::lowerBound(
size_t index )
const 5523 return matrix_.lowerBound( col_, index );
5542 template<
typename MT >
5544 Column<MT,false,false,true>::upperBound(
size_t index )
5546 return matrix_.upperBound( col_, index );
5565 template<
typename MT >
5567 Column<MT,false,false,true>::upperBound(
size_t index )
const 5569 return matrix_.upperBound( col_, index );
5596 template<
typename MT >
5597 template<
typename Other >
5598 inline Column<MT,false,false,true>& Column<MT,false,false,true>::scale(
const Other& scalar )
5603 element->value() *= scalar;
5629 template<
typename MT >
5630 template<
typename Other >
5631 inline bool Column<MT,false,false,true>::canAlias(
const Other* alias )
const noexcept
5633 return matrix_.isAliased( alias );
5650 template<
typename MT >
5651 template<
typename Other >
5652 inline bool Column<MT,false,false,true>::isAliased(
const Other* alias )
const noexcept
5654 return matrix_.isAliased( alias );
5672 template<
typename MT >
5673 template<
typename VT >
5674 inline void Column<MT,false,false,true>::assign(
const DenseVector<VT,false>& rhs )
5679 for(
size_t i=0UL; i<
size(); ++i )
5681 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
5682 matrix_.reserve( col_, extendCapacity() );
5684 matrix_.append( col_, i, (~rhs)[i],
true );
5703 template<
typename MT >
5704 template<
typename VT >
5705 inline void Column<MT,false,false,true>::assign(
const SparseVector<VT,false>& rhs )
5710 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5711 matrix_.append( col_, element->index(), element->value(), true );
5730 template<
typename MT >
5731 template<
typename VT >
5732 inline void Column<MT,false,false,true>::addAssign(
const DenseVector<VT,false>& rhs )
5734 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5742 const AddType tmp(
serial( *
this + (~rhs) ) );
5743 matrix_.reset( col_ );
5762 template<
typename MT >
5763 template<
typename VT >
5764 inline void Column<MT,false,false,true>::addAssign(
const SparseVector<VT,false>& rhs )
5766 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5774 const AddType tmp(
serial( *
this + (~rhs) ) );
5775 matrix_.reset( col_ );
5776 matrix_.reserve( col_, tmp.nonZeros() );
5795 template<
typename MT >
5796 template<
typename VT >
5797 inline void Column<MT,false,false,true>::subAssign(
const DenseVector<VT,false>& rhs )
5799 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5807 const SubType tmp(
serial( *
this - (~rhs) ) );
5808 matrix_.reset( col_ );
5827 template<
typename MT >
5828 template<
typename VT >
5829 inline void Column<MT,false,false,true>::subAssign(
const SparseVector<VT,false>& rhs )
5831 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5839 const SubType tmp(
serial( *
this - (~rhs) ) );
5840 matrix_.reset( col_ );
5841 matrix_.reserve( col_, tmp.nonZeros() );
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
#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.
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
Header file for the SparseVector base class.
Header file for the View base class.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#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:81
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1411
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
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:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
Header file for the implementation of the Column base template.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
#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:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
#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:60
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
Constraints on the storage order of matrix types.
#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:81
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1393
Header file for the IsUniLower type trait.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:308
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:242
Constraint on the data type.
Constraint on the transpose flag of vector types.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Constraint on the data type.
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
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: ColumnMajorMatrix.h:61
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#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:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for the IsLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Header file for the SparseElement base class.
Constraint on the data type.
Constraint on the data type.
Header file for the exception macros of the math module.
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:264
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#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:79
#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: RowMajorMatrix.h:61
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Header file for the reset shim.
#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:79
Header file for the column trait.
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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:81
Header file for the IsReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
#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:61
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3083
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the IsRestricted type trait.
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.