35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 114 template<
typename MT
117 class Column<MT,true,false,SF,CCAs...>
118 :
public View< SparseVector< Column<MT,true,false,SF,CCAs...>, false > >
119 ,
private ColumnData<CCAs...>
123 using DataType = ColumnData<CCAs...>;
124 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
130 using This = Column<MT,
true,
false,SF,CCAs...>;
132 using BaseType = SparseVector<This,false>;
133 using ViewedType = MT;
161 template<
typename... RCAs >
162 explicit inline Column( MT& matrix, RCAs... args );
164 Column(
const Column& ) =
default;
178 inline Reference operator[](
size_t index );
194 inline Column& operator=( initializer_list<ElementType> list );
195 inline Column& operator=(
const Column& rhs );
197 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
198 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
199 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
200 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
201 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
202 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
203 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
204 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
205 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
214 inline MT& operand() noexcept;
215 inline const MT& operand() const noexcept;
217 inline
size_t size() const noexcept;
218 inline
size_t capacity() const noexcept;
221 inline
void reserve(
size_t n );
230 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
237 inline
void erase(
size_t index );
242 inline
void erase( Pred predicate );
244 template< typename Pred >
252 inline
Iterator find (
size_t index );
254 inline
Iterator lowerBound(
size_t index );
256 inline
Iterator upperBound(
size_t index );
264 template< typename Other > inline Column& scale( const Other& scalar );
271 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
272 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
274 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
275 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
276 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
277 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
278 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
279 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
287 inline
size_t extendCapacity() const noexcept;
333 template< typename MT
336 template< typename... RCAs >
337 inline Column<MT,true,false,SF,CCAs...>::Column( MT& matrix, RCAs... args )
338 : DataType( args... )
342 if( matrix_.columns() <=
column() ) {
372 template<
typename MT
375 inline typename Column<MT,
true,
false,SF,CCAs...>
::Reference 376 Column<MT,true,false,SF,CCAs...>::operator[](
size_t index )
379 return matrix_(index,
column());
395 template<
typename MT
399 Column<MT,true,false,SF,CCAs...>::operator[](
size_t index )
const 402 return const_cast<const MT&
>( matrix_ )(index,
column());
419 template<
typename MT
422 inline typename Column<MT,
true,
false,SF,CCAs...>
::Reference 423 Column<MT,true,false,SF,CCAs...>::at(
size_t index )
425 if( index >=
size() ) {
428 return (*
this)[index];
445 template<
typename MT
449 Column<MT,true,false,SF,CCAs...>::at(
size_t index )
const 451 if( index >=
size() ) {
454 return (*
this)[index];
468 template<
typename MT
471 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 474 return matrix_.begin(
column() );
488 template<
typename MT
494 return matrix_.cbegin(
column() );
508 template<
typename MT
514 return matrix_.cbegin(
column() );
528 template<
typename MT
531 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 534 return matrix_.end(
column() );
548 template<
typename MT
554 return matrix_.cend(
column() );
568 template<
typename MT
574 return matrix_.cend(
column() );
603 template<
typename MT
606 inline Column<MT,
true,
false,SF,CCAs...>&
607 Column<MT,true,false,SF,CCAs...>::operator=( initializer_list<ElementType> list )
611 if( list.size() >
size() ) {
615 const InitializerVector<ElementType,false> tmp( list,
size() );
617 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
621 decltype(
auto) left( derestrict( *this ) );
648 template< typename MT
651 inline Column<MT,true,false,SF,CCAs...>&
652 Column<MT,true,false,SF,CCAs...>::operator=( const Column& rhs )
660 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
column() == rhs.column() ) )
663 if(
size() != rhs.size() ) {
667 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
671 decltype(
auto) left( derestrict( *this ) );
673 if( rhs.canAlias( &matrix_ ) ) {
676 left.reserve( tmp.nonZeros() );
681 left.reserve( rhs.nonZeros() );
707 template<
typename MT
710 template<
typename VT >
711 inline Column<MT,
true,
false,SF,CCAs...>&
712 Column<MT,true,false,SF,CCAs...>::operator=(
const DenseVector<VT,false>& rhs )
724 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
727 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
731 decltype(
auto) left( derestrict( *this ) );
734 const ResultType_t<VT> tmp( right );
740 assign( left, right );
765 template<
typename MT
768 template<
typename VT >
769 inline Column<MT,
true,
false,SF,CCAs...>&
770 Column<MT,true,false,SF,CCAs...>::operator=(
const SparseVector<VT,false>& rhs )
782 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
785 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
789 decltype(
auto) left( derestrict( *this ) );
792 const ResultType_t<VT> tmp( right );
794 left.reserve( tmp.nonZeros() );
799 left.reserve( right.nonZeros() );
800 assign( left, right );
825 template<
typename MT
828 template<
typename VT >
829 inline Column<MT,
true,
false,SF,CCAs...>&
841 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
851 const AddType tmp( *
this + (~rhs) );
853 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
857 decltype(
auto) left( derestrict( *this ) );
884 template< typename MT
887 template< typename VT >
888 inline Column<MT,true,false,SF,CCAs...>&
889 Column<MT,true,false,SF,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
900 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
910 const AddType tmp( *
this + (~rhs) );
912 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
916 decltype(
auto) left( derestrict( *this ) );
945 template< typename MT
948 template< typename VT >
949 inline Column<MT,true,false,SF,CCAs...>&
950 Column<MT,true,false,SF,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
961 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
971 const SubType tmp( *
this - (~rhs) );
973 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
977 decltype(
auto) left( derestrict( *this ) );
1005 template< typename MT
1008 template< typename VT >
1009 inline Column<MT,true,false,SF,CCAs...>&
1010 Column<MT,true,false,SF,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
1012 using blaze::assign;
1021 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1031 const SubType tmp( *
this - (~rhs) );
1033 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1037 decltype(
auto) left( derestrict( *this ) );
1041 assign( left, tmp );
1064 template< typename MT
1067 template< typename VT >
1068 inline Column<MT,true,false,SF,CCAs...>&
1069 Column<MT,true,false,SF,CCAs...>::operator*=( const Vector<VT,false>& rhs )
1071 using blaze::assign;
1079 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1088 const MultType tmp( *
this * (~rhs) );
1090 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1094 decltype(
auto) left( derestrict( *this ) );
1097 assign( left, tmp );
1119 template< typename MT
1122 template< typename VT >
1123 inline Column<MT,true,false,SF,CCAs...>&
1124 Column<MT,true,false,SF,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
1126 using blaze::assign;
1135 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1145 const DivType tmp( *
this / (~rhs) );
1147 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1151 decltype(
auto) left( derestrict( *this ) );
1154 assign( left, tmp );
1177 template< typename MT
1180 template< typename VT >
1181 inline Column<MT,true,false,SF,CCAs...>&
1182 Column<MT,true,false,SF,CCAs...>::operator%=( const Vector<VT,false>& rhs )
1184 using blaze::assign;
1189 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1195 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1199 const CrossType tmp( *
this % (~rhs) );
1201 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1205 decltype(
auto) left( derestrict( *this ) );
1208 assign( left, tmp );
1232 template< typename MT
1235 inline MT& Column<MT,true,false,SF,CCAs...>::operand() noexcept
1249 template<
typename MT
1252 inline const MT& Column<MT,true,false,SF,CCAs...>::operand() const noexcept
1266 template<
typename MT
1271 return matrix_.rows();
1283 template<
typename MT
1288 return matrix_.capacity(
column() );
1303 template<
typename MT
1308 return matrix_.nonZeros(
column() );
1320 template<
typename MT
1325 matrix_.reset(
column() );
1341 template<
typename MT
1344 void Column<MT,true,false,SF,CCAs...>::reserve(
size_t n )
1346 matrix_.reserve(
column(), n );
1361 template<
typename MT
1364 inline size_t Column<MT,true,false,SF,CCAs...>::extendCapacity() const noexcept
1369 size_t nonzeros( 2UL*
capacity()+1UL );
1370 nonzeros =
max( nonzeros, 7UL );
1371 nonzeros =
min( nonzeros,
size() );
1401 template<
typename MT
1404 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1407 return matrix_.set( index,
column(), value );
1426 template<
typename MT
1429 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1430 Column<MT,true,false,SF,CCAs...>::insert(
size_t index,
const ElementType& value )
1432 return matrix_.insert( index,
column(), value );
1463 template<
typename MT
1466 inline void Column<MT,true,false,SF,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
1468 matrix_.append( index,
column(), value, check );
1491 template<
typename MT
1494 inline void Column<MT,true,false,SF,CCAs...>::erase(
size_t index )
1496 matrix_.erase( index,
column() );
1511 template<
typename MT
1514 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1515 Column<MT,true,false,SF,CCAs...>::erase(
Iterator pos )
1517 return matrix_.erase(
column(), pos );
1533 template<
typename MT
1536 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1539 return matrix_.erase(
column(), first, last );
1568 template<
typename MT
1571 template<
typename Pred
1573 inline void Column<MT,true,false,SF,CCAs...>::erase( Pred predicate )
1606 template<
typename MT
1609 template<
typename Pred >
1610 inline void Column<MT,true,false,SF,CCAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
1612 matrix_.erase(
column(), first, last, predicate );
1640 template<
typename MT
1643 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1644 Column<MT,true,false,SF,CCAs...>::find(
size_t index )
1646 return matrix_.find( index,
column() );
1666 template<
typename MT
1670 Column<MT,true,false,SF,CCAs...>::find(
size_t index )
const 1672 return matrix_.find( index,
column() );
1691 template<
typename MT
1694 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1695 Column<MT,true,false,SF,CCAs...>::lowerBound(
size_t index )
1697 return matrix_.lowerBound( index,
column() );
1716 template<
typename MT
1720 Column<MT,true,false,SF,CCAs...>::lowerBound(
size_t index )
const 1722 return matrix_.lowerBound( index,
column() );
1741 template<
typename MT
1744 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1745 Column<MT,true,false,SF,CCAs...>::upperBound(
size_t index )
1747 return matrix_.upperBound( index,
column() );
1766 template<
typename MT
1770 Column<MT,true,false,SF,CCAs...>::upperBound(
size_t index )
const 1772 return matrix_.upperBound( index,
column() );
1799 template<
typename MT
1802 template<
typename Other >
1803 inline Column<MT,
true,
false,SF,CCAs...>&
1804 Column<MT,true,false,SF,CCAs...>::scale(
const Other& scalar )
1809 element->value() *= scalar;
1835 template<
typename MT
1838 template<
typename Other >
1839 inline bool Column<MT,true,false,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1841 return matrix_.isAliased( alias );
1858 template<
typename MT
1861 template<
typename Other >
1862 inline bool Column<MT,true,false,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1864 return matrix_.isAliased( alias );
1882 template<
typename MT
1885 template<
typename VT >
1886 inline void Column<MT,true,false,SF,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
1891 for(
size_t i=0UL; i<
size(); ++i )
1893 if( matrix_.nonZeros(
column() ) == matrix_.capacity(
column() ) )
1894 matrix_.reserve(
column(), extendCapacity() );
1896 matrix_.append( i,
column(), (~rhs)[i],
true );
1915 template<
typename MT
1918 template<
typename VT >
1919 inline void Column<MT,true,false,SF,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
1924 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1925 matrix_.append( element->index(),
column(), element->value(), true );
1944 template<
typename MT
1947 template<
typename VT >
1948 inline void Column<MT,true,false,SF,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
1950 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1958 const AddType tmp(
serial( *
this + (~rhs) ) );
1959 matrix_.reset(
column() );
1978 template<
typename MT
1981 template<
typename VT >
1982 inline void Column<MT,true,false,SF,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
1984 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1992 const AddType tmp(
serial( *
this + (~rhs) ) );
1993 matrix_.reset(
column() );
1994 matrix_.reserve(
column(), tmp.nonZeros() );
2013 template<
typename MT
2016 template<
typename VT >
2017 inline void Column<MT,true,false,SF,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
2019 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2027 const SubType tmp(
serial( *
this - (~rhs) ) );
2028 matrix_.reset(
column() );
2047 template<
typename MT
2050 template<
typename VT >
2051 inline void Column<MT,true,false,SF,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
2053 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2061 const SubType tmp(
serial( *
this - (~rhs) ) );
2062 matrix_.reset(
column() );
2063 matrix_.reserve(
column(), tmp.nonZeros() );
2090 template<
typename MT
2092 class Column<MT,false,false,false,CCAs...>
2093 :
public View< SparseVector< Column<MT,false,false,false,CCAs...>, false > >
2094 ,
private ColumnData<CCAs...>
2098 using DataType = ColumnData<CCAs...>;
2099 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2105 using This = Column<MT,
false,
false,
false,CCAs...>;
2107 using BaseType = SparseVector<This,false>;
2108 using ViewedType = MT;
2125 template<
typename MatrixType
2126 ,
typename IteratorType >
2128 :
private SparseElement
2137 inline ColumnElement( IteratorType pos,
size_t row )
2149 template<
typename T >
inline ColumnElement& operator=(
const T& v ) {
2161 template<
typename T >
inline ColumnElement&
operator+=(
const T& v ) {
2173 template<
typename T >
inline ColumnElement&
operator-=(
const T& v ) {
2185 template<
typename T >
inline ColumnElement&
operator*=(
const T& v ) {
2197 template<
typename T >
inline ColumnElement&
operator/=(
const T& v ) {
2208 inline const ColumnElement* operator->()
const {
2218 inline decltype(
auto) value()
const {
2219 return pos_->value();
2228 inline size_t index()
const {
2244 template<
typename MatrixType
2245 ,
typename IteratorType >
2246 class ColumnIterator
2250 using IteratorCategory = std::forward_iterator_tag;
2251 using ValueType = ColumnElement<MatrixType,IteratorType>;
2252 using PointerType = ValueType;
2253 using ReferenceType = ValueType;
2254 using DifferenceType = ptrdiff_t;
2257 using iterator_category = IteratorCategory;
2258 using value_type = ValueType;
2259 using pointer = PointerType;
2260 using reference = ReferenceType;
2261 using difference_type = DifferenceType;
2267 inline ColumnIterator()
2268 : matrix_( nullptr )
2282 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
2283 : matrix_( &matrix )
2288 for( ; row_<matrix_->rows(); ++row_ ) {
2289 pos_ = matrix_->find( row_, column_ );
2290 if( pos_ != matrix_->end( row_ ) )
break;
2303 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2304 : matrix_( &matrix )
2318 template<
typename MatrixType2,
typename IteratorType2 >
2319 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
2320 : matrix_( it.matrix_ )
2322 , column_( it.column_ )
2332 inline ColumnIterator& operator++() {
2334 for( ; row_<matrix_->rows(); ++row_ ) {
2335 pos_ = matrix_->find( row_, column_ );
2336 if( pos_ != matrix_->end( row_ ) )
break;
2348 inline const ColumnIterator operator++(
int ) {
2349 const ColumnIterator tmp( *
this );
2360 inline ReferenceType
operator*()
const {
2361 return ReferenceType( pos_, row_ );
2370 inline PointerType operator->()
const {
2371 return PointerType( pos_, row_ );
2381 template<
typename MatrixType2,
typename IteratorType2 >
2382 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2383 return row_ == rhs.row_;
2393 template<
typename MatrixType2,
typename IteratorType2 >
2394 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2395 return !( *
this == rhs );
2405 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2406 size_t counter( 0UL );
2407 for(
size_t i=rhs.row_; i<row_; ++i ) {
2408 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2417 MatrixType* matrix_;
2424 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2425 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 >
friend class Column;
2432 using ConstIterator = ColumnIterator< const MT, ConstIterator_t<MT> >;
2446 template<
typename... RCAs >
2447 explicit inline Column( MT& matrix, RCAs... args );
2449 Column(
const Column& ) =
default;
2456 ~Column() =
default;
2463 inline Reference operator[](
size_t index );
2479 inline Column& operator=( initializer_list<ElementType> list );
2480 inline Column& operator=(
const Column& rhs );
2482 template<
typename VT >
inline Column& operator= (
const Vector<VT,false>& rhs );
2483 template<
typename VT >
inline Column&
operator+=(
const Vector<VT,false>& rhs );
2484 template<
typename VT >
inline Column&
operator-=(
const Vector<VT,false>& rhs );
2485 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
2486 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
2487 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
2496 inline MT& operand() noexcept;
2497 inline const MT& operand() const noexcept;
2499 inline
size_t size() const;
2502 inline
void reset();
2503 inline
void reserve(
size_t n );
2512 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
2519 inline
void erase(
size_t index );
2524 inline
void erase( Pred predicate );
2526 template< typename Pred >
2534 inline
Iterator find (
size_t index );
2536 inline
Iterator lowerBound(
size_t index );
2538 inline
Iterator upperBound(
size_t index );
2546 template< typename Other > inline Column& scale( const Other& scalar );
2553 template< typename Other > inline
bool canAlias ( const Other* alias ) const;
2554 template< typename Other > inline
bool isAliased( const Other* alias ) const;
2556 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2557 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2558 template< typename VT > inline
void addAssign( const Vector<VT,false>& rhs );
2559 template< typename VT > inline
void subAssign( const Vector<VT,false>& rhs );
2607 template< typename MT
2609 template< typename... RCAs >
2610 inline Column<MT,false,false,false,CCAs...>::Column( MT& matrix, RCAs... args )
2611 : DataType( args... )
2612 , matrix_ ( matrix )
2615 if( matrix_.columns() <=
column() ) {
2645 template<
typename MT
2647 inline typename Column<MT,
false,
false,
false,CCAs...>
::Reference 2648 Column<MT,false,false,false,CCAs...>::operator[](
size_t index )
2651 return matrix_(index,
column());
2667 template<
typename MT
2670 Column<MT,false,false,false,CCAs...>::operator[](
size_t index )
const 2673 return const_cast<const MT&
>( matrix_ )(index,
column());
2690 template<
typename MT
2692 inline typename Column<MT,
false,
false,
false,CCAs...>
::Reference 2693 Column<MT,false,false,false,CCAs...>::at(
size_t index )
2695 if( index >=
size() ) {
2698 return (*
this)[index];
2715 template<
typename MT
2718 Column<MT,false,false,false,CCAs...>::at(
size_t index )
const 2720 if( index >=
size() ) {
2723 return (*
this)[index];
2737 template<
typename MT
2739 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 2756 template<
typename MT
2775 template<
typename MT
2794 template<
typename MT
2796 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 2813 template<
typename MT
2832 template<
typename MT
2866 template<
typename MT
2868 inline Column<MT,
false,
false,
false,CCAs...>&
2869 Column<MT,false,false,false,CCAs...>::operator=( initializer_list<ElementType> list )
2871 using blaze::assign;
2873 if( list.size() >
size() ) {
2877 const InitializerVector<ElementType,false> tmp( list,
size() );
2879 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
2883 decltype(
auto) left( derestrict( *this ) );
2885 assign( left, tmp );
2909 template< typename MT
2911 inline Column<MT,false,false,false,CCAs...>&
2912 Column<MT,false,false,false,CCAs...>::operator=( const Column& rhs )
2914 using blaze::assign;
2920 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
column() == rhs.column() ) )
2923 if(
size() != rhs.size() ) {
2927 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
2931 decltype(
auto) left( derestrict( *this ) );
2933 if( rhs.canAlias( &matrix_ ) ) {
2935 assign( left, tmp );
2938 assign( left, rhs );
2963 template<
typename MT
2965 template<
typename VT >
2966 inline Column<MT,
false,
false,
false,CCAs...>&
2967 Column<MT,false,false,false,CCAs...>::operator=(
const Vector<VT,false>& rhs )
2969 using blaze::assign;
2975 const CompositeType_t<VT> tmp( ~rhs );
2977 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
2981 decltype(
auto) left( derestrict( *this ) );
2983 assign( left, tmp );
3007 template< typename MT
3009 template< typename VT >
3010 inline Column<MT,false,false,false,CCAs...>&
3011 Column<MT,false,false,false,CCAs...>::operator+=( const Vector<VT,false>& rhs )
3013 using blaze::assign;
3021 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3030 const AddType tmp( *
this + (~rhs) );
3032 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3036 decltype(
auto) left( derestrict( *this ) );
3038 assign( left, tmp );
3062 template< typename MT
3064 template< typename VT >
3065 inline Column<MT,false,false,false,CCAs...>&
3066 Column<MT,false,false,false,CCAs...>::operator-=( const Vector<VT,false>& rhs )
3068 using blaze::assign;
3076 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3085 const SubType tmp( *
this - (~rhs) );
3087 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3091 decltype(
auto) left( derestrict( *this ) );
3093 assign( left, tmp );
3116 template< typename MT
3118 template< typename VT >
3119 inline Column<MT,false,false,false,CCAs...>&
3120 Column<MT,false,false,false,CCAs...>::operator*=( const Vector<VT,false>& rhs )
3122 using blaze::assign;
3130 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3139 const MultType tmp( *
this * (~rhs) );
3141 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3145 decltype(
auto) left( derestrict( *this ) );
3147 assign( left, tmp );
3169 template< typename MT
3171 template< typename VT >
3172 inline Column<MT,false,false,false,CCAs...>&
3173 Column<MT,false,false,false,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
3175 using blaze::assign;
3184 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3194 const DivType tmp( *
this / (~rhs) );
3196 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3200 decltype(
auto) left( derestrict( *this ) );
3202 assign( left, tmp );
3225 template< typename MT
3227 template< typename VT >
3228 inline Column<MT,false,false,false,CCAs...>&
3229 Column<MT,false,false,false,CCAs...>::operator%=( const Vector<VT,false>& rhs )
3231 using blaze::assign;
3236 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3242 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3246 const CrossType tmp( *
this % (~rhs) );
3248 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3252 decltype(
auto) left( derestrict( *this ) );
3254 assign( left, tmp );
3278 template< typename MT
3280 inline MT& Column<MT,false,false,false,CCAs...>::operand() noexcept
3294 template<
typename MT
3296 inline const MT& Column<MT,false,false,false,CCAs...>::operand() const noexcept
3310 template<
typename MT
3314 return matrix_.rows();
3326 template<
typename MT
3330 return matrix_.rows();
3345 template<
typename MT
3349 size_t counter( 0UL );
3365 template<
typename MT
3369 const size_t ibegin( ( IsLower_v<MT> )
3370 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3374 const size_t iend ( ( IsUpper_v<MT> )
3375 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3380 for(
size_t i=ibegin; i<iend; ++i ) {
3381 matrix_.erase( i,
column() );
3398 template<
typename MT
3400 void Column<MT,false,false,false,CCAs...>::reserve(
size_t n )
3430 template<
typename MT
3432 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3454 template<
typename MT
3456 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3457 Column<MT,false,false,false,CCAs...>::insert(
size_t index,
const ElementType& value )
3490 template<
typename MT
3492 inline void Column<MT,false,false,false,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
3494 if( !check || !isDefault<strict>( value ) )
3495 matrix_.insert( index,
column(), value );
3518 template<
typename MT
3520 inline void Column<MT,false,false,false,CCAs...>::erase(
size_t index )
3522 matrix_.erase( index,
column() );
3537 template<
typename MT
3539 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3540 Column<MT,false,false,false,CCAs...>::erase(
Iterator pos )
3542 const size_t row( pos.row_ );
3547 matrix_.erase(
row, pos.pos_ );
3564 template<
typename MT
3566 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3567 Column<MT,false,false,false,CCAs...>::erase(
Iterator first,
Iterator last )
3569 for( ; first!=last; ++first ) {
3570 matrix_.erase( first.row_, first.pos_ );
3601 template<
typename MT
3603 template<
typename Pred
3605 inline void Column<MT,false,false,false,CCAs...>::erase( Pred predicate )
3608 if( predicate( element->value() ) )
3609 matrix_.erase( element.row_, element.pos_ );
3642 template<
typename MT
3644 template<
typename Pred >
3645 inline void Column<MT,false,false,false,CCAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
3647 for( ; first!=last; ++first ) {
3648 if( predicate( first->value() ) )
3649 matrix_.erase( first.row_, first.pos_ );
3678 template<
typename MT
3680 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3681 Column<MT,false,false,false,CCAs...>::find(
size_t index )
3683 const Iterator_t<MT> pos( matrix_.find( index,
column() ) );
3685 if( pos != matrix_.end( index ) )
3708 template<
typename MT
3711 Column<MT,false,false,false,CCAs...>::find(
size_t index )
const 3713 const ConstIterator_t<MT> pos( matrix_.find( index,
column() ) );
3715 if( pos != matrix_.end( index ) )
3737 template<
typename MT
3739 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3740 Column<MT,false,false,false,CCAs...>::lowerBound(
size_t index )
3742 for(
size_t i=index; i<
size(); ++i )
3744 const Iterator_t<MT> pos( matrix_.find( i,
column() ) );
3746 if( pos != matrix_.end( i ) )
3769 template<
typename MT
3772 Column<MT,false,false,false,CCAs...>::lowerBound(
size_t index )
const 3774 for(
size_t i=index; i<
size(); ++i )
3776 const ConstIterator_t<MT> pos( matrix_.find( i,
column() ) );
3778 if( pos != matrix_.end( i ) )
3801 template<
typename MT
3803 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3804 Column<MT,false,false,false,CCAs...>::upperBound(
size_t index )
3806 for(
size_t i=index+1UL; i<
size(); ++i )
3808 const Iterator_t<MT> pos( matrix_.find( i,
column() ) );
3810 if( pos != matrix_.end( i ) )
3833 template<
typename MT
3836 Column<MT,false,false,false,CCAs...>::upperBound(
size_t index )
const 3838 for(
size_t i=index+1UL; i<
size(); ++i )
3840 const ConstIterator_t<MT> pos( matrix_.find( i,
column() ) );
3842 if( pos != matrix_.end( i ) )
3873 template<
typename MT
3875 template<
typename Other >
3876 inline Column<MT,
false,
false,
false,CCAs...>&
3877 Column<MT,false,false,false,CCAs...>::scale(
const Other& scalar )
3882 element->value() *= scalar;
3908 template<
typename MT
3910 template<
typename Other >
3911 inline bool Column<MT,false,false,false,CCAs...>::canAlias(
const Other* alias )
const 3913 return matrix_.isAliased( alias );
3926 template<
typename MT
3928 template<
typename Other >
3929 inline bool Column<MT,false,false,false,CCAs...>::isAliased(
const Other* alias )
const 3931 return matrix_.isAliased( alias );
3949 template<
typename MT
3951 template<
typename VT >
3952 inline void Column<MT,false,false,false,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
3956 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3957 matrix_(i,
column()) = (~rhs)[i];
3976 template<
typename MT
3978 template<
typename VT >
3979 inline void Column<MT,false,false,false,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
3985 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3986 for( ; i<element->index(); ++i )
3987 matrix_.erase( i,
column() );
3988 matrix_(i++,
column()) = element->value();
3990 for( ; i<
size(); ++i ) {
3991 matrix_.erase( i,
column() );
4010 template<
typename MT
4012 template<
typename VT >
4013 inline void Column<MT,false,false,false,CCAs...>::addAssign(
const Vector<VT,false>& rhs )
4015 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4022 const AddType tmp(
serial( *
this + (~rhs) ) );
4041 template<
typename MT
4043 template<
typename VT >
4044 inline void Column<MT,false,false,false,CCAs...>::subAssign(
const Vector<VT,false>& rhs )
4046 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4053 const SubType tmp(
serial( *
this - (~rhs) ) );
4080 template<
typename MT
4082 class Column<MT,false,false,true,CCAs...>
4083 :
public View< SparseVector< Column<MT,false,false,true,CCAs...>, false > >
4084 ,
private ColumnData<CCAs...>
4088 using DataType = ColumnData<CCAs...>;
4089 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4095 using This = Column<MT,
false,
false,
true,CCAs...>;
4097 using BaseType = SparseVector<This,false>;
4098 using ViewedType = MT;
4126 template<
typename... RCAs >
4127 explicit inline Column( MT& matrix, RCAs... args );
4129 Column(
const Column& ) =
default;
4136 ~Column() =
default;
4143 inline Reference operator[](
size_t index );
4159 inline Column& operator=( initializer_list<ElementType> list );
4160 inline Column& operator=(
const Column& rhs );
4162 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
4163 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
4164 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
4165 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
4166 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
4167 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
4168 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
4169 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
4170 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
4179 inline MT& operand() noexcept;
4180 inline const MT& operand() const noexcept;
4182 inline
size_t size() const noexcept;
4183 inline
size_t capacity() const noexcept;
4185 inline
void reset();
4186 inline
void reserve(
size_t n );
4195 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
4202 inline
void erase(
size_t index );
4207 inline
void erase( Pred predicate );
4209 template< typename Pred >
4217 inline
Iterator find (
size_t index );
4219 inline
Iterator lowerBound(
size_t index );
4221 inline
Iterator upperBound(
size_t index );
4229 template< typename Other > inline Column& scale( const Other& scalar );
4236 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4237 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4239 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
4240 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
4241 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
4242 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4243 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
4244 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4252 inline
size_t extendCapacity() const noexcept;
4299 template< typename MT
4301 template< typename... RCAs >
4302 inline Column<MT,false,false,true,CCAs...>::Column( MT& matrix, RCAs... args )
4303 : DataType( args... )
4304 , matrix_ ( matrix )
4307 if( matrix_.columns() <=
column() ) {
4337 template<
typename MT
4339 inline typename Column<MT,
false,
false,
true,CCAs...>
::Reference 4340 Column<MT,false,false,true,CCAs...>::operator[](
size_t index )
4343 return matrix_(
column(),index);
4359 template<
typename MT
4362 Column<MT,false,false,true,CCAs...>::operator[](
size_t index )
const 4365 return const_cast<const MT&
>( matrix_ )(
column(),index);
4382 template<
typename MT
4384 inline typename Column<MT,
false,
false,
true,CCAs...>
::Reference 4385 Column<MT,false,false,true,CCAs...>::at(
size_t index )
4387 if( index >=
size() ) {
4390 return (*
this)[index];
4407 template<
typename MT
4410 Column<MT,false,false,true,CCAs...>::at(
size_t index )
const 4412 if( index >=
size() ) {
4415 return (*
this)[index];
4429 template<
typename MT
4431 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 4434 return matrix_.begin(
column() );
4448 template<
typename MT
4453 return matrix_.cbegin(
column() );
4467 template<
typename MT
4472 return matrix_.cbegin(
column() );
4486 template<
typename MT
4488 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 4491 return matrix_.end(
column() );
4505 template<
typename MT
4510 return matrix_.cend(
column() );
4524 template<
typename MT
4529 return matrix_.cend(
column() );
4558 template<
typename MT
4560 inline Column<MT,
false,
false,
true,CCAs...>&
4561 Column<MT,false,false,true,CCAs...>::operator=( initializer_list<ElementType> list )
4563 using blaze::assign;
4565 if( list.size() >
size() ) {
4569 const InitializerVector<ElementType,false> tmp( list,
size() );
4571 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4575 decltype(
auto) left( derestrict( *this ) );
4578 assign( left, tmp );
4602 template< typename MT
4604 inline Column<MT,false,false,true,CCAs...>&
4605 Column<MT,false,false,true,CCAs...>::operator=( const Column& rhs )
4607 using blaze::assign;
4613 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
column() == rhs.column() ) )
4616 if(
size() != rhs.size() ) {
4620 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
4624 decltype(
auto) left( derestrict( *this ) );
4626 if( rhs.canAlias( &matrix_ ) ) {
4629 left.reserve( tmp.nonZeros() );
4630 assign( left, tmp );
4634 left.reserve( rhs.nonZeros() );
4635 assign( left, rhs );
4660 template<
typename MT
4662 template<
typename VT >
4663 inline Column<MT,
false,
false,
true,CCAs...>&
4664 Column<MT,false,false,true,CCAs...>::operator=(
const DenseVector<VT,false>& rhs )
4666 using blaze::assign;
4676 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4677 Right right( ~rhs );
4679 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4683 decltype(
auto) left( derestrict( *this ) );
4686 const ResultType_t<VT> tmp( right );
4688 assign( left, tmp );
4692 assign( left, right );
4717 template<
typename MT
4719 template<
typename VT >
4720 inline Column<MT,
false,
false,
true,CCAs...>&
4721 Column<MT,false,false,true,CCAs...>::operator=(
const SparseVector<VT,false>& rhs )
4723 using blaze::assign;
4733 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4734 Right right( ~rhs );
4736 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4740 decltype(
auto) left( derestrict( *this ) );
4743 const ResultType_t<VT> tmp( right);
4745 left.reserve( tmp.nonZeros() );
4746 assign( left, tmp );
4750 left.reserve( right.nonZeros() );
4751 assign( left, right );
4776 template<
typename MT
4778 template<
typename VT >
4779 inline Column<MT,
false,
false,
true,CCAs...>&
4782 using blaze::assign;
4791 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4801 const AddType tmp( *
this + (~rhs) );
4803 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4807 decltype(
auto) left( derestrict( *this ) );
4810 assign( left, tmp );
4834 template< typename MT
4836 template< typename VT >
4837 inline Column<MT,false,false,true,CCAs...>&
4838 Column<MT,false,false,true,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
4840 using blaze::assign;
4849 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4859 const AddType tmp( *
this + (~rhs) );
4861 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4865 decltype(
auto) left( derestrict( *this ) );
4869 assign( left, tmp );
4894 template< typename MT
4896 template< typename VT >
4897 inline Column<MT,false,false,true,CCAs...>&
4898 Column<MT,false,false,true,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
4900 using blaze::assign;
4909 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4919 const SubType tmp( *
this - (~rhs) );
4921 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4925 decltype(
auto) left( derestrict( *this ) );
4928 assign( left, tmp );
4953 template< typename MT
4955 template< typename VT >
4956 inline Column<MT,false,false,true,CCAs...>&
4957 Column<MT,false,false,true,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
4959 using blaze::assign;
4968 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4978 const SubType tmp( *
this - (~rhs) );
4980 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4984 decltype(
auto) left( derestrict( *this ) );
4988 assign( left, tmp );
5011 template< typename MT
5013 template< typename VT >
5014 inline Column<MT,false,false,true,CCAs...>&
5015 Column<MT,false,false,true,CCAs...>::operator*=( const Vector<VT,false>& rhs )
5017 using blaze::assign;
5025 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5034 const MultType tmp( *
this * (~rhs) );
5036 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5040 decltype(
auto) left( derestrict( *this ) );
5043 assign( left, tmp );
5065 template< typename MT
5067 template< typename VT >
5068 inline Column<MT,false,false,true,CCAs...>&
5069 Column<MT,false,false,true,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
5071 using blaze::assign;
5080 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5090 const DivType tmp( *
this / (~rhs) );
5092 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5096 decltype(
auto) left( derestrict( *this ) );
5099 assign( left, tmp );
5122 template< typename MT
5124 template< typename VT >
5125 inline Column<MT,false,false,true,CCAs...>&
5126 Column<MT,false,false,true,CCAs...>::operator%=( const Vector<VT,false>& rhs )
5128 using blaze::assign;
5133 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5139 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5143 const CrossType tmp( *
this % (~rhs) );
5145 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5149 decltype(
auto) left( derestrict( *this ) );
5152 assign( left, tmp );
5176 template< typename MT
5178 inline MT& Column<MT,false,false,true,CCAs...>::operand() noexcept
5192 template<
typename MT
5194 inline const MT& Column<MT,false,false,true,CCAs...>::operand() const noexcept
5208 template<
typename MT
5212 return matrix_.rows();
5224 template<
typename MT
5228 return matrix_.capacity(
column() );
5243 template<
typename MT
5247 return matrix_.nonZeros(
column() );
5259 template<
typename MT
5263 matrix_.reset(
column() );
5279 template<
typename MT
5281 void Column<MT,false,false,true,CCAs...>::reserve(
size_t n )
5283 matrix_.reserve(
column(), n );
5298 template<
typename MT
5300 inline size_t Column<MT,false,false,true,CCAs...>::extendCapacity() const noexcept
5305 size_t nonzeros( 2UL*
capacity()+1UL );
5306 nonzeros =
max( nonzeros, 7UL );
5307 nonzeros =
min( nonzeros,
size() );
5337 template<
typename MT
5339 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5342 return matrix_.set(
column(), index, value );
5361 template<
typename MT
5363 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5364 Column<MT,false,false,true,CCAs...>::insert(
size_t index,
const ElementType& value )
5366 return matrix_.insert(
column(), index, value );
5397 template<
typename MT
5399 inline void Column<MT,false,false,true,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
5401 matrix_.append(
column(), index, value, check );
5424 template<
typename MT
5426 inline void Column<MT,false,false,true,CCAs...>::erase(
size_t index )
5428 matrix_.erase(
column(), index );
5443 template<
typename MT
5445 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5446 Column<MT,false,false,true,CCAs...>::erase(
Iterator pos )
5448 return matrix_.erase(
column(), pos );
5464 template<
typename MT
5466 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5467 Column<MT,false,false,true,CCAs...>::erase(
Iterator first,
Iterator last )
5469 return matrix_.erase(
column(), first, last );
5498 template<
typename MT
5500 template<
typename Pred
5502 inline void Column<MT,false,false,true,CCAs...>::erase( Pred predicate )
5535 template<
typename MT
5537 template<
typename Pred >
5538 inline void Column<MT,false,false,true,CCAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
5540 matrix_.erase(
column(), first, last, predicate );
5568 template<
typename MT
5570 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5571 Column<MT,false,false,true,CCAs...>::find(
size_t index )
5573 return matrix_.find(
column(), index );
5593 template<
typename MT
5596 Column<MT,false,false,true,CCAs...>::find(
size_t index )
const 5598 return matrix_.find(
column(), index );
5617 template<
typename MT
5619 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5620 Column<MT,false,false,true,CCAs...>::lowerBound(
size_t index )
5622 return matrix_.lowerBound(
column(), index );
5641 template<
typename MT
5644 Column<MT,false,false,true,CCAs...>::lowerBound(
size_t index )
const 5646 return matrix_.lowerBound(
column(), index );
5665 template<
typename MT
5667 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5668 Column<MT,false,false,true,CCAs...>::upperBound(
size_t index )
5670 return matrix_.upperBound(
column(), index );
5689 template<
typename MT
5692 Column<MT,false,false,true,CCAs...>::upperBound(
size_t index )
const 5694 return matrix_.upperBound(
column(), index );
5721 template<
typename MT
5723 template<
typename Other >
5724 inline Column<MT,
false,
false,
true,CCAs...>&
5725 Column<MT,false,false,true,CCAs...>::scale(
const Other& scalar )
5730 element->value() *= scalar;
5756 template<
typename MT
5758 template<
typename Other >
5759 inline bool Column<MT,false,false,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
5761 return matrix_.isAliased( alias );
5778 template<
typename MT
5780 template<
typename Other >
5781 inline bool Column<MT,false,false,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
5783 return matrix_.isAliased( alias );
5801 template<
typename MT
5803 template<
typename VT >
5804 inline void Column<MT,false,false,true,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
5809 for(
size_t i=0UL; i<
size(); ++i )
5811 if( matrix_.nonZeros(
column() ) == matrix_.capacity(
column() ) )
5812 matrix_.reserve(
column(), extendCapacity() );
5814 matrix_.append(
column(), i, (~rhs)[i],
true );
5833 template<
typename MT
5835 template<
typename VT >
5836 inline void Column<MT,false,false,true,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
5841 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5842 matrix_.append(
column(), element->index(), element->value(), true );
5861 template<
typename MT
5863 template<
typename VT >
5864 inline void Column<MT,false,false,true,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
5866 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5874 const AddType tmp(
serial( *
this + (~rhs) ) );
5875 matrix_.reset(
column() );
5894 template<
typename MT
5896 template<
typename VT >
5897 inline void Column<MT,false,false,true,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
5899 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5907 const AddType tmp(
serial( *
this + (~rhs) ) );
5908 matrix_.reset(
column() );
5909 matrix_.reserve(
column(), tmp.nonZeros() );
5928 template<
typename MT
5930 template<
typename VT >
5931 inline void Column<MT,false,false,true,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
5933 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5941 const SubType tmp(
serial( *
this - (~rhs) ) );
5942 matrix_.reset(
column() );
5961 template<
typename MT
5963 template<
typename VT >
5964 inline void Column<MT,false,false,true,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
5966 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5974 const SubType tmp(
serial( *
this - (~rhs) ) );
5975 matrix_.reset(
column() );
5976 matrix_.reserve(
column(), 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.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
#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
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr 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:750
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.
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
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:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#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:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#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
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
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
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the IsUniLower type trait.
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:482
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:416
Constraint on the data type.
Constraint on the transpose flag of vector types.
Constraint on the data type.
typename ColumnTrait< MT, CCAs... >::Type ColumnTrait_t
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_t alias declaration provid...
Definition: ColumnTrait.h:170
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:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#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:3076
#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:3080
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
#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:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
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.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
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:438
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:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
#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 relaxation flag types.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#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.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
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:808
#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.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#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:3082
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.The IsIntegral_v variable template provides...
Definition: IsIntegral.h:95
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.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Header file for the implementation of the ColumnData class template.
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.
Constraint on the data type.