35#ifndef _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_
36#define _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_
115class Column<MT,true,false,SF,CCAs...>
116 :
public View< SparseVector< Column<MT,true,false,SF,CCAs...>, false > >
117 ,
private ColumnData<CCAs...>
121 using DataType = ColumnData<CCAs...>;
122 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
128 using This = Column<MT,
true,
false,SF,CCAs...>;
131 using BaseType = View< SparseVector<This,false> >;
133 using ViewedType = MT;
135 using TransposeType = TransposeType_t<ResultType>;
136 using ElementType = ElementType_t<MT>;
137 using ReturnType = ReturnType_t<MT>;
138 using CompositeType =
const Column&;
141 using ConstReference = ConstReference_t<MT>;
144 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
147 using ConstIterator = ConstIterator_t<MT>;
150 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
155 static constexpr bool smpAssignable =
false;
158 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
164 template<
typename... RCAs >
165 explicit inline Column( MT& matrix, RCAs... args );
167 Column(
const Column& ) =
default;
181 inline Reference operator[](
size_t index );
182 inline ConstReference operator[](
size_t index )
const;
183 inline Reference at(
size_t index );
184 inline ConstReference at(
size_t index )
const;
185 inline Iterator
begin ();
186 inline ConstIterator
begin ()
const;
187 inline ConstIterator
cbegin()
const;
188 inline Iterator
end ();
189 inline ConstIterator
end ()
const;
190 inline ConstIterator
cend ()
const;
198 inline Column& operator=(
const Column& rhs );
200 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
201 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
202 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
203 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
204 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
205 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
206 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
207 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
208 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
217 inline MT& operand() noexcept;
218 inline const MT& operand() const noexcept;
220 inline
size_t size() const noexcept;
221 inline
size_t capacity() const noexcept;
224 inline
void reserve(
size_t n );
231 inline Iterator
set (
size_t index, const ElementType& value );
232 inline Iterator insert(
size_t index, const ElementType& value );
233 inline
void append(
size_t index, const ElementType& value,
bool check=false );
240 inline
void erase(
size_t index );
241 inline Iterator erase( Iterator pos );
242 inline Iterator erase( Iterator first, Iterator last );
245 inline
void erase( Pred predicate );
247 template< typename Pred >
248 inline
void erase( Iterator first, Iterator last, Pred predicate );
255 inline Iterator
find (
size_t index );
256 inline ConstIterator
find (
size_t index ) const;
258 inline ConstIterator
lowerBound(
size_t index ) const;
260 inline ConstIterator
upperBound(
size_t index ) const;
267 template< typename Other > inline Column& scale( const Other& scalar );
274 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
275 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
277 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
278 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
279 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
280 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
281 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
282 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
290 inline
size_t extendCapacity() const noexcept;
339template< typename... RCAs >
340inline Column<MT,true,false,SF,CCAs...>::Column( MT& matrix, RCAs... args )
341 : DataType( args... )
345 if( matrix_.columns() <=
column() ) {
378inline typename Column<MT,
true,
false,SF,CCAs...>::Reference
379 Column<MT,true,false,SF,CCAs...>::operator[](
size_t index )
382 return matrix_(index,
column());
401inline typename Column<MT,
true,
false,SF,CCAs...>::ConstReference
402 Column<MT,true,false,SF,CCAs...>::operator[](
size_t index )
const
405 return const_cast<const MT&
>( matrix_ )(index,
column());
425inline typename Column<MT,
true,
false,SF,CCAs...>::Reference
426 Column<MT,true,false,SF,CCAs...>::at(
size_t index )
428 if( index >=
size() ) {
431 return (*
this)[index];
451inline typename Column<MT,
true,
false,SF,CCAs...>::ConstReference
452 Column<MT,true,false,SF,CCAs...>::at(
size_t index )
const
454 if( index >=
size() ) {
457 return (*
this)[index];
474inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
477 return matrix_.begin(
column() );
494inline typename Column<MT,
true,
false,SF,CCAs...>::ConstIterator
497 return matrix_.cbegin(
column() );
514inline typename Column<MT,
true,
false,SF,CCAs...>::ConstIterator
517 return matrix_.cbegin(
column() );
534inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
537 return matrix_.end(
column() );
554inline typename Column<MT,
true,
false,SF,CCAs...>::ConstIterator
557 return matrix_.cend(
column() );
574inline typename Column<MT,
true,
false,SF,CCAs...>::ConstIterator
577 return matrix_.cend(
column() );
609inline Column<MT,
true,
false,SF,CCAs...>&
614 if( list.size() >
size() ) {
618 const InitializerVector<ElementType,false> tmp( list,
size() );
620 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
624 decltype(
auto) left( derestrict( *
this ) );
654inline Column<MT,
true,
false,SF,CCAs...>&
655 Column<MT,true,false,SF,CCAs...>::operator=(
const Column& rhs )
663 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
column() == rhs.column() ) )
666 if(
size() != rhs.size() ) {
670 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
674 decltype(
auto) left( derestrict( *
this ) );
676 if( rhs.canAlias(
this ) ) {
677 const ResultType tmp( rhs );
679 left.reserve( tmp.nonZeros() );
684 left.reserve( rhs.nonZeros() );
713template<
typename VT >
714inline Column<MT,
true,
false,SF,CCAs...>&
715 Column<MT,true,false,SF,CCAs...>::operator=(
const DenseVector<VT,false>& rhs )
723 if(
size() != (*rhs).size() ) {
727 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
730 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
734 decltype(
auto) left( derestrict( *
this ) );
736 if( IsReference_v<Right> && right.canAlias(
this ) ) {
737 const ResultType_t<VT> tmp( right );
743 assign( left, right );
771template<
typename VT >
772inline Column<MT,
true,
false,SF,CCAs...>&
773 Column<MT,true,false,SF,CCAs...>::operator=(
const SparseVector<VT,false>& rhs )
781 if(
size() != (*rhs).size() ) {
785 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
788 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
792 decltype(
auto) left( derestrict( *
this ) );
794 if( IsReference_v<Right> && right.canAlias(
this ) ) {
795 const ResultType_t<VT> tmp( right );
797 left.reserve( tmp.nonZeros() );
802 left.reserve( right.nonZeros() );
803 assign( left, right );
831template<
typename VT >
832inline Column<MT,
true,
false,SF,CCAs...>&
844 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
850 if(
size() != (*rhs).size() ) {
854 const AddType tmp( *
this + (*rhs) );
856 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
860 decltype(
auto) left( derestrict( *
this ) );
890template<
typename VT >
891inline Column<MT,
true,
false,SF,CCAs...>&
903 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
909 if(
size() != (*rhs).size() ) {
913 const AddType tmp( *
this + (*rhs) );
915 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
919 decltype(
auto) left( derestrict( *
this ) );
922 left.reserve( tmp.nonZeros() );
951template<
typename VT >
952inline Column<MT,
true,
false,SF,CCAs...>&
964 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
970 if(
size() != (*rhs).size() ) {
974 const SubType tmp( *
this - (*rhs) );
976 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
980 decltype(
auto) left( derestrict( *
this ) );
1008template<
typename MT
1011template<
typename VT >
1012inline Column<MT,
true,
false,SF,CCAs...>&
1015 using blaze::assign;
1024 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1030 if(
size() != (*rhs).size() ) {
1034 const SubType tmp( *
this - (*rhs) );
1036 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1040 decltype(
auto) left( derestrict( *
this ) );
1043 left.reserve( tmp.nonZeros() );
1044 assign( left, tmp );
1067template<
typename MT
1070template<
typename VT >
1071inline Column<MT,
true,
false,SF,CCAs...>&
1074 using blaze::assign;
1082 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1087 if(
size() != (*rhs).size() ) {
1091 const MultType tmp( *
this * (*rhs) );
1093 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1097 decltype(
auto) left( derestrict( *
this ) );
1100 assign( left, tmp );
1122template<
typename MT
1125template<
typename VT >
1126inline Column<MT,
true,
false,SF,CCAs...>&
1129 using blaze::assign;
1138 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1144 if(
size() != (*rhs).size() ) {
1148 const DivType tmp( *
this / (*rhs) );
1150 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1154 decltype(
auto) left( derestrict( *
this ) );
1157 assign( left, tmp );
1180template<
typename MT
1183template<
typename VT >
1184inline Column<MT,
true,
false,SF,CCAs...>&
1185 Column<MT,true,false,SF,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
1187 using blaze::assign;
1192 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1198 if(
size() != 3UL || (*rhs).size() != 3UL ) {
1202 const CrossType tmp( *
this % (*rhs) );
1204 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1208 decltype(
auto) left( derestrict( *
this ) );
1211 assign( left, tmp );
1235template<
typename MT
1238inline MT& Column<MT,true,false,SF,CCAs...>::operand() noexcept
1252template<
typename MT
1255inline const MT& Column<MT,true,false,SF,CCAs...>::operand() const noexcept
1269template<
typename MT
1274 return matrix_.rows();
1286template<
typename MT
1291 return matrix_.capacity(
column() );
1306template<
typename MT
1311 return matrix_.nonZeros(
column() );
1323template<
typename MT
1328 matrix_.reset(
column() );
1344template<
typename MT
1347void Column<MT,true,false,SF,CCAs...>::reserve(
size_t n )
1349 matrix_.reserve(
column(), n );
1364template<
typename MT
1367inline size_t Column<MT,true,false,SF,CCAs...>::extendCapacity() const noexcept
1372 size_t nonzeros( 2UL*
capacity()+1UL );
1373 nonzeros =
max( nonzeros, 7UL );
1374 nonzeros =
min( nonzeros,
size() );
1404template<
typename MT
1407inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
1410 return matrix_.set( index,
column(), value );
1429template<
typename MT
1432inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
1433 Column<MT,true,false,SF,CCAs...>::insert(
size_t index,
const ElementType& value )
1435 return matrix_.insert( index,
column(), value );
1466template<
typename MT
1469inline void Column<MT,true,false,SF,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
1471 matrix_.append( index,
column(), value, check );
1494template<
typename MT
1497inline void Column<MT,true,false,SF,CCAs...>::erase(
size_t index )
1499 matrix_.erase( index,
column() );
1514template<
typename MT
1517inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
1518 Column<MT,true,false,SF,CCAs...>::erase( Iterator pos )
1520 return matrix_.erase(
column(), pos );
1536template<
typename MT
1539inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
1540 Column<MT,true,false,SF,CCAs...>::erase( Iterator first, Iterator last )
1542 return matrix_.erase(
column(), first, last );
1571template<
typename MT
1574template<
typename Pred
1576inline void Column<MT,true,false,SF,CCAs...>::erase( Pred predicate )
1609template<
typename MT
1612template<
typename Pred >
1613inline void Column<MT,true,false,SF,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
1615 matrix_.erase(
column(), first, last, predicate );
1643template<
typename MT
1646inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
1649 return matrix_.find( index,
column() );
1669template<
typename MT
1672inline typename Column<MT,
true,
false,SF,CCAs...>::ConstIterator
1675 return matrix_.find( index,
column() );
1694template<
typename MT
1697inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
1700 return matrix_.lowerBound( index,
column() );
1719template<
typename MT
1722inline typename Column<MT,
true,
false,SF,CCAs...>::ConstIterator
1725 return matrix_.lowerBound( index,
column() );
1744template<
typename MT
1747inline typename Column<MT,
true,
false,SF,CCAs...>::Iterator
1750 return matrix_.upperBound( index,
column() );
1769template<
typename MT
1772inline typename Column<MT,
true,
false,SF,CCAs...>::ConstIterator
1775 return matrix_.upperBound( index,
column() );
1802template<
typename MT
1805template<
typename Other >
1806inline Column<MT,
true,
false,SF,CCAs...>&
1807 Column<MT,true,false,SF,CCAs...>::scale(
const Other& scalar )
1811 for( Iterator element=
begin(); element!=
end(); ++element )
1812 element->value() *= scalar;
1838template<
typename MT
1841template<
typename Other >
1842inline bool Column<MT,true,false,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1844 return matrix_.isAliased( &unview( *alias ) );
1861template<
typename MT
1864template<
typename Other >
1865inline bool Column<MT,true,false,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1867 return matrix_.isAliased( &unview( *alias ) );
1885template<
typename MT
1888template<
typename VT >
1889inline void Column<MT,true,false,SF,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
1894 for(
size_t i=0UL; i<
size(); ++i )
1896 if( matrix_.nonZeros(
column() ) == matrix_.capacity(
column() ) )
1897 matrix_.reserve(
column(), extendCapacity() );
1899 matrix_.append( i,
column(), (*rhs)[i], true );
1918template<
typename MT
1921template<
typename VT >
1922inline void Column<MT,true,false,SF,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
1927 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
1928 matrix_.append( element->index(),
column(), element->value(),
true );
1947template<
typename MT
1950template<
typename VT >
1951inline void Column<MT,true,false,SF,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
1953 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1961 const AddType tmp(
serial( *
this + (*rhs) ) );
1962 matrix_.reset(
column() );
1981template<
typename MT
1984template<
typename VT >
1985inline void Column<MT,true,false,SF,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
1987 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1995 const AddType tmp(
serial( *
this + (*rhs) ) );
1996 matrix_.reset(
column() );
1997 matrix_.reserve(
column(), tmp.nonZeros() );
2016template<
typename MT
2019template<
typename VT >
2020inline void Column<MT,true,false,SF,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
2022 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2030 const SubType tmp(
serial( *
this - (*rhs) ) );
2031 matrix_.reset(
column() );
2050template<
typename MT
2053template<
typename VT >
2054inline void Column<MT,true,false,SF,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
2056 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2064 const SubType tmp(
serial( *
this - (*rhs) ) );
2065 matrix_.reset(
column() );
2066 matrix_.reserve(
column(), tmp.nonZeros() );
2093template<
typename MT
2095class Column<MT,false,false,false,CCAs...>
2096 :
public View< SparseVector< Column<MT,false,false,false,CCAs...>, false > >
2097 ,
private ColumnData<CCAs...>
2101 using DataType = ColumnData<CCAs...>;
2102 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2108 using This = Column<MT,
false,
false,
false,CCAs...>;
2111 using BaseType = View< SparseVector<This,false> >;
2113 using ViewedType = MT;
2115 using TransposeType = TransposeType_t<ResultType>;
2116 using ElementType = ElementType_t<MT>;
2117 using ReturnType = ReturnType_t<MT>;
2118 using CompositeType =
const Column&;
2121 using ConstReference = ConstReference_t<MT>;
2124 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2130 template<
typename MatrixType
2131 ,
typename IteratorType >
2133 :
private SparseElement
2142 inline ColumnElement( IteratorType pos,
size_t row )
2154 template<
typename T >
inline ColumnElement& operator=(
const T& v ) {
2166 template<
typename T >
inline ColumnElement&
operator+=(
const T& v ) {
2178 template<
typename T >
inline ColumnElement&
operator-=(
const T& v ) {
2190 template<
typename T >
inline ColumnElement&
operator*=(
const T& v ) {
2202 template<
typename T >
inline ColumnElement&
operator/=(
const T& v ) {
2213 inline const ColumnElement* operator->()
const {
2223 inline decltype(
auto) value()
const {
2224 return pos_->value();
2233 inline size_t index()
const {
2249 template<
typename MatrixType
2250 ,
typename IteratorType >
2251 class ColumnIterator
2255 using IteratorCategory = std::forward_iterator_tag;
2256 using ValueType = ColumnElement<MatrixType,IteratorType>;
2257 using PointerType = ValueType;
2258 using ReferenceType = ValueType;
2262 using iterator_category = IteratorCategory;
2263 using value_type = ValueType;
2264 using pointer = PointerType;
2265 using reference = ReferenceType;
2266 using difference_type = DifferenceType;
2272 inline ColumnIterator()
2273 : matrix_( nullptr )
2287 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
2288 : matrix_( &matrix )
2293 for( ; row_<matrix_->rows(); ++row_ ) {
2294 pos_ = matrix_->find( row_, column_ );
2295 if( pos_ != matrix_->end( row_ ) )
break;
2308 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2309 : matrix_( &matrix )
2323 template<
typename MatrixType2,
typename IteratorType2 >
2324 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
2325 : matrix_( it.matrix_ )
2327 , column_( it.column_ )
2337 inline ColumnIterator& operator++() {
2339 for( ; row_<matrix_->rows(); ++row_ ) {
2340 pos_ = matrix_->find( row_, column_ );
2341 if( pos_ != matrix_->end( row_ ) )
break;
2353 inline const ColumnIterator operator++(
int ) {
2354 const ColumnIterator tmp( *
this );
2365 inline ReferenceType
operator*()
const {
2366 return ReferenceType( pos_, row_ );
2375 inline PointerType operator->()
const {
2376 return PointerType( pos_, row_ );
2386 template<
typename MatrixType2,
typename IteratorType2 >
2387 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2388 return row_ == rhs.row_;
2398 template<
typename MatrixType2,
typename IteratorType2 >
2399 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2400 return !( *
this == rhs );
2410 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2411 size_t counter( 0UL );
2412 for(
size_t i=rhs.row_; i<row_; ++i ) {
2413 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2422 MatrixType* matrix_;
2429 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2430 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 >
friend class Column;
2437 using ConstIterator = ColumnIterator< const MT, ConstIterator_t<MT> >;
2440 using Iterator = If_t< IsConst_v<MT>, ConstIterator, ColumnIterator< MT, Iterator_t<MT> > >;
2445 static constexpr bool smpAssignable =
false;
2448 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2454 template<
typename... RCAs >
2455 explicit inline Column( MT& matrix, RCAs... args );
2457 Column(
const Column& ) =
default;
2464 ~Column() =
default;
2471 inline Reference operator[](
size_t index );
2472 inline ConstReference operator[](
size_t index )
const;
2473 inline Reference at(
size_t index );
2474 inline ConstReference at(
size_t index )
const;
2475 inline Iterator
begin ();
2476 inline ConstIterator
begin ()
const;
2477 inline ConstIterator
cbegin()
const;
2478 inline Iterator
end ();
2479 inline ConstIterator
end ()
const;
2480 inline ConstIterator
cend ()
const;
2488 inline Column& operator=(
const Column& rhs );
2490 template<
typename VT >
inline Column& operator= (
const Vector<VT,false>& rhs );
2491 template<
typename VT >
inline Column&
operator+=(
const Vector<VT,false>& rhs );
2492 template<
typename VT >
inline Column&
operator-=(
const Vector<VT,false>& rhs );
2493 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
2494 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
2495 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
2504 inline MT& operand() noexcept;
2505 inline const MT& operand() const noexcept;
2507 inline
size_t size() const;
2510 inline
void reset();
2511 inline
void reserve(
size_t n );
2518 inline Iterator
set (
size_t index, const ElementType& value );
2519 inline Iterator insert(
size_t index, const ElementType& value );
2520 inline
void append(
size_t index, const ElementType& value,
bool check=false );
2527 inline
void erase(
size_t index );
2528 inline Iterator erase( Iterator pos );
2529 inline Iterator erase( Iterator first, Iterator last );
2532 inline
void erase( Pred predicate );
2534 template< typename Pred >
2535 inline
void erase( Iterator first, Iterator last, Pred predicate );
2542 inline Iterator
find (
size_t index );
2543 inline ConstIterator
find (
size_t index ) const;
2545 inline ConstIterator
lowerBound(
size_t index ) const;
2547 inline ConstIterator
upperBound(
size_t index ) const;
2554 template< typename Other > inline Column& scale( const Other& scalar );
2561 template< typename Other > inline
bool canAlias ( const Other* alias ) const;
2562 template< typename Other > inline
bool isAliased( const Other* alias ) const;
2564 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2565 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2566 template< typename VT > inline
void addAssign( const Vector<VT,false>& rhs );
2567 template< typename VT > inline
void subAssign( const Vector<VT,false>& rhs );
2615template< typename MT
2617template< typename... RCAs >
2618inline Column<MT,false,false,false,CCAs...>::Column( MT& matrix, RCAs... args )
2619 : DataType( args... )
2620 , matrix_ ( matrix )
2623 if( matrix_.columns() <=
column() ) {
2653template<
typename MT
2655inline typename Column<MT,
false,
false,
false,CCAs...>::Reference
2656 Column<MT,false,false,false,CCAs...>::operator[](
size_t index )
2659 return matrix_(index,
column());
2675template<
typename MT
2677inline typename Column<MT,
false,
false,
false,CCAs...>::ConstReference
2678 Column<MT,false,false,false,CCAs...>::operator[](
size_t index )
const
2681 return const_cast<const MT&
>( matrix_ )(index,
column());
2698template<
typename MT
2700inline typename Column<MT,
false,
false,
false,CCAs...>::Reference
2701 Column<MT,false,false,false,CCAs...>::at(
size_t index )
2703 if( index >=
size() ) {
2706 return (*
this)[index];
2723template<
typename MT
2725inline typename Column<MT,
false,
false,
false,CCAs...>::ConstReference
2726 Column<MT,false,false,false,CCAs...>::at(
size_t index )
const
2728 if( index >=
size() ) {
2731 return (*
this)[index];
2745template<
typename MT
2747inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
2750 return Iterator( matrix_, 0UL,
column() );
2764template<
typename MT
2766inline typename Column<MT,
false,
false,
false,CCAs...>::ConstIterator
2769 return ConstIterator( matrix_, 0UL,
column() );
2783template<
typename MT
2785inline typename Column<MT,
false,
false,
false,CCAs...>::ConstIterator
2788 return ConstIterator( matrix_, 0UL,
column() );
2802template<
typename MT
2804inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
2807 return Iterator( matrix_,
size(),
column() );
2821template<
typename MT
2823inline typename Column<MT,
false,
false,
false,CCAs...>::ConstIterator
2826 return ConstIterator( matrix_,
size(),
column() );
2840template<
typename MT
2842inline typename Column<MT,
false,
false,
false,CCAs...>::ConstIterator
2845 return ConstIterator( matrix_,
size(),
column() );
2874template<
typename MT
2876inline Column<MT,
false,
false,
false,CCAs...>&
2879 using blaze::assign;
2881 if( list.size() >
size() ) {
2885 const InitializerVector<ElementType,false> tmp( list,
size() );
2887 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
2891 decltype(
auto) left( derestrict( *
this ) );
2893 assign( left, tmp );
2917template<
typename MT
2919inline Column<MT,
false,
false,
false,CCAs...>&
2920 Column<MT,false,false,false,CCAs...>::operator=(
const Column& rhs )
2922 using blaze::assign;
2928 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
column() == rhs.column() ) )
2931 if(
size() != rhs.size() ) {
2935 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
2939 decltype(
auto) left( derestrict( *
this ) );
2941 if( rhs.canAlias(
this ) ) {
2942 const ResultType tmp( rhs );
2943 assign( left, tmp );
2946 assign( left, rhs );
2971template<
typename MT
2973template<
typename VT >
2974inline Column<MT,
false,
false,
false,CCAs...>&
2975 Column<MT,false,false,false,CCAs...>::operator=(
const Vector<VT,false>& rhs )
2977 using blaze::assign;
2979 if(
size() != (*rhs).size() ) {
2983 const CompositeType_t<VT> tmp( *rhs );
2985 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
2989 decltype(
auto) left( derestrict( *
this ) );
2991 assign( left, tmp );
3015template<
typename MT
3017template<
typename VT >
3018inline Column<MT,
false,
false,
false,CCAs...>&
3021 using blaze::assign;
3029 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3034 if(
size() != (*rhs).size() ) {
3038 const AddType tmp( *
this + (*rhs) );
3040 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3044 decltype(
auto) left( derestrict( *
this ) );
3046 assign( left, tmp );
3070template<
typename MT
3072template<
typename VT >
3073inline Column<MT,
false,
false,
false,CCAs...>&
3076 using blaze::assign;
3084 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3089 if(
size() != (*rhs).size() ) {
3093 const SubType tmp( *
this - (*rhs) );
3095 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3099 decltype(
auto) left( derestrict( *
this ) );
3101 assign( left, tmp );
3124template<
typename MT
3126template<
typename VT >
3127inline Column<MT,
false,
false,
false,CCAs...>&
3130 using blaze::assign;
3138 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3143 if(
size() != (*rhs).size() ) {
3147 const MultType tmp( *
this * (*rhs) );
3149 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3153 decltype(
auto) left( derestrict( *
this ) );
3155 assign( left, tmp );
3177template<
typename MT
3179template<
typename VT >
3180inline Column<MT,
false,
false,
false,CCAs...>&
3183 using blaze::assign;
3192 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3198 if(
size() != (*rhs).size() ) {
3202 const DivType tmp( *
this / (*rhs) );
3204 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3208 decltype(
auto) left( derestrict( *
this ) );
3210 assign( left, tmp );
3233template<
typename MT
3235template<
typename VT >
3236inline Column<MT,
false,
false,
false,CCAs...>&
3237 Column<MT,false,false,false,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
3239 using blaze::assign;
3244 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3250 if(
size() != 3UL || (*rhs).size() != 3UL ) {
3254 const CrossType tmp( *
this % (*rhs) );
3256 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3260 decltype(
auto) left( derestrict( *
this ) );
3262 assign( left, tmp );
3286template<
typename MT
3288inline MT& Column<MT,false,false,false,CCAs...>::operand() noexcept
3302template<
typename MT
3304inline const MT& Column<MT,false,false,false,CCAs...>::operand() const noexcept
3318template<
typename MT
3322 return matrix_.rows();
3334template<
typename MT
3338 return matrix_.rows();
3353template<
typename MT
3357 size_t counter( 0UL );
3358 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
3373template<
typename MT
3377 const size_t ibegin( ( IsLower_v<MT> )
3378 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3382 const size_t iend ( ( IsUpper_v<MT> )
3383 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3388 for(
size_t i=ibegin; i<iend; ++i ) {
3389 matrix_.erase( i,
column() );
3406template<
typename MT
3408void Column<MT,false,false,false,CCAs...>::reserve(
size_t n )
3438template<
typename MT
3440inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
3443 return Iterator( matrix_, index,
column(), matrix_.set( index,
column(), value ) );
3462template<
typename MT
3464inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
3465 Column<MT,false,false,false,CCAs...>::insert(
size_t index,
const ElementType& value )
3467 return Iterator( matrix_, index,
column(), matrix_.insert( index,
column(), value ) );
3498template<
typename MT
3500inline void Column<MT,false,false,false,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
3502 if( !check || !isDefault<strict>( value ) )
3503 matrix_.insert( index,
column(), value );
3526template<
typename MT
3528inline void Column<MT,false,false,false,CCAs...>::erase(
size_t index )
3530 matrix_.erase( index,
column() );
3545template<
typename MT
3547inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
3548 Column<MT,false,false,false,CCAs...>::erase( Iterator pos )
3550 const size_t row( pos.row_ );
3555 matrix_.erase(
row, pos.pos_ );
3556 return Iterator( matrix_,
row+1UL,
column() );
3572template<
typename MT
3574inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
3575 Column<MT,false,false,false,CCAs...>::erase( Iterator first, Iterator last )
3577 for( ; first!=last; ++first ) {
3578 matrix_.erase( first.row_, first.pos_ );
3609template<
typename MT
3611template<
typename Pred
3613inline void Column<MT,false,false,false,CCAs...>::erase( Pred predicate )
3615 for( Iterator element=
begin(); element!=
end(); ++element ) {
3616 if( predicate( element->value() ) )
3617 matrix_.erase( element.row_, element.pos_ );
3650template<
typename MT
3652template<
typename Pred >
3653inline void Column<MT,false,false,false,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
3655 for( ; first!=last; ++first ) {
3656 if( predicate( first->value() ) )
3657 matrix_.erase( first.row_, first.pos_ );
3686template<
typename MT
3688inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
3691 const Iterator_t<MT> pos( matrix_.find( index,
column() ) );
3693 if( pos != matrix_.end( index ) )
3694 return Iterator( matrix_, index,
column(), pos );
3716template<
typename MT
3718inline typename Column<MT,
false,
false,
false,CCAs...>::ConstIterator
3721 const ConstIterator_t<MT> pos( matrix_.find( index,
column() ) );
3723 if( pos != matrix_.end( index ) )
3724 return ConstIterator( matrix_, index,
column(), pos );
3745template<
typename MT
3747inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
3750 for(
size_t i=index; i<
size(); ++i )
3752 const Iterator_t<MT> pos( matrix_.find( i,
column() ) );
3754 if( pos != matrix_.end( i ) )
3755 return Iterator( matrix_, i,
column(), pos );
3777template<
typename MT
3779inline typename Column<MT,
false,
false,
false,CCAs...>::ConstIterator
3782 for(
size_t i=index; i<
size(); ++i )
3784 const ConstIterator_t<MT> pos( matrix_.find( i,
column() ) );
3786 if( pos != matrix_.end( i ) )
3787 return ConstIterator( matrix_, i,
column(), pos );
3809template<
typename MT
3811inline typename Column<MT,
false,
false,
false,CCAs...>::Iterator
3814 for(
size_t i=index+1UL; i<
size(); ++i )
3816 const Iterator_t<MT> pos( matrix_.find( i,
column() ) );
3818 if( pos != matrix_.end( i ) )
3819 return Iterator( matrix_, i,
column(), pos );
3841template<
typename MT
3843inline typename Column<MT,
false,
false,
false,CCAs...>::ConstIterator
3846 for(
size_t i=index+1UL; i<
size(); ++i )
3848 const ConstIterator_t<MT> pos( matrix_.find( i,
column() ) );
3850 if( pos != matrix_.end( i ) )
3851 return ConstIterator( matrix_, i,
column(), pos );
3881template<
typename MT
3883template<
typename Other >
3884inline Column<MT,
false,
false,
false,CCAs...>&
3885 Column<MT,false,false,false,CCAs...>::scale(
const Other& scalar )
3889 for( Iterator element=
begin(); element!=
end(); ++element )
3890 element->value() *= scalar;
3916template<
typename MT
3918template<
typename Other >
3919inline bool Column<MT,false,false,false,CCAs...>::canAlias(
const Other* alias )
const
3921 return matrix_.isAliased( &unview( *alias ) );
3934template<
typename MT
3936template<
typename Other >
3937inline bool Column<MT,false,false,false,CCAs...>::isAliased(
const Other* alias )
const
3939 return matrix_.isAliased( &unview( *alias ) );
3957template<
typename MT
3959template<
typename VT >
3960inline void Column<MT,false,false,false,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
3964 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3965 matrix_(i,
column()) = (*rhs)[i];
3984template<
typename MT
3986template<
typename VT >
3987inline void Column<MT,false,false,false,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
3993 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
3994 for( ; i<element->index(); ++i )
3995 matrix_.erase( i,
column() );
3996 matrix_(i++,
column()) = element->value();
3998 for( ; i<
size(); ++i ) {
3999 matrix_.erase( i,
column() );
4018template<
typename MT
4020template<
typename VT >
4021inline void Column<MT,false,false,false,CCAs...>::addAssign(
const Vector<VT,false>& rhs )
4023 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4030 const AddType tmp(
serial( *
this + (*rhs) ) );
4049template<
typename MT
4051template<
typename VT >
4052inline void Column<MT,false,false,false,CCAs...>::subAssign(
const Vector<VT,false>& rhs )
4054 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4061 const SubType tmp(
serial( *
this - (*rhs) ) );
4088template<
typename MT
4090class Column<MT,false,false,true,CCAs...>
4091 :
public View< SparseVector< Column<MT,false,false,true,CCAs...>, false > >
4092 ,
private ColumnData<CCAs...>
4096 using DataType = ColumnData<CCAs...>;
4097 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4103 using This = Column<MT,
false,
false,
true,CCAs...>;
4106 using BaseType = View< SparseVector<This,false> >;
4108 using ViewedType = MT;
4110 using TransposeType = TransposeType_t<ResultType>;
4111 using ElementType = ElementType_t<MT>;
4112 using ReturnType = ReturnType_t<MT>;
4113 using CompositeType =
const Column&;
4116 using ConstReference = ConstReference_t<MT>;
4119 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4122 using ConstIterator = ConstIterator_t<MT>;
4125 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4130 static constexpr bool smpAssignable =
false;
4133 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
4139 template<
typename... RCAs >
4140 explicit inline Column( MT& matrix, RCAs... args );
4142 Column(
const Column& ) =
default;
4149 ~Column() =
default;
4156 inline Reference operator[](
size_t index );
4157 inline ConstReference operator[](
size_t index )
const;
4158 inline Reference at(
size_t index );
4159 inline ConstReference at(
size_t index )
const;
4160 inline Iterator
begin ();
4161 inline ConstIterator
begin ()
const;
4162 inline ConstIterator
cbegin()
const;
4163 inline Iterator
end ();
4164 inline ConstIterator
end ()
const;
4165 inline ConstIterator
cend ()
const;
4173 inline Column& operator=(
const Column& rhs );
4175 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
4176 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
4177 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
4178 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
4179 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
4180 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
4181 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
4182 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
4183 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
4192 inline MT& operand() noexcept;
4193 inline const MT& operand() const noexcept;
4195 inline
size_t size() const noexcept;
4196 inline
size_t capacity() const noexcept;
4198 inline
void reset();
4199 inline
void reserve(
size_t n );
4206 inline Iterator
set (
size_t index, const ElementType& value );
4207 inline Iterator insert(
size_t index, const ElementType& value );
4208 inline
void append(
size_t index, const ElementType& value,
bool check=false );
4215 inline
void erase(
size_t index );
4216 inline Iterator erase( Iterator pos );
4217 inline Iterator erase( Iterator first, Iterator last );
4220 inline
void erase( Pred predicate );
4222 template< typename Pred >
4223 inline
void erase( Iterator first, Iterator last, Pred predicate );
4230 inline Iterator
find (
size_t index );
4231 inline ConstIterator
find (
size_t index ) const;
4233 inline ConstIterator
lowerBound(
size_t index ) const;
4235 inline ConstIterator
upperBound(
size_t index ) const;
4242 template< typename Other > inline Column& scale( const Other& scalar );
4249 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4250 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4252 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
4253 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
4254 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
4255 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4256 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
4257 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4265 inline
size_t extendCapacity() const noexcept;
4312template< typename MT
4314template< typename... RCAs >
4315inline Column<MT,false,false,true,CCAs...>::Column( MT& matrix, RCAs... args )
4316 : DataType( args... )
4317 , matrix_ ( matrix )
4320 if( matrix_.columns() <=
column() ) {
4350template<
typename MT
4352inline typename Column<MT,
false,
false,
true,CCAs...>::Reference
4353 Column<MT,false,false,true,CCAs...>::operator[](
size_t index )
4356 return matrix_(
column(),index);
4372template<
typename MT
4374inline typename Column<MT,
false,
false,
true,CCAs...>::ConstReference
4375 Column<MT,false,false,true,CCAs...>::operator[](
size_t index )
const
4378 return const_cast<const MT&
>( matrix_ )(
column(),index);
4395template<
typename MT
4397inline typename Column<MT,
false,
false,
true,CCAs...>::Reference
4398 Column<MT,false,false,true,CCAs...>::at(
size_t index )
4400 if( index >=
size() ) {
4403 return (*
this)[index];
4420template<
typename MT
4422inline typename Column<MT,
false,
false,
true,CCAs...>::ConstReference
4423 Column<MT,false,false,true,CCAs...>::at(
size_t index )
const
4425 if( index >=
size() ) {
4428 return (*
this)[index];
4442template<
typename MT
4444inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
4447 return matrix_.begin(
column() );
4461template<
typename MT
4463inline typename Column<MT,
false,
false,
true,CCAs...>::ConstIterator
4466 return matrix_.cbegin(
column() );
4480template<
typename MT
4482inline typename Column<MT,
false,
false,
true,CCAs...>::ConstIterator
4485 return matrix_.cbegin(
column() );
4499template<
typename MT
4501inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
4504 return matrix_.end(
column() );
4518template<
typename MT
4520inline typename Column<MT,
false,
false,
true,CCAs...>::ConstIterator
4523 return matrix_.cend(
column() );
4537template<
typename MT
4539inline typename Column<MT,
false,
false,
true,CCAs...>::ConstIterator
4542 return matrix_.cend(
column() );
4571template<
typename MT
4573inline Column<MT,
false,
false,
true,CCAs...>&
4576 using blaze::assign;
4578 if( list.size() >
size() ) {
4582 const InitializerVector<ElementType,false> tmp( list,
size() );
4584 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4588 decltype(
auto) left( derestrict( *
this ) );
4591 assign( left, tmp );
4615template<
typename MT
4617inline Column<MT,
false,
false,
true,CCAs...>&
4618 Column<MT,false,false,true,CCAs...>::operator=(
const Column& rhs )
4620 using blaze::assign;
4626 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
column() == rhs.column() ) )
4629 if(
size() != rhs.size() ) {
4633 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
4637 decltype(
auto) left( derestrict( *
this ) );
4639 if( rhs.canAlias(
this ) ) {
4640 const ResultType tmp( rhs );
4642 left.reserve( tmp.nonZeros() );
4643 assign( left, tmp );
4647 left.reserve( rhs.nonZeros() );
4648 assign( left, rhs );
4673template<
typename MT
4675template<
typename VT >
4676inline Column<MT,
false,
false,
true,CCAs...>&
4677 Column<MT,false,false,true,CCAs...>::operator=(
const DenseVector<VT,false>& rhs )
4679 using blaze::assign;
4685 if(
size() != (*rhs).size() ) {
4689 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4690 Right right( *rhs );
4692 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4696 decltype(
auto) left( derestrict( *
this ) );
4698 if( IsReference_v<Right> && right.canAlias(
this ) ) {
4699 const ResultType_t<VT> tmp( right );
4701 assign( left, tmp );
4705 assign( left, right );
4730template<
typename MT
4732template<
typename VT >
4733inline Column<MT,
false,
false,
true,CCAs...>&
4734 Column<MT,false,false,true,CCAs...>::operator=(
const SparseVector<VT,false>& rhs )
4736 using blaze::assign;
4742 if(
size() != (*rhs).size() ) {
4746 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4747 Right right( *rhs );
4749 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4753 decltype(
auto) left( derestrict( *
this ) );
4755 if( IsReference_v<Right> && right.canAlias(
this ) ) {
4756 const ResultType_t<VT> tmp( right);
4758 left.reserve( tmp.nonZeros() );
4759 assign( left, tmp );
4763 left.reserve( right.nonZeros() );
4764 assign( left, right );
4789template<
typename MT
4791template<
typename VT >
4792inline Column<MT,
false,
false,
true,CCAs...>&
4795 using blaze::assign;
4804 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4810 if(
size() != (*rhs).size() ) {
4814 const AddType tmp( *
this + (*rhs) );
4816 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4820 decltype(
auto) left( derestrict( *
this ) );
4823 assign( left, tmp );
4847template<
typename MT
4849template<
typename VT >
4850inline Column<MT,
false,
false,
true,CCAs...>&
4853 using blaze::assign;
4862 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4868 if(
size() != (*rhs).size() ) {
4872 const AddType tmp( *
this + (*rhs) );
4874 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4878 decltype(
auto) left( derestrict( *
this ) );
4881 left.reserve( tmp.nonZeros() );
4882 assign( left, tmp );
4907template<
typename MT
4909template<
typename VT >
4910inline Column<MT,
false,
false,
true,CCAs...>&
4913 using blaze::assign;
4922 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4928 if(
size() != (*rhs).size() ) {
4932 const SubType tmp( *
this - (*rhs) );
4934 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4938 decltype(
auto) left( derestrict( *
this ) );
4941 assign( left, tmp );
4966template<
typename MT
4968template<
typename VT >
4969inline Column<MT,
false,
false,
true,CCAs...>&
4972 using blaze::assign;
4981 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4987 if(
size() != (*rhs).size() ) {
4991 const SubType tmp( *
this - (*rhs) );
4993 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4997 decltype(
auto) left( derestrict( *
this ) );
5000 left.reserve( tmp.nonZeros() );
5001 assign( left, tmp );
5024template<
typename MT
5026template<
typename VT >
5027inline Column<MT,
false,
false,
true,CCAs...>&
5030 using blaze::assign;
5038 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5043 if(
size() != (*rhs).size() ) {
5047 const MultType tmp( *
this * (*rhs) );
5049 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5053 decltype(
auto) left( derestrict( *
this ) );
5056 assign( left, tmp );
5078template<
typename MT
5080template<
typename VT >
5081inline Column<MT,
false,
false,
true,CCAs...>&
5084 using blaze::assign;
5093 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5099 if(
size() != (*rhs).size() ) {
5103 const DivType tmp( *
this / (*rhs) );
5105 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5109 decltype(
auto) left( derestrict( *
this ) );
5112 assign( left, tmp );
5135template<
typename MT
5137template<
typename VT >
5138inline Column<MT,
false,
false,
true,CCAs...>&
5139 Column<MT,false,false,true,CCAs...>::operator%=(
const Vector<VT,false>& rhs )
5141 using blaze::assign;
5146 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5152 if(
size() != 3UL || (*rhs).size() != 3UL ) {
5156 const CrossType tmp( *
this % (*rhs) );
5158 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5162 decltype(
auto) left( derestrict( *
this ) );
5165 assign( left, tmp );
5189template<
typename MT
5191inline MT& Column<MT,false,false,true,CCAs...>::operand() noexcept
5205template<
typename MT
5207inline const MT& Column<MT,false,false,true,CCAs...>::operand() const noexcept
5221template<
typename MT
5225 return matrix_.rows();
5237template<
typename MT
5241 return matrix_.capacity(
column() );
5256template<
typename MT
5260 return matrix_.nonZeros(
column() );
5272template<
typename MT
5276 matrix_.reset(
column() );
5292template<
typename MT
5294void Column<MT,false,false,true,CCAs...>::reserve(
size_t n )
5296 matrix_.reserve(
column(), n );
5311template<
typename MT
5313inline size_t Column<MT,false,false,true,CCAs...>::extendCapacity() const noexcept
5318 size_t nonzeros( 2UL*
capacity()+1UL );
5319 nonzeros =
max( nonzeros, 7UL );
5320 nonzeros =
min( nonzeros,
size() );
5350template<
typename MT
5352inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
5355 return matrix_.set(
column(), index, value );
5374template<
typename MT
5376inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
5377 Column<MT,false,false,true,CCAs...>::insert(
size_t index,
const ElementType& value )
5379 return matrix_.insert(
column(), index, value );
5410template<
typename MT
5412inline void Column<MT,false,false,true,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
5414 matrix_.append(
column(), index, value, check );
5437template<
typename MT
5439inline void Column<MT,false,false,true,CCAs...>::erase(
size_t index )
5441 matrix_.erase(
column(), index );
5456template<
typename MT
5458inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
5459 Column<MT,false,false,true,CCAs...>::erase( Iterator pos )
5461 return matrix_.erase(
column(), pos );
5477template<
typename MT
5479inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
5480 Column<MT,false,false,true,CCAs...>::erase( Iterator first, Iterator last )
5482 return matrix_.erase(
column(), first, last );
5511template<
typename MT
5513template<
typename Pred
5515inline void Column<MT,false,false,true,CCAs...>::erase( Pred predicate )
5548template<
typename MT
5550template<
typename Pred >
5551inline void Column<MT,false,false,true,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
5553 matrix_.erase(
column(), first, last, predicate );
5581template<
typename MT
5583inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
5586 return matrix_.find(
column(), index );
5606template<
typename MT
5608inline typename Column<MT,
false,
false,
true,CCAs...>::ConstIterator
5611 return matrix_.find(
column(), index );
5630template<
typename MT
5632inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
5635 return matrix_.lowerBound(
column(), index );
5654template<
typename MT
5656inline typename Column<MT,
false,
false,
true,CCAs...>::ConstIterator
5659 return matrix_.lowerBound(
column(), index );
5678template<
typename MT
5680inline typename Column<MT,
false,
false,
true,CCAs...>::Iterator
5683 return matrix_.upperBound(
column(), index );
5702template<
typename MT
5704inline typename Column<MT,
false,
false,
true,CCAs...>::ConstIterator
5707 return matrix_.upperBound(
column(), index );
5734template<
typename MT
5736template<
typename Other >
5737inline Column<MT,
false,
false,
true,CCAs...>&
5738 Column<MT,false,false,true,CCAs...>::scale(
const Other& scalar )
5742 for( Iterator element=
begin(); element!=
end(); ++element )
5743 element->value() *= scalar;
5769template<
typename MT
5771template<
typename Other >
5772inline bool Column<MT,false,false,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
5774 return matrix_.isAliased( &unview( *alias ) );
5791template<
typename MT
5793template<
typename Other >
5794inline bool Column<MT,false,false,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
5796 return matrix_.isAliased( &unview( *alias ) );
5814template<
typename MT
5816template<
typename VT >
5817inline void Column<MT,false,false,true,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
5822 for(
size_t i=0UL; i<
size(); ++i )
5824 if( matrix_.nonZeros(
column() ) == matrix_.capacity(
column() ) )
5825 matrix_.reserve(
column(), extendCapacity() );
5827 matrix_.append(
column(), i, (*rhs)[i], true );
5846template<
typename MT
5848template<
typename VT >
5849inline void Column<MT,false,false,true,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
5854 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
5855 matrix_.append(
column(), element->index(), element->value(),
true );
5874template<
typename MT
5876template<
typename VT >
5877inline void Column<MT,false,false,true,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
5879 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5887 const AddType tmp(
serial( *
this + (*rhs) ) );
5888 matrix_.reset(
column() );
5907template<
typename MT
5909template<
typename VT >
5910inline void Column<MT,false,false,true,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
5912 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5920 const AddType tmp(
serial( *
this + (*rhs) ) );
5921 matrix_.reset(
column() );
5922 matrix_.reserve(
column(), tmp.nonZeros() );
5941template<
typename MT
5943template<
typename VT >
5944inline void Column<MT,false,false,true,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
5946 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5954 const SubType tmp(
serial( *
this - (*rhs) ) );
5955 matrix_.reset(
column() );
5974template<
typename MT
5976template<
typename VT >
5977inline void Column<MT,false,false,true,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
5979 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5987 const SubType tmp(
serial( *
this - (*rhs) ) );
5988 matrix_.reset(
column() );
5989 matrix_.reserve(
column(), tmp.nonZeros() );
Header file for the addition trait.
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the ColumnData class template.
Constraints on the storage order of matrix types.
Header file for the column trait.
Constraint on the transpose flag of vector types.
Header file for the cross product trait.
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:751
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the If class template.
Header file for the IsConst type trait.
Header file for the isDefault shim.
Header file for the IsExpression type trait class.
Header file for the IsIntegral type trait.
Header file for the IsLower type trait.
Header file for the IsReference type trait.
Header file for the IsRestricted type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUpper type trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
Header file for the subtraction trait.
Constraint on the data type.
Constraint on the data type.
Initializer list type of the Blaze library.
Pointer difference type of the Blaze library.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of a vector representation of an initializer list.
Header file for the SparseVector base class.
Header file for the View base class.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:574
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:1339
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:1375
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:386
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:510
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
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:9640
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:448
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: RowMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.
Definition: TransExpr.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:60
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.
Definition: ColumnVector.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: UniTriangular.h:81
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.h:61
typename ColumnTrait< MT, CCAs... >::Type ColumnTrait_t
Auxiliary alias declaration for the ColumnTrait type trait.
Definition: ColumnTrait.h:144
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 operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
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:628
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:730
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:562
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
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:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:518
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
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
MT::Iterator upperBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index greater than the given index.
Definition: SparseMatrix.h:244
MT::Iterator lowerBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index not less than the given index.
Definition: SparseMatrix.h:194
MT::Iterator find(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Searches for a specific matrix element.
Definition: SparseMatrix.h:144
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.
Definition: IsIntegral.h:95
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
constexpr bool isChecked(const Ts &... args)
Extracting blaze::Check arguments from a given list of arguments.
Definition: Check.h:225
Header file for the exception macros of the math module.
Header file for the reset shim.
Header file for the serial shim.
Header file for the SparseElement base class.
Header file for basic type definitions.
Header file for the generic max algorithm.
Header file for the generic min algorithm.
Header file for the implementation of the Column base template.