35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_ 113 template<
typename MT
116 class Column<MT,true,false,SF,CCAs...>
117 :
public View< SparseVector< Column<MT,true,false,SF,CCAs...>, false > >
118 ,
private ColumnData<CCAs...>
122 using DataType = ColumnData<CCAs...>;
123 using Operand = If_< IsExpression<MT>, MT, MT& >;
129 using This = Column<MT,
true,
false,SF,CCAs...>;
131 using BaseType = SparseVector<This,false>;
132 using ViewedType = MT;
154 enum :
bool { smpAssignable =
false };
160 template<
typename... RCAs >
161 explicit inline Column( MT& matrix, RCAs... args );
173 inline Reference operator[](
size_t index );
174 inline ConstReference operator[](
size_t index )
const;
176 inline ConstReference at(
size_t index )
const;
178 inline ConstIterator
begin ()
const;
179 inline ConstIterator
cbegin()
const;
181 inline ConstIterator
end ()
const;
182 inline ConstIterator
cend ()
const;
189 inline Column& operator=( initializer_list<ElementType> list );
190 inline Column& operator=(
const Column& rhs );
192 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
193 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
194 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
195 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
196 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
197 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
198 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
199 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
200 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
209 inline MT& operand() noexcept;
210 inline const MT& operand() const noexcept;
212 inline
size_t size() const noexcept;
213 inline
size_t capacity() const noexcept;
216 inline
void reserve(
size_t n );
225 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
232 inline
void erase(
size_t index );
236 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
237 inline
void erase( Pred predicate );
239 template< typename Pred >
247 inline
Iterator find (
size_t index );
248 inline ConstIterator find (
size_t index ) const;
249 inline
Iterator lowerBound(
size_t index );
250 inline ConstIterator lowerBound(
size_t index ) const;
251 inline
Iterator upperBound(
size_t index );
252 inline ConstIterator upperBound(
size_t index ) const;
259 template< typename Other > inline Column& scale( const Other& scalar );
266 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
267 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
269 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
270 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
271 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
272 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
273 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
274 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
282 inline
size_t extendCapacity() const noexcept;
328 template< typename MT
331 template< typename... RCAs >
332 inline Column<MT,true,false,SF,CCAs...>::Column( MT& matrix, RCAs... args )
333 : DataType( args... )
336 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
337 if( matrix_.columns() <=
column() ) {
367 template<
typename MT
370 inline typename Column<MT,
true,
false,SF,CCAs...>
::Reference 371 Column<MT,true,false,SF,CCAs...>::operator[](
size_t index )
374 return matrix_(index,
column());
390 template<
typename MT
394 Column<MT,true,false,SF,CCAs...>::operator[](
size_t index )
const 397 return const_cast<const MT&
>( matrix_ )(index,
column());
414 template<
typename MT
417 inline typename Column<MT,
true,
false,SF,CCAs...>
::Reference 418 Column<MT,true,false,SF,CCAs...>::at(
size_t index )
420 if( index >=
size() ) {
423 return (*
this)[index];
440 template<
typename MT
444 Column<MT,true,false,SF,CCAs...>::at(
size_t index )
const 446 if( index >=
size() ) {
449 return (*
this)[index];
463 template<
typename MT
466 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 469 return matrix_.begin(
column() );
483 template<
typename MT
489 return matrix_.cbegin(
column() );
503 template<
typename MT
509 return matrix_.cbegin(
column() );
523 template<
typename MT
526 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 529 return matrix_.end(
column() );
543 template<
typename MT
549 return matrix_.cend(
column() );
563 template<
typename MT
569 return matrix_.cend(
column() );
598 template<
typename MT
601 inline Column<MT,
true,
false,SF,CCAs...>&
602 Column<MT,true,false,SF,CCAs...>::operator=( initializer_list<ElementType> list )
606 if( list.size() >
size() ) {
610 const InitializerVector<ElementType,false> tmp( list,
size() );
612 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
616 decltype(
auto) left( derestrict( *this ) );
643 template< typename MT
646 inline Column<MT,true,false,SF,CCAs...>&
647 Column<MT,true,false,SF,CCAs...>::operator=( const Column& rhs )
655 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
column() == rhs.column() ) )
658 if(
size() != rhs.size() ) {
662 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
666 decltype(
auto) left( derestrict( *this ) );
668 if( rhs.canAlias( &matrix_ ) ) {
671 left.reserve( tmp.nonZeros() );
676 left.reserve( rhs.nonZeros() );
702 template<
typename MT
705 template<
typename VT >
706 inline Column<MT,
true,
false,SF,CCAs...>&
707 Column<MT,true,false,SF,CCAs...>::operator=(
const DenseVector<VT,false>& rhs )
719 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
722 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
726 decltype(
auto) left( derestrict( *this ) );
728 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
729 const ResultType_<VT> tmp( right );
735 assign( left, right );
760 template<
typename MT
763 template<
typename VT >
764 inline Column<MT,
true,
false,SF,CCAs...>&
765 Column<MT,true,false,SF,CCAs...>::operator=(
const SparseVector<VT,false>& rhs )
777 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
780 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
784 decltype(
auto) left( derestrict( *this ) );
786 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
787 const ResultType_<VT> tmp( right );
789 left.reserve( tmp.nonZeros() );
794 left.reserve( right.nonZeros() );
795 assign( left, right );
820 template<
typename MT
823 template<
typename VT >
824 inline Column<MT,
true,
false,SF,CCAs...>&
836 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
846 const AddType tmp( *
this + (~rhs) );
848 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
852 decltype(
auto) left( derestrict( *this ) );
879 template< typename MT
882 template< typename VT >
883 inline Column<MT,true,false,SF,CCAs...>&
884 Column<MT,true,false,SF,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
895 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
905 const AddType tmp( *
this + (~rhs) );
907 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
911 decltype(
auto) left( derestrict( *this ) );
940 template< typename MT
943 template< typename VT >
944 inline Column<MT,true,false,SF,CCAs...>&
945 Column<MT,true,false,SF,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
956 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
966 const SubType tmp( *
this - (~rhs) );
968 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
972 decltype(
auto) left( derestrict( *this ) );
1000 template< typename MT
1003 template< typename VT >
1004 inline Column<MT,true,false,SF,CCAs...>&
1005 Column<MT,true,false,SF,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
1007 using blaze::assign;
1016 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
1026 const SubType tmp( *
this - (~rhs) );
1028 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1032 decltype(
auto) left( derestrict( *this ) );
1035 left.reserve( tmp.nonZeros() );
1036 assign( left, tmp );
1059 template< typename MT
1062 template< typename VT >
1063 inline Column<MT,true,false,SF,CCAs...>&
1064 Column<MT,true,false,SF,CCAs...>::operator*=( const Vector<VT,false>& rhs )
1066 using blaze::assign;
1074 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
1083 const MultType tmp( *
this * (~rhs) );
1085 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1089 decltype(
auto) left( derestrict( *this ) );
1092 assign( left, tmp );
1114 template< typename MT
1117 template< typename VT >
1118 inline Column<MT,true,false,SF,CCAs...>&
1119 Column<MT,true,false,SF,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
1121 using blaze::assign;
1130 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
1140 const DivType tmp( *
this / (~rhs) );
1142 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1146 decltype(
auto) left( derestrict( *this ) );
1149 assign( left, tmp );
1172 template< typename MT
1175 template< typename VT >
1176 inline Column<MT,true,false,SF,CCAs...>&
1177 Column<MT,true,false,SF,CCAs...>::operator%=( const Vector<VT,false>& rhs )
1179 using blaze::assign;
1184 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1190 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1194 const CrossType tmp( *
this % (~rhs) );
1196 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
1200 decltype(
auto) left( derestrict( *this ) );
1203 assign( left, tmp );
1227 template< typename MT
1230 inline MT& Column<MT,true,false,SF,CCAs...>::operand() noexcept
1244 template<
typename MT
1247 inline const MT& Column<MT,true,false,SF,CCAs...>::operand() const noexcept
1261 template<
typename MT
1266 return matrix_.rows();
1278 template<
typename MT
1283 return matrix_.capacity(
column() );
1298 template<
typename MT
1303 return matrix_.nonZeros(
column() );
1315 template<
typename MT
1320 matrix_.reset(
column() );
1336 template<
typename MT
1339 void Column<MT,true,false,SF,CCAs...>::reserve(
size_t n )
1341 matrix_.reserve(
column(), n );
1356 template<
typename MT
1359 inline size_t Column<MT,true,false,SF,CCAs...>::extendCapacity() const noexcept
1364 size_t nonzeros( 2UL*
capacity()+1UL );
1365 nonzeros =
max( nonzeros, 7UL );
1366 nonzeros =
min( nonzeros,
size() );
1396 template<
typename MT
1399 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1402 return matrix_.set( index,
column(), value );
1421 template<
typename MT
1424 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1425 Column<MT,true,false,SF,CCAs...>::insert(
size_t index,
const ElementType& value )
1427 return matrix_.insert( index,
column(), value );
1458 template<
typename MT
1461 inline void Column<MT,true,false,SF,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
1463 matrix_.append( index,
column(), value, check );
1486 template<
typename MT
1489 inline void Column<MT,true,false,SF,CCAs...>::erase(
size_t index )
1491 matrix_.erase( index,
column() );
1506 template<
typename MT
1509 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1510 Column<MT,true,false,SF,CCAs...>::erase(
Iterator pos )
1512 return matrix_.erase(
column(), pos );
1528 template<
typename MT
1531 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1534 return matrix_.erase(
column(), first, last );
1563 template<
typename MT
1566 template<
typename Pred
1568 inline void Column<MT,true,false,SF,CCAs...>::erase( Pred predicate )
1601 template<
typename MT
1604 template<
typename Pred >
1605 inline void Column<MT,true,false,SF,CCAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
1607 matrix_.erase(
column(), first, last, predicate );
1635 template<
typename MT
1638 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1639 Column<MT,true,false,SF,CCAs...>::find(
size_t index )
1641 return matrix_.find( index,
column() );
1661 template<
typename MT
1665 Column<MT,true,false,SF,CCAs...>::find(
size_t index )
const 1667 return matrix_.find( index,
column() );
1686 template<
typename MT
1689 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1690 Column<MT,true,false,SF,CCAs...>::lowerBound(
size_t index )
1692 return matrix_.lowerBound( index,
column() );
1711 template<
typename MT
1715 Column<MT,true,false,SF,CCAs...>::lowerBound(
size_t index )
const 1717 return matrix_.lowerBound( index,
column() );
1736 template<
typename MT
1739 inline typename Column<MT,
true,
false,SF,CCAs...>
::Iterator 1740 Column<MT,true,false,SF,CCAs...>::upperBound(
size_t index )
1742 return matrix_.upperBound( index,
column() );
1761 template<
typename MT
1765 Column<MT,true,false,SF,CCAs...>::upperBound(
size_t index )
const 1767 return matrix_.upperBound( index,
column() );
1794 template<
typename MT
1797 template<
typename Other >
1798 inline Column<MT,
true,
false,SF,CCAs...>&
1799 Column<MT,true,false,SF,CCAs...>::scale(
const Other& scalar )
1804 element->value() *= scalar;
1830 template<
typename MT
1833 template<
typename Other >
1834 inline bool Column<MT,true,false,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1836 return matrix_.isAliased( alias );
1853 template<
typename MT
1856 template<
typename Other >
1857 inline bool Column<MT,true,false,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1859 return matrix_.isAliased( alias );
1877 template<
typename MT
1880 template<
typename VT >
1881 inline void Column<MT,true,false,SF,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
1886 for(
size_t i=0UL; i<
size(); ++i )
1888 if( matrix_.nonZeros(
column() ) == matrix_.capacity(
column() ) )
1889 matrix_.reserve(
column(), extendCapacity() );
1891 matrix_.append( i,
column(), (~rhs)[i],
true );
1910 template<
typename MT
1913 template<
typename VT >
1914 inline void Column<MT,true,false,SF,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
1919 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1920 matrix_.append( element->index(),
column(), element->value(), true );
1939 template<
typename MT
1942 template<
typename VT >
1943 inline void Column<MT,true,false,SF,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
1945 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1953 const AddType tmp(
serial( *
this + (~rhs) ) );
1954 matrix_.reset(
column() );
1973 template<
typename MT
1976 template<
typename VT >
1977 inline void Column<MT,true,false,SF,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
1979 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1987 const AddType tmp(
serial( *
this + (~rhs) ) );
1988 matrix_.reset(
column() );
1989 matrix_.reserve(
column(), tmp.nonZeros() );
2008 template<
typename MT
2011 template<
typename VT >
2012 inline void Column<MT,true,false,SF,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
2014 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2022 const SubType tmp(
serial( *
this - (~rhs) ) );
2023 matrix_.reset(
column() );
2042 template<
typename MT
2045 template<
typename VT >
2046 inline void Column<MT,true,false,SF,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
2048 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2056 const SubType tmp(
serial( *
this - (~rhs) ) );
2057 matrix_.reset(
column() );
2058 matrix_.reserve(
column(), tmp.nonZeros() );
2085 template<
typename MT
2087 class Column<MT,false,false,false,CCAs...>
2088 :
public View< SparseVector< Column<MT,false,false,false,CCAs...>, false > >
2089 ,
private ColumnData<CCAs...>
2093 using DataType = ColumnData<CCAs...>;
2094 using Operand = If_< IsExpression<MT>, MT, MT& >;
2100 using This = Column<MT,
false,
false,
false,CCAs...>;
2102 using BaseType = SparseVector<This,false>;
2103 using ViewedType = MT;
2111 using ConstReference = ConstReference_<MT>;
2120 template<
typename MatrixType
2121 ,
typename IteratorType >
2123 :
private SparseElement
2132 inline ColumnElement( IteratorType pos,
size_t row )
2144 template<
typename T >
inline ColumnElement& operator=(
const T& v ) {
2156 template<
typename T >
inline ColumnElement&
operator+=(
const T& v ) {
2168 template<
typename T >
inline ColumnElement&
operator-=(
const T& v ) {
2180 template<
typename T >
inline ColumnElement&
operator*=(
const T& v ) {
2192 template<
typename T >
inline ColumnElement&
operator/=(
const T& v ) {
2203 inline const ColumnElement* operator->()
const {
2213 inline decltype(
auto) value()
const {
2214 return pos_->value();
2223 inline size_t index()
const {
2239 template<
typename MatrixType
2240 ,
typename IteratorType >
2241 class ColumnIterator
2245 using IteratorCategory = std::forward_iterator_tag;
2246 using ValueType = ColumnElement<MatrixType,IteratorType>;
2247 using PointerType = ValueType;
2248 using ReferenceType = ValueType;
2249 using DifferenceType = ptrdiff_t;
2252 using iterator_category = IteratorCategory;
2253 using value_type = ValueType;
2254 using pointer = PointerType;
2255 using reference = ReferenceType;
2256 using difference_type = DifferenceType;
2262 inline ColumnIterator()
2263 : matrix_( nullptr )
2277 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
2278 : matrix_( &matrix )
2283 for( ; row_<matrix_->rows(); ++row_ ) {
2284 pos_ = matrix_->find( row_, column_ );
2285 if( pos_ != matrix_->end( row_ ) )
break;
2298 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2299 : matrix_( &matrix )
2313 template<
typename MatrixType2,
typename IteratorType2 >
2314 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
2315 : matrix_( it.matrix_ )
2317 , column_( it.column_ )
2327 inline ColumnIterator& operator++() {
2329 for( ; row_<matrix_->rows(); ++row_ ) {
2330 pos_ = matrix_->find( row_, column_ );
2331 if( pos_ != matrix_->end( row_ ) )
break;
2343 inline const ColumnIterator operator++(
int ) {
2344 const ColumnIterator tmp( *
this );
2355 inline ReferenceType
operator*()
const {
2356 return ReferenceType( pos_, row_ );
2365 inline PointerType operator->()
const {
2366 return PointerType( pos_, row_ );
2376 template<
typename MatrixType2,
typename IteratorType2 >
2377 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2378 return row_ == rhs.row_;
2388 template<
typename MatrixType2,
typename IteratorType2 >
2389 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2390 return !( *
this == rhs );
2400 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2401 size_t counter( 0UL );
2402 for(
size_t i=rhs.row_; i<row_; ++i ) {
2403 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2412 MatrixType* matrix_;
2419 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2420 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 >
friend class Column;
2427 using ConstIterator = ColumnIterator< const MT, ConstIterator_<MT> >;
2435 enum :
bool { smpAssignable =
false };
2441 template<
typename... RCAs >
2442 explicit inline Column( MT& matrix, RCAs... args );
2454 inline Reference operator[](
size_t index );
2455 inline ConstReference operator[](
size_t index )
const;
2457 inline ConstReference at(
size_t index )
const;
2459 inline ConstIterator
begin ()
const;
2460 inline ConstIterator
cbegin()
const;
2462 inline ConstIterator
end ()
const;
2463 inline ConstIterator
cend ()
const;
2470 inline Column& operator=( initializer_list<ElementType> list );
2471 inline Column& operator=(
const Column& rhs );
2473 template<
typename VT >
inline Column& operator= (
const Vector<VT,false>& rhs );
2474 template<
typename VT >
inline Column&
operator+=(
const Vector<VT,false>& rhs );
2475 template<
typename VT >
inline Column&
operator-=(
const Vector<VT,false>& rhs );
2476 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
2477 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
2478 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
2487 inline MT& operand() noexcept;
2488 inline const MT& operand() const noexcept;
2490 inline
size_t size() const;
2492 inline
size_t nonZeros() const;
2493 inline
void reset();
2494 inline
void reserve(
size_t n );
2503 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
2510 inline
void erase(
size_t index );
2514 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
2515 inline
void erase( Pred predicate );
2517 template< typename Pred >
2525 inline
Iterator find (
size_t index );
2526 inline ConstIterator find (
size_t index ) const;
2527 inline
Iterator lowerBound(
size_t index );
2528 inline ConstIterator lowerBound(
size_t index ) const;
2529 inline
Iterator upperBound(
size_t index );
2530 inline ConstIterator upperBound(
size_t index ) const;
2537 template< typename Other > inline Column& scale( const Other& scalar );
2544 template< typename Other > inline
bool canAlias ( const Other* alias ) const;
2545 template< typename Other > inline
bool isAliased( const Other* alias ) const;
2547 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
2548 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
2549 template< typename VT > inline
void addAssign( const Vector<VT,false>& rhs );
2550 template< typename VT > inline
void subAssign( const Vector<VT,false>& rhs );
2598 template< typename MT
2600 template< typename... RCAs >
2601 inline Column<MT,false,false,false,CCAs...>::Column( MT& matrix, RCAs... args )
2602 : DataType( args... )
2603 , matrix_ ( matrix )
2605 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
2606 if( matrix_.columns() <=
column() ) {
2636 template<
typename MT
2638 inline typename Column<MT,
false,
false,
false,CCAs...>
::Reference 2639 Column<MT,false,false,false,CCAs...>::operator[](
size_t index )
2642 return matrix_(index,
column());
2658 template<
typename MT
2661 Column<MT,false,false,false,CCAs...>::operator[](
size_t index )
const 2664 return const_cast<const MT&
>( matrix_ )(index,
column());
2681 template<
typename MT
2683 inline typename Column<MT,
false,
false,
false,CCAs...>
::Reference 2684 Column<MT,false,false,false,CCAs...>::at(
size_t index )
2686 if( index >=
size() ) {
2689 return (*
this)[index];
2706 template<
typename MT
2709 Column<MT,false,false,false,CCAs...>::at(
size_t index )
const 2711 if( index >=
size() ) {
2714 return (*
this)[index];
2728 template<
typename MT
2730 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 2747 template<
typename MT
2766 template<
typename MT
2785 template<
typename MT
2787 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 2804 template<
typename MT
2823 template<
typename MT
2857 template<
typename MT
2859 inline Column<MT,
false,
false,
false,CCAs...>&
2860 Column<MT,false,false,false,CCAs...>::operator=( initializer_list<ElementType> list )
2862 using blaze::assign;
2864 if( list.size() >
size() ) {
2868 const InitializerVector<ElementType,false> tmp( list,
size() );
2870 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
2874 decltype(
auto) left( derestrict( *this ) );
2876 assign( left, tmp );
2900 template< typename MT
2902 inline Column<MT,false,false,false,CCAs...>&
2903 Column<MT,false,false,false,CCAs...>::operator=( const Column& rhs )
2905 using blaze::assign;
2911 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
2914 if(
size() != rhs.size() ) {
2918 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
2922 decltype(
auto) left( derestrict( *this ) );
2924 if( rhs.canAlias( &matrix_ ) ) {
2926 assign( left, tmp );
2929 assign( left, rhs );
2954 template<
typename MT
2956 template<
typename VT >
2957 inline Column<MT,
false,
false,
false,CCAs...>&
2958 Column<MT,false,false,false,CCAs...>::operator=(
const Vector<VT,false>& rhs )
2960 using blaze::assign;
2966 const CompositeType_<VT> tmp( ~rhs );
2968 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
2972 decltype(
auto) left( derestrict( *this ) );
2974 assign( left, tmp );
2998 template< typename MT
3000 template< typename VT >
3001 inline Column<MT,false,false,false,CCAs...>&
3002 Column<MT,false,false,false,CCAs...>::operator+=( const Vector<VT,false>& rhs )
3004 using blaze::assign;
3012 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
3021 const AddType tmp( *
this + (~rhs) );
3023 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3027 decltype(
auto) left( derestrict( *this ) );
3029 assign( left, tmp );
3053 template< typename MT
3055 template< typename VT >
3056 inline Column<MT,false,false,false,CCAs...>&
3057 Column<MT,false,false,false,CCAs...>::operator-=( const Vector<VT,false>& rhs )
3059 using blaze::assign;
3067 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
3076 const SubType tmp( *
this - (~rhs) );
3078 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3082 decltype(
auto) left( derestrict( *this ) );
3084 assign( left, tmp );
3107 template< typename MT
3109 template< typename VT >
3110 inline Column<MT,false,false,false,CCAs...>&
3111 Column<MT,false,false,false,CCAs...>::operator*=( const Vector<VT,false>& rhs )
3113 using blaze::assign;
3121 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
3130 const MultType tmp( *
this * (~rhs) );
3132 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3136 decltype(
auto) left( derestrict( *this ) );
3138 assign( left, tmp );
3160 template< typename MT
3162 template< typename VT >
3163 inline Column<MT,false,false,false,CCAs...>&
3164 Column<MT,false,false,false,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
3166 using blaze::assign;
3175 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
3185 const DivType tmp( *
this / (~rhs) );
3187 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3191 decltype(
auto) left( derestrict( *this ) );
3193 assign( left, tmp );
3216 template< typename MT
3218 template< typename VT >
3219 inline Column<MT,false,false,false,CCAs...>&
3220 Column<MT,false,false,false,CCAs...>::operator%=( const Vector<VT,false>& rhs )
3222 using blaze::assign;
3227 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
3233 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3237 const CrossType tmp( *
this % (~rhs) );
3239 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
3243 decltype(
auto) left( derestrict( *this ) );
3245 assign( left, tmp );
3269 template< typename MT
3271 inline MT& Column<MT,false,false,false,CCAs...>::operand() noexcept
3285 template<
typename MT
3287 inline const MT& Column<MT,false,false,false,CCAs...>::operand() const noexcept
3301 template<
typename MT
3305 return matrix_.rows();
3317 template<
typename MT
3321 return matrix_.rows();
3336 template<
typename MT
3340 size_t counter( 0UL );
3341 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
3356 template<
typename MT
3360 const size_t ibegin( ( IsLower<MT>::value )
3361 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3365 const size_t iend ( ( IsUpper<MT>::value )
3366 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3371 for(
size_t i=ibegin; i<iend; ++i ) {
3372 matrix_.erase( i,
column() );
3389 template<
typename MT
3391 void Column<MT,false,false,false,CCAs...>::reserve(
size_t n )
3421 template<
typename MT
3423 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3426 return Iterator( matrix_, index,
column(), matrix_.set( index, column(), value ) );
3445 template<
typename MT
3447 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3448 Column<MT,false,false,false,CCAs...>::insert(
size_t index,
const ElementType& value )
3450 return Iterator( matrix_, index,
column(), matrix_.insert( index, column(), value ) );
3481 template<
typename MT
3483 inline void Column<MT,false,false,false,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
3485 if( !check || !isDefault<strict>( value ) )
3486 matrix_.insert( index,
column(), value );
3509 template<
typename MT
3511 inline void Column<MT,false,false,false,CCAs...>::erase(
size_t index )
3513 matrix_.erase( index,
column() );
3528 template<
typename MT
3530 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3531 Column<MT,false,false,false,CCAs...>::erase(
Iterator pos )
3533 const size_t row( pos.row_ );
3538 matrix_.erase( row, pos.pos_ );
3555 template<
typename MT
3557 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3558 Column<MT,false,false,false,CCAs...>::erase(
Iterator first,
Iterator last )
3560 for( ; first!=last; ++first ) {
3561 matrix_.erase( first.row_, first.pos_ );
3592 template<
typename MT
3594 template<
typename Pred
3596 inline void Column<MT,false,false,false,CCAs...>::erase( Pred predicate )
3599 if( predicate( element->value() ) )
3600 matrix_.erase( element.row_, element.pos_ );
3633 template<
typename MT
3635 template<
typename Pred >
3636 inline void Column<MT,false,false,false,CCAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
3638 for( ; first!=last; ++first ) {
3639 if( predicate( first->value() ) )
3640 matrix_.erase( first.row_, first.pos_ );
3669 template<
typename MT
3671 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3672 Column<MT,false,false,false,CCAs...>::find(
size_t index )
3674 const Iterator_<MT> pos( matrix_.find( index, column() ) );
3676 if( pos != matrix_.end( index ) )
3699 template<
typename MT
3702 Column<MT,false,false,false,CCAs...>::find(
size_t index )
const 3704 const ConstIterator_<MT> pos( matrix_.find( index, column() ) );
3706 if( pos != matrix_.end( index ) )
3728 template<
typename MT
3730 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3731 Column<MT,false,false,false,CCAs...>::lowerBound(
size_t index )
3733 for(
size_t i=index; i<
size(); ++i )
3735 const Iterator_<MT> pos( matrix_.find( i, column() ) );
3737 if( pos != matrix_.end( i ) )
3760 template<
typename MT
3763 Column<MT,false,false,false,CCAs...>::lowerBound(
size_t index )
const 3765 for(
size_t i=index; i<
size(); ++i )
3767 const ConstIterator_<MT> pos( matrix_.find( i, column() ) );
3769 if( pos != matrix_.end( i ) )
3792 template<
typename MT
3794 inline typename Column<MT,
false,
false,
false,CCAs...>
::Iterator 3795 Column<MT,false,false,false,CCAs...>::upperBound(
size_t index )
3797 for(
size_t i=index+1UL; i<
size(); ++i )
3799 const Iterator_<MT> pos( matrix_.find( i, column() ) );
3801 if( pos != matrix_.end( i ) )
3824 template<
typename MT
3827 Column<MT,false,false,false,CCAs...>::upperBound(
size_t index )
const 3829 for(
size_t i=index+1UL; i<
size(); ++i )
3831 const ConstIterator_<MT> pos( matrix_.find( i, column() ) );
3833 if( pos != matrix_.end( i ) )
3864 template<
typename MT
3866 template<
typename Other >
3867 inline Column<MT,
false,
false,
false,CCAs...>&
3868 Column<MT,false,false,false,CCAs...>::scale(
const Other& scalar )
3873 element->value() *= scalar;
3899 template<
typename MT
3901 template<
typename Other >
3902 inline bool Column<MT,false,false,false,CCAs...>::canAlias(
const Other* alias )
const 3904 return matrix_.isAliased( alias );
3917 template<
typename MT
3919 template<
typename Other >
3920 inline bool Column<MT,false,false,false,CCAs...>::isAliased(
const Other* alias )
const 3922 return matrix_.isAliased( alias );
3940 template<
typename MT
3942 template<
typename VT >
3943 inline void Column<MT,false,false,false,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
3947 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3948 matrix_(i,
column()) = (~rhs)[i];
3967 template<
typename MT
3969 template<
typename VT >
3970 inline void Column<MT,false,false,false,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
3976 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3977 for( ; i<element->index(); ++i )
3978 matrix_.erase( i, column() );
3979 matrix_(i++,
column()) = element->value();
3981 for( ; i<
size(); ++i ) {
3982 matrix_.erase( i,
column() );
4001 template<
typename MT
4003 template<
typename VT >
4004 inline void Column<MT,false,false,false,CCAs...>::addAssign(
const Vector<VT,false>& rhs )
4006 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4013 const AddType tmp(
serial( *
this + (~rhs) ) );
4032 template<
typename MT
4034 template<
typename VT >
4035 inline void Column<MT,false,false,false,CCAs...>::subAssign(
const Vector<VT,false>& rhs )
4037 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4044 const SubType tmp(
serial( *
this - (~rhs) ) );
4071 template<
typename MT
4073 class Column<MT,false,false,true,CCAs...>
4074 :
public View< SparseVector< Column<MT,false,false,true,CCAs...>, false > >
4075 ,
private ColumnData<CCAs...>
4079 using DataType = ColumnData<CCAs...>;
4080 using Operand = If_< IsExpression<MT>, MT, MT& >;
4086 using This = Column<MT,
false,
false,
true,CCAs...>;
4088 using BaseType = SparseVector<This,false>;
4089 using ViewedType = MT;
4097 using ConstReference = ConstReference_<MT>;
4103 using ConstIterator = ConstIterator_<MT>;
4111 enum :
bool { smpAssignable =
false };
4117 template<
typename... RCAs >
4118 explicit inline Column( MT& matrix, RCAs... args );
4130 inline Reference operator[](
size_t index );
4131 inline ConstReference operator[](
size_t index )
const;
4133 inline ConstReference at(
size_t index )
const;
4135 inline ConstIterator
begin ()
const;
4136 inline ConstIterator
cbegin()
const;
4138 inline ConstIterator
end ()
const;
4139 inline ConstIterator
cend ()
const;
4146 inline Column& operator=( initializer_list<ElementType> list );
4147 inline Column& operator=(
const Column& rhs );
4149 template<
typename VT >
inline Column& operator= (
const DenseVector<VT,false>& rhs );
4150 template<
typename VT >
inline Column& operator= (
const SparseVector<VT,false>& rhs );
4151 template<
typename VT >
inline Column&
operator+=(
const DenseVector<VT,false>& rhs );
4152 template<
typename VT >
inline Column&
operator+=(
const SparseVector<VT,false>& rhs );
4153 template<
typename VT >
inline Column&
operator-=(
const DenseVector<VT,false>& rhs );
4154 template<
typename VT >
inline Column&
operator-=(
const SparseVector<VT,false>& rhs );
4155 template<
typename VT >
inline Column&
operator*=(
const Vector<VT,false>& rhs );
4156 template<
typename VT >
inline Column&
operator/=(
const DenseVector<VT,false>& rhs );
4157 template<
typename VT >
inline Column& operator%=(
const Vector<VT,false>& rhs );
4166 inline MT& operand() noexcept;
4167 inline const MT& operand() const noexcept;
4169 inline
size_t size() const noexcept;
4170 inline
size_t capacity() const noexcept;
4171 inline
size_t nonZeros() const;
4172 inline
void reset();
4173 inline
void reserve(
size_t n );
4182 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
4189 inline
void erase(
size_t index );
4193 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
4194 inline
void erase( Pred predicate );
4196 template< typename Pred >
4204 inline
Iterator find (
size_t index );
4205 inline ConstIterator find (
size_t index ) const;
4206 inline
Iterator lowerBound(
size_t index );
4207 inline ConstIterator lowerBound(
size_t index ) const;
4208 inline
Iterator upperBound(
size_t index );
4209 inline ConstIterator upperBound(
size_t index ) const;
4216 template< typename Other > inline Column& scale( const Other& scalar );
4223 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4224 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4226 template< typename VT > inline
void assign ( const DenseVector <VT,false>& rhs );
4227 template< typename VT > inline
void assign ( const SparseVector<VT,false>& rhs );
4228 template< typename VT > inline
void addAssign( const DenseVector <VT,false>& rhs );
4229 template< typename VT > inline
void addAssign( const SparseVector<VT,false>& rhs );
4230 template< typename VT > inline
void subAssign( const DenseVector <VT,false>& rhs );
4231 template< typename VT > inline
void subAssign( const SparseVector<VT,false>& rhs );
4239 inline
size_t extendCapacity() const noexcept;
4286 template< typename MT
4288 template< typename... RCAs >
4289 inline Column<MT,false,false,true,CCAs...>::Column( MT& matrix, RCAs... args )
4290 : DataType( args... )
4291 , matrix_ ( matrix )
4293 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
4294 if( matrix_.columns() <=
column() ) {
4324 template<
typename MT
4326 inline typename Column<MT,
false,
false,
true,CCAs...>
::Reference 4327 Column<MT,false,false,true,CCAs...>::operator[](
size_t index )
4330 return matrix_(
column(),index);
4346 template<
typename MT
4349 Column<MT,false,false,true,CCAs...>::operator[](
size_t index )
const 4352 return const_cast<const MT&
>( matrix_ )(
column(),index);
4369 template<
typename MT
4371 inline typename Column<MT,
false,
false,
true,CCAs...>
::Reference 4372 Column<MT,false,false,true,CCAs...>::at(
size_t index )
4374 if( index >=
size() ) {
4377 return (*
this)[index];
4394 template<
typename MT
4397 Column<MT,false,false,true,CCAs...>::at(
size_t index )
const 4399 if( index >=
size() ) {
4402 return (*
this)[index];
4416 template<
typename MT
4418 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 4421 return matrix_.begin(
column() );
4435 template<
typename MT
4440 return matrix_.cbegin(
column() );
4454 template<
typename MT
4459 return matrix_.cbegin(
column() );
4473 template<
typename MT
4475 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 4478 return matrix_.end(
column() );
4492 template<
typename MT
4497 return matrix_.cend(
column() );
4511 template<
typename MT
4516 return matrix_.cend(
column() );
4545 template<
typename MT
4547 inline Column<MT,
false,
false,
true,CCAs...>&
4548 Column<MT,false,false,true,CCAs...>::operator=( initializer_list<ElementType> list )
4550 using blaze::assign;
4552 if( list.size() >
size() ) {
4556 const InitializerVector<ElementType,false> tmp( list,
size() );
4558 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4562 decltype(
auto) left( derestrict( *this ) );
4565 assign( left, tmp );
4589 template< typename MT
4591 inline Column<MT,false,false,true,CCAs...>&
4592 Column<MT,false,false,true,CCAs...>::operator=( const Column& rhs )
4594 using blaze::assign;
4600 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
4603 if(
size() != rhs.size() ) {
4607 if( !tryAssign( matrix_, rhs, 0UL,
column() ) ) {
4611 decltype(
auto) left( derestrict( *this ) );
4613 if( rhs.canAlias( &matrix_ ) ) {
4616 left.reserve( tmp.nonZeros() );
4617 assign( left, tmp );
4621 left.reserve( rhs.nonZeros() );
4622 assign( left, rhs );
4647 template<
typename MT
4649 template<
typename VT >
4650 inline Column<MT,
false,
false,
true,CCAs...>&
4651 Column<MT,false,false,true,CCAs...>::operator=(
const DenseVector<VT,false>& rhs )
4653 using blaze::assign;
4663 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4664 Right right( ~rhs );
4666 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4670 decltype(
auto) left( derestrict( *this ) );
4672 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4673 const ResultType_<VT> tmp( right );
4675 assign( left, tmp );
4679 assign( left, right );
4704 template<
typename MT
4706 template<
typename VT >
4707 inline Column<MT,
false,
false,
true,CCAs...>&
4708 Column<MT,false,false,true,CCAs...>::operator=(
const SparseVector<VT,false>& rhs )
4710 using blaze::assign;
4720 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4721 Right right( ~rhs );
4723 if( !tryAssign( matrix_, right, 0UL,
column() ) ) {
4727 decltype(
auto) left( derestrict( *this ) );
4729 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4730 const ResultType_<VT> tmp( right);
4732 left.reserve( tmp.nonZeros() );
4733 assign( left, tmp );
4737 left.reserve( right.nonZeros() );
4738 assign( left, right );
4763 template<
typename MT
4765 template<
typename VT >
4766 inline Column<MT,
false,
false,
true,CCAs...>&
4769 using blaze::assign;
4778 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4788 const AddType tmp( *
this + (~rhs) );
4790 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4794 decltype(
auto) left( derestrict( *this ) );
4797 assign( left, tmp );
4821 template< typename MT
4823 template< typename VT >
4824 inline Column<MT,false,false,true,CCAs...>&
4825 Column<MT,false,false,true,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
4827 using blaze::assign;
4836 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4846 const AddType tmp( *
this + (~rhs) );
4848 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4852 decltype(
auto) left( derestrict( *this ) );
4855 left.reserve( tmp.nonZeros() );
4856 assign( left, tmp );
4881 template< typename MT
4883 template< typename VT >
4884 inline Column<MT,false,false,true,CCAs...>&
4885 Column<MT,false,false,true,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
4887 using blaze::assign;
4896 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4906 const SubType tmp( *
this - (~rhs) );
4908 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4912 decltype(
auto) left( derestrict( *this ) );
4915 assign( left, tmp );
4940 template< typename MT
4942 template< typename VT >
4943 inline Column<MT,false,false,true,CCAs...>&
4944 Column<MT,false,false,true,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
4946 using blaze::assign;
4955 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4965 const SubType tmp( *
this - (~rhs) );
4967 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
4971 decltype(
auto) left( derestrict( *this ) );
4974 left.reserve( tmp.nonZeros() );
4975 assign( left, tmp );
4998 template< typename MT
5000 template< typename VT >
5001 inline Column<MT,false,false,true,CCAs...>&
5002 Column<MT,false,false,true,CCAs...>::operator*=( const Vector<VT,false>& rhs )
5004 using blaze::assign;
5012 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
5021 const MultType tmp( *
this * (~rhs) );
5023 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5027 decltype(
auto) left( derestrict( *this ) );
5030 assign( left, tmp );
5052 template< typename MT
5054 template< typename VT >
5055 inline Column<MT,false,false,true,CCAs...>&
5056 Column<MT,false,false,true,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
5058 using blaze::assign;
5067 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
5077 const DivType tmp( *
this / (~rhs) );
5079 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5083 decltype(
auto) left( derestrict( *this ) );
5086 assign( left, tmp );
5109 template< typename MT
5111 template< typename VT >
5112 inline Column<MT,false,false,true,CCAs...>&
5113 Column<MT,false,false,true,CCAs...>::operator%=( const Vector<VT,false>& rhs )
5115 using blaze::assign;
5120 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
5126 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5130 const CrossType tmp( *
this % (~rhs) );
5132 if( !tryAssign( matrix_, tmp, 0UL,
column() ) ) {
5136 decltype(
auto) left( derestrict( *this ) );
5139 assign( left, tmp );
5163 template< typename MT
5165 inline MT& Column<MT,false,false,true,CCAs...>::operand() noexcept
5179 template<
typename MT
5181 inline const MT& Column<MT,false,false,true,CCAs...>::operand() const noexcept
5195 template<
typename MT
5199 return matrix_.rows();
5211 template<
typename MT
5215 return matrix_.capacity(
column() );
5230 template<
typename MT
5234 return matrix_.nonZeros(
column() );
5246 template<
typename MT
5250 matrix_.reset(
column() );
5266 template<
typename MT
5268 void Column<MT,false,false,true,CCAs...>::reserve(
size_t n )
5270 matrix_.reserve(
column(), n );
5285 template<
typename MT
5287 inline size_t Column<MT,false,false,true,CCAs...>::extendCapacity() const noexcept
5292 size_t nonzeros( 2UL*
capacity()+1UL );
5293 nonzeros =
max( nonzeros, 7UL );
5294 nonzeros =
min( nonzeros,
size() );
5324 template<
typename MT
5326 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5329 return matrix_.set(
column(), index, value );
5348 template<
typename MT
5350 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5351 Column<MT,false,false,true,CCAs...>::insert(
size_t index,
const ElementType& value )
5353 return matrix_.insert(
column(), index, value );
5384 template<
typename MT
5386 inline void Column<MT,false,false,true,CCAs...>::append(
size_t index,
const ElementType& value,
bool check )
5388 matrix_.append(
column(), index, value, check );
5411 template<
typename MT
5413 inline void Column<MT,false,false,true,CCAs...>::erase(
size_t index )
5415 matrix_.erase(
column(), index );
5430 template<
typename MT
5432 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5433 Column<MT,false,false,true,CCAs...>::erase(
Iterator pos )
5435 return matrix_.erase(
column(), pos );
5451 template<
typename MT
5453 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5454 Column<MT,false,false,true,CCAs...>::erase(
Iterator first,
Iterator last )
5456 return matrix_.erase(
column(), first, last );
5485 template<
typename MT
5487 template<
typename Pred
5489 inline void Column<MT,false,false,true,CCAs...>::erase( Pred predicate )
5522 template<
typename MT
5524 template<
typename Pred >
5525 inline void Column<MT,false,false,true,CCAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
5527 matrix_.erase(
column(), first, last, predicate );
5555 template<
typename MT
5557 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5558 Column<MT,false,false,true,CCAs...>::find(
size_t index )
5560 return matrix_.find(
column(), index );
5580 template<
typename MT
5583 Column<MT,false,false,true,CCAs...>::find(
size_t index )
const 5585 return matrix_.find(
column(), index );
5604 template<
typename MT
5606 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5607 Column<MT,false,false,true,CCAs...>::lowerBound(
size_t index )
5609 return matrix_.lowerBound(
column(), index );
5628 template<
typename MT
5631 Column<MT,false,false,true,CCAs...>::lowerBound(
size_t index )
const 5633 return matrix_.lowerBound(
column(), index );
5652 template<
typename MT
5654 inline typename Column<MT,
false,
false,
true,CCAs...>
::Iterator 5655 Column<MT,false,false,true,CCAs...>::upperBound(
size_t index )
5657 return matrix_.upperBound(
column(), index );
5676 template<
typename MT
5679 Column<MT,false,false,true,CCAs...>::upperBound(
size_t index )
const 5681 return matrix_.upperBound(
column(), index );
5708 template<
typename MT
5710 template<
typename Other >
5711 inline Column<MT,
false,
false,
true,CCAs...>&
5712 Column<MT,false,false,true,CCAs...>::scale(
const Other& scalar )
5717 element->value() *= scalar;
5743 template<
typename MT
5745 template<
typename Other >
5746 inline bool Column<MT,false,false,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
5748 return matrix_.isAliased( alias );
5765 template<
typename MT
5767 template<
typename Other >
5768 inline bool Column<MT,false,false,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
5770 return matrix_.isAliased( alias );
5788 template<
typename MT
5790 template<
typename VT >
5791 inline void Column<MT,false,false,true,CCAs...>::assign(
const DenseVector<VT,false>& rhs )
5796 for(
size_t i=0UL; i<
size(); ++i )
5798 if( matrix_.nonZeros( column() ) == matrix_.capacity(
column() ) )
5799 matrix_.reserve( column(), extendCapacity() );
5801 matrix_.append(
column(), i, (~rhs)[i],
true );
5820 template<
typename MT
5822 template<
typename VT >
5823 inline void Column<MT,false,false,true,CCAs...>::assign(
const SparseVector<VT,false>& rhs )
5828 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5829 matrix_.append(
column(), element->index(), element->value(), true );
5848 template<
typename MT
5850 template<
typename VT >
5851 inline void Column<MT,false,false,true,CCAs...>::addAssign(
const DenseVector<VT,false>& rhs )
5853 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5861 const AddType tmp(
serial( *
this + (~rhs) ) );
5862 matrix_.reset(
column() );
5881 template<
typename MT
5883 template<
typename VT >
5884 inline void Column<MT,false,false,true,CCAs...>::addAssign(
const SparseVector<VT,false>& rhs )
5886 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5894 const AddType tmp(
serial( *
this + (~rhs) ) );
5895 matrix_.reset(
column() );
5896 matrix_.reserve(
column(), tmp.nonZeros() );
5915 template<
typename MT
5917 template<
typename VT >
5918 inline void Column<MT,false,false,true,CCAs...>::subAssign(
const DenseVector<VT,false>& rhs )
5920 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5928 const SubType tmp(
serial( *
this - (~rhs) ) );
5929 matrix_.reset(
column() );
5948 template<
typename MT
5950 template<
typename VT >
5951 inline void Column<MT,false,false,true,CCAs...>::subAssign(
const SparseVector<VT,false>& rhs )
5953 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5961 const SubType tmp(
serial( *
this - (~rhs) ) );
5962 matrix_.reset(
column() );
5963 matrix_.reserve(
column(), tmp.nonZeros() );
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
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:522
Header file for basic type definitions.
Header file for the SparseVector base class.
Header file for the View base class.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
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:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
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:588
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
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:560
#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:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
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
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:1950
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:474
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:408
Constraint on the data type.
Constraint on the transpose flag of vector types.
Constraint on the data type.
Headerfile for the generic max algorithm.
typename ColumnTrait< MT, CCAs... >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:144
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for the IsLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Header file for the SparseElement base class.
Constraint on the data type.
Constraint on the data type.
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
Header file for the reset shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Header file for the IsReference type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#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
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
Header file for the implementation of the ColumnData class template.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
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
Constraint on the data type.