35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_
36 #define _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_
108 template<
typename MT
110 class Column<MT,true,false,SF>
111 :
public SparseVector< Column<MT,true,false,SF>, false >
117 typedef If_< IsExpression<MT>, MT, MT& > Operand;
122 typedef Column<MT,true,false,SF>
This;
123 typedef SparseVector<This,false>
BaseType;
145 enum :
bool { smpAssignable =
false };
151 explicit inline Column( Operand matrix,
size_t index );
163 inline Reference operator[](
size_t index );
164 inline ConstReference operator[](
size_t index )
const;
165 inline Reference at(
size_t index );
166 inline ConstReference at(
size_t index )
const;
167 inline Iterator
begin ();
168 inline ConstIterator
begin ()
const;
169 inline ConstIterator
cbegin()
const;
170 inline Iterator
end ();
171 inline ConstIterator
end ()
const;
172 inline ConstIterator
cend ()
const;
179 inline Column& operator=(
const Column& rhs );
181 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
182 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& 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 Vector<VT,false>& rhs );
188 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
190 template<
typename Other >
191 inline EnableIf_< IsNumeric<Other>, Column >&
operator*=( Other rhs );
193 template<
typename Other >
194 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
201 inline size_t size() const noexcept;
202 inline
size_t capacity() const noexcept;
205 inline Iterator
set (
size_t index, const ElementType& value );
206 inline Iterator insert (
size_t index, const ElementType& value );
207 inline
void erase (
size_t index );
208 inline Iterator erase ( Iterator pos );
209 inline Iterator erase ( Iterator first, Iterator last );
210 inline
void reserve(
size_t n );
211 template< typename Other > inline Column& scale ( const Other& scalar );
218 inline Iterator find (
size_t index );
219 inline ConstIterator find (
size_t index ) const;
220 inline Iterator lowerBound(
size_t index );
221 inline ConstIterator lowerBound(
size_t index ) const;
222 inline Iterator upperBound(
size_t index );
223 inline ConstIterator upperBound(
size_t index ) const;
230 inline
void append(
size_t index, const ElementType& value,
bool check=false );
237 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
238 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
240 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
241 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
242 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
243 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
244 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
245 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
253 inline
size_t extendCapacity() const noexcept;
266 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
267 friend
bool isIntact( const Column<MT2,SO2,DF2,SF2>&
column ) noexcept;
269 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
270 friend
bool isSame( const Column<MT2,SO2,DF2,SF2>& a, const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
272 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
273 friend
bool tryAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
275 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
276 friend
bool tryAddAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
278 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
279 friend
bool trySubAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
281 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
282 friend
bool tryMultAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
284 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
317 template< typename MT
319 inline Column<MT,true,false,SF>::Column( Operand matrix,
size_t index )
323 if( matrix_.columns() <= index ) {
349 template<
typename MT
352 Column<MT,true,false,SF>::operator[](
size_t index )
355 return matrix_(index,col_);
371 template<
typename MT
374 Column<MT,true,false,SF>::operator[](
size_t index )
const
377 return const_cast<const MT&
>( matrix_ )(index,col_);
394 template<
typename MT
397 Column<MT,true,false,SF>::at(
size_t index )
399 if( index >=
size() ) {
402 return (*
this)[index];
419 template<
typename MT
422 Column<MT,true,false,SF>::at(
size_t index )
const
424 if( index >=
size() ) {
427 return (*
this)[index];
441 template<
typename MT
445 return matrix_.begin( col_ );
459 template<
typename MT
463 return matrix_.cbegin( col_ );
477 template<
typename MT
481 return matrix_.cbegin( col_ );
495 template<
typename MT
499 return matrix_.end( col_ );
513 template<
typename MT
517 return matrix_.cend( col_ );
531 template<
typename MT
535 return matrix_.cend( col_ );
563 template<
typename MT
565 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const Column& rhs )
573 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
576 if(
size() != rhs.size() ) {
580 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
584 DerestrictTrait_<This> left( derestrict( *
this ) );
586 if( rhs.canAlias( &matrix_ ) ) {
587 const ResultType tmp( rhs );
589 left.reserve( tmp.nonZeros() );
594 left.reserve( rhs.nonZeros() );
620 template<
typename MT
622 template<
typename VT >
623 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const DenseVector<VT,false>& rhs )
635 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
638 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
642 DerestrictTrait_<This> left( derestrict( *
this ) );
644 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
645 const ResultType_<VT> tmp( right );
651 assign( left, right );
676 template<
typename MT
678 template<
typename VT >
679 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::operator=(
const SparseVector<VT,false>& rhs )
691 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
694 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
698 DerestrictTrait_<This> left( derestrict( *
this ) );
700 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
701 const ResultType_<VT> tmp( right );
703 left.reserve( tmp.nonZeros() );
708 left.reserve( right.nonZeros() );
709 assign( left, right );
734 template<
typename MT
736 template<
typename VT >
748 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
758 const AddType tmp( *
this + (~rhs) );
760 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
764 DerestrictTrait_<This> left( derestrict( *
this ) );
791 template<
typename MT
793 template<
typename VT >
805 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
815 const AddType tmp( *
this + (~rhs) );
817 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
821 DerestrictTrait_<This> left( derestrict( *
this ) );
824 left.reserve( tmp.nonZeros() );
850 template<
typename MT
852 template<
typename VT >
864 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
874 const SubType tmp( *
this - (~rhs) );
876 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
880 DerestrictTrait_<This> left( derestrict( *
this ) );
908 template<
typename MT
910 template<
typename VT >
922 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
932 const SubType tmp( *
this - (~rhs) );
934 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
938 DerestrictTrait_<This> left( derestrict( *
this ) );
941 left.reserve( tmp.nonZeros() );
965 template<
typename MT
967 template<
typename VT >
978 typedef MultTrait_< ResultType, ResultType_<VT> > MultType;
987 const MultType tmp( *
this * (~rhs) );
989 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
993 DerestrictTrait_<This> left( derestrict( *
this ) );
1018 template<
typename MT
1020 template<
typename VT >
1023 using blaze::assign;
1032 typedef DivTrait_< ResultType, ResultType_<VT> > DivType;
1042 const DivType tmp( *
this / (~rhs) );
1044 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1048 DerestrictTrait_<This> left( derestrict( *
this ) );
1051 assign( left, tmp );
1076 template<
typename MT
1078 template<
typename Other >
1079 inline EnableIf_<IsNumeric<Other>, Column<MT,true,false,SF> >&
1084 for( Iterator element=
begin(); element!=
end(); ++element )
1085 element->value() *= rhs;
1110 template<
typename MT
1112 template<
typename Other >
1113 inline EnableIf_<IsNumeric<Other>, Column<MT,true,false,SF> >&
1120 typedef DivTrait_<ElementType,Other> DT;
1121 typedef If_< IsNumeric<DT>, DT, Other > Tmp;
1125 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
1126 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1127 for( Iterator element=
begin(); element!=
end(); ++element )
1128 element->value() *= tmp;
1131 for( Iterator element=
begin(); element!=
end(); ++element )
1132 element->value() /= rhs;
1155 template<
typename MT
1159 return matrix_.rows();
1171 template<
typename MT
1175 return matrix_.capacity( col_ );
1190 template<
typename MT
1194 return matrix_.nonZeros( col_ );
1206 template<
typename MT
1210 matrix_.reset( col_ );
1228 template<
typename MT
1233 return matrix_.set( index, col_, value );
1252 template<
typename MT
1255 Column<MT,true,false,SF>::insert(
size_t index,
const ElementType& value )
1257 return matrix_.insert( index, col_, value );
1272 template<
typename MT
1274 inline void Column<MT,true,false,SF>::erase(
size_t index )
1276 matrix_.erase( index, col_ );
1291 template<
typename MT
1295 return matrix_.erase( col_, pos );
1311 template<
typename MT
1314 Column<MT,true,false,SF>::erase( Iterator first, Iterator last )
1316 return matrix_.erase( col_, first, last );
1332 template<
typename MT
1334 void Column<MT,true,false,SF>::reserve(
size_t n )
1336 matrix_.reserve( col_, n );
1353 template<
typename MT
1355 template<
typename Other >
1356 inline Column<MT,true,false,SF>& Column<MT,true,false,SF>::scale(
const Other& scalar )
1360 for( Iterator element=
begin(); element!=
end(); ++element )
1361 element->value() *= scalar;
1377 template<
typename MT
1379 inline size_t Column<MT,true,false,SF>::extendCapacity() const noexcept
1384 size_t nonzeros( 2UL*
capacity()+1UL );
1385 nonzeros =
max( nonzeros, 7UL );
1386 nonzeros =
min( nonzeros,
size() );
1418 template<
typename MT
1422 return matrix_.find( index, col_ );
1442 template<
typename MT
1445 Column<MT,true,false,SF>::find(
size_t index )
const
1447 return matrix_.find( index, col_ );
1466 template<
typename MT
1470 return matrix_.lowerBound( index, col_ );
1489 template<
typename MT
1492 Column<MT,true,false,SF>::lowerBound(
size_t index )
const
1494 return matrix_.lowerBound( index, col_ );
1513 template<
typename MT
1517 return matrix_.upperBound( index, col_ );
1536 template<
typename MT
1539 Column<MT,true,false,SF>::upperBound(
size_t index )
const
1541 return matrix_.upperBound( index, col_ );
1580 template<
typename MT
1582 inline void Column<MT,true,false,SF>::append(
size_t index,
const ElementType& value,
bool check )
1584 matrix_.append( index, col_, value, check );
1609 template<
typename MT
1611 template<
typename Other >
1612 inline bool Column<MT,true,false,SF>::canAlias(
const Other* alias )
const noexcept
1614 return matrix_.isAliased( alias );
1631 template<
typename MT
1633 template<
typename Other >
1634 inline bool Column<MT,true,false,SF>::isAliased(
const Other* alias )
const noexcept
1636 return matrix_.isAliased( alias );
1654 template<
typename MT
1656 template<
typename VT >
1657 inline void Column<MT,true,false,SF>::assign(
const DenseVector<VT,false>& rhs )
1662 for(
size_t i=0UL; i<
size(); ++i )
1664 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
1665 matrix_.reserve( col_, extendCapacity() );
1667 matrix_.append( i, col_, (~rhs)[i],
true );
1686 template<
typename MT
1688 template<
typename VT >
1689 inline void Column<MT,true,false,SF>::assign(
const SparseVector<VT,false>& rhs )
1694 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1695 matrix_.append( element->index(), col_, element->value(), true );
1714 template<
typename MT
1716 template<
typename VT >
1717 inline void Column<MT,true,false,SF>::addAssign(
const DenseVector<VT,false>& rhs )
1719 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
1727 const AddType tmp(
serial( *
this + (~rhs) ) );
1728 matrix_.reset( col_ );
1747 template<
typename MT
1749 template<
typename VT >
1750 inline void Column<MT,true,false,SF>::addAssign(
const SparseVector<VT,false>& rhs )
1752 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
1760 const AddType tmp(
serial( *
this + (~rhs) ) );
1761 matrix_.reset( col_ );
1762 matrix_.reserve( col_, tmp.nonZeros() );
1781 template<
typename MT
1783 template<
typename VT >
1784 inline void Column<MT,true,false,SF>::subAssign(
const DenseVector<VT,false>& rhs )
1786 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
1794 const SubType tmp(
serial( *
this - (~rhs) ) );
1795 matrix_.reset( col_ );
1814 template<
typename MT
1816 template<
typename VT >
1817 inline void Column<MT,true,false,SF>::subAssign(
const SparseVector<VT,false>& rhs )
1819 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
1827 const SubType tmp(
serial( *
this - (~rhs) ) );
1828 matrix_.reset( col_ );
1829 matrix_.reserve( col_, tmp.nonZeros() );
1856 template<
typename MT >
1857 class Column<MT,false,false,false>
1858 :
public SparseVector< Column<MT,false,false,false>, false >
1864 typedef If_< IsExpression<MT>, MT, MT& > Operand;
1869 typedef Column<MT,false,false,false>
This;
1870 typedef SparseVector<This,false>
BaseType;
1887 template<
typename MatrixType
1888 ,
typename IteratorType >
1889 class ColumnElement :
private SparseElement
1899 enum :
bool { returnConst = IsConst<MatrixType>::value };
1904 typedef typename std::iterator_traits<IteratorType>::value_type SET;
1906 typedef Reference_<SET> RT;
1907 typedef ConstReference_<SET> CRT;
1912 typedef ValueType_<SET> ValueType;
1913 typedef size_t IndexType;
1914 typedef IfTrue_<returnConst,CRT,RT>
Reference;
1924 inline ColumnElement( IteratorType pos,
size_t row )
1936 template<
typename T >
inline ColumnElement& operator=(
const T& v ) {
1948 template<
typename T >
inline ColumnElement&
operator+=(
const T& v ) {
1960 template<
typename T >
inline ColumnElement&
operator-=(
const T& v ) {
1972 template<
typename T >
inline ColumnElement&
operator*=(
const T& v ) {
1984 template<
typename T >
inline ColumnElement&
operator/=(
const T& v ) {
1995 inline const ColumnElement* operator->()
const {
2005 inline Reference value()
const {
2006 return pos_->value();
2015 inline IndexType index()
const {
2031 template<
typename MatrixType
2032 ,
typename IteratorType >
2033 class ColumnIterator
2037 typedef std::forward_iterator_tag IteratorCategory;
2038 typedef ColumnElement<MatrixType,IteratorType> ValueType;
2039 typedef ValueType PointerType;
2040 typedef ValueType ReferenceType;
2041 typedef ptrdiff_t DifferenceType;
2044 typedef IteratorCategory iterator_category;
2045 typedef ValueType value_type;
2046 typedef PointerType pointer;
2047 typedef ReferenceType reference;
2048 typedef DifferenceType difference_type;
2054 inline ColumnIterator()
2055 : matrix_( nullptr )
2069 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
2070 : matrix_( &matrix )
2075 for( ; row_<matrix_->rows(); ++row_ ) {
2076 pos_ = matrix_->find( row_, column_ );
2077 if( pos_ != matrix_->end( row_ ) )
break;
2090 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2091 : matrix_( &matrix )
2105 template<
typename MatrixType2,
typename IteratorType2 >
2106 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
2107 : matrix_( it.matrix_ )
2109 , column_( it.column_ )
2119 inline ColumnIterator& operator++() {
2121 for( ; row_<matrix_->rows(); ++row_ ) {
2122 pos_ = matrix_->find( row_, column_ );
2123 if( pos_ != matrix_->end( row_ ) )
break;
2135 inline const ColumnIterator operator++(
int ) {
2136 const ColumnIterator tmp( *
this );
2147 inline ReferenceType
operator*()
const {
2148 return ReferenceType( pos_, row_ );
2157 inline PointerType operator->()
const {
2158 return PointerType( pos_, row_ );
2168 template<
typename MatrixType2,
typename IteratorType2 >
2169 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2170 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2180 template<
typename MatrixType2,
typename IteratorType2 >
2181 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2182 return !( *
this == rhs );
2192 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2193 size_t counter( 0UL );
2194 for(
size_t i=rhs.row_; i<row_; ++i ) {
2195 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2204 MatrixType* matrix_;
2211 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2212 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
friend class Column;
2219 typedef ColumnIterator< const MT, ConstIterator_<MT> >
ConstIterator;
2227 enum :
bool { smpAssignable =
false };
2233 explicit inline Column( Operand matrix,
size_t index );
2245 inline Reference operator[](
size_t index );
2246 inline ConstReference operator[](
size_t index )
const;
2247 inline Reference at(
size_t index );
2248 inline ConstReference at(
size_t index )
const;
2249 inline Iterator
begin ();
2250 inline ConstIterator
begin ()
const;
2251 inline ConstIterator
cbegin()
const;
2252 inline Iterator
end ();
2253 inline ConstIterator
end ()
const;
2254 inline ConstIterator
cend ()
const;
2261 inline Column& operator= (
const Column& rhs );
2262 template<
typename VT >
inline Column& operator= (
const Vector<VT,false>& rhs );
2263 template<
typename VT >
inline Column&
operator+=(
const Vector<VT,false>& rhs );
2264 template<
typename VT >
inline Column&
operator-=(
const Vector<VT,false>& rhs );
2265 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
2266 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
2268 template<
typename Other >
2269 inline EnableIf_<IsNumeric<Other>, Column >&
operator*=( Other rhs );
2271 template<
typename Other >
2272 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
2279 inline size_t size()
const;
2282 inline void reset();
2283 inline Iterator
set (
size_t index,
const ElementType& value );
2284 inline Iterator insert (
size_t index,
const ElementType& value );
2285 inline void erase (
size_t index );
2286 inline Iterator erase ( Iterator pos );
2287 inline Iterator erase ( Iterator first, Iterator last );
2288 inline void reserve(
size_t n );
2289 template<
typename Other >
inline Column& scale (
const Other& scalar );
2296 inline Iterator find (
size_t index );
2297 inline ConstIterator find (
size_t index )
const;
2298 inline Iterator lowerBound(
size_t index );
2299 inline ConstIterator lowerBound(
size_t index )
const;
2300 inline Iterator upperBound(
size_t index );
2301 inline ConstIterator upperBound(
size_t index )
const;
2308 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
2315 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2316 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2318 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
2319 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
2320 template<
typename VT >
inline void addAssign(
const Vector<VT,false>& rhs );
2321 template<
typename VT >
inline void subAssign(
const Vector<VT,false>& rhs );
2335 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2336 friend bool isIntact(
const Column<MT2,SO2,DF2,SF2>& column ) noexcept;
2338 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2339 friend bool isSame(
const Column<MT2,SO2,DF2,SF2>& a,
const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
2341 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2342 friend bool tryAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2344 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2345 friend bool tryAddAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2347 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2348 friend bool trySubAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2350 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename VT >
2351 friend bool tryMultAssign(
const Column<MT2,SO2,DF2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2353 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2354 friend DerestrictTrait_< Column<MT2,SO2,DF2,SF2> > derestrict( Column<MT2,SO2,DF2,SF2>& column );
2387 template<
typename MT >
2388 inline Column<MT,false,false,false>::Column( Operand matrix,
size_t index )
2392 if( matrix_.columns() <= index ) {
2418 template<
typename MT >
2420 Column<MT,false,false,false>::operator[](
size_t index )
2423 return matrix_(index,col_);
2439 template<
typename MT >
2441 Column<MT,false,false,false>::operator[](
size_t index )
const
2444 return const_cast<const MT&
>( matrix_ )(index,col_);
2461 template<
typename MT >
2463 Column<MT,false,false,false>::at(
size_t index )
2465 if( index >=
size() ) {
2468 return (*
this)[index];
2485 template<
typename MT >
2487 Column<MT,false,false,false>::at(
size_t index )
const
2489 if( index >=
size() ) {
2492 return (*
this)[index];
2506 template<
typename MT >
2509 return Iterator( matrix_, 0UL, col_ );
2523 template<
typename MT >
2541 template<
typename MT >
2559 template<
typename MT >
2576 template<
typename MT >
2594 template<
typename MT >
2626 template<
typename MT >
2627 inline Column<MT,false,false,false>&
2628 Column<MT,false,false,false>::operator=(
const Column& rhs )
2630 using blaze::assign;
2636 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
2639 if(
size() != rhs.size() ) {
2643 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
2647 DerestrictTrait_<This> left( derestrict( *
this ) );
2649 if( rhs.canAlias( &matrix_ ) ) {
2650 const ResultType tmp( rhs );
2651 assign( left, tmp );
2654 assign( left, rhs );
2679 template<
typename MT >
2680 template<
typename VT >
2681 inline Column<MT,false,false,false>&
2682 Column<MT,false,false,false>::operator=(
const Vector<VT,false>& rhs )
2684 using blaze::assign;
2690 const CompositeType_<VT> tmp( ~rhs );
2692 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2696 DerestrictTrait_<This> left( derestrict( *
this ) );
2698 assign( left, tmp );
2722 template<
typename MT >
2723 template<
typename VT >
2724 inline Column<MT,false,false,false>&
2727 using blaze::assign;
2735 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
2744 const AddType tmp( *
this + (~rhs) );
2746 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2750 DerestrictTrait_<This> left( derestrict( *
this ) );
2752 assign( left, tmp );
2776 template<
typename MT >
2777 template<
typename VT >
2778 inline Column<MT,false,false,false>&
2781 using blaze::assign;
2789 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
2798 const SubType tmp( *
this - (~rhs) );
2800 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2804 DerestrictTrait_<This> left( derestrict( *
this ) );
2806 assign( left, tmp );
2829 template<
typename MT >
2830 template<
typename VT >
2831 inline Column<MT,false,false,false>&
2834 using blaze::assign;
2842 typedef MultTrait_< ResultType, ResultType_<VT> > MultType;
2851 const MultType tmp( *
this * (~rhs) );
2853 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2857 DerestrictTrait_<This> left( derestrict( *
this ) );
2859 assign( left, tmp );
2881 template<
typename MT >
2882 template<
typename VT >
2883 inline Column<MT,false,false,false>&
2886 using blaze::assign;
2895 typedef DivTrait_< ResultType, ResultType_<VT> > DivType;
2905 const DivType tmp( *
this / (~rhs) );
2907 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2911 DerestrictTrait_<This> left( derestrict( *
this ) );
2913 assign( left, tmp );
2938 template<
typename MT >
2939 template<
typename Other >
2940 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,false> >&
2945 for( Iterator element=
begin(); element!=
end(); ++element )
2946 element->value() *= rhs;
2971 template<
typename MT >
2972 template<
typename Other >
2973 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,false> >&
2980 typedef DivTrait_<ElementType,Other> DT;
2981 typedef If_< IsNumeric<DT>, DT, Other > Tmp;
2985 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2986 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2987 for( Iterator element=
begin(); element!=
end(); ++element )
2988 element->value() *= tmp;
2991 for( Iterator element=
begin(); element!=
end(); ++element )
2992 element->value() /= rhs;
3015 template<
typename MT >
3018 return matrix_.rows();
3030 template<
typename MT >
3033 return matrix_.rows();
3048 template<
typename MT >
3051 size_t counter( 0UL );
3052 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
3067 template<
typename MT >
3070 const size_t ibegin( ( IsLower<MT>::value )
3071 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3075 const size_t iend ( ( IsUpper<MT>::value )
3076 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3081 for(
size_t i=ibegin; i<iend; ++i ) {
3082 matrix_.erase( i, col_ );
3101 template<
typename MT >
3105 return Iterator( matrix_, index, col_, matrix_.set( index, col_, value ) );
3124 template<
typename MT >
3126 Column<MT,false,false,false>::insert(
size_t index,
const ElementType& value )
3128 return Iterator( matrix_, index, col_, matrix_.insert( index, col_, value ) );
3143 template<
typename MT >
3144 inline void Column<MT,false,false,false>::erase(
size_t index )
3146 matrix_.erase( index, col_ );
3161 template<
typename MT >
3163 Column<MT,false,false,false>::erase( Iterator pos )
3165 const size_t row( pos.row_ );
3170 matrix_.erase( row, pos.pos_ );
3171 return Iterator( matrix_, row+1UL, col_ );
3187 template<
typename MT >
3189 Column<MT,false,false,false>::erase( Iterator first, Iterator last )
3191 for( ; first!=last; ++first ) {
3192 matrix_.erase( first.row_, first.pos_ );
3210 template<
typename MT >
3211 void Column<MT,false,false,false>::reserve(
size_t n )
3232 template<
typename MT >
3233 template<
typename Other >
3234 inline Column<MT,false,false,false>& Column<MT,false,false,false>::scale(
const Other& scalar )
3238 for( Iterator element=
begin(); element!=
end(); ++element )
3239 element->value() *= scalar;
3268 template<
typename MT >
3270 Column<MT,false,false,false>::find(
size_t index )
3272 const Iterator_<MT> pos( matrix_.find( index, col_ ) );
3274 if( pos != matrix_.end( index ) )
3275 return Iterator( matrix_, index, col_, pos );
3297 template<
typename MT >
3299 Column<MT,false,false,false>::find(
size_t index )
const
3301 const ConstIterator_<MT> pos( matrix_.find( index, col_ ) );
3303 if( pos != matrix_.end( index ) )
3325 template<
typename MT >
3327 Column<MT,false,false,false>::lowerBound(
size_t index )
3329 for(
size_t i=index; i<
size(); ++i )
3331 const Iterator_<MT> pos( matrix_.find( i, col_ ) );
3333 if( pos != matrix_.end( i ) )
3334 return Iterator( matrix_, i, col_, pos );
3356 template<
typename MT >
3358 Column<MT,false,false,false>::lowerBound(
size_t index )
const
3360 for(
size_t i=index; i<
size(); ++i )
3362 const ConstIterator_<MT> pos( matrix_.find( i, col_ ) );
3364 if( pos != matrix_.end( i ) )
3387 template<
typename MT >
3389 Column<MT,false,false,false>::upperBound(
size_t index )
3391 for(
size_t i=index+1UL; i<
size(); ++i )
3393 const Iterator_<MT> pos( matrix_.find( i, col_ ) );
3395 if( pos != matrix_.end( i ) )
3396 return Iterator( matrix_, i, col_, pos );
3418 template<
typename MT >
3420 Column<MT,false,false,false>::upperBound(
size_t index )
const
3422 for(
size_t i=index+1UL; i<
size(); ++i )
3424 const ConstIterator_<MT> pos( matrix_.find( i, col_ ) );
3426 if( pos != matrix_.end( i ) )
3469 template<
typename MT >
3470 inline void Column<MT,false,false,false>::append(
size_t index,
const ElementType& value,
bool check )
3473 matrix_.insert( index, col_, value );
3498 template<
typename MT >
3499 template<
typename Other >
3500 inline bool Column<MT,false,false,false>::canAlias(
const Other* alias )
const
3502 return matrix_.isAliased( alias );
3515 template<
typename MT >
3516 template<
typename Other >
3517 inline bool Column<MT,false,false,false>::isAliased(
const Other* alias )
const
3519 return matrix_.isAliased( alias );
3537 template<
typename MT >
3538 template<
typename VT >
3539 inline void Column<MT,false,false,false>::assign(
const DenseVector<VT,false>& rhs )
3543 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3544 matrix_(i,col_) = (~rhs)[i];
3563 template<
typename MT >
3564 template<
typename VT >
3565 inline void Column<MT,false,false,false>::assign(
const SparseVector<VT,false>& rhs )
3571 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3572 for( ; i<element->index(); ++i )
3573 matrix_.erase( i, col_ );
3574 matrix_(i++,col_) = element->value();
3576 for( ; i<
size(); ++i ) {
3577 matrix_.erase( i, col_ );
3596 template<
typename MT >
3597 template<
typename VT >
3598 inline void Column<MT,false,false,false>::addAssign(
const Vector<VT,false>& rhs )
3600 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
3607 const AddType tmp(
serial( *
this + (~rhs) ) );
3626 template<
typename MT >
3627 template<
typename VT >
3628 inline void Column<MT,false,false,false>::subAssign(
const Vector<VT,false>& rhs )
3630 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
3637 const SubType tmp(
serial( *
this - (~rhs) ) );
3664 template<
typename MT >
3665 class Column<MT,false,false,true>
3666 :
public SparseVector< Column<MT,false,false,true>, false >
3672 typedef If_< IsExpression<MT>, MT, MT& > Operand;
3677 typedef Column<MT,false,false,true>
This;
3678 typedef SparseVector<This,false>
BaseType;
3700 enum :
bool { smpAssignable =
false };
3706 explicit inline Column( Operand matrix,
size_t index );
3718 inline Reference operator[](
size_t index );
3719 inline ConstReference operator[](
size_t index )
const;
3720 inline Reference at(
size_t index );
3721 inline ConstReference at(
size_t index )
const;
3722 inline Iterator
begin ();
3723 inline ConstIterator
begin ()
const;
3724 inline ConstIterator
cbegin()
const;
3725 inline Iterator
end ();
3726 inline ConstIterator
end ()
const;
3727 inline ConstIterator
cend ()
const;
3734 inline Column& operator=(
const Column& rhs );
3736 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
3737 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
3738 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
3739 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
3740 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
3741 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
3742 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
3743 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
3745 template<
typename Other >
3746 inline EnableIf_<IsNumeric<Other>, Column >&
operator*=( Other rhs );
3748 template<
typename Other >
3749 inline EnableIf_<IsNumeric<Other>, Column >&
operator/=( Other rhs );
3756 inline size_t size() const noexcept;
3757 inline
size_t capacity() const noexcept;
3759 inline
void reset();
3760 inline Iterator
set (
size_t index, const ElementType& value );
3761 inline Iterator insert (
size_t index, const ElementType& value );
3762 inline
void erase (
size_t index );
3763 inline Iterator erase ( Iterator pos );
3764 inline Iterator erase ( Iterator first, Iterator last );
3765 inline
void reserve(
size_t n );
3766 template< typename Other > inline Column& scale ( const Other& scalar );
3773 inline Iterator find (
size_t index );
3774 inline ConstIterator find (
size_t index ) const;
3775 inline Iterator lowerBound(
size_t index );
3776 inline ConstIterator lowerBound(
size_t index ) const;
3777 inline Iterator upperBound(
size_t index );
3778 inline ConstIterator upperBound(
size_t index ) const;
3785 inline
void append(
size_t index, const ElementType& value,
bool check=false );
3792 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
3793 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
3795 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
3796 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
3797 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
3798 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
3799 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
3800 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
3808 inline
size_t extendCapacity() const noexcept;
3821 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
3822 friend
bool isIntact( const Column<MT2,SO2,DF2,SF2>& column ) noexcept;
3824 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
3825 friend
bool isSame( const Column<MT2,SO2,DF2,SF2>& a, const Column<MT2,SO2,DF2,SF2>& b ) noexcept;
3827 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
3828 friend
bool tryAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
3830 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
3831 friend
bool tryAddAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
3833 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
3834 friend
bool trySubAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
3836 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
3837 friend
bool tryMultAssign( const Column<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,false>& rhs,
size_t index );
3839 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
3840 friend
DerestrictTrait_< Column<MT2,SO2,DF2,SF2> > derestrict( Column<MT2,SO2,DF2,SF2>& column );
3873 template< typename MT >
3874 inline Column<MT,false,false,true>::Column( Operand matrix,
size_t index )
3878 if( matrix_.columns() <= index ) {
3904 template<
typename MT >
3906 Column<MT,false,false,true>::operator[](
size_t index )
3909 return matrix_(col_,index);
3925 template<
typename MT >
3927 Column<MT,false,false,true>::operator[](
size_t index )
const
3930 return const_cast<const MT&
>( matrix_ )(col_,index);
3947 template<
typename MT >
3949 Column<MT,false,false,true>::at(
size_t index )
3951 if( index >=
size() ) {
3954 return (*
this)[index];
3971 template<
typename MT >
3973 Column<MT,false,false,true>::at(
size_t index )
const
3975 if( index >=
size() ) {
3978 return (*
this)[index];
3992 template<
typename MT >
3995 return matrix_.begin( col_ );
4009 template<
typename MT >
4013 return matrix_.cbegin( col_ );
4027 template<
typename MT >
4031 return matrix_.cbegin( col_ );
4045 template<
typename MT >
4048 return matrix_.end( col_ );
4062 template<
typename MT >
4066 return matrix_.cend( col_ );
4080 template<
typename MT >
4084 return matrix_.cend( col_ );
4112 template<
typename MT >
4113 inline Column<MT,false,false,true>& Column<MT,false,false,true>::operator=(
const Column& rhs )
4115 using blaze::assign;
4121 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
4124 if(
size() != rhs.size() ) {
4128 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
4132 DerestrictTrait_<This> left( derestrict( *
this ) );
4134 if( rhs.canAlias( &matrix_ ) ) {
4135 const ResultType tmp( rhs );
4137 left.reserve( tmp.nonZeros() );
4138 assign( left, tmp );
4142 left.reserve( rhs.nonZeros() );
4143 assign( left, rhs );
4168 template<
typename MT >
4169 template<
typename VT >
4170 inline Column<MT,false,false,true>&
4171 Column<MT,false,false,true>::operator=(
const DenseVector<VT,false>& rhs )
4173 using blaze::assign;
4183 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4184 Right right( ~rhs );
4186 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4190 DerestrictTrait_<This> left( derestrict( *
this ) );
4192 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4193 const ResultType_<VT> tmp( right );
4195 assign( left, tmp );
4199 assign( left, right );
4224 template<
typename MT >
4225 template<
typename VT >
4226 inline Column<MT,false,false,true>&
4227 Column<MT,false,false,true>::operator=(
const SparseVector<VT,false>& rhs )
4229 using blaze::assign;
4239 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4240 Right right( ~rhs );
4242 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4246 DerestrictTrait_<This> left( derestrict( *
this ) );
4248 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4249 const ResultType_<VT> tmp( right);
4251 left.reserve( tmp.nonZeros() );
4252 assign( left, tmp );
4256 left.reserve( right.nonZeros() );
4257 assign( left, right );
4282 template<
typename MT >
4283 template<
typename VT >
4284 inline Column<MT,false,false,true>&
4287 using blaze::assign;
4296 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
4306 const AddType tmp( *
this + (~rhs) );
4308 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4312 DerestrictTrait_<This> left( derestrict( *
this ) );
4315 assign( left, tmp );
4339 template<
typename MT >
4340 template<
typename VT >
4341 inline Column<MT,false,false,true>&
4344 using blaze::assign;
4353 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
4363 const AddType tmp( *
this + (~rhs) );
4365 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4369 DerestrictTrait_<This> left( derestrict( *
this ) );
4372 left.reserve( tmp.nonZeros() );
4373 assign( left, tmp );
4398 template<
typename MT >
4399 template<
typename VT >
4400 inline Column<MT,false,false,true>&
4403 using blaze::assign;
4412 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
4422 const SubType tmp( *
this - (~rhs) );
4424 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4428 DerestrictTrait_<This> left( derestrict( *
this ) );
4431 assign( left, tmp );
4456 template<
typename MT >
4457 template<
typename VT >
4458 inline Column<MT,false,false,true>&
4461 using blaze::assign;
4470 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
4480 const SubType tmp( *
this - (~rhs) );
4482 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4486 DerestrictTrait_<This> left( derestrict( *
this ) );
4489 left.reserve( tmp.nonZeros() );
4490 assign( left, tmp );
4513 template<
typename MT >
4514 template<
typename VT >
4515 inline Column<MT,false,false,true>&
4518 using blaze::assign;
4526 typedef MultTrait_< ResultType, ResultType_<VT> > MultType;
4535 const MultType tmp( *
this * (~rhs) );
4537 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4541 DerestrictTrait_<This> left( derestrict( *
this ) );
4544 assign( left, tmp );
4566 template<
typename MT >
4567 template<
typename VT >
4568 inline Column<MT,false,false,true>&
4571 using blaze::assign;
4580 typedef DivTrait_< ResultType, ResultType_<VT> > DivType;
4590 const DivType tmp( *
this / (~rhs) );
4592 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4596 DerestrictTrait_<This> left( derestrict( *
this ) );
4599 assign( left, tmp );
4624 template<
typename MT >
4625 template<
typename Other >
4626 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,true> >&
4631 for( Iterator element=
begin(); element!=
end(); ++element )
4632 element->value() *= rhs;
4657 template<
typename MT >
4658 template<
typename Other >
4659 inline EnableIf_<IsNumeric<Other>, Column<MT,false,false,true> >&
4666 typedef DivTrait_<ElementType,Other> DT;
4667 typedef If_< IsNumeric<DT>, DT, Other > Tmp;
4671 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
4672 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
4673 for( Iterator element=
begin(); element!=
end(); ++element )
4674 element->value() *= tmp;
4677 for( Iterator element=
begin(); element!=
end(); ++element )
4678 element->value() /= rhs;
4701 template<
typename MT >
4704 return matrix_.rows();
4716 template<
typename MT >
4719 return matrix_.capacity( col_ );
4734 template<
typename MT >
4737 return matrix_.nonZeros( col_ );
4749 template<
typename MT >
4752 matrix_.reset( col_ );
4770 template<
typename MT >
4774 return matrix_.set( col_, index, value );
4793 template<
typename MT >
4795 Column<MT,false,false,true>::insert(
size_t index,
const ElementType& value )
4797 return matrix_.insert( col_, index, value );
4812 template<
typename MT >
4813 inline void Column<MT,false,false,true>::erase(
size_t index )
4815 matrix_.erase( col_, index );
4830 template<
typename MT >
4832 Column<MT,false,false,true>::erase( Iterator pos )
4834 return matrix_.erase( col_, pos );
4850 template<
typename MT >
4852 Column<MT,false,false,true>::erase( Iterator first, Iterator last )
4854 return matrix_.erase( col_, first, last );
4870 template<
typename MT >
4871 void Column<MT,false,false,true>::reserve(
size_t n )
4873 matrix_.reserve( col_, n );
4890 template<
typename MT >
4891 template<
typename Other >
4892 inline Column<MT,false,false,true>& Column<MT,false,false,true>::scale(
const Other& scalar )
4896 for( Iterator element=
begin(); element!=
end(); ++element )
4897 element->value() *= scalar;
4913 template<
typename MT >
4914 inline size_t Column<MT,false,false,true>::extendCapacity() const noexcept
4919 size_t nonzeros( 2UL*
capacity()+1UL );
4920 nonzeros =
max( nonzeros, 7UL );
4921 nonzeros =
min( nonzeros,
size() );
4953 template<
typename MT >
4955 Column<MT,false,false,true>::find(
size_t index )
4957 return matrix_.find( col_, index );
4977 template<
typename MT >
4979 Column<MT,false,false,true>::find(
size_t index )
const
4981 return matrix_.find( col_, index );
5000 template<
typename MT >
5002 Column<MT,false,false,true>::lowerBound(
size_t index )
5004 return matrix_.lowerBound( col_, index );
5023 template<
typename MT >
5025 Column<MT,false,false,true>::lowerBound(
size_t index )
const
5027 return matrix_.lowerBound( col_, index );
5046 template<
typename MT >
5048 Column<MT,false,false,true>::upperBound(
size_t index )
5050 return matrix_.upperBound( col_, index );
5069 template<
typename MT >
5071 Column<MT,false,false,true>::upperBound(
size_t index )
const
5073 return matrix_.upperBound( col_, index );
5112 template<
typename MT >
5113 inline void Column<MT,false,false,true>::append(
size_t index,
const ElementType& value,
bool check )
5115 matrix_.append( col_, index, value, check );
5140 template<
typename MT >
5141 template<
typename Other >
5142 inline bool Column<MT,false,false,true>::canAlias(
const Other* alias )
const noexcept
5144 return matrix_.isAliased( alias );
5161 template<
typename MT >
5162 template<
typename Other >
5163 inline bool Column<MT,false,false,true>::isAliased(
const Other* alias )
const noexcept
5165 return matrix_.isAliased( alias );
5183 template<
typename MT >
5184 template<
typename VT >
5185 inline void Column<MT,false,false,true>::assign(
const DenseVector<VT,false>& rhs )
5190 for(
size_t i=0UL; i<
size(); ++i )
5192 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
5193 matrix_.reserve( col_, extendCapacity() );
5195 matrix_.append( col_, i, (~rhs)[i],
true );
5214 template<
typename MT >
5215 template<
typename VT >
5216 inline void Column<MT,false,false,true>::assign(
const SparseVector<VT,false>& rhs )
5221 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5222 matrix_.append( col_, element->index(), element->value(), true );
5241 template<
typename MT >
5242 template<
typename VT >
5243 inline void Column<MT,false,false,true>::addAssign(
const DenseVector<VT,false>& rhs )
5245 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
5253 const AddType tmp(
serial( *
this + (~rhs) ) );
5254 matrix_.reset( col_ );
5273 template<
typename MT >
5274 template<
typename VT >
5275 inline void Column<MT,false,false,true>::addAssign(
const SparseVector<VT,false>& rhs )
5277 typedef AddTrait_< ResultType, ResultType_<VT> > AddType;
5285 const AddType tmp(
serial( *
this + (~rhs) ) );
5286 matrix_.reset( col_ );
5287 matrix_.reserve( col_, tmp.nonZeros() );
5306 template<
typename MT >
5307 template<
typename VT >
5308 inline void Column<MT,false,false,true>::subAssign(
const DenseVector<VT,false>& rhs )
5310 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
5318 const SubType tmp(
serial( *
this - (~rhs) ) );
5319 matrix_.reset( col_ );
5338 template<
typename MT >
5339 template<
typename VT >
5340 inline void Column<MT,false,false,true>::subAssign(
const SparseVector<VT,false>& rhs )
5342 typedef SubTrait_< ResultType, ResultType_<VT> > SubType;
5350 const SubType tmp(
serial( *
this - (~rhs) ) );
5351 matrix_.reset( col_ );
5352 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.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
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:346
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:653
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:258
#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:188
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:2643
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
#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:723
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:384
#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:1716
DisableIf_< Or< IsComputation< MT >, IsTransExpr< 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:126
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:298
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:232
Constraint on the data type.
Constraint on the transpose flag of vector types.
Constraint on the data type.
bool isDefault(const CompressedMatrix< Type, SO > &m)
Returns whether the given compressed matrix is in default state.
Definition: CompressedMatrix.h:5104
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
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5131
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
#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
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.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2640
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:254
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
Constraint on the data type.
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
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
DisableIf_< Or< IsComputation< MT >, IsTransExpr< 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:126
#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:2642
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:2646
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:2637
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2638
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
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.
#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.