35 #ifndef _BLAZE_MATH_VIEWS_COLUMNS_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMNS_SPARSE_H_ 112 template<
typename MT
115 class Columns<MT,true,false,SF,CCAs...>
116 :
public View< SparseMatrix< Columns<MT,true,false,SF,CCAs...>, true > >
117 ,
private ColumnsData<CCAs...>
121 using DataType = ColumnsData<CCAs...>;
122 using Operand = If_< IsExpression<MT>, MT, MT& >;
128 using This = Columns<MT,
true,
false,SF,CCAs...>;
130 using BaseType = SparseMatrix<This,true>;
131 using ViewedType = MT;
154 enum :
bool { smpAssignable = MT::smpAssignable };
160 template<
typename... RCAs >
161 explicit inline Columns( MT& matrix, RCAs... args );
163 inline Columns(
const Columns& ) =
default;
164 inline Columns( Columns&& ) =
default;
175 inline Reference operator()(
size_t i,
size_t j );
176 inline ConstReference operator()(
size_t i,
size_t j )
const;
177 inline Reference at(
size_t i,
size_t j );
178 inline ConstReference at(
size_t i,
size_t j )
const;
180 inline ConstIterator
begin (
size_t j )
const;
181 inline ConstIterator
cbegin(
size_t j )
const;
183 inline ConstIterator
end (
size_t j )
const;
184 inline ConstIterator
cend (
size_t j )
const;
191 inline Columns& operator=( initializer_list< initializer_list<ElementType> > list );
192 inline Columns& operator=(
const Columns& rhs );
194 template<
typename MT2,
bool SO >
inline Columns& operator= (
const Matrix<MT2,SO>& rhs );
195 template<
typename MT2,
bool SO >
inline Columns&
operator+=(
const Matrix<MT2,SO>& rhs );
196 template<
typename MT2,
bool SO >
inline Columns&
operator-=(
const Matrix<MT2,SO>& rhs );
197 template<
typename MT2,
bool SO >
inline Columns& operator%=(
const Matrix<MT2,SO>& rhs );
205 using DataType::idces;
208 inline MT& operand() noexcept;
209 inline const MT& operand() const noexcept;
211 inline
size_t rows() const noexcept;
212 inline
size_t capacity() const noexcept;
213 inline
size_t capacity(
size_t j ) const noexcept;
215 inline
size_t nonZeros(
size_t j ) const;
217 inline
void reset(
size_t j );
218 inline
void reserve(
size_t nonzeros );
219 void reserve(
size_t j,
size_t nonzeros );
221 inline
void trim(
size_t j );
230 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
231 inline
void finalize(
size_t j );
238 inline
void erase(
size_t i,
size_t j );
242 template< typename Pred >
243 inline
void erase( Pred predicate );
245 template< typename Pred >
246 inline
void erase(
size_t j,
Iterator first,
Iterator last, Pred predicate );
253 inline
Iterator find (
size_t i,
size_t j );
254 inline ConstIterator find (
size_t i,
size_t j ) const;
255 inline
Iterator lowerBound(
size_t i,
size_t j );
256 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
257 inline
Iterator upperBound(
size_t i,
size_t j );
258 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
268 template< typename Other > inline Columns& scale( const Other& scalar );
275 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
276 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
278 inline
bool canSMPAssign() const noexcept;
280 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
281 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
282 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
283 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
284 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
285 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
293 inline
size_t extendCapacity(
size_t j ) const noexcept;
340 template< typename MT
343 template< typename... RCAs >
344 inline Columns<MT,true,false,SF,CCAs...>::Columns( MT& matrix, RCAs... args )
345 : DataType( args... )
348 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
349 for(
size_t j=0UL; j<
columns(); ++j ) {
350 if( matrix_.columns() <= idx(j) ) {
379 template<
typename MT
382 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Reference 383 Columns<MT,true,false,SF,CCAs...>::operator()(
size_t i,
size_t j )
388 return matrix_(i,idx(j));
405 template<
typename MT
409 Columns<MT,true,false,SF,CCAs...>::operator()(
size_t i,
size_t j )
const 414 return const_cast<const MT&
>( matrix_ )(i,idx(j));
432 template<
typename MT
435 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Reference 436 Columns<MT,true,false,SF,CCAs...>::at(
size_t i,
size_t j )
462 template<
typename MT
466 Columns<MT,true,false,SF,CCAs...>::at(
size_t i,
size_t j )
const 489 template<
typename MT
492 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 497 return matrix_.begin( idx(j) );
512 template<
typename MT
520 return matrix_.cbegin( idx(j) );
535 template<
typename MT
543 return matrix_.cbegin( idx(j) );
558 template<
typename MT
561 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 566 return matrix_.end( idx(j) );
581 template<
typename MT
589 return matrix_.cend( idx(j) );
604 template<
typename MT
612 return matrix_.cend( idx(j) );
642 template<
typename MT
645 inline Columns<MT,
true,
false,SF,CCAs...>&
646 Columns<MT,true,false,SF,CCAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
651 if( list.size() !=
rows() ) {
655 const InitializerMatrix<ElementType> tmp( list,
columns() );
657 if( IsRestricted<MT>::value ) {
658 for(
size_t j=0UL; j<
columns(); ++j ) {
665 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
691 template<
typename MT
694 inline Columns<MT,
true,
false,SF,CCAs...>&
695 Columns<MT,true,false,SF,CCAs...>::operator=(
const Columns& rhs )
703 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && idces() == rhs.idces() ) )
706 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
710 if( IsRestricted<MT>::value ) {
711 for(
size_t j=0UL; j<
columns(); ++j ) {
712 if( !tryAssign( matrix_,
column( rhs, j,
unchecked ), 0UL, idx(j) ) ) {
718 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
720 if( rhs.canAlias( &matrix_ ) ) {
753 template<
typename MT
756 template<
typename MT2
758 inline Columns<MT,
true,
false,SF,CCAs...>&
759 Columns<MT,true,false,SF,CCAs...>::operator=(
const Matrix<MT2,SO>& rhs )
770 using Right = CompositeType_<MT2>;
773 if( IsRestricted<MT>::value ) {
774 for(
size_t j=0UL; j<
columns(); ++j ) {
775 if( !tryAssign( matrix_,
column( right, j,
unchecked ), 0UL, idx(j) ) ) {
781 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
783 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
784 const ResultType_<MT2> tmp( right );
815 template<
typename MT
818 template<
typename MT2
820 inline Columns<MT,
true,
false,SF,CCAs...>&
830 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
838 const AddType tmp( *
this + (~rhs) );
840 if( IsRestricted<MT>::value ) {
841 for(
size_t j=0UL; j<
columns(); ++j ) {
842 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
848 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
875 template<
typename MT
878 template<
typename MT2
880 inline Columns<MT,
true,
false,SF,CCAs...>&
890 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
898 const SubType tmp( *
this - (~rhs) );
900 if( IsRestricted<MT>::value ) {
901 for(
size_t j=0UL; j<
columns(); ++j ) {
902 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
908 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
935 template<
typename MT
938 template<
typename MT2
940 inline Columns<MT,
true,
false,SF,CCAs...>&
941 Columns<MT,true,false,SF,CCAs...>::operator%=(
const Matrix<MT2,SO>& rhs )
950 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
958 const SchurType tmp( *
this % (~rhs) );
960 if( IsRestricted<MT>::value ) {
961 for(
size_t j=0UL; j<
columns(); ++j ) {
962 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
968 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
995 template<
typename MT
998 inline MT& Columns<MT,true,false,SF,CCAs...>::operand() noexcept
1012 template<
typename MT
1015 inline const MT& Columns<MT,true,false,SF,CCAs...>::operand() const noexcept
1029 template<
typename MT
1034 return matrix_.rows();
1046 template<
typename MT
1051 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
1066 template<
typename MT
1073 return matrix_.capacity( idx(j) );
1085 template<
typename MT
1090 size_t nonzeros( 0UL );
1092 for(
size_t j=0UL; j<
columns(); ++j )
1110 template<
typename MT
1117 return matrix_.nonZeros( idx(j) );
1129 template<
typename MT
1134 for(
size_t j=0UL; j<
columns(); ++j ) {
1135 matrix_.reset( idx(j) );
1152 template<
typename MT
1157 matrix_.reset( idx(j) );
1174 template<
typename MT
1177 inline void Columns<MT,true,false,SF,CCAs...>::reserve(
size_t nonzeros )
1179 const size_t current(
capacity() );
1181 if( nonzeros > current ) {
1182 matrix_.reserve( matrix_.capacity() + nonzeros - current );
1202 template<
typename MT
1205 void Columns<MT,true,false,SF,CCAs...>::reserve(
size_t j,
size_t nonzeros )
1207 matrix_.reserve( idx(j), nonzeros );
1223 template<
typename MT
1226 void Columns<MT,true,false,SF,CCAs...>::trim()
1228 for(
size_t j=0UL; j<
columns(); ++j ) {
1247 template<
typename MT
1250 void Columns<MT,true,false,SF,CCAs...>::trim(
size_t j )
1254 matrix_.trim( idx(j) );
1270 template<
typename MT
1273 inline size_t Columns<MT,true,false,SF,CCAs...>::extendCapacity(
size_t j )
const noexcept
1278 size_t nonzeros( 2UL*
capacity( j )+1UL );
1279 nonzeros =
max( nonzeros, 7UL );
1280 nonzeros =
min( nonzeros,
rows() );
1311 template<
typename MT
1314 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 1317 return matrix_.set( i, idx(j), value );
1337 template<
typename MT
1340 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 1341 Columns<MT,true,false,SF,CCAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
1343 return matrix_.insert( i, idx(j), value );
1393 template<
typename MT
1396 inline void Columns<MT,true,false,SF,CCAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
1398 if( !check || !isDefault<strict>( value ) )
1399 matrix_.insert( i, idx(j), value );
1419 template<
typename MT
1422 inline void Columns<MT,true,false,SF,CCAs...>::finalize(
size_t j )
1450 template<
typename MT
1453 inline void Columns<MT,true,false,SF,CCAs...>::erase(
size_t i,
size_t j )
1458 matrix_.erase( i, idx(j) );
1474 template<
typename MT
1477 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 1478 Columns<MT,true,false,SF,CCAs...>::erase(
size_t j,
Iterator pos )
1482 return matrix_.erase( idx(j), pos );
1499 template<
typename MT
1502 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 1503 Columns<MT,true,false,SF,CCAs...>::erase(
size_t j,
Iterator first,
Iterator last )
1507 return matrix_.erase( idx(j), first, last );
1536 template<
typename MT
1539 template<
typename Pred >
1540 inline void Columns<MT,true,false,SF,CCAs...>::erase( Pred predicate )
1542 for(
size_t j=0UL; j<
columns(); ++j ) {
1543 matrix_.erase( idx(j),
begin(j),
end(j), predicate );
1577 template<
typename MT
1580 template<
typename Pred >
1581 inline void Columns<MT,true,false,SF,CCAs...>::erase(
size_t j,
Iterator first,
Iterator last, Pred predicate )
1585 matrix_.erase( idx(j), first, last, predicate );
1614 template<
typename MT
1617 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 1618 Columns<MT,true,false,SF,CCAs...>::find(
size_t i,
size_t j )
1620 return matrix_.find( i, idx(j) );
1641 template<
typename MT
1645 Columns<MT,true,false,SF,CCAs...>::find(
size_t i,
size_t j )
const 1647 return matrix_.find( i, idx(j) );
1667 template<
typename MT
1670 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 1671 Columns<MT,true,false,SF,CCAs...>::lowerBound(
size_t i,
size_t j )
1673 return matrix_.lowerBound( i, idx(j) );
1693 template<
typename MT
1697 Columns<MT,true,false,SF,CCAs...>::lowerBound(
size_t i,
size_t j )
const 1699 return matrix_.lowerBound( i, idx(j) );
1719 template<
typename MT
1722 inline typename Columns<MT,
true,
false,SF,CCAs...>
::Iterator 1723 Columns<MT,true,false,SF,CCAs...>::upperBound(
size_t i,
size_t j )
1725 return matrix_.upperBound( i, idx(j) );
1745 template<
typename MT
1749 Columns<MT,true,false,SF,CCAs...>::upperBound(
size_t i,
size_t j )
const 1751 return matrix_.upperBound( i, idx(j) );
1778 template<
typename MT
1781 inline Columns<MT,
true,
false,SF,CCAs...>&
1790 if( IsRestricted<MT>::value ) {
1791 for(
size_t j=0UL; j<
columns(); ++j ) {
1792 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
1798 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1822 template<
typename MT
1825 inline Columns<MT,
true,
false,SF,CCAs...>&
1834 if( IsRestricted<MT>::value ) {
1835 for(
size_t j=0UL; j<
columns(); ++j ) {
1836 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
1842 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
1866 template<
typename MT
1869 template<
typename Other >
1870 inline Columns<MT,
true,
false,SF,CCAs...>&
1871 Columns<MT,true,false,SF,CCAs...>::scale(
const Other& scalar )
1875 for(
size_t j=0UL; j<
columns(); ++j ) {
1878 element->value() *= scalar;
1906 template<
typename MT
1909 template<
typename Other >
1910 inline bool Columns<MT,true,false,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1912 return matrix_.isAliased( alias );
1929 template<
typename MT
1932 template<
typename Other >
1933 inline bool Columns<MT,true,false,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1935 return matrix_.isAliased( alias );
1952 template<
typename MT
1955 inline bool Columns<MT,true,false,SF,CCAs...>::canSMPAssign() const noexcept
1975 template<
typename MT
1978 template<
typename MT2
1980 inline void Columns<MT,true,false,SF,CCAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
1989 for(
size_t j=0UL; j<
columns(); ++j )
1991 const size_t index( idx(j) );
1992 size_t remaining( matrix_.capacity( index ) );
1994 for(
size_t i=0UL; i<
rows(); ++i )
1996 if( remaining == 0UL ) {
1997 matrix_.reserve( index, extendCapacity( j ) );
1998 remaining = matrix_.capacity( index ) - matrix_.nonZeros( index );
2001 matrix_.append( i, index, (~rhs)(i,j),
true );
2022 template<
typename MT
2025 template<
typename MT2 >
2026 inline void Columns<MT,true,false,SF,CCAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
2035 for(
size_t j=0UL; j<
columns(); ++j )
2037 const size_t index( idx(j) );
2038 size_t remaining( matrix_.capacity( index ) );
2040 for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2042 if( remaining == 0UL ) {
2043 matrix_.reserve( index, extendCapacity( j ) );
2044 remaining = matrix_.capacity( index ) - matrix_.nonZeros( index );
2047 matrix_.append( element->index(), index, element->value(), true );
2068 template<
typename MT
2071 template<
typename MT2 >
2072 inline void Columns<MT,true,false,SF,CCAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
2083 using RhsIterator = ConstIterator_<MT2>;
2086 std::vector<size_t> columnLengths(
columns(), 0UL );
2087 for(
size_t i=0UL; i<
rows(); ++i ) {
2088 for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2089 ++columnLengths[element->index()];
2093 for(
size_t j=0UL; j<
columns(); ++j ) {
2094 reserve( j, columnLengths[j] );
2098 for(
size_t i=0UL; i<
rows(); ++i ) {
2099 for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2100 append( i, element->index(), element->value(), true );
2119 template<
typename MT
2122 template<
typename MT2
2124 inline void Columns<MT,true,false,SF,CCAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
2129 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
2136 const AddType tmp(
serial( *
this + (~rhs) ) );
2156 template<
typename MT
2159 template<
typename MT2
2161 inline void Columns<MT,true,false,SF,CCAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
2166 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
2173 const SubType tmp(
serial( *
this - (~rhs) ) );
2193 template<
typename MT
2196 template<
typename MT2
2198 inline void Columns<MT,true,false,SF,CCAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
2203 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
2211 const SchurType tmp(
serial( *
this % (~rhs) ) );
2239 template<
typename MT
2241 class Columns<MT,false,false,false,CCAs...>
2242 :
public View< SparseMatrix< Columns<MT,false,false,false,CCAs...>, true > >
2243 ,
private ColumnsData<CCAs...>
2247 using DataType = ColumnsData<CCAs...>;
2248 using Operand = If_< IsExpression<MT>, MT, MT& >;
2254 using This = Columns<MT,
false,
false,
false,CCAs...>;
2256 using BaseType = SparseMatrix<This,true>;
2257 using ViewedType = MT;
2266 using ConstReference = ConstReference_<MT>;
2275 template<
typename MatrixType
2276 ,
typename IteratorType >
2277 class ColumnsElement
2278 :
private SparseElement
2287 inline ColumnsElement( IteratorType pos,
size_t row )
2299 template<
typename T >
inline ColumnsElement& operator=(
const T& v ) {
2311 template<
typename T >
inline ColumnsElement&
operator+=(
const T& v ) {
2323 template<
typename T >
inline ColumnsElement&
operator-=(
const T& v ) {
2335 template<
typename T >
inline ColumnsElement&
operator*=(
const T& v ) {
2347 template<
typename T >
inline ColumnsElement&
operator/=(
const T& v ) {
2358 inline const ColumnsElement* operator->()
const {
2368 inline decltype(
auto) value()
const {
2369 return pos_->value();
2378 inline size_t index()
const {
2394 template<
typename MatrixType
2395 ,
typename IteratorType >
2396 class ColumnsIterator
2400 using IteratorCategory = std::forward_iterator_tag;
2401 using ValueType = ColumnsElement<MatrixType,IteratorType>;
2402 using PointerType = ValueType;
2403 using ReferenceType = ValueType;
2404 using DifferenceType = ptrdiff_t;
2407 using iterator_category = IteratorCategory;
2408 using value_type = ValueType;
2409 using pointer = PointerType;
2410 using reference = ReferenceType;
2411 using difference_type = DifferenceType;
2417 inline ColumnsIterator()
2418 : matrix_( nullptr )
2432 inline ColumnsIterator( MatrixType& matrix,
size_t row,
size_t column )
2433 : matrix_( &matrix )
2438 for( ; row_<matrix_->rows(); ++row_ ) {
2439 pos_ = matrix_->find( row_, column_ );
2440 if( pos_ != matrix_->end( row_ ) )
break;
2453 inline ColumnsIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2454 : matrix_( &matrix )
2468 template<
typename MatrixType2,
typename IteratorType2 >
2469 inline ColumnsIterator(
const ColumnsIterator<MatrixType2,IteratorType2>& it )
2470 : matrix_( it.matrix_ )
2472 , column_( it.column_ )
2482 inline ColumnsIterator& operator++() {
2484 for( ; row_<matrix_->rows(); ++row_ ) {
2485 pos_ = matrix_->find( row_, column_ );
2486 if( pos_ != matrix_->end( row_ ) )
break;
2498 inline const ColumnsIterator operator++(
int ) {
2499 const ColumnsIterator tmp( *
this );
2510 inline ReferenceType
operator*()
const {
2511 return ReferenceType( pos_, row_ );
2520 inline PointerType operator->()
const {
2521 return PointerType( pos_, row_ );
2531 template<
typename MatrixType2,
typename IteratorType2 >
2532 inline bool operator==(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2533 return row_ == rhs.row_;
2543 template<
typename MatrixType2,
typename IteratorType2 >
2544 inline bool operator!=(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2545 return !( *
this == rhs );
2555 inline DifferenceType
operator-(
const ColumnsIterator& rhs )
const {
2556 size_t counter( 0UL );
2557 for(
size_t i=rhs.row_; i<row_; ++i ) {
2558 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2567 MatrixType* matrix_;
2574 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnsIterator;
2575 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CCAs2 >
friend class Columns;
2582 using ConstIterator = ColumnsIterator< const MT, ConstIterator_<MT> >;
2590 enum :
bool { smpAssignable = MT::smpAssignable };
2596 template<
typename... RCAs >
2597 explicit inline Columns( MT& matrix, RCAs... args );
2599 inline Columns(
const Columns& ) =
default;
2600 inline Columns( Columns&& ) =
default;
2611 inline Reference operator()(
size_t i,
size_t j );
2612 inline ConstReference operator()(
size_t i,
size_t j )
const;
2613 inline Reference at(
size_t i,
size_t j );
2614 inline ConstReference at(
size_t i,
size_t j )
const;
2616 inline ConstIterator
begin (
size_t j )
const;
2617 inline ConstIterator
cbegin(
size_t j )
const;
2619 inline ConstIterator
end (
size_t j )
const;
2620 inline ConstIterator
cend (
size_t j )
const;
2627 inline Columns& operator=( initializer_list< initializer_list<ElementType> > list );
2628 inline Columns& operator=(
const Columns& rhs );
2630 template<
typename MT2,
bool SO >
inline Columns& operator= (
const Matrix<MT2,SO>& rhs );
2631 template<
typename MT2,
bool SO >
inline Columns&
operator+=(
const Matrix<MT2,SO>& rhs );
2632 template<
typename MT2,
bool SO >
inline Columns&
operator-=(
const Matrix<MT2,SO>& rhs );
2633 template<
typename MT2,
bool SO >
inline Columns& operator%=(
const Matrix<MT2,SO>& rhs );
2640 using DataType::idx;
2641 using DataType::idces;
2644 inline MT& operand() noexcept;
2645 inline const MT& operand() const noexcept;
2647 inline
size_t rows() const noexcept;
2648 inline
size_t capacity() const noexcept;
2649 inline
size_t capacity(
size_t j ) const noexcept;
2651 inline
size_t nonZeros(
size_t j ) const;
2652 inline
void reset();
2653 inline
void reset(
size_t j );
2654 inline
void reserve(
size_t nonzeros );
2655 void reserve(
size_t j,
size_t nonzeros );
2657 inline
void trim(
size_t j );
2666 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
2667 inline
void finalize(
size_t j );
2674 inline
void erase(
size_t i,
size_t j );
2678 template< typename Pred >
2679 inline
void erase( Pred predicate );
2681 template< typename Pred >
2682 inline
void erase(
size_t j,
Iterator first,
Iterator last, Pred predicate );
2689 inline
Iterator find (
size_t i,
size_t j );
2690 inline ConstIterator find (
size_t i,
size_t j ) const;
2691 inline
Iterator lowerBound(
size_t i,
size_t j );
2692 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
2693 inline
Iterator upperBound(
size_t i,
size_t j );
2694 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
2701 inline Columns& transpose();
2702 inline Columns& ctranspose();
2704 template< typename Other > inline Columns& scale( const Other& scalar );
2711 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
2712 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
2714 inline
bool canSMPAssign() const noexcept;
2716 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
2717 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
2718 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
2719 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
2720 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
2721 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
2770 template< typename MT
2772 template< typename... RCAs >
2773 inline Columns<MT,false,false,false,CCAs...>::Columns( MT& matrix, RCAs... args )
2774 : DataType( args... )
2775 , matrix_ ( matrix )
2777 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
2778 for(
size_t j=0UL; j<
columns(); ++j ) {
2779 if( matrix_.columns() <= idx(j) ) {
2808 template<
typename MT
2810 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Reference 2811 Columns<MT,false,false,false,CCAs...>::operator()(
size_t i,
size_t j )
2816 return matrix_(i,idx(j));
2833 template<
typename MT
2836 Columns<MT,false,false,false,CCAs...>::operator()(
size_t i,
size_t j )
const 2841 return const_cast<const MT&
>( matrix_ )(i,idx(j));
2859 template<
typename MT
2861 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Reference 2862 Columns<MT,false,false,false,CCAs...>::at(
size_t i,
size_t j )
2870 return (*
this)(i,j);
2888 template<
typename MT
2891 Columns<MT,false,false,false,CCAs...>::at(
size_t i,
size_t j )
const 2899 return (*
this)(i,j);
2914 template<
typename MT
2916 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 2921 return Iterator( matrix_, 0UL, idx(j) );
2936 template<
typename MT
2958 template<
typename MT
2980 template<
typename MT
2982 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 3002 template<
typename MT
3024 template<
typename MT
3061 template<
typename MT
3063 inline Columns<MT,
false,
false,
false,CCAs...>&
3064 Columns<MT,false,false,false,CCAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
3069 if( list.size() !=
rows() ) {
3073 const InitializerMatrix<ElementType> tmp( list,
columns() );
3075 if( IsRestricted<MT>::value ) {
3076 for(
size_t j=0UL; j<
columns(); ++j ) {
3083 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
3108 template<
typename MT
3110 inline Columns<MT,
false,
false,
false,CCAs...>&
3111 Columns<MT,false,false,false,CCAs...>::operator=(
const Columns& rhs )
3119 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && idces() == rhs.idces() ) )
3122 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
3126 if( IsRestricted<MT>::value ) {
3127 for(
size_t j=0UL; j<
columns(); ++j ) {
3128 if( !tryAssign( matrix_,
column( rhs, j,
unchecked ), 0UL, idx(j) ) ) {
3134 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
3136 if( rhs.canAlias( &matrix_ ) ) {
3169 template<
typename MT
3171 template<
typename MT2
3173 inline Columns<MT,
false,
false,
false,CCAs...>&
3174 Columns<MT,false,false,false,CCAs...>::operator=(
const Matrix<MT2,SO>& rhs )
3185 using Right = CompositeType_<MT2>;
3186 Right right( ~rhs );
3188 if( IsRestricted<MT>::value ) {
3189 for(
size_t j=0UL; j<
columns(); ++j ) {
3190 if( !tryAssign( matrix_,
column( right, j,
unchecked ), 0UL, idx(j) ) ) {
3196 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
3198 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3199 const ResultType_<MT2> tmp( right );
3200 if( IsSparseMatrix< ResultType_<MT2> >::value )
3205 if( IsSparseMatrix<MT2>::value )
3232 template<
typename MT
3234 template<
typename MT2
3236 inline Columns<MT,
false,
false,
false,CCAs...>&
3246 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
3254 const AddType tmp( *
this + (~rhs) );
3256 if( IsRestricted<MT>::value ) {
3257 for(
size_t j=0UL; j<
columns(); ++j ) {
3258 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
3264 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
3266 if( IsSparseMatrix<AddType>::value ) {
3294 template<
typename MT
3296 template<
typename MT2
3298 inline Columns<MT,
false,
false,
false,CCAs...>&
3308 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
3316 const SubType tmp( *
this - (~rhs) );
3318 if( IsRestricted<MT>::value ) {
3319 for(
size_t j=0UL; j<
columns(); ++j ) {
3320 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
3326 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
3328 if( IsSparseMatrix<SubType>::value ) {
3356 template<
typename MT
3358 template<
typename MT2
3360 inline Columns<MT,
false,
false,
false,CCAs...>&
3361 Columns<MT,false,false,false,CCAs...>::operator%=(
const Matrix<MT2,SO>& rhs )
3370 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
3378 const SchurType tmp( *
this % (~rhs) );
3380 if( IsRestricted<MT>::value ) {
3381 for(
size_t j=0UL; j<
columns(); ++j ) {
3382 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
3388 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
3390 if( IsSparseMatrix<SchurType>::value ) {
3418 template<
typename MT
3420 inline MT& Columns<MT,false,false,false,CCAs...>::operand() noexcept
3434 template<
typename MT
3436 inline const MT& Columns<MT,false,false,false,CCAs...>::operand() const noexcept
3450 template<
typename MT
3454 return matrix_.rows();
3466 template<
typename MT
3485 template<
typename MT
3505 template<
typename MT
3509 size_t nonzeros( 0UL );
3511 for(
size_t i=0UL; i<
rows(); ++i ) {
3512 const auto end( matrix_.end( i ) );
3513 for(
size_t j=0UL; j<
columns(); ++j ) {
3514 auto pos = matrix_.find( i, idx(j) );
3536 template<
typename MT
3542 size_t counter( 0UL );
3544 const ConstIterator last(
end(j) );
3545 for( ConstIterator element=
begin(j); element!=last; ++element ) {
3561 template<
typename MT
3565 for(
size_t j=0UL; j<
columns(); ++j ) {
3583 template<
typename MT
3587 const size_t index( idx(j) );
3589 const size_t ibegin( ( IsLower<MT>::value )
3590 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3594 const size_t iend ( ( IsUpper<MT>::value )
3595 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3600 for(
size_t i=ibegin; i<iend; ++i ) {
3601 matrix_.erase( i, index );
3619 template<
typename MT
3621 inline void Columns<MT,false,false,false,CCAs...>::reserve(
size_t nonzeros )
3644 template<
typename MT
3646 void Columns<MT,false,false,false,CCAs...>::reserve(
size_t j,
size_t nonzeros )
3666 template<
typename MT
3668 void Columns<MT,false,false,false,CCAs...>::trim()
3687 template<
typename MT
3689 void Columns<MT,false,false,false,CCAs...>::trim(
size_t j )
3722 template<
typename MT
3724 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 3727 return Iterator( matrix_, i, idx(j), matrix_.set( i, idx(j), value ) );
3747 template<
typename MT
3749 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 3750 Columns<MT,false,false,false,CCAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
3752 return Iterator( matrix_, i, idx(j), matrix_.insert( i, idx(j), value ) );
3802 template<
typename MT
3804 inline void Columns<MT,false,false,false,CCAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
3806 if( !check || !isDefault<strict>( value ) )
3807 matrix_.insert( i, idx(j), value );
3827 template<
typename MT
3829 inline void Columns<MT,false,false,false,CCAs...>::finalize(
size_t j )
3857 template<
typename MT
3859 inline void Columns<MT,false,false,false,CCAs...>::erase(
size_t i,
size_t j )
3864 matrix_.erase( i, idx(j) );
3880 template<
typename MT
3882 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 3883 Columns<MT,false,false,false,CCAs...>::erase(
size_t j,
Iterator pos )
3885 const size_t row( pos.row_ );
3890 matrix_.erase( row, pos.pos_ );
3891 return Iterator( matrix_, row+1UL, idx(j) );
3908 template<
typename MT
3910 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 3911 Columns<MT,false,false,false,CCAs...>::erase(
size_t j,
Iterator first,
Iterator last )
3917 for( ; first!=last; ++first ) {
3918 matrix_.erase( first.row_, first.pos_ );
3950 template<
typename MT
3952 template<
typename Pred >
3953 inline void Columns<MT,false,false,false,CCAs...>::erase( Pred predicate )
3955 for(
size_t j=0UL; j<
columns(); ++j ) {
3957 if( predicate( element->value() ) )
3958 matrix_.erase( element.row_, element.pos_ );
3993 template<
typename MT
3995 template<
typename Pred >
3996 inline void Columns<MT,false,false,false,CCAs...>::erase(
size_t j,
Iterator first,
Iterator last, Pred predicate )
4002 for( ; first!=last; ++first ) {
4003 if( predicate( first->value() ) )
4004 matrix_.erase( first.row_, first.pos_ );
4034 template<
typename MT
4036 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 4037 Columns<MT,false,false,false,CCAs...>::find(
size_t i,
size_t j )
4039 const size_t index( idx(j) );
4040 const Iterator_<MT> pos( matrix_.find( i, index ) );
4042 if( pos != matrix_.end( i ) )
4043 return Iterator( matrix_, i, index, pos );
4066 template<
typename MT
4069 Columns<MT,false,false,false,CCAs...>::find(
size_t i,
size_t j )
const 4071 const size_t index( idx(j) );
4072 const ConstIterator_<MT> pos( matrix_.find( i, index ) );
4074 if( pos != matrix_.end( i ) )
4097 template<
typename MT
4099 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 4100 Columns<MT,false,false,false,CCAs...>::lowerBound(
size_t i,
size_t j )
4102 const size_t index( idx(j) );
4104 for( ; i<
rows(); ++i )
4106 const Iterator_<MT> pos( matrix_.find( i, index ) );
4108 if( pos != matrix_.end( i ) )
4109 return Iterator( matrix_, i, index, pos );
4132 template<
typename MT
4135 Columns<MT,false,false,false,CCAs...>::lowerBound(
size_t i,
size_t j )
const 4137 const size_t index( idx(j) );
4139 for( ; i<
rows(); ++i )
4141 const ConstIterator_<MT> pos( matrix_.find( i, index ) );
4143 if( pos != matrix_.end( i ) )
4167 template<
typename MT
4169 inline typename Columns<MT,
false,
false,
false,CCAs...>
::Iterator 4170 Columns<MT,false,false,false,CCAs...>::upperBound(
size_t i,
size_t j )
4172 return lowerBound( i+1UL, j );
4192 template<
typename MT
4195 Columns<MT,false,false,false,CCAs...>::upperBound(
size_t i,
size_t j )
const 4197 return lowerBound( i+1UL, j );
4224 template<
typename MT
4226 inline Columns<MT,
false,
false,
false,CCAs...>&
4238 if( IsRestricted<MT>::value ) {
4239 for(
size_t j=0UL; j<
columns(); ++j ) {
4240 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
4246 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
4270 template<
typename MT
4272 inline Columns<MT,
false,
false,
false,CCAs...>&
4284 if( IsRestricted<MT>::value ) {
4285 for(
size_t j=0UL; j<
columns(); ++j ) {
4286 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
4292 BLAZE_DECLTYPE_AUTO( left, derestrict( *
this ) );
4316 template<
typename MT
4318 template<
typename Other >
4319 inline Columns<MT,
false,
false,
false,CCAs...>&
4320 Columns<MT,false,false,false,CCAs...>::scale(
const Other& scalar )
4326 for(
size_t i=0UL; i<
rows(); ++i ) {
4327 const auto end( matrix_.end( i ) );
4328 for(
size_t j=0UL; j<
columns(); ++j ) {
4329 auto pos = matrix_.find( i, idx(j) );
4331 pos->value() *= scalar;
4361 template<
typename MT
4363 template<
typename Other >
4364 inline bool Columns<MT,false,false,false,CCAs...>::canAlias(
const Other* alias )
const noexcept
4366 return matrix_.isAliased( alias );
4383 template<
typename MT
4385 template<
typename Other >
4386 inline bool Columns<MT,false,false,false,CCAs...>::isAliased(
const Other* alias )
const noexcept
4388 return matrix_.isAliased( alias );
4405 template<
typename MT
4407 inline bool Columns<MT,false,false,false,CCAs...>::canSMPAssign() const noexcept
4427 template<
typename MT
4429 template<
typename MT2
4431 inline void Columns<MT,false,false,false,CCAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
4436 using RT = If_< IsComputation<MT2>, ElementType_<MT>,
const ElementType_<MT2>& >;
4441 for(
size_t i=0UL; i<
rows(); ++i ) {
4442 for(
size_t j=0UL; j<
columns(); ++j ) {
4443 RT value( (~rhs)(i,j) );
4444 if( !isDefault<strict>( value ) )
4445 matrix_.set( i, idx(j), std::move( value ) );
4446 else matrix_.erase( i, idx(j) );
4466 template<
typename MT
4468 template<
typename MT2 >
4469 inline void Columns<MT,false,false,false,CCAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
4476 using RT = If_< IsComputation<MT2>, ElementType_<MT>,
const ElementType_<MT2>& >;
4482 for(
size_t i=0UL; i<
rows(); ++i ) {
4483 for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element ) {
4484 RT value( element->value() );
4485 if( !isDefault<strict>( value ) )
4486 matrix_.set( i, idx( element->index() ), std::move( value ) );
4487 else matrix_.erase( i, idx( element->index() ) );
4507 template<
typename MT
4509 template<
typename MT2 >
4510 inline void Columns<MT,false,false,false,CCAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
4515 using RT = If_< IsComputation<MT2>, ElementType_<MT>,
const ElementType_<MT2>& >;
4521 for(
size_t j=0UL; j<
columns(); ++j ) {
4522 const size_t index( idx(j) );
4523 for( ConstIterator_<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
4524 RT value( element->value() );
4525 if( !isDefault<strict>( value ) )
4526 matrix_.set( element->index(), index, std::move( value ) );
4527 else matrix_.erase( element->index(), index );
4547 template<
typename MT
4549 template<
typename MT2
4551 inline void Columns<MT,false,false,false,CCAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
4556 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
4563 const AddType tmp(
serial( *
this + (~rhs) ) );
4583 template<
typename MT
4585 template<
typename MT2
4587 inline void Columns<MT,false,false,false,CCAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
4592 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
4599 const SubType tmp(
serial( *
this - (~rhs) ) );
4619 template<
typename MT
4621 template<
typename MT2
4623 inline void Columns<MT,false,false,false,CCAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
4628 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
4636 const SchurType tmp(
serial( *
this % (~rhs) ) );
4664 template<
typename MT
4666 class Columns<MT,false,false,true,CCAs...>
4667 :
public View< SparseMatrix< Columns<MT,false,false,true,CCAs...>, true > >
4668 ,
private ColumnsData<CCAs...>
4672 using DataType = ColumnsData<CCAs...>;
4673 using Operand = If_< IsExpression<MT>, MT, MT& >;
4679 using This = Columns<MT,
false,
false,
true,CCAs...>;
4681 using BaseType = SparseMatrix<This,true>;
4682 using ViewedType = MT;
4691 using ConstReference = ConstReference_<MT>;
4697 using ConstIterator = ConstIterator_<MT>;
4705 enum :
bool { smpAssignable = MT::smpAssignable };
4711 template<
typename... RCAs >
4712 explicit inline Columns( MT& matrix, RCAs... args );
4714 inline Columns(
const Columns& ) =
default;
4715 inline Columns( Columns&& ) =
default;
4726 inline Reference operator()(
size_t i,
size_t j );
4727 inline ConstReference operator()(
size_t i,
size_t j )
const;
4728 inline Reference at(
size_t i,
size_t j );
4729 inline ConstReference at(
size_t i,
size_t j )
const;
4731 inline ConstIterator
begin (
size_t j )
const;
4732 inline ConstIterator
cbegin(
size_t j )
const;
4734 inline ConstIterator
end (
size_t j )
const;
4735 inline ConstIterator
cend (
size_t j )
const;
4742 Columns& operator=(
const Columns& ) =
delete;
4749 using DataType::idx;
4750 using DataType::idces;
4753 inline MT& operand() noexcept;
4754 inline const MT& operand() const noexcept;
4756 inline
size_t rows() const noexcept;
4757 inline
size_t capacity() const noexcept;
4758 inline
size_t capacity(
size_t j ) const noexcept;
4760 inline
size_t nonZeros(
size_t j ) const;
4761 inline
void reset();
4762 inline
void reset(
size_t j );
4763 inline
void reserve(
size_t nonzeros );
4764 void reserve(
size_t j,
size_t nonzeros );
4766 inline
void trim(
size_t j );
4775 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
4776 inline
void finalize(
size_t j );
4783 inline
void erase(
size_t i,
size_t j );
4787 template< typename Pred >
4788 inline
void erase( Pred predicate );
4790 template< typename Pred >
4791 inline
void erase(
size_t j,
Iterator first,
Iterator last, Pred predicate );
4798 inline
Iterator find (
size_t i,
size_t j );
4799 inline ConstIterator find (
size_t i,
size_t j ) const;
4800 inline
Iterator lowerBound(
size_t i,
size_t j );
4801 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
4802 inline
Iterator upperBound(
size_t i,
size_t j );
4803 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
4810 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4811 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4813 inline
bool canSMPAssign() const noexcept;
4862 template< typename MT
4864 template< typename... RCAs >
4865 inline Columns<MT,false,false,true,CCAs...>::Columns( MT& matrix, RCAs... args )
4866 : DataType( args... )
4867 , matrix_ ( matrix )
4869 if( !Contains< TypeList<RCAs...>,
Unchecked >::value ) {
4870 for(
size_t j=0UL; j<
columns(); ++j ) {
4871 if( matrix_.columns() <= idx(j) ) {
4900 template<
typename MT
4902 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Reference 4903 Columns<MT,false,false,true,CCAs...>::operator()(
size_t i,
size_t j )
4908 return matrix_(idx(j),i);
4925 template<
typename MT
4928 Columns<MT,false,false,true,CCAs...>::operator()(
size_t i,
size_t j )
const 4933 return const_cast<const MT&
>( matrix_ )(idx(j),i);
4951 template<
typename MT
4953 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Reference 4954 Columns<MT,false,false,true,CCAs...>::at(
size_t i,
size_t j )
4962 return (*
this)(i,j);
4980 template<
typename MT
4983 Columns<MT,false,false,true,CCAs...>::at(
size_t i,
size_t j )
const 4991 return (*
this)(i,j);
5006 template<
typename MT
5008 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5013 return matrix_.begin( idx(j) );
5028 template<
typename MT
5035 return matrix_.cbegin( idx(j) );
5050 template<
typename MT
5057 return matrix_.cbegin( idx(j) );
5072 template<
typename MT
5074 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5079 return matrix_.end( idx(j) );
5094 template<
typename MT
5101 return matrix_.cend( idx(j) );
5116 template<
typename MT
5123 return matrix_.cend( idx(j) );
5143 template<
typename MT
5145 inline MT& Columns<MT,false,false,true,CCAs...>::operand() noexcept
5159 template<
typename MT
5161 inline const MT& Columns<MT,false,false,true,CCAs...>::operand() const noexcept
5175 template<
typename MT
5179 return matrix_.rows();
5191 template<
typename MT
5195 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
5210 template<
typename MT
5216 return matrix_.capacity( idx(j) );
5228 template<
typename MT
5232 size_t nonzeros( 0UL );
5234 for(
size_t j=0UL; j<
columns(); ++j )
5252 template<
typename MT
5258 return matrix_.nonZeros( idx(j) );
5270 template<
typename MT
5274 for(
size_t j=0UL; j<
columns(); ++j ) {
5275 matrix_.reset( idx(j) );
5292 template<
typename MT
5296 matrix_.reset( idx(j) );
5313 template<
typename MT
5315 inline void Columns<MT,false,false,true,CCAs...>::reserve(
size_t nonzeros )
5317 const size_t current(
capacity() );
5319 if( nonzeros > current ) {
5320 matrix_.reserve( matrix_.capacity() + nonzeros - current );
5339 template<
typename MT
5341 void Columns<MT,false,false,true,CCAs...>::reserve(
size_t j,
size_t nonzeros )
5343 matrix_.reserve( idx(j), nonzeros );
5359 template<
typename MT
5361 void Columns<MT,false,false,true,CCAs...>::trim()
5363 for(
size_t j=0UL; j<
columns(); ++j ) {
5382 template<
typename MT
5384 void Columns<MT,false,false,true,CCAs...>::trim(
size_t j )
5388 matrix_.trim( idx(j) );
5415 template<
typename MT
5417 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5420 return matrix_.set( idx(j), i, value );
5440 template<
typename MT
5442 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5443 Columns<MT,false,false,true,CCAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
5445 return matrix_.insert( idx(j), i, value );
5495 template<
typename MT
5497 inline void Columns<MT,false,false,true,CCAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
5499 if( !check || !isDefault<strict>( value ) )
5500 matrix_.insert( idx(j), i, value );
5520 template<
typename MT
5522 inline void Columns<MT,false,false,true,CCAs...>::finalize(
size_t j )
5550 template<
typename MT
5552 inline void Columns<MT,false,false,true,CCAs...>::erase(
size_t i,
size_t j )
5557 matrix_.erase( idx(j), i );
5573 template<
typename MT
5575 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5576 Columns<MT,false,false,true,CCAs...>::erase(
size_t j,
Iterator pos )
5580 return matrix_.erase( idx(j), pos );
5597 template<
typename MT
5599 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5600 Columns<MT,false,false,true,CCAs...>::erase(
size_t j,
Iterator first,
Iterator last )
5604 return matrix_.erase( idx(j), first, last );
5633 template<
typename MT
5635 template<
typename Pred >
5636 inline void Columns<MT,false,false,true,CCAs...>::erase( Pred predicate )
5638 for(
size_t j=0UL; j<
columns(); ++j ) {
5639 matrix_.erase( idx(j),
begin(j),
end(j), predicate );
5673 template<
typename MT
5675 template<
typename Pred >
5676 inline void Columns<MT,false,false,true,CCAs...>::erase(
size_t j,
Iterator first,
Iterator last, Pred predicate )
5680 matrix_.erase( idx(j), first, last, predicate );
5709 template<
typename MT
5711 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5712 Columns<MT,false,false,true,CCAs...>::find(
size_t i,
size_t j )
5714 return matrix_.find( idx(j), i );
5735 template<
typename MT
5738 Columns<MT,false,false,true,CCAs...>::find(
size_t i,
size_t j )
const 5740 return matrix_.find( idx(j), i );
5760 template<
typename MT
5762 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5763 Columns<MT,false,false,true,CCAs...>::lowerBound(
size_t i,
size_t j )
5765 return matrix_.lowerBound( idx(j), i );
5785 template<
typename MT
5788 Columns<MT,false,false,true,CCAs...>::lowerBound(
size_t i,
size_t j )
const 5790 return matrix_.lowerBound( idx(j), i );
5810 template<
typename MT
5812 inline typename Columns<MT,
false,
false,
true,CCAs...>
::Iterator 5813 Columns<MT,false,false,true,CCAs...>::upperBound(
size_t i,
size_t j )
5815 return matrix_.upperBound( idx(j), i );
5835 template<
typename MT
5838 Columns<MT,false,false,true,CCAs...>::upperBound(
size_t i,
size_t j )
const 5840 return matrix_.upperBound( idx(j), i );
5865 template<
typename MT
5867 template<
typename Other >
5868 inline bool Columns<MT,false,false,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
5870 return matrix_.isAliased( alias );
5887 template<
typename MT
5889 template<
typename Other >
5890 inline bool Columns<MT,false,false,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
5892 return matrix_.isAliased( alias );
5909 template<
typename MT
5911 inline bool Columns<MT,false,false,true,CCAs...>::canSMPAssign() const noexcept
#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.
Header file for the implementation of the Columns base template.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
Header file for the Schur product trait.
#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 View base class.
#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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
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
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:827
#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
Header file for the decltype(auto) workaround.
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 extended initializer_list functionality.
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 data type.
Header file for the SparseMatrix base class.
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
Headerfile for the generic max algorithm.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
typename ColumnsTrait< MT, CCAs... >::Type ColumnsTrait_
Auxiliary alias declaration for the ColumnsTrait type trait.The ColumnsTrait_ alias declaration provi...
Definition: ColumnsTrait.h:145
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
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1359
Header file for the If class template.
#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
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
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.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
Header file for the SparseElement base class.
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COLUMNS_TYPE(T)
Constraint on the data type.In case the given data type T is a column selection type (i...
Definition: Columns.h:81
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.
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 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
Header file for the columns trait.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
#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 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.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
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
Header file for the implementation of the ColumnsData class template.
Header file for the IsComputation type trait class.
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
#define BLAZE_THROW_LOGIC_ERROR(MESSAGE)
Macro for the emission of a std::logic_error exception.This macro encapsulates the default way of Bla...
Definition: Exception.h:187
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.
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 IsHermitian type trait.
Header file for the IsRestricted type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:801