35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 110 template<
typename MT
112 class Column<MT,true,false,SF>
113 :
public SparseVector< Column<MT,true,false,SF>, false >
119 typedef If_< IsExpression<MT>, MT, MT& > Operand;
124 typedef Column<MT,true,false,SF>
This;
125 typedef SparseVector<This,false>
BaseType;
147 enum :
bool { smpAssignable =
false };
153 explicit inline Column( Operand matrix,
size_t index );
165 inline Reference operator[](
size_t index );
166 inline ConstReference operator[](
size_t index )
const;
167 inline Reference at(
size_t index );
168 inline ConstReference at(
size_t index )
const;
169 inline Iterator
begin ();
170 inline ConstIterator
begin ()
const;
171 inline ConstIterator
cbegin()
const;
172 inline Iterator
end ();
173 inline ConstIterator
end ()
const;
174 inline ConstIterator
cend ()
const;
181 inline Column& operator=(
const Column& rhs );
183 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
184 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
185 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
186 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
187 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
188 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
189 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
190 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
192 template<
typename Other >
193 inline EnableIf_< IsNumeric<Other>, Column >&
operator*=( Other rhs );
195 template<
typename Other >
196 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
203 inline size_t size() const noexcept;
204 inline
size_t capacity() const noexcept;
207 inline
void reserve(
size_t n );
214 inline Iterator
set (
size_t index, const ElementType& value );
215 inline Iterator insert(
size_t index, const ElementType& value );
216 inline
void append(
size_t index, const ElementType& value,
bool check=false );
223 inline
void erase(
size_t index );
224 inline Iterator erase( Iterator pos );
225 inline Iterator erase( Iterator first, Iterator last );
227 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
228 inline
void erase( Pred predicate );
230 template< typename Pred >
231 inline
void erase( Iterator first, Iterator last, Pred predicate );
238 inline Iterator find (
size_t index );
239 inline ConstIterator find (
size_t index ) const;
240 inline Iterator lowerBound(
size_t index );
241 inline ConstIterator lowerBound(
size_t index ) const;
242 inline Iterator upperBound(
size_t index );
243 inline ConstIterator upperBound(
size_t index ) const;
250 template< typename Other > inline Column& scale( const Other& scalar );
257 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
258 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
260 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
261 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
262 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
263 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
264 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
265 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
273 inline
size_t extendCapacity() const noexcept;
286 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
287 friend
bool isIntact( const Column<MT2,SO2,DF2,SF2>&
column ) noexcept;
289 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
290 friend
bool isSame( const Column<MT2,SO2,DF2,SF2>& a, const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
292 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
293 friend
bool tryAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
295 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
296 friend
bool tryAddAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
298 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
299 friend
bool trySubAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
301 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
302 friend
bool tryMultAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
304 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
337 template< typename MT
339 inline Column<MT,true,false,SF>::Column( Operand matrix,
size_t index )
343 if( matrix_.columns() <= index ) {
369 template<
typename MT
372 Column<MT,true,false,SF>::operator[](
size_t index )
375 return matrix_(index,col_);
391 template<
typename MT
394 Column<MT,true,false,SF>::operator[](
size_t index )
const 397 return const_cast<const MT&
>( matrix_ )(index,col_);
414 template<
typename MT
417 Column<MT,true,false,SF>::at(
size_t index )
419 if( index >=
size() ) {
422 return (*
this)[index];
439 template<
typename MT
442 Column<MT,true,false,SF>::at(
size_t index )
const 444 if( index >=
size() ) {
447 return (*
this)[index];
461 template<
typename MT
465 return matrix_.begin( col_ );
479 template<
typename MT
483 return matrix_.cbegin( col_ );
497 template<
typename MT
501 return matrix_.cbegin( col_ );
515 template<
typename MT
519 return matrix_.end( col_ );
533 template<
typename MT
537 return matrix_.cend( col_ );
551 template<
typename MT
555 return matrix_.cend( col_ );
583 template<
typename MT
585 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const Column& rhs )
593 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
596 if(
size() != rhs.size() ) {
600 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
604 DerestrictTrait_<This> left( derestrict( *
this ) );
606 if( rhs.canAlias( &matrix_ ) ) {
607 const ResultType tmp( rhs );
609 left.reserve( tmp.nonZeros() );
614 left.reserve( rhs.nonZeros() );
640 template<
typename MT
642 template<
typename VT >
643 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const DenseVector<VT,false>& rhs )
655 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
658 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
662 DerestrictTrait_<This> left( derestrict( *
this ) );
664 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
665 const ResultType_<VT> tmp( right );
671 assign( left, right );
696 template<
typename MT
698 template<
typename VT >
699 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const SparseVector<VT,false>& rhs )
711 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
714 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
718 DerestrictTrait_<This> left( derestrict( *
this ) );
720 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
721 const ResultType_<VT> tmp( right );
723 left.reserve( tmp.nonZeros() );
728 left.reserve( right.nonZeros() );
729 assign( left, right );
754 template<
typename MT
756 template<
typename VT >
768 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
778 const AddType tmp( *
this + (~rhs) );
780 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
784 DerestrictTrait_<This> left( derestrict( *
this ) );
811 template<
typename MT
813 template<
typename VT >
825 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
835 const AddType tmp( *
this + (~rhs) );
837 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
841 DerestrictTrait_<This> left( derestrict( *
this ) );
844 left.reserve( tmp.nonZeros() );
870 template<
typename MT
872 template<
typename VT >
884 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
894 const SubType tmp( *
this - (~rhs) );
896 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
900 DerestrictTrait_<This> left( derestrict( *
this ) );
928 template<
typename MT
930 template<
typename VT >
942 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
952 const SubType tmp( *
this - (~rhs) );
954 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
958 DerestrictTrait_<This> left( derestrict( *
this ) );
961 left.reserve( tmp.nonZeros() );
985 template<
typename MT
987 template<
typename VT >
998 typedef MultTrait_< ResultType, ResultType_<VT> > MultType;
1007 const MultType tmp( *
this * (~rhs) );
1009 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1013 DerestrictTrait_<This> left( derestrict( *
this ) );
1016 assign( left, tmp );
1038 template<
typename MT
1040 template<
typename VT >
1043 using blaze::assign;
1052 typedef DivTrait_< ResultType, ResultType_<VT> > DivType;
1062 const DivType tmp( *
this / (~rhs) );
1064 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1068 DerestrictTrait_<This> left( derestrict( *
this ) );
1071 assign( left, tmp );
1096 template<
typename MT
1098 template<
typename Other >
1099 inline EnableIf_<IsNumeric<Other>, Column<MT,true,false,SF> >&
1104 for( Iterator element=
begin(); element!=
end(); ++element )
1105 element->value() *= rhs;
1130 template<
typename MT
1132 template<
typename Other >
1133 inline EnableIf_<IsNumeric<Other>, Column<MT,true,false,SF> >&
1140 typedef DivTrait_<ElementType,Other> DT;
1141 typedef If_< IsNumeric<DT>, DT, Other > Tmp;
1145 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
1146 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1147 for( Iterator element=
begin(); element!=
end(); ++element )
1148 element->value() *= tmp;
1151 for( Iterator element=
begin(); element!=
end(); ++element )
1152 element->value() /= rhs;
1175 template<
typename MT
1179 return matrix_.rows();
1191 template<
typename MT
1195 return matrix_.capacity( col_ );
1210 template<
typename MT
1214 return matrix_.nonZeros( col_ );
1226 template<
typename MT
1230 matrix_.reset( col_ );
1246 template<
typename MT
1248 void Column<MT,true,false,SF>::reserve(
size_t n )
1250 matrix_.reserve( col_, n );
1265 template<
typename MT
1267 inline size_t Column<MT,true,false,SF>::extendCapacity() const noexcept
1272 size_t nonzeros( 2UL*
capacity()+1UL );
1273 nonzeros =
max( nonzeros, 7UL );
1274 nonzeros =
min( nonzeros,
size() );
1304 template<
typename MT
1309 return matrix_.set( index, col_, value );
1328 template<
typename MT
1331 Column<MT,true,false,SF>::insert(
size_t index,
const ElementType& value )
1333 return matrix_.insert( index, col_, value );
1364 template<
typename MT
1366 inline void Column<MT,true,false,SF>::append(
size_t index,
const ElementType& value,
bool check )
1368 matrix_.append( index, col_, value, check );
1391 template<
typename MT
1393 inline void Column<MT,true,false,SF>::erase(
size_t index )
1395 matrix_.erase( index, col_ );
1410 template<
typename MT
1414 return matrix_.erase( col_, pos );
1430 template<
typename MT
1433 Column<MT,true,false,SF>::erase( Iterator first, Iterator last )
1435 return matrix_.erase( col_, first, last );
1464 template<
typename MT
1466 template<
typename Pred
1468 inline void Column<MT,true,false,SF>::erase( Pred predicate )
1470 matrix_.erase( col_,
begin(),
end(), predicate );
1501 template<
typename MT
1503 template<
typename Pred >
1504 inline void Column<MT,true,false,SF>::erase( Iterator first, Iterator last, Pred predicate )
1506 matrix_.erase( col_, first, last, predicate );
1534 template<
typename MT
1538 return matrix_.find( index, col_ );
1558 template<
typename MT
1561 Column<MT,true,false,SF>::find(
size_t index )
const 1563 return matrix_.find( index, col_ );
1582 template<
typename MT
1586 return matrix_.lowerBound( index, col_ );
1605 template<
typename MT
1608 Column<MT,true,false,SF>::lowerBound(
size_t index )
const 1610 return matrix_.lowerBound( index, col_ );
1629 template<
typename MT
1633 return matrix_.upperBound( index, col_ );
1652 template<
typename MT
1655 Column<MT,true,false,SF>::upperBound(
size_t index )
const 1657 return matrix_.upperBound( index, col_ );
1682 template<
typename MT
1684 template<
typename Other >
1685 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::scale(
const Other& scalar )
1689 for( Iterator element=
begin(); element!=
end(); ++element )
1690 element->value() *= scalar;
1716 template<
typename MT
1718 template<
typename Other >
1719 inline bool Column<MT,true,false,SF>::canAlias(
const Other* alias )
const noexcept
1721 return matrix_.isAliased( alias );
1738 template<
typename MT
1740 template<
typename Other >
1741 inline bool Column<MT,true,false,SF>::isAliased(
const Other* alias )
const noexcept
1743 return matrix_.isAliased( alias );
1761 template<
typename MT
1763 template<
typename VT >
1764 inline void Column<MT,true,false,SF>::assign(
const DenseVector<VT,false>& rhs )
1769 for(
size_t i=0UL; i<
size(); ++i )
1771 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
1772 matrix_.reserve( col_, extendCapacity() );
1774 matrix_.append( i, col_, (~rhs)[i],
true );
1793 template<
typename MT
1795 template<
typename VT >
1796 inline void Column<MT,true,false,SF>::assign(
const SparseVector<VT,false>& rhs )
1801 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1802 matrix_.append( element->index(), col_, element->value(), true );
1821 template<
typename MT
1823 template<
typename VT >
1824 inline void Column<MT,true,false,SF>::addAssign(
const DenseVector<VT,false>& rhs )
1826 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
1834 const AddType tmp(
serial( *
this + (~rhs) ) );
1835 matrix_.reset( col_ );
1854 template<
typename MT
1856 template<
typename VT >
1857 inline void Column<MT,true,false,SF>::addAssign(
const SparseVector<VT,false>& rhs )
1859 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
1867 const AddType tmp(
serial( *
this + (~rhs) ) );
1868 matrix_.reset( col_ );
1869 matrix_.reserve( col_, tmp.nonZeros() );
1888 template<
typename MT
1890 template<
typename VT >
1891 inline void Column<MT,true,false,SF>::subAssign(
const DenseVector<VT,false>& rhs )
1893 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
1901 const SubType tmp(
serial( *
this - (~rhs) ) );
1902 matrix_.reset( col_ );
1921 template<
typename MT
1923 template<
typename VT >
1924 inline void Column<MT,true,false,SF>::subAssign(
const SparseVector<VT,false>& rhs )
1926 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
1934 const SubType tmp(
serial( *
this - (~rhs) ) );
1935 matrix_.reset( col_ );
1936 matrix_.reserve( col_, tmp.nonZeros() );
1963 template<
typename MT >
1964 class Column<MT,false,false,false>
1965 :
public SparseVector< Column<MT,false,false,false>, false >
1971 typedef If_< IsExpression<MT>, MT, MT& > Operand;
1976 typedef Column<MT,false,false,false>
This;
1977 typedef SparseVector<This,false>
BaseType;
1994 template<
typename MatrixType
1995 ,
typename IteratorType >
1996 class ColumnElement :
private SparseElement
2006 enum :
bool { returnConst = IsConst<MatrixType>::value };
2011 typedef typename std::iterator_traits<IteratorType>::value_type SET;
2013 typedef Reference_<SET> RT;
2014 typedef ConstReference_<SET> CRT;
2019 typedef ValueType_<SET> ValueType;
2020 typedef size_t IndexType;
2021 typedef IfTrue_<returnConst,CRT,RT>
Reference;
2031 inline ColumnElement( IteratorType pos,
size_t row )
2043 template<
typename T >
inline ColumnElement& operator=(
const T& v ) {
2055 template<
typename T >
inline ColumnElement&
operator+=(
const T& v ) {
2067 template<
typename T >
inline ColumnElement&
operator-=(
const T& v ) {
2079 template<
typename T >
inline ColumnElement&
operator*=(
const T& v ) {
2091 template<
typename T >
inline ColumnElement&
operator/=(
const T& v ) {
2102 inline const ColumnElement* operator->()
const {
2112 inline Reference value()
const {
2113 return pos_->value();
2122 inline IndexType index()
const {
2138 template<
typename MatrixType
2139 ,
typename IteratorType >
2140 class ColumnIterator
2144 typedef std::forward_iterator_tag IteratorCategory;
2145 typedef ColumnElement<MatrixType,IteratorType> ValueType;
2146 typedef ValueType PointerType;
2147 typedef ValueType ReferenceType;
2148 typedef ptrdiff_t DifferenceType;
2151 typedef IteratorCategory iterator_category;
2152 typedef ValueType value_type;
2153 typedef PointerType pointer;
2154 typedef ReferenceType reference;
2155 typedef DifferenceType difference_type;
2161 inline ColumnIterator()
2162 : matrix_( nullptr )
2176 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
2177 : matrix_( &matrix )
2182 for( ; row_<matrix_->rows(); ++row_ ) {
2183 pos_ = matrix_->find( row_, column_ );
2184 if( pos_ != matrix_->end( row_ ) )
break;
2197 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2198 : matrix_( &matrix )
2212 template<
typename MatrixType2,
typename IteratorType2 >
2213 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
2214 : matrix_( it.matrix_ )
2216 , column_( it.column_ )
2226 inline ColumnIterator& operator++() {
2228 for( ; row_<matrix_->rows(); ++row_ ) {
2229 pos_ = matrix_->find( row_, column_ );
2230 if( pos_ != matrix_->end( row_ ) )
break;
2242 inline const ColumnIterator operator++(
int ) {
2243 const ColumnIterator tmp( *
this );
2254 inline ReferenceType
operator*()
const {
2255 return ReferenceType( pos_, row_ );
2264 inline PointerType operator->()
const {
2265 return PointerType( pos_, row_ );
2275 template<
typename MatrixType2,
typename IteratorType2 >
2276 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2277 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2287 template<
typename MatrixType2,
typename IteratorType2 >
2288 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2289 return !( *
this == rhs );
2299 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2300 size_t counter( 0UL );
2301 for(
size_t i=rhs.row_; i<row_; ++i ) {
2302 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2311 MatrixType* matrix_;
2318 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2319 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
friend class Column;
2326 typedef ColumnIterator< const MT, ConstIterator_<MT> >
ConstIterator;
2334 enum :
bool { smpAssignable =
false };
2340 explicit inline Column( Operand matrix,
size_t index );
2352 inline Reference operator[](
size_t index );
2353 inline ConstReference operator[](
size_t index )
const;
2354 inline Reference at(
size_t index );
2355 inline ConstReference at(
size_t index )
const;
2356 inline Iterator
begin ();
2357 inline ConstIterator
begin ()
const;
2358 inline ConstIterator
cbegin()
const;
2359 inline Iterator
end ();
2360 inline ConstIterator
end ()
const;
2361 inline ConstIterator
cend ()
const;
2368 inline Column& operator= (
const Column& rhs );
2369 template<
typename VT >
inline Column& operator= (
const Vector<VT,false>& rhs );
2370 template<
typename VT >
inline Column&
operator+=(
const Vector<VT,false>& rhs );
2371 template<
typename VT >
inline Column&
operator-=(
const Vector<VT,false>& rhs );
2372 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
2373 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
2375 template<
typename Other >
2376 inline EnableIf_<IsNumeric<Other>, Column >&
operator*=( Other rhs );
2378 template<
typename Other >
2379 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
2386 inline size_t size()
const;
2389 inline void reset();
2390 inline void reserve(
size_t n );
2397 inline Iterator
set (
size_t index,
const ElementType& value );
2398 inline Iterator insert(
size_t index,
const ElementType& value );
2399 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
2406 inline void erase(
size_t index );
2407 inline Iterator erase( Iterator pos );
2408 inline Iterator erase( Iterator first, Iterator last );
2410 template<
typename Pred,
typename = DisableIf_< IsIntegral<Pred> > >
2411 inline void erase( Pred predicate );
2413 template<
typename Pred >
2414 inline void erase( Iterator first, Iterator last, Pred predicate );
2421 inline Iterator find (
size_t index );
2422 inline ConstIterator find (
size_t index )
const;
2423 inline Iterator lowerBound(
size_t index );
2424 inline ConstIterator lowerBound(
size_t index )
const;
2425 inline Iterator upperBound(
size_t index );
2426 inline ConstIterator upperBound(
size_t index )
const;
2433 template<
typename Other >
inline Column& scale(
const Other& scalar );
2440 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2441 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2443 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
2444 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
2445 template<
typename VT >
inline void addAssign(
const Vector<VT,false>& rhs );
2446 template<
typename VT >
inline void subAssign(
const Vector<VT,false>& rhs );
2460 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2461 friend bool isIntact(
const Column<MT2,SO2,DF2,SF2>& column ) noexcept;
2463 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2464 friend bool isSame(
const Column<MT2,SO2,DF2,SF2>& a,
const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
2466 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2467 friend bool tryAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2469 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2470 friend bool tryAddAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2472 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2473 friend bool trySubAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2475 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2476 friend bool tryMultAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2478 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2479 friend DerestrictTrait_< Column<MT2,SO2,DF2,SF2> > derestrict( Column<MT2,SO2,DF2,SF2>& column );
2512 template<
typename MT >
2513 inline Column<MT,false,false,false>::Column( Operand matrix,
size_t index )
2517 if( matrix_.columns() <= index ) {
2543 template<
typename MT >
2545 Column<MT,false,false,false>::operator[](
size_t index )
2548 return matrix_(index,col_);
2564 template<
typename MT >
2566 Column<MT,false,false,false>::operator[](
size_t index )
const 2569 return const_cast<const MT&
>( matrix_ )(index,col_);
2586 template<
typename MT >
2588 Column<MT,false,false,false>::at(
size_t index )
2590 if( index >=
size() ) {
2593 return (*
this)[index];
2610 template<
typename MT >
2612 Column<MT,false,false,false>::at(
size_t index )
const 2614 if( index >=
size() ) {
2617 return (*
this)[index];
2631 template<
typename MT >
2634 return Iterator( matrix_, 0UL, col_ );
2648 template<
typename MT >
2666 template<
typename MT >
2684 template<
typename MT >
2701 template<
typename MT >
2719 template<
typename MT >
2751 template<
typename MT >
2752 inline Column<MT,false,false,false>&
2753 Column<MT,false,false,false>::operator=(
const Column& rhs )
2755 using blaze::assign;
2761 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
2764 if(
size() != rhs.size() ) {
2768 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
2772 DerestrictTrait_<This> left( derestrict( *
this ) );
2774 if( rhs.canAlias( &matrix_ ) ) {
2775 const ResultType tmp( rhs );
2776 assign( left, tmp );
2779 assign( left, rhs );
2804 template<
typename MT >
2805 template<
typename VT >
2806 inline Column<MT,false,false,false>&
2807 Column<MT,false,false,false>::operator=(
const Vector<VT,false>& rhs )
2809 using blaze::assign;
2815 const CompositeType_<VT> tmp( ~rhs );
2817 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2821 DerestrictTrait_<This> left( derestrict( *
this ) );
2823 assign( left, tmp );
2847 template<
typename MT >
2848 template<
typename VT >
2849 inline Column<MT,false,false,false>&
2852 using blaze::assign;
2860 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
2869 const AddType tmp( *
this + (~rhs) );
2871 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2875 DerestrictTrait_<This> left( derestrict( *
this ) );
2877 assign( left, tmp );
2901 template<
typename MT >
2902 template<
typename VT >
2903 inline Column<MT,false,false,false>&
2906 using blaze::assign;
2914 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
2923 const SubType tmp( *
this - (~rhs) );
2925 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2929 DerestrictTrait_<This> left( derestrict( *
this ) );
2931 assign( left, tmp );
2954 template<
typename MT >
2955 template<
typename VT >
2956 inline Column<MT,false,false,false>&
2959 using blaze::assign;
2967 typedef MultTrait_< ResultType, ResultType_<VT> > MultType;
2976 const MultType tmp( *
this * (~rhs) );
2978 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2982 DerestrictTrait_<This> left( derestrict( *
this ) );
2984 assign( left, tmp );
3006 template<
typename MT >
3007 template<
typename VT >
3008 inline Column<MT,false,false,false>&
3011 using blaze::assign;
3020 typedef DivTrait_< ResultType, ResultType_<VT> > DivType;
3030 const DivType tmp( *
this / (~rhs) );
3032 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
3036 DerestrictTrait_<This> left( derestrict( *
this ) );
3038 assign( left, tmp );
3063 template<
typename MT >
3064 template<
typename Other >
3065 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,false> >&
3070 for( Iterator element=
begin(); element!=
end(); ++element )
3071 element->value() *= rhs;
3096 template<
typename MT >
3097 template<
typename Other >
3098 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,false> >&
3105 typedef DivTrait_<ElementType,Other> DT;
3106 typedef If_< IsNumeric<DT>, DT, Other > Tmp;
3110 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
3111 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
3112 for( Iterator element=
begin(); element!=
end(); ++element )
3113 element->value() *= tmp;
3116 for( Iterator element=
begin(); element!=
end(); ++element )
3117 element->value() /= rhs;
3140 template<
typename MT >
3143 return matrix_.rows();
3155 template<
typename MT >
3158 return matrix_.rows();
3173 template<
typename MT >
3176 size_t counter( 0UL );
3177 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
3192 template<
typename MT >
3195 const size_t ibegin( ( IsLower<MT>::value )
3196 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3200 const size_t iend ( ( IsUpper<MT>::value )
3201 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3206 for(
size_t i=ibegin; i<iend; ++i ) {
3207 matrix_.erase( i, col_ );
3224 template<
typename MT >
3225 void Column<MT,false,false,false>::reserve(
size_t n )
3255 template<
typename MT >
3259 return Iterator( matrix_, index, col_, matrix_.set( index, col_, value ) );
3278 template<
typename MT >
3280 Column<MT,false,false,false>::insert(
size_t index,
const ElementType& value )
3282 return Iterator( matrix_, index, col_, matrix_.insert( index, col_, value ) );
3313 template<
typename MT >
3314 inline void Column<MT,false,false,false>::append(
size_t index,
const ElementType& value,
bool check )
3317 matrix_.insert( index, col_, value );
3340 template<
typename MT >
3341 inline void Column<MT,false,false,false>::erase(
size_t index )
3343 matrix_.erase( index, col_ );
3358 template<
typename MT >
3360 Column<MT,false,false,false>::erase( Iterator pos )
3362 const size_t row( pos.row_ );
3367 matrix_.erase( row, pos.pos_ );
3368 return Iterator( matrix_, row+1UL, col_ );
3384 template<
typename MT >
3386 Column<MT,false,false,false>::erase( Iterator first, Iterator last )
3388 for( ; first!=last; ++first ) {
3389 matrix_.erase( first.row_, first.pos_ );
3420 template<
typename MT >
3421 template<
typename Pred
3423 inline void Column<MT,false,false,false>::erase( Pred predicate )
3425 for( Iterator element=
begin(); element!=
end(); ++element ) {
3426 if( predicate( element->value() ) )
3427 matrix_.erase( element.row_, element.pos_ );
3460 template<
typename MT >
3461 template<
typename Pred >
3462 inline void Column<MT,false,false,false>::erase( Iterator first, Iterator last, Pred predicate )
3464 for( ; first!=last; ++first ) {
3465 if( predicate( first->value() ) )
3466 matrix_.erase( first.row_, first.pos_ );
3495 template<
typename MT >
3497 Column<MT,false,false,false>::find(
size_t index )
3499 const Iterator_<MT> pos( matrix_.find( index, col_ ) );
3501 if( pos != matrix_.end( index ) )
3502 return Iterator( matrix_, index, col_, pos );
3524 template<
typename MT >
3526 Column<MT,false,false,false>::find(
size_t index )
const 3528 const ConstIterator_<MT> pos( matrix_.find( index, col_ ) );
3530 if( pos != matrix_.end( index ) )
3552 template<
typename MT >
3554 Column<MT,false,false,false>::lowerBound(
size_t index )
3556 for(
size_t i=index; i<
size(); ++i )
3558 const Iterator_<MT> pos( matrix_.find( i, col_ ) );
3560 if( pos != matrix_.end( i ) )
3561 return Iterator( matrix_, i, col_, pos );
3583 template<
typename MT >
3585 Column<MT,false,false,false>::lowerBound(
size_t index )
const 3587 for(
size_t i=index; i<
size(); ++i )
3589 const ConstIterator_<MT> pos( matrix_.find( i, col_ ) );
3591 if( pos != matrix_.end( i ) )
3614 template<
typename MT >
3616 Column<MT,false,false,false>::upperBound(
size_t index )
3618 for(
size_t i=index+1UL; i<
size(); ++i )
3620 const Iterator_<MT> pos( matrix_.find( i, col_ ) );
3622 if( pos != matrix_.end( i ) )
3623 return Iterator( matrix_, i, col_, pos );
3645 template<
typename MT >
3647 Column<MT,false,false,false>::upperBound(
size_t index )
const 3649 for(
size_t i=index+1UL; i<
size(); ++i )
3651 const ConstIterator_<MT> pos( matrix_.find( i, col_ ) );
3653 if( pos != matrix_.end( i ) )
3682 template<
typename MT >
3683 template<
typename Other >
3684 inline Column<MT,false,false,false>& Column<MT,false,false,false>::scale(
const Other& scalar )
3688 for( Iterator element=
begin(); element!=
end(); ++element )
3689 element->value() *= scalar;
3715 template<
typename MT >
3716 template<
typename Other >
3717 inline bool Column<MT,false,false,false>::canAlias(
const Other* alias )
const 3719 return matrix_.isAliased( alias );
3732 template<
typename MT >
3733 template<
typename Other >
3734 inline bool Column<MT,false,false,false>::isAliased(
const Other* alias )
const 3736 return matrix_.isAliased( alias );
3754 template<
typename MT >
3755 template<
typename VT >
3756 inline void Column<MT,false,false,false>::assign(
const DenseVector<VT,false>& rhs )
3760 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3761 matrix_(i,col_) = (~rhs)[i];
3780 template<
typename MT >
3781 template<
typename VT >
3782 inline void Column<MT,false,false,false>::assign(
const SparseVector<VT,false>& rhs )
3788 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3789 for( ; i<element->index(); ++i )
3790 matrix_.erase( i, col_ );
3791 matrix_(i++,col_) = element->value();
3793 for( ; i<
size(); ++i ) {
3794 matrix_.erase( i, col_ );
3813 template<
typename MT >
3814 template<
typename VT >
3815 inline void Column<MT,false,false,false>::addAssign(
const Vector<VT,false>& rhs )
3817 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
3824 const AddType tmp(
serial( *
this + (~rhs) ) );
3843 template<
typename MT >
3844 template<
typename VT >
3845 inline void Column<MT,false,false,false>::subAssign(
const Vector<VT,false>& rhs )
3847 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
3854 const SubType tmp(
serial( *
this - (~rhs) ) );
3881 template<
typename MT >
3882 class Column<MT,false,false,true>
3883 :
public SparseVector< Column<MT,false,false,true>, false >
3889 typedef If_< IsExpression<MT>, MT, MT& > Operand;
3894 typedef Column<MT,false,false,true>
This;
3895 typedef SparseVector<This,false>
BaseType;
3917 enum :
bool { smpAssignable =
false };
3923 explicit inline Column( Operand matrix,
size_t index );
3935 inline Reference operator[](
size_t index );
3936 inline ConstReference operator[](
size_t index )
const;
3937 inline Reference at(
size_t index );
3938 inline ConstReference at(
size_t index )
const;
3939 inline Iterator
begin ();
3940 inline ConstIterator
begin ()
const;
3941 inline ConstIterator
cbegin()
const;
3942 inline Iterator
end ();
3943 inline ConstIterator
end ()
const;
3944 inline ConstIterator
cend ()
const;
3951 inline Column& operator=(
const Column& rhs );
3953 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
3954 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
3955 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
3956 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
3957 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
3958 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
3959 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
3960 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
3962 template<
typename Other >
3963 inline EnableIf_<IsNumeric<Other>, Column >&
operator*=( Other rhs );
3965 template<
typename Other >
3966 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
3973 inline size_t size() const noexcept;
3974 inline
size_t capacity() const noexcept;
3976 inline
void reset();
3977 inline
void reserve(
size_t n );
3984 inline Iterator
set (
size_t index, const ElementType& value );
3985 inline Iterator insert(
size_t index, const ElementType& value );
3986 inline
void append(
size_t index, const ElementType& value,
bool check=false );
3993 inline
void erase(
size_t index );
3994 inline Iterator erase( Iterator pos );
3995 inline Iterator erase( Iterator first, Iterator last );
3997 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
3998 inline
void erase( Pred predicate );
4000 template< typename Pred >
4001 inline
void erase( Iterator first, Iterator last, Pred predicate );
4008 inline Iterator find (
size_t index );
4009 inline ConstIterator find (
size_t index ) const;
4010 inline Iterator lowerBound(
size_t index );
4011 inline ConstIterator lowerBound(
size_t index ) const;
4012 inline Iterator upperBound(
size_t index );
4013 inline ConstIterator upperBound(
size_t index ) const;
4020 template< typename Other > inline Column& scale( const Other& scalar );
4027 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4028 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4030 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
4031 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
4032 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
4033 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4034 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
4035 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4043 inline
size_t extendCapacity() const noexcept;
4056 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4057 friend
bool isIntact( const Column<MT2,SO2,DF2,SF2>& column ) noexcept;
4059 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4060 friend
bool isSame( const Column<MT2,SO2,DF2,SF2>& a, const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
4062 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4063 friend
bool tryAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4065 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4066 friend
bool tryAddAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4068 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4069 friend
bool trySubAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4071 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4072 friend
bool tryMultAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
4074 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4075 friend
DerestrictTrait_< Column<MT2,SO2,DF2,SF2> > derestrict( Column<MT2,SO2,DF2,SF2>& column );
4108 template< typename MT >
4109 inline Column<MT,false,false,true>::Column( Operand matrix,
size_t index )
4113 if( matrix_.columns() <= index ) {
4139 template<
typename MT >
4141 Column<MT,false,false,true>::operator[](
size_t index )
4144 return matrix_(col_,index);
4160 template<
typename MT >
4162 Column<MT,false,false,true>::operator[](
size_t index )
const 4165 return const_cast<const MT&
>( matrix_ )(col_,index);
4182 template<
typename MT >
4184 Column<MT,false,false,true>::at(
size_t index )
4186 if( index >=
size() ) {
4189 return (*
this)[index];
4206 template<
typename MT >
4208 Column<MT,false,false,true>::at(
size_t index )
const 4210 if( index >=
size() ) {
4213 return (*
this)[index];
4227 template<
typename MT >
4230 return matrix_.begin( col_ );
4244 template<
typename MT >
4248 return matrix_.cbegin( col_ );
4262 template<
typename MT >
4266 return matrix_.cbegin( col_ );
4280 template<
typename MT >
4283 return matrix_.end( col_ );
4297 template<
typename MT >
4301 return matrix_.cend( col_ );
4315 template<
typename MT >
4319 return matrix_.cend( col_ );
4347 template<
typename MT >
4348 inline Column<MT,false,false,true>& Column<MT,false,false,true>::operator=(
const Column& rhs )
4350 using blaze::assign;
4356 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
4359 if(
size() != rhs.size() ) {
4363 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
4367 DerestrictTrait_<This> left( derestrict( *
this ) );
4369 if( rhs.canAlias( &matrix_ ) ) {
4370 const ResultType tmp( rhs );
4372 left.reserve( tmp.nonZeros() );
4373 assign( left, tmp );
4377 left.reserve( rhs.nonZeros() );
4378 assign( left, rhs );
4403 template<
typename MT >
4404 template<
typename VT >
4405 inline Column<MT,false,false,true>&
4406 Column<MT,false,false,true>::operator=(
const DenseVector<VT,false>& rhs )
4408 using blaze::assign;
4418 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4419 Right right( ~rhs );
4421 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4425 DerestrictTrait_<This> left( derestrict( *
this ) );
4427 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4428 const ResultType_<VT> tmp( right );
4430 assign( left, tmp );
4434 assign( left, right );
4459 template<
typename MT >
4460 template<
typename VT >
4461 inline Column<MT,false,false,true>&
4462 Column<MT,false,false,true>::operator=(
const SparseVector<VT,false>& rhs )
4464 using blaze::assign;
4474 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4475 Right right( ~rhs );
4477 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4481 DerestrictTrait_<This> left( derestrict( *
this ) );
4483 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4484 const ResultType_<VT> tmp( right);
4486 left.reserve( tmp.nonZeros() );
4487 assign( left, tmp );
4491 left.reserve( right.nonZeros() );
4492 assign( left, right );
4517 template<
typename MT >
4518 template<
typename VT >
4519 inline Column<MT,false,false,true>&
4522 using blaze::assign;
4531 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
4541 const AddType tmp( *
this + (~rhs) );
4543 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4547 DerestrictTrait_<This> left( derestrict( *
this ) );
4550 assign( left, tmp );
4574 template<
typename MT >
4575 template<
typename VT >
4576 inline Column<MT,false,false,true>&
4579 using blaze::assign;
4588 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
4598 const AddType tmp( *
this + (~rhs) );
4600 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4604 DerestrictTrait_<This> left( derestrict( *
this ) );
4607 left.reserve( tmp.nonZeros() );
4608 assign( left, tmp );
4633 template<
typename MT >
4634 template<
typename VT >
4635 inline Column<MT,false,false,true>&
4638 using blaze::assign;
4647 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
4657 const SubType tmp( *
this - (~rhs) );
4659 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4663 DerestrictTrait_<This> left( derestrict( *
this ) );
4666 assign( left, tmp );
4691 template<
typename MT >
4692 template<
typename VT >
4693 inline Column<MT,false,false,true>&
4696 using blaze::assign;
4705 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
4715 const SubType tmp( *
this - (~rhs) );
4717 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4721 DerestrictTrait_<This> left( derestrict( *
this ) );
4724 left.reserve( tmp.nonZeros() );
4725 assign( left, tmp );
4748 template<
typename MT >
4749 template<
typename VT >
4750 inline Column<MT,false,false,true>&
4753 using blaze::assign;
4761 typedef MultTrait_< ResultType, ResultType_<VT> > MultType;
4770 const MultType tmp( *
this * (~rhs) );
4772 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4776 DerestrictTrait_<This> left( derestrict( *
this ) );
4779 assign( left, tmp );
4801 template<
typename MT >
4802 template<
typename VT >
4803 inline Column<MT,false,false,true>&
4806 using blaze::assign;
4815 typedef DivTrait_< ResultType, ResultType_<VT> > DivType;
4825 const DivType tmp( *
this / (~rhs) );
4827 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4831 DerestrictTrait_<This> left( derestrict( *
this ) );
4834 assign( left, tmp );
4859 template<
typename MT >
4860 template<
typename Other >
4861 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,true> >&
4866 for( Iterator element=
begin(); element!=
end(); ++element )
4867 element->value() *= rhs;
4892 template<
typename MT >
4893 template<
typename Other >
4894 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,true> >&
4901 typedef DivTrait_<ElementType,Other> DT;
4902 typedef If_< IsNumeric<DT>, DT, Other > Tmp;
4906 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
4907 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
4908 for( Iterator element=
begin(); element!=
end(); ++element )
4909 element->value() *= tmp;
4912 for( Iterator element=
begin(); element!=
end(); ++element )
4913 element->value() /= rhs;
4936 template<
typename MT >
4939 return matrix_.rows();
4951 template<
typename MT >
4954 return matrix_.capacity( col_ );
4969 template<
typename MT >
4972 return matrix_.nonZeros( col_ );
4984 template<
typename MT >
4987 matrix_.reset( col_ );
5003 template<
typename MT >
5004 void Column<MT,false,false,true>::reserve(
size_t n )
5006 matrix_.reserve( col_, n );
5021 template<
typename MT >
5022 inline size_t Column<MT,false,false,true>::extendCapacity() const noexcept
5027 size_t nonzeros( 2UL*
capacity()+1UL );
5028 nonzeros =
max( nonzeros, 7UL );
5029 nonzeros =
min( nonzeros,
size() );
5059 template<
typename MT >
5063 return matrix_.set( col_, index, value );
5082 template<
typename MT >
5084 Column<MT,false,false,true>::insert(
size_t index,
const ElementType& value )
5086 return matrix_.insert( col_, index, value );
5117 template<
typename MT >
5118 inline void Column<MT,false,false,true>::append(
size_t index,
const ElementType& value,
bool check )
5120 matrix_.append( col_, index, value, check );
5143 template<
typename MT >
5144 inline void Column<MT,false,false,true>::erase(
size_t index )
5146 matrix_.erase( col_, index );
5161 template<
typename MT >
5163 Column<MT,false,false,true>::erase( Iterator pos )
5165 return matrix_.erase( col_, pos );
5181 template<
typename MT >
5183 Column<MT,false,false,true>::erase( Iterator first, Iterator last )
5185 return matrix_.erase( col_, first, last );
5214 template<
typename MT >
5215 template<
typename Pred
5217 inline void Column<MT,false,false,true>::erase( Pred predicate )
5219 matrix_.erase( col_,
begin(),
end(), predicate );
5250 template<
typename MT >
5251 template<
typename Pred >
5252 inline void Column<MT,false,false,true>::erase( Iterator first, Iterator last, Pred predicate )
5254 matrix_.erase( col_, first, last, predicate );
5282 template<
typename MT >
5284 Column<MT,false,false,true>::find(
size_t index )
5286 return matrix_.find( col_, index );
5306 template<
typename MT >
5308 Column<MT,false,false,true>::find(
size_t index )
const 5310 return matrix_.find( col_, index );
5329 template<
typename MT >
5331 Column<MT,false,false,true>::lowerBound(
size_t index )
5333 return matrix_.lowerBound( col_, index );
5352 template<
typename MT >
5354 Column<MT,false,false,true>::lowerBound(
size_t index )
const 5356 return matrix_.lowerBound( col_, index );
5375 template<
typename MT >
5377 Column<MT,false,false,true>::upperBound(
size_t index )
5379 return matrix_.upperBound( col_, index );
5398 template<
typename MT >
5400 Column<MT,false,false,true>::upperBound(
size_t index )
const 5402 return matrix_.upperBound( col_, index );
5427 template<
typename MT >
5428 template<
typename Other >
5429 inline Column<MT,false,false,true>& Column<MT,false,false,true>::scale(
const Other& scalar )
5433 for( Iterator element=
begin(); element!=
end(); ++element )
5434 element->value() *= scalar;
5460 template<
typename MT >
5461 template<
typename Other >
5462 inline bool Column<MT,false,false,true>::canAlias(
const Other* alias )
const noexcept
5464 return matrix_.isAliased( alias );
5481 template<
typename MT >
5482 template<
typename Other >
5483 inline bool Column<MT,false,false,true>::isAliased(
const Other* alias )
const noexcept
5485 return matrix_.isAliased( alias );
5503 template<
typename MT >
5504 template<
typename VT >
5505 inline void Column<MT,false,false,true>::assign(
const DenseVector<VT,false>& rhs )
5510 for(
size_t i=0UL; i<
size(); ++i )
5512 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
5513 matrix_.reserve( col_, extendCapacity() );
5515 matrix_.append( col_, i, (~rhs)[i],
true );
5534 template<
typename MT >
5535 template<
typename VT >
5536 inline void Column<MT,false,false,true>::assign(
const SparseVector<VT,false>& rhs )
5541 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5542 matrix_.append( col_, element->index(), element->value(), true );
5561 template<
typename MT >
5562 template<
typename VT >
5563 inline void Column<MT,false,false,true>::addAssign(
const DenseVector<VT,false>& rhs )
5565 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
5573 const AddType tmp(
serial( *
this + (~rhs) ) );
5574 matrix_.reset( col_ );
5593 template<
typename MT >
5594 template<
typename VT >
5595 inline void Column<MT,false,false,true>::addAssign(
const SparseVector<VT,false>& rhs )
5597 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
5605 const AddType tmp(
serial( *
this + (~rhs) ) );
5606 matrix_.reset( col_ );
5607 matrix_.reserve( col_, tmp.nonZeros() );
5626 template<
typename MT >
5627 template<
typename VT >
5628 inline void Column<MT,false,false,true>::subAssign(
const DenseVector<VT,false>& rhs )
5630 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
5638 const SubType tmp(
serial( *
this - (~rhs) ) );
5639 matrix_.reset( col_ );
5658 template<
typename MT >
5659 template<
typename VT >
5660 inline void Column<MT,false,false,true>::subAssign(
const SparseVector<VT,false>& rhs )
5662 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
5670 const SubType tmp(
serial( *
this - (~rhs) ) );
5671 matrix_.reset( col_ );
5672 matrix_.reserve( col_, tmp.nonZeros() );
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
Header file for mathematical functions.
typename DerestrictTrait< T >::Type DerestrictTrait_
Auxiliary alias declaration for the DerestrictTrait type trait.The DerestrictTrait_ alias declaration...
Definition: DerestrictTrait.h:110
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:352
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:721
Header file for basic type definitions.
Header file for the SparseVector base class.
Header file for the View base class.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:194
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:533
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2935
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
Header file for the IsIntegral type trait.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#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 DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:390
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Header file for the IsUniLower type trait.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1802
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:304
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:238
Constraint on the data type.
Constraint on the transpose flag of vector types.
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#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
#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
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for the IsLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Header file for the SparseElement base class.
Constraint on the data type.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:128
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2932
Constraint on the data type.
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:128
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
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:1285
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Header file for the reset shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
Header file for the column trait.
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
#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.
#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
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
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:1303
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the IsRestricted type trait.
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
#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.