35 #ifndef _BLAZE_MATH_VIEWS_COLUMNS_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMNS_SPARSE_H_ 110 template<
typename MT
113 class Columns<MT,true,false,SF,CCAs...>
114 :
public View< SparseMatrix< Columns<MT,true,false,SF,CCAs...>, true > >
115 ,
private ColumnsData<CCAs...>
119 using DataType = ColumnsData<CCAs...>;
120 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
124 static constexpr
size_t N =
sizeof...( CCAs );
130 using This = Columns<MT,
true,
false,SF,CCAs...>;
132 using BaseType = SparseMatrix<This,true>;
133 using ViewedType = MT;
134 using ResultType = ColumnsTrait_t<MT,N>;
135 using OppositeType = OppositeType_t<ResultType>;
136 using TransposeType = TransposeType_t<ResultType>;
137 using ElementType = ElementType_t<MT>;
138 using ReturnType = ReturnType_t<MT>;
139 using CompositeType =
const Columns&;
142 using ConstReference = ConstReference_t<MT>;
145 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
148 using ConstIterator = ConstIterator_t<MT>;
151 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
156 static constexpr
bool smpAssignable = MT::smpAssignable;
159 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
165 template<
typename... RCAs >
166 explicit inline Columns( MT& matrix, RCAs... args );
168 Columns(
const Columns& ) =
default;
169 Columns( Columns&& ) =
default;
176 ~Columns() =
default;
183 inline Reference operator()(
size_t i,
size_t j );
184 inline ConstReference operator()(
size_t i,
size_t j )
const;
185 inline Reference at(
size_t i,
size_t j );
186 inline ConstReference at(
size_t i,
size_t j )
const;
187 inline Iterator
begin (
size_t j );
188 inline ConstIterator
begin (
size_t j )
const;
189 inline ConstIterator
cbegin(
size_t j )
const;
190 inline Iterator
end (
size_t j );
191 inline ConstIterator
end (
size_t j )
const;
192 inline ConstIterator
cend (
size_t j )
const;
199 inline Columns& operator=( initializer_list< initializer_list<ElementType> > list );
200 inline Columns& operator=(
const Columns& rhs );
202 template<
typename MT2,
bool SO >
inline Columns& operator= (
const Matrix<MT2,SO>& rhs );
203 template<
typename MT2,
bool SO >
inline Columns&
operator+=(
const Matrix<MT2,SO>& rhs );
204 template<
typename MT2,
bool SO >
inline Columns&
operator-=(
const Matrix<MT2,SO>& rhs );
205 template<
typename MT2,
bool SO >
inline Columns& operator%=(
const Matrix<MT2,SO>& rhs );
213 using DataType::idces;
216 inline MT& operand() noexcept;
217 inline const MT& operand() const noexcept;
219 inline
size_t rows() const noexcept;
220 inline
size_t capacity() const noexcept;
221 inline
size_t capacity(
size_t j ) const noexcept;
223 inline
size_t nonZeros(
size_t j ) const;
225 inline
void reset(
size_t j );
226 inline
void reserve(
size_t nonzeros );
227 void reserve(
size_t j,
size_t nonzeros );
229 inline
void trim(
size_t j );
236 inline Iterator
set (
size_t i,
size_t j, const ElementType& value );
237 inline Iterator insert (
size_t i,
size_t j, const ElementType& value );
238 inline
void append (
size_t i,
size_t j, const ElementType& value,
bool check=false );
239 inline
void finalize(
size_t j );
246 inline
void erase(
size_t i,
size_t j );
247 inline Iterator erase(
size_t j, Iterator pos );
248 inline Iterator erase(
size_t j, Iterator first, Iterator last );
250 template< typename Pred >
251 inline
void erase( Pred predicate );
253 template< typename Pred >
254 inline
void erase(
size_t j, Iterator first, Iterator last, Pred predicate );
261 inline Iterator find (
size_t i,
size_t j );
262 inline ConstIterator find (
size_t i,
size_t j ) const;
263 inline Iterator lowerBound(
size_t i,
size_t j );
264 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
265 inline Iterator upperBound(
size_t i,
size_t j );
266 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
276 template< typename Other > inline Columns& scale( const Other& scalar );
283 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
284 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
286 inline
bool canSMPAssign() const noexcept;
288 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
289 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
290 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
291 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
292 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
293 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
301 inline
size_t extendCapacity(
size_t j ) const noexcept;
348 template< typename MT
351 template< typename... RCAs >
352 inline Columns<MT,true,false,SF,CCAs...>::Columns( MT& matrix, RCAs... args )
353 : DataType( args... )
357 for(
size_t j=0UL; j<
columns(); ++j ) {
358 if( matrix_.columns() <= idx(j) ) {
387 template<
typename MT
390 inline typename Columns<MT,
true,
false,SF,CCAs...>::Reference
391 Columns<MT,true,false,SF,CCAs...>::operator()(
size_t i,
size_t j )
396 return matrix_(i,idx(j));
413 template<
typename MT
416 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstReference
417 Columns<MT,true,false,SF,CCAs...>::operator()(
size_t i,
size_t j )
const 422 return const_cast<const MT&>( matrix_ )(i,idx(j));
440 template<
typename MT
443 inline typename Columns<MT,
true,
false,SF,CCAs...>::Reference
444 Columns<MT,true,false,SF,CCAs...>::at(
size_t i,
size_t j )
470 template<
typename MT
473 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstReference
474 Columns<MT,true,false,SF,CCAs...>::at(
size_t i,
size_t j )
const 497 template<
typename MT
500 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
505 return matrix_.begin( idx(j) );
520 template<
typename MT
523 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstIterator
528 return matrix_.cbegin( idx(j) );
543 template<
typename MT
546 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstIterator
551 return matrix_.cbegin( idx(j) );
566 template<
typename MT
569 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
574 return matrix_.end( idx(j) );
589 template<
typename MT
592 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstIterator
597 return matrix_.cend( idx(j) );
612 template<
typename MT
615 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstIterator
620 return matrix_.cend( idx(j) );
650 template<
typename MT
653 inline Columns<MT,
true,
false,SF,CCAs...>&
654 Columns<MT,true,false,SF,CCAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
659 if( list.size() !=
rows() ) {
663 const InitializerMatrix<ElementType> tmp( list,
columns() );
665 if( IsRestricted_v<MT> ) {
666 for(
size_t j=0UL; j<
columns(); ++j ) {
673 decltype(
auto) left( derestrict( *this ) );
699 template< typename MT
702 inline Columns<MT,true,false,SF,CCAs...>&
703 Columns<MT,true,false,SF,CCAs...>::operator=( const Columns& rhs )
711 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
714 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
718 if( IsRestricted_v<MT> ) {
719 for(
size_t j=0UL; j<
columns(); ++j ) {
720 if( !tryAssign( matrix_,
column( rhs, j,
unchecked ), 0UL, idx(j) ) ) {
726 decltype(
auto) left( derestrict( *this ) );
728 if( rhs.canAlias( &matrix_ ) ) {
729 const ResultType tmp( rhs );
761 template<
typename MT
764 template<
typename MT2
766 inline Columns<MT,
true,
false,SF,CCAs...>&
767 Columns<MT,true,false,SF,CCAs...>::operator=(
const Matrix<MT2,SO>& rhs )
778 using Right = CompositeType_t<MT2>;
781 if( IsRestricted_v<MT> ) {
782 for(
size_t j=0UL; j<
columns(); ++j ) {
783 if( !tryAssign( matrix_,
column( right, j,
unchecked ), 0UL, idx(j) ) ) {
789 decltype(
auto) left( derestrict( *this ) );
792 const ResultType_t<MT2> tmp( right );
823 template<
typename MT
826 template<
typename MT2
828 inline Columns<MT,
true,
false,SF,CCAs...>&
838 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
846 const AddType tmp( *
this + (~rhs) );
848 if( IsRestricted_v<MT> ) {
849 for(
size_t j=0UL; j<
columns(); ++j ) {
850 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
856 decltype(
auto) left( derestrict( *this ) );
883 template< typename MT
886 template< typename MT2
888 inline Columns<MT,true,false,SF,CCAs...>&
889 Columns<MT,true,false,SF,CCAs...>::operator-=( const Matrix<MT2,SO>& rhs )
898 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
906 const SubType tmp( *
this - (~rhs) );
908 if( IsRestricted_v<MT> ) {
909 for(
size_t j=0UL; j<
columns(); ++j ) {
910 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
916 decltype(
auto) left( derestrict( *this ) );
943 template< typename MT
946 template< typename MT2
948 inline Columns<MT,true,false,SF,CCAs...>&
949 Columns<MT,true,false,SF,CCAs...>::operator%=( const Matrix<MT2,SO>& rhs )
958 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
966 const SchurType tmp( *
this % (~rhs) );
968 if( IsRestricted_v<MT> ) {
969 for(
size_t j=0UL; j<
columns(); ++j ) {
970 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
976 decltype(
auto) left( derestrict( *this ) );
1003 template< typename MT
1005 , typename... CCAs >
1006 inline MT& Columns<MT,true,false,SF,CCAs...>::operand() noexcept
1020 template<
typename MT
1022 ,
typename... CCAs >
1023 inline const MT& Columns<MT,true,false,SF,CCAs...>::operand() const noexcept
1037 template<
typename MT
1039 ,
typename... CCAs >
1042 return matrix_.rows();
1054 template<
typename MT
1056 ,
typename... CCAs >
1059 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
1074 template<
typename MT
1076 ,
typename... CCAs >
1081 return matrix_.capacity( idx(j) );
1093 template<
typename MT
1095 ,
typename... CCAs >
1098 size_t nonzeros( 0UL );
1100 for(
size_t j=0UL; j<
columns(); ++j )
1118 template<
typename MT
1120 ,
typename... CCAs >
1125 return matrix_.nonZeros( idx(j) );
1137 template<
typename MT
1139 ,
typename... CCAs >
1142 for(
size_t j=0UL; j<
columns(); ++j ) {
1143 matrix_.reset( idx(j) );
1160 template<
typename MT
1162 ,
typename... CCAs >
1165 matrix_.reset( idx(j) );
1182 template<
typename MT
1184 ,
typename... CCAs >
1185 inline void Columns<MT,true,false,SF,CCAs...>::reserve(
size_t nonzeros )
1187 const size_t current(
capacity() );
1189 if( nonzeros > current ) {
1190 matrix_.reserve( matrix_.capacity() + nonzeros - current );
1210 template<
typename MT
1212 ,
typename... CCAs >
1213 void Columns<MT,true,false,SF,CCAs...>::reserve(
size_t j,
size_t nonzeros )
1215 matrix_.reserve( idx(j), nonzeros );
1231 template<
typename MT
1233 ,
typename... CCAs >
1234 void Columns<MT,true,false,SF,CCAs...>::trim()
1236 for(
size_t j=0UL; j<
columns(); ++j ) {
1255 template<
typename MT
1257 ,
typename... CCAs >
1258 void Columns<MT,true,false,SF,CCAs...>::trim(
size_t j )
1262 matrix_.trim( idx(j) );
1278 template<
typename MT
1280 ,
typename... CCAs >
1281 inline size_t Columns<MT,true,false,SF,CCAs...>::extendCapacity(
size_t j )
const noexcept
1286 size_t nonzeros( 2UL*
capacity( j )+1UL );
1287 nonzeros =
max( nonzeros, 7UL );
1288 nonzeros =
min( nonzeros,
rows() );
1319 template<
typename MT
1321 ,
typename... CCAs >
1322 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
1325 return matrix_.set( i, idx(j), value );
1345 template<
typename MT
1347 ,
typename... CCAs >
1348 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
1349 Columns<MT,true,false,SF,CCAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
1351 return matrix_.insert( i, idx(j), value );
1401 template<
typename MT
1403 ,
typename... CCAs >
1404 inline void Columns<MT,true,false,SF,CCAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
1406 if( !check || !isDefault<strict>( value ) )
1407 matrix_.insert( i, idx(j), value );
1427 template<
typename MT
1429 ,
typename... CCAs >
1430 inline void Columns<MT,true,false,SF,CCAs...>::finalize(
size_t j )
1458 template<
typename MT
1460 ,
typename... CCAs >
1461 inline void Columns<MT,true,false,SF,CCAs...>::erase(
size_t i,
size_t j )
1466 matrix_.erase( i, idx(j) );
1482 template<
typename MT
1484 ,
typename... CCAs >
1485 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
1486 Columns<MT,true,false,SF,CCAs...>::erase(
size_t j, Iterator pos )
1490 return matrix_.erase( idx(j), pos );
1507 template<
typename MT
1509 ,
typename... CCAs >
1510 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
1511 Columns<MT,true,false,SF,CCAs...>::erase(
size_t j, Iterator first, Iterator last )
1515 return matrix_.erase( idx(j), first, last );
1544 template<
typename MT
1546 ,
typename... CCAs >
1547 template<
typename Pred >
1548 inline void Columns<MT,true,false,SF,CCAs...>::erase( Pred predicate )
1550 for(
size_t j=0UL; j<
columns(); ++j ) {
1551 matrix_.erase( idx(j),
begin(j),
end(j), predicate );
1585 template<
typename MT
1587 ,
typename... CCAs >
1588 template<
typename Pred >
1589 inline void Columns<MT,true,false,SF,CCAs...>::erase(
size_t j, Iterator first, Iterator last, Pred predicate )
1593 matrix_.erase( idx(j), first, last, predicate );
1622 template<
typename MT
1624 ,
typename... CCAs >
1625 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
1626 Columns<MT,true,false,SF,CCAs...>::find(
size_t i,
size_t j )
1628 return matrix_.find( i, idx(j) );
1649 template<
typename MT
1651 ,
typename... CCAs >
1652 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstIterator
1653 Columns<MT,true,false,SF,CCAs...>::find(
size_t i,
size_t j )
const 1655 return matrix_.find( i, idx(j) );
1675 template<
typename MT
1677 ,
typename... CCAs >
1678 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
1679 Columns<MT,true,false,SF,CCAs...>::lowerBound(
size_t i,
size_t j )
1681 return matrix_.lowerBound( i, idx(j) );
1701 template<
typename MT
1703 ,
typename... CCAs >
1704 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstIterator
1705 Columns<MT,true,false,SF,CCAs...>::lowerBound(
size_t i,
size_t j )
const 1707 return matrix_.lowerBound( i, idx(j) );
1727 template<
typename MT
1729 ,
typename... CCAs >
1730 inline typename Columns<MT,
true,
false,SF,CCAs...>::Iterator
1731 Columns<MT,true,false,SF,CCAs...>::upperBound(
size_t i,
size_t j )
1733 return matrix_.upperBound( i, idx(j) );
1753 template<
typename MT
1755 ,
typename... CCAs >
1756 inline typename Columns<MT,
true,
false,SF,CCAs...>::ConstIterator
1757 Columns<MT,true,false,SF,CCAs...>::upperBound(
size_t i,
size_t j )
const 1759 return matrix_.upperBound( i, idx(j) );
1786 template<
typename MT
1788 ,
typename... CCAs >
1789 inline Columns<MT,
true,
false,SF,CCAs...>&
1796 const ResultType tmp(
trans( *
this ) );
1798 if( IsRestricted_v<MT> ) {
1799 for(
size_t j=0UL; j<
columns(); ++j ) {
1800 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
1806 decltype(
auto) left( derestrict( *this ) );
1830 template< typename MT
1832 , typename... CCAs >
1833 inline Columns<MT,true,false,SF,CCAs...>&
1834 Columns<MT,true,false,SF,CCAs...>::
ctranspose()
1840 const ResultType tmp(
ctrans( *
this ) );
1842 if( IsRestricted_v<MT> ) {
1843 for(
size_t j=0UL; j<
columns(); ++j ) {
1844 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
1850 decltype(
auto) left( derestrict( *this ) );
1874 template< typename MT
1876 , typename... CCAs >
1877 template< typename Other >
1878 inline Columns<MT,true,false,SF,CCAs...>&
1879 Columns<MT,true,false,SF,CCAs...>::scale( const Other& scalar )
1883 for(
size_t j=0UL; j<
columns(); ++j ) {
1884 const Iterator last(
end(j) );
1885 for( Iterator element=
begin(j); element!=last; ++element )
1886 element->value() *= scalar;
1914 template<
typename MT
1916 ,
typename... CCAs >
1917 template<
typename Other >
1918 inline bool Columns<MT,true,false,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1920 return matrix_.isAliased( alias );
1937 template<
typename MT
1939 ,
typename... CCAs >
1940 template<
typename Other >
1941 inline bool Columns<MT,true,false,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1943 return matrix_.isAliased( alias );
1960 template<
typename MT
1962 ,
typename... CCAs >
1963 inline bool Columns<MT,true,false,SF,CCAs...>::canSMPAssign() const noexcept
1983 template<
typename MT
1985 ,
typename... CCAs >
1986 template<
typename MT2
1988 inline void Columns<MT,true,false,SF,CCAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
1997 for(
size_t j=0UL; j<
columns(); ++j )
1999 const size_t index( idx(j) );
2000 size_t remaining( matrix_.capacity( index ) );
2002 for(
size_t i=0UL; i<
rows(); ++i )
2004 if( remaining == 0UL ) {
2005 matrix_.reserve( index, extendCapacity( j ) );
2006 remaining = matrix_.capacity( index ) - matrix_.nonZeros( index );
2009 matrix_.append( i, index, (~rhs)(i,j),
true );
2030 template<
typename MT
2032 ,
typename... CCAs >
2033 template<
typename MT2 >
2034 inline void Columns<MT,true,false,SF,CCAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
2043 for(
size_t j=0UL; j<
columns(); ++j )
2045 const size_t index( idx(j) );
2046 size_t remaining( matrix_.capacity( index ) );
2048 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2050 if( remaining == 0UL ) {
2051 matrix_.reserve( index, extendCapacity( j ) );
2052 remaining = matrix_.capacity( index ) - matrix_.nonZeros( index );
2055 matrix_.append( element->index(), index, element->value(), true );
2076 template<
typename MT
2078 ,
typename... CCAs >
2079 template<
typename MT2 >
2080 inline void Columns<MT,true,false,SF,CCAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
2092 std::vector<size_t> columnLengths(
columns(), 0UL );
2093 for(
size_t i=0UL; i<
rows(); ++i ) {
2094 for(
auto element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2095 ++columnLengths[element->index()];
2099 for(
size_t j=0UL; j<
columns(); ++j ) {
2100 reserve( j, columnLengths[j] );
2104 for(
size_t i=0UL; i<
rows(); ++i ) {
2105 for(
auto element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2106 append( i, element->index(), element->value(), true );
2125 template<
typename MT
2127 ,
typename... CCAs >
2128 template<
typename MT2
2130 inline void Columns<MT,true,false,SF,CCAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
2135 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
2142 const AddType tmp(
serial( *
this + (~rhs) ) );
2162 template<
typename MT
2164 ,
typename... CCAs >
2165 template<
typename MT2
2167 inline void Columns<MT,true,false,SF,CCAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
2172 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
2179 const SubType tmp(
serial( *
this - (~rhs) ) );
2199 template<
typename MT
2201 ,
typename... CCAs >
2202 template<
typename MT2
2204 inline void Columns<MT,true,false,SF,CCAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
2209 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
2217 const SchurType tmp(
serial( *
this % (~rhs) ) );
2245 template<
typename MT
2246 ,
typename... CCAs >
2247 class Columns<MT,false,false,false,CCAs...>
2248 :
public View< SparseMatrix< Columns<MT,false,false,false,CCAs...>, true > >
2249 ,
private ColumnsData<CCAs...>
2253 using DataType = ColumnsData<CCAs...>;
2254 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2258 static constexpr
size_t N =
sizeof...( CCAs );
2264 using This = Columns<MT,
false,
false,
false,CCAs...>;
2266 using BaseType = SparseMatrix<This,true>;
2267 using ViewedType = MT;
2268 using ResultType = ColumnsTrait_t<MT,N>;
2269 using OppositeType = OppositeType_t<ResultType>;
2270 using TransposeType = TransposeType_t<ResultType>;
2271 using ElementType = ElementType_t<MT>;
2272 using ReturnType = ReturnType_t<MT>;
2273 using CompositeType =
const Columns&;
2276 using ConstReference = ConstReference_t<MT>;
2279 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2285 template<
typename MatrixType
2286 ,
typename IteratorType >
2287 class ColumnsElement
2288 :
private SparseElement
2297 inline ColumnsElement( IteratorType pos,
size_t row )
2309 template<
typename T >
inline ColumnsElement& operator=(
const T& v ) {
2321 template<
typename T >
inline ColumnsElement&
operator+=(
const T& v ) {
2333 template<
typename T >
inline ColumnsElement&
operator-=(
const T& v ) {
2345 template<
typename T >
inline ColumnsElement&
operator*=(
const T& v ) {
2357 template<
typename T >
inline ColumnsElement&
operator/=(
const T& v ) {
2368 inline const ColumnsElement* operator->()
const {
2378 inline decltype(
auto) value()
const {
2379 return pos_->value();
2388 inline size_t index()
const {
2404 template<
typename MatrixType
2405 ,
typename IteratorType >
2406 class ColumnsIterator
2410 using IteratorCategory = std::forward_iterator_tag;
2411 using ValueType = ColumnsElement<MatrixType,IteratorType>;
2412 using PointerType = ValueType;
2413 using ReferenceType = ValueType;
2414 using DifferenceType = ptrdiff_t;
2417 using iterator_category = IteratorCategory;
2418 using value_type = ValueType;
2419 using pointer = PointerType;
2420 using reference = ReferenceType;
2421 using difference_type = DifferenceType;
2427 inline ColumnsIterator()
2428 : matrix_( nullptr )
2442 inline ColumnsIterator( MatrixType& matrix,
size_t row,
size_t column )
2443 : matrix_( &matrix )
2448 for( ; row_<matrix_->rows(); ++row_ ) {
2449 pos_ = matrix_->find( row_, column_ );
2450 if( pos_ != matrix_->end( row_ ) )
break;
2463 inline ColumnsIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2464 : matrix_( &matrix )
2478 template<
typename MatrixType2,
typename IteratorType2 >
2479 inline ColumnsIterator(
const ColumnsIterator<MatrixType2,IteratorType2>& it )
2480 : matrix_( it.matrix_ )
2482 , column_( it.column_ )
2492 inline ColumnsIterator& operator++() {
2494 for( ; row_<matrix_->rows(); ++row_ ) {
2495 pos_ = matrix_->find( row_, column_ );
2496 if( pos_ != matrix_->end( row_ ) )
break;
2508 inline const ColumnsIterator operator++(
int ) {
2509 const ColumnsIterator tmp( *
this );
2520 inline ReferenceType
operator*()
const {
2521 return ReferenceType( pos_, row_ );
2530 inline PointerType operator->()
const {
2531 return PointerType( pos_, row_ );
2541 template<
typename MatrixType2,
typename IteratorType2 >
2542 inline bool operator==(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2543 return row_ == rhs.row_;
2553 template<
typename MatrixType2,
typename IteratorType2 >
2554 inline bool operator!=(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2555 return !( *
this == rhs );
2565 inline DifferenceType
operator-(
const ColumnsIterator& rhs )
const {
2566 size_t counter( 0UL );
2567 for(
size_t i=rhs.row_; i<row_; ++i ) {
2568 if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2577 MatrixType* matrix_;
2584 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnsIterator;
2585 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename... CCAs2 >
friend class Columns;
2592 using ConstIterator = ColumnsIterator< const MT, ConstIterator_t<MT> >;
2595 using Iterator = If_t< IsConst_v<MT>, ConstIterator, ColumnsIterator< MT, Iterator_t<MT> > >;
2600 static constexpr
bool smpAssignable = MT::smpAssignable;
2603 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
2609 template<
typename... RCAs >
2610 explicit inline Columns( MT& matrix, RCAs... args );
2612 Columns(
const Columns& ) =
default;
2613 Columns( Columns&& ) =
default;
2620 ~Columns() =
default;
2627 inline Reference operator()(
size_t i,
size_t j );
2628 inline ConstReference operator()(
size_t i,
size_t j )
const;
2629 inline Reference at(
size_t i,
size_t j );
2630 inline ConstReference at(
size_t i,
size_t j )
const;
2631 inline Iterator
begin (
size_t j );
2632 inline ConstIterator
begin (
size_t j )
const;
2633 inline ConstIterator
cbegin(
size_t j )
const;
2634 inline Iterator
end (
size_t j );
2635 inline ConstIterator
end (
size_t j )
const;
2636 inline ConstIterator
cend (
size_t j )
const;
2643 inline Columns& operator=( initializer_list< initializer_list<ElementType> > list );
2644 inline Columns& operator=(
const Columns& rhs );
2646 template<
typename MT2,
bool SO >
inline Columns& operator= (
const Matrix<MT2,SO>& rhs );
2647 template<
typename MT2,
bool SO >
inline Columns&
operator+=(
const Matrix<MT2,SO>& rhs );
2648 template<
typename MT2,
bool SO >
inline Columns&
operator-=(
const Matrix<MT2,SO>& rhs );
2649 template<
typename MT2,
bool SO >
inline Columns& operator%=(
const Matrix<MT2,SO>& rhs );
2656 using DataType::idx;
2657 using DataType::idces;
2660 inline MT& operand() noexcept;
2661 inline const MT& operand() const noexcept;
2663 inline
size_t rows() const noexcept;
2664 inline
size_t capacity() const noexcept;
2665 inline
size_t capacity(
size_t j ) const noexcept;
2667 inline
size_t nonZeros(
size_t j ) const;
2668 inline
void reset();
2669 inline
void reset(
size_t j );
2670 inline
void reserve(
size_t nonzeros );
2671 void reserve(
size_t j,
size_t nonzeros );
2673 inline
void trim(
size_t j );
2680 inline Iterator
set (
size_t i,
size_t j, const ElementType& value );
2681 inline Iterator insert (
size_t i,
size_t j, const ElementType& value );
2682 inline
void append (
size_t i,
size_t j, const ElementType& value,
bool check=false );
2683 inline
void finalize(
size_t j );
2690 inline
void erase(
size_t i,
size_t j );
2691 inline Iterator erase(
size_t j, Iterator pos );
2692 inline Iterator erase(
size_t j, Iterator first, Iterator last );
2694 template< typename Pred >
2695 inline
void erase( Pred predicate );
2697 template< typename Pred >
2698 inline
void erase(
size_t j, Iterator first, Iterator last, Pred predicate );
2705 inline Iterator find (
size_t i,
size_t j );
2706 inline ConstIterator find (
size_t i,
size_t j ) const;
2707 inline Iterator lowerBound(
size_t i,
size_t j );
2708 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
2709 inline Iterator upperBound(
size_t i,
size_t j );
2710 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
2720 template< typename Other > inline Columns& scale( const Other& scalar );
2727 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
2728 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
2730 inline
bool canSMPAssign() const noexcept;
2732 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
2733 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
2734 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
2735 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
2736 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
2737 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
2786 template< typename MT
2787 , typename... CCAs >
2788 template< typename... RCAs >
2789 inline Columns<MT,false,false,false,CCAs...>::Columns( MT& matrix, RCAs... args )
2790 : DataType( args... )
2791 , matrix_ ( matrix )
2794 for(
size_t j=0UL; j<
columns(); ++j ) {
2795 if( matrix_.columns() <= idx(j) ) {
2824 template<
typename MT
2825 ,
typename... CCAs >
2826 inline typename Columns<MT,
false,
false,
false,CCAs...>::Reference
2827 Columns<MT,false,false,false,CCAs...>::operator()(
size_t i,
size_t j )
2832 return matrix_(i,idx(j));
2849 template<
typename MT
2850 ,
typename... CCAs >
2851 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstReference
2852 Columns<MT,false,false,false,CCAs...>::operator()(
size_t i,
size_t j )
const 2857 return const_cast<const MT&>( matrix_ )(i,idx(j));
2875 template<
typename MT
2876 ,
typename... CCAs >
2877 inline typename Columns<MT,
false,
false,
false,CCAs...>::Reference
2878 Columns<MT,false,false,false,CCAs...>::at(
size_t i,
size_t j )
2886 return (*
this)(i,j);
2904 template<
typename MT
2905 ,
typename... CCAs >
2906 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstReference
2907 Columns<MT,false,false,false,CCAs...>::at(
size_t i,
size_t j )
const 2915 return (*
this)(i,j);
2930 template<
typename MT
2931 ,
typename... CCAs >
2932 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
2937 return Iterator( matrix_, 0UL, idx(j) );
2952 template<
typename MT
2953 ,
typename... CCAs >
2954 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstIterator
2959 return ConstIterator( matrix_, 0UL, idx(j) );
2974 template<
typename MT
2975 ,
typename... CCAs >
2976 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstIterator
2981 return ConstIterator( matrix_, 0UL, idx(j) );
2996 template<
typename MT
2997 ,
typename... CCAs >
2998 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
3003 return Iterator( matrix_,
rows(), idx(j) );
3018 template<
typename MT
3019 ,
typename... CCAs >
3020 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstIterator
3025 return ConstIterator( matrix_,
rows(), idx(j) );
3040 template<
typename MT
3041 ,
typename... CCAs >
3042 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstIterator
3047 return ConstIterator( matrix_,
rows(), idx(j) );
3077 template<
typename MT
3078 ,
typename... CCAs >
3079 inline Columns<MT,
false,
false,
false,CCAs...>&
3080 Columns<MT,false,false,false,CCAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
3085 if( list.size() !=
rows() ) {
3089 const InitializerMatrix<ElementType> tmp( list,
columns() );
3091 if( IsRestricted_v<MT> ) {
3092 for(
size_t j=0UL; j<
columns(); ++j ) {
3099 decltype(
auto) left( derestrict( *this ) );
3124 template< typename MT
3125 , typename... CCAs >
3126 inline Columns<MT,false,false,false,CCAs...>&
3127 Columns<MT,false,false,false,CCAs...>::operator=( const Columns& rhs )
3135 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
3138 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
3142 if( IsRestricted_v<MT> ) {
3143 for(
size_t j=0UL; j<
columns(); ++j ) {
3144 if( !tryAssign( matrix_,
column( rhs, j,
unchecked ), 0UL, idx(j) ) ) {
3150 decltype(
auto) left( derestrict( *this ) );
3152 if( rhs.canAlias( &matrix_ ) ) {
3153 const ResultType tmp( rhs );
3185 template<
typename MT
3186 ,
typename... CCAs >
3187 template<
typename MT2
3189 inline Columns<MT,
false,
false,
false,CCAs...>&
3190 Columns<MT,false,false,false,CCAs...>::operator=(
const Matrix<MT2,SO>& rhs )
3201 using Right = CompositeType_t<MT2>;
3202 Right right( ~rhs );
3204 if( IsRestricted_v<MT> ) {
3205 for(
size_t j=0UL; j<
columns(); ++j ) {
3206 if( !tryAssign( matrix_,
column( right, j,
unchecked ), 0UL, idx(j) ) ) {
3212 decltype(
auto) left( derestrict( *this ) );
3215 const ResultType_t<MT2> tmp( right );
3221 if( IsSparseMatrix_v<MT2> )
3248 template<
typename MT
3249 ,
typename... CCAs >
3250 template<
typename MT2
3252 inline Columns<MT,
false,
false,
false,CCAs...>&
3262 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
3270 const AddType tmp( *
this + (~rhs) );
3272 if( IsRestricted_v<MT> ) {
3273 for(
size_t j=0UL; j<
columns(); ++j ) {
3274 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
3280 decltype(
auto) left( derestrict( *this ) );
3310 template<
typename MT
3311 ,
typename... CCAs >
3312 template<
typename MT2
3314 inline Columns<MT,
false,
false,
false,CCAs...>&
3324 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
3332 const SubType tmp( *
this - (~rhs) );
3334 if( IsRestricted_v<MT> ) {
3335 for(
size_t j=0UL; j<
columns(); ++j ) {
3336 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
3342 decltype(
auto) left( derestrict( *this ) );
3372 template<
typename MT
3373 ,
typename... CCAs >
3374 template<
typename MT2
3376 inline Columns<MT,
false,
false,
false,CCAs...>&
3377 Columns<MT,false,false,false,CCAs...>::operator%=(
const Matrix<MT2,SO>& rhs )
3386 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
3394 const SchurType tmp( *
this % (~rhs) );
3396 if( IsRestricted_v<MT> ) {
3397 for(
size_t j=0UL; j<
columns(); ++j ) {
3398 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
3404 decltype(
auto) left( derestrict( *this ) );
3434 template<
typename MT
3435 ,
typename... CCAs >
3436 inline MT& Columns<MT,false,false,false,CCAs...>::operand() noexcept
3450 template<
typename MT
3451 ,
typename... CCAs >
3452 inline const MT& Columns<MT,false,false,false,CCAs...>::operand() const noexcept
3466 template<
typename MT
3467 ,
typename... CCAs >
3470 return matrix_.rows();
3482 template<
typename MT
3483 ,
typename... CCAs >
3501 template<
typename MT
3502 ,
typename... CCAs >
3521 template<
typename MT
3522 ,
typename... CCAs >
3525 size_t nonzeros( 0UL );
3527 for(
size_t i=0UL; i<
rows(); ++i ) {
3528 const auto end( matrix_.end( i ) );
3529 for(
size_t j=0UL; j<
columns(); ++j ) {
3530 auto pos = matrix_.find( i, idx(j) );
3552 template<
typename MT
3553 ,
typename... CCAs >
3558 size_t counter( 0UL );
3560 const ConstIterator last(
end(j) );
3561 for( ConstIterator element=
begin(j); element!=last; ++element ) {
3577 template<
typename MT
3578 ,
typename... CCAs >
3581 for(
size_t j=0UL; j<
columns(); ++j ) {
3599 template<
typename MT
3600 ,
typename... CCAs >
3603 const size_t index( idx(j) );
3605 const size_t ibegin( ( IsLower_v<MT> )
3606 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3610 const size_t iend ( ( IsUpper_v<MT> )
3611 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3616 for(
size_t i=ibegin; i<iend; ++i ) {
3617 matrix_.erase( i, index );
3635 template<
typename MT
3636 ,
typename... CCAs >
3637 inline void Columns<MT,false,false,false,CCAs...>::reserve(
size_t nonzeros )
3660 template<
typename MT
3661 ,
typename... CCAs >
3662 void Columns<MT,false,false,false,CCAs...>::reserve(
size_t j,
size_t nonzeros )
3682 template<
typename MT
3683 ,
typename... CCAs >
3684 void Columns<MT,false,false,false,CCAs...>::trim()
3703 template<
typename MT
3704 ,
typename... CCAs >
3705 void Columns<MT,false,false,false,CCAs...>::trim(
size_t j )
3738 template<
typename MT
3739 ,
typename... CCAs >
3740 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
3743 return Iterator( matrix_, i, idx(j), matrix_.set( i, idx(j), value ) );
3763 template<
typename MT
3764 ,
typename... CCAs >
3765 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
3766 Columns<MT,false,false,false,CCAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
3768 return Iterator( matrix_, i, idx(j), matrix_.insert( i, idx(j), value ) );
3818 template<
typename MT
3819 ,
typename... CCAs >
3820 inline void Columns<MT,false,false,false,CCAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
3822 if( !check || !isDefault<strict>( value ) )
3823 matrix_.insert( i, idx(j), value );
3843 template<
typename MT
3844 ,
typename... CCAs >
3845 inline void Columns<MT,false,false,false,CCAs...>::finalize(
size_t j )
3873 template<
typename MT
3874 ,
typename... CCAs >
3875 inline void Columns<MT,false,false,false,CCAs...>::erase(
size_t i,
size_t j )
3880 matrix_.erase( i, idx(j) );
3896 template<
typename MT
3897 ,
typename... CCAs >
3898 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
3899 Columns<MT,false,false,false,CCAs...>::erase(
size_t j, Iterator pos )
3901 const size_t row( pos.row_ );
3906 matrix_.erase(
row, pos.pos_ );
3907 return Iterator( matrix_,
row+1UL, idx(j) );
3924 template<
typename MT
3925 ,
typename... CCAs >
3926 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
3927 Columns<MT,false,false,false,CCAs...>::erase(
size_t j, Iterator first, Iterator last )
3933 for( ; first!=last; ++first ) {
3934 matrix_.erase( first.row_, first.pos_ );
3966 template<
typename MT
3967 ,
typename... CCAs >
3968 template<
typename Pred >
3969 inline void Columns<MT,false,false,false,CCAs...>::erase( Pred predicate )
3971 for(
size_t j=0UL; j<
columns(); ++j ) {
3972 for( Iterator element=
begin(j); element!=
end(j); ++element ) {
3973 if( predicate( element->value() ) )
3974 matrix_.erase( element.row_, element.pos_ );
4009 template<
typename MT
4010 ,
typename... CCAs >
4011 template<
typename Pred >
4012 inline void Columns<MT,false,false,false,CCAs...>::erase(
size_t j, Iterator first, Iterator last, Pred predicate )
4018 for( ; first!=last; ++first ) {
4019 if( predicate( first->value() ) )
4020 matrix_.erase( first.row_, first.pos_ );
4050 template<
typename MT
4051 ,
typename... CCAs >
4052 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
4053 Columns<MT,false,false,false,CCAs...>::find(
size_t i,
size_t j )
4055 const size_t index( idx(j) );
4056 const Iterator_t<MT> pos( matrix_.find( i, index ) );
4058 if( pos != matrix_.end( i ) )
4059 return Iterator( matrix_, i, index, pos );
4082 template<
typename MT
4083 ,
typename... CCAs >
4084 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstIterator
4085 Columns<MT,false,false,false,CCAs...>::find(
size_t i,
size_t j )
const 4087 const size_t index( idx(j) );
4088 const ConstIterator_t<MT> pos( matrix_.find( i, index ) );
4090 if( pos != matrix_.end( i ) )
4091 return ConstIterator( matrix_, i, index, pos );
4113 template<
typename MT
4114 ,
typename... CCAs >
4115 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
4116 Columns<MT,false,false,false,CCAs...>::lowerBound(
size_t i,
size_t j )
4118 const size_t index( idx(j) );
4120 for( ; i<
rows(); ++i )
4122 const Iterator_t<MT> pos( matrix_.find( i, index ) );
4124 if( pos != matrix_.end( i ) )
4125 return Iterator( matrix_, i, index, pos );
4148 template<
typename MT
4149 ,
typename... CCAs >
4150 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstIterator
4151 Columns<MT,false,false,false,CCAs...>::lowerBound(
size_t i,
size_t j )
const 4153 const size_t index( idx(j) );
4155 for( ; i<
rows(); ++i )
4157 const ConstIterator_t<MT> pos( matrix_.find( i, index ) );
4159 if( pos != matrix_.end( i ) )
4160 return ConstIterator( matrix_, i, index, pos );
4183 template<
typename MT
4184 ,
typename... CCAs >
4185 inline typename Columns<MT,
false,
false,
false,CCAs...>::Iterator
4186 Columns<MT,false,false,false,CCAs...>::upperBound(
size_t i,
size_t j )
4188 return lowerBound( i+1UL, j );
4208 template<
typename MT
4209 ,
typename... CCAs >
4210 inline typename Columns<MT,
false,
false,
false,CCAs...>::ConstIterator
4211 Columns<MT,false,false,false,CCAs...>::upperBound(
size_t i,
size_t j )
const 4213 return lowerBound( i+1UL, j );
4240 template<
typename MT
4241 ,
typename... CCAs >
4242 inline Columns<MT,
false,
false,
false,CCAs...>&
4252 const ResultType tmp(
trans( *
this ) );
4254 if( IsRestricted_v<MT> ) {
4255 for(
size_t j=0UL; j<
columns(); ++j ) {
4256 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
4262 decltype(
auto) left( derestrict( *this ) );
4286 template< typename MT
4287 , typename... CCAs >
4288 inline Columns<MT,false,false,false,CCAs...>&
4289 Columns<MT,false,false,false,CCAs...>::
ctranspose()
4298 const ResultType tmp(
ctrans( *
this ) );
4300 if( IsRestricted_v<MT> ) {
4301 for(
size_t j=0UL; j<
columns(); ++j ) {
4302 if( !tryAssign( matrix_,
column( tmp, j,
unchecked ), 0UL, idx(j) ) ) {
4308 decltype(
auto) left( derestrict( *this ) );
4332 template< typename MT
4333 , typename... CCAs >
4334 template< typename Other >
4335 inline Columns<MT,false,false,false,CCAs...>&
4336 Columns<MT,false,false,false,CCAs...>::scale( const Other& scalar )
4342 for(
size_t i=0UL; i<
rows(); ++i ) {
4343 const auto end( matrix_.end( i ) );
4344 for(
size_t j=0UL; j<
columns(); ++j ) {
4345 auto pos = matrix_.find( i, idx(j) );
4347 pos->value() *= scalar;
4377 template<
typename MT
4378 ,
typename... CCAs >
4379 template<
typename Other >
4380 inline bool Columns<MT,false,false,false,CCAs...>::canAlias(
const Other* alias )
const noexcept
4382 return matrix_.isAliased( alias );
4399 template<
typename MT
4400 ,
typename... CCAs >
4401 template<
typename Other >
4402 inline bool Columns<MT,false,false,false,CCAs...>::isAliased(
const Other* alias )
const noexcept
4404 return matrix_.isAliased( alias );
4421 template<
typename MT
4422 ,
typename... CCAs >
4423 inline bool Columns<MT,false,false,false,CCAs...>::canSMPAssign() const noexcept
4443 template<
typename MT
4444 ,
typename... CCAs >
4445 template<
typename MT2
4447 inline void Columns<MT,false,false,false,CCAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
4452 using RT = If_t< IsComputation_v<MT2>, ElementType_t<MT>,
const ElementType_t<MT2>& >;
4457 for(
size_t i=0UL; i<
rows(); ++i ) {
4458 for(
size_t j=0UL; j<
columns(); ++j ) {
4459 RT value( (~rhs)(i,j) );
4460 if( !isDefault<strict>( value ) )
4461 matrix_.set( i, idx(j), std::move( value ) );
4462 else matrix_.erase( i, idx(j) );
4482 template<
typename MT
4483 ,
typename... CCAs >
4484 template<
typename MT2 >
4485 inline void Columns<MT,false,false,false,CCAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
4492 using RT = If_t< IsComputation_v<MT2>, ElementType_t<MT>,
const ElementType_t<MT2>& >;
4498 for(
size_t i=0UL; i<
rows(); ++i ) {
4499 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element ) {
4500 RT value( element->value() );
4501 if( !isDefault<strict>( value ) )
4502 matrix_.set( i, idx( element->index() ), std::move( value ) );
4503 else matrix_.erase( i, idx( element->index() ) );
4523 template<
typename MT
4524 ,
typename... CCAs >
4525 template<
typename MT2 >
4526 inline void Columns<MT,false,false,false,CCAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
4531 using RT = If_t< IsComputation_v<MT2>, ElementType_t<MT>,
const ElementType_t<MT2>& >;
4537 for(
size_t j=0UL; j<
columns(); ++j ) {
4538 const size_t index( idx(j) );
4539 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
4540 RT value( element->value() );
4541 if( !isDefault<strict>( value ) )
4542 matrix_.set( element->index(), index, std::move( value ) );
4543 else matrix_.erase( element->index(), index );
4563 template<
typename MT
4564 ,
typename... CCAs >
4565 template<
typename MT2
4567 inline void Columns<MT,false,false,false,CCAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
4572 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
4579 const AddType tmp(
serial( *
this + (~rhs) ) );
4599 template<
typename MT
4600 ,
typename... CCAs >
4601 template<
typename MT2
4603 inline void Columns<MT,false,false,false,CCAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
4608 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
4615 const SubType tmp(
serial( *
this - (~rhs) ) );
4635 template<
typename MT
4636 ,
typename... CCAs >
4637 template<
typename MT2
4639 inline void Columns<MT,false,false,false,CCAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
4644 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
4652 const SchurType tmp(
serial( *
this % (~rhs) ) );
4680 template<
typename MT
4681 ,
typename... CCAs >
4682 class Columns<MT,false,false,true,CCAs...>
4683 :
public View< SparseMatrix< Columns<MT,false,false,true,CCAs...>, true > >
4684 ,
private ColumnsData<CCAs...>
4688 using DataType = ColumnsData<CCAs...>;
4689 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4693 static constexpr
size_t N =
sizeof...( CCAs );
4699 using This = Columns<MT,
false,
false,
true,CCAs...>;
4701 using BaseType = SparseMatrix<This,true>;
4702 using ViewedType = MT;
4703 using ResultType = ColumnsTrait_t<MT,N>;
4704 using OppositeType = OppositeType_t<ResultType>;
4705 using TransposeType = TransposeType_t<ResultType>;
4706 using ElementType = ElementType_t<MT>;
4707 using ReturnType = ReturnType_t<MT>;
4708 using CompositeType =
const Columns&;
4711 using ConstReference = ConstReference_t<MT>;
4714 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4717 using ConstIterator = ConstIterator_t<MT>;
4720 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4725 static constexpr
bool smpAssignable = MT::smpAssignable;
4728 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
4734 template<
typename... RCAs >
4735 explicit inline Columns( MT& matrix, RCAs... args );
4737 Columns(
const Columns& ) =
default;
4738 Columns( Columns&& ) =
default;
4745 ~Columns() =
default;
4752 inline Reference operator()(
size_t i,
size_t j );
4753 inline ConstReference operator()(
size_t i,
size_t j )
const;
4754 inline Reference at(
size_t i,
size_t j );
4755 inline ConstReference at(
size_t i,
size_t j )
const;
4756 inline Iterator
begin (
size_t j );
4757 inline ConstIterator
begin (
size_t j )
const;
4758 inline ConstIterator
cbegin(
size_t j )
const;
4759 inline Iterator
end (
size_t j );
4760 inline ConstIterator
end (
size_t j )
const;
4761 inline ConstIterator
cend (
size_t j )
const;
4768 Columns& operator=(
const Columns& ) =
delete;
4775 using DataType::idx;
4776 using DataType::idces;
4779 inline MT& operand() noexcept;
4780 inline const MT& operand() const noexcept;
4782 inline
size_t rows() const noexcept;
4783 inline
size_t capacity() const noexcept;
4784 inline
size_t capacity(
size_t j ) const noexcept;
4786 inline
size_t nonZeros(
size_t j ) const;
4787 inline
void reset();
4788 inline
void reset(
size_t j );
4789 inline
void reserve(
size_t nonzeros );
4790 void reserve(
size_t j,
size_t nonzeros );
4792 inline
void trim(
size_t j );
4799 inline Iterator
set (
size_t i,
size_t j, const ElementType& value );
4800 inline Iterator insert (
size_t i,
size_t j, const ElementType& value );
4801 inline
void append (
size_t i,
size_t j, const ElementType& value,
bool check=false );
4802 inline
void finalize(
size_t j );
4809 inline
void erase(
size_t i,
size_t j );
4810 inline Iterator erase(
size_t j, Iterator pos );
4811 inline Iterator erase(
size_t j, Iterator first, Iterator last );
4813 template< typename Pred >
4814 inline
void erase( Pred predicate );
4816 template< typename Pred >
4817 inline
void erase(
size_t j, Iterator first, Iterator last, Pred predicate );
4824 inline Iterator find (
size_t i,
size_t j );
4825 inline ConstIterator find (
size_t i,
size_t j ) const;
4826 inline Iterator lowerBound(
size_t i,
size_t j );
4827 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
4828 inline Iterator upperBound(
size_t i,
size_t j );
4829 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
4836 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4837 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4839 inline
bool canSMPAssign() const noexcept;
4888 template< typename MT
4889 , typename... CCAs >
4890 template< typename... RCAs >
4891 inline Columns<MT,false,false,true,CCAs...>::Columns( MT& matrix, RCAs... args )
4892 : DataType( args... )
4893 , matrix_ ( matrix )
4896 for(
size_t j=0UL; j<
columns(); ++j ) {
4897 if( matrix_.columns() <= idx(j) ) {
4926 template<
typename MT
4927 ,
typename... CCAs >
4928 inline typename Columns<MT,
false,
false,
true,CCAs...>::Reference
4929 Columns<MT,false,false,true,CCAs...>::operator()(
size_t i,
size_t j )
4934 return matrix_(idx(j),i);
4951 template<
typename MT
4952 ,
typename... CCAs >
4953 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstReference
4954 Columns<MT,false,false,true,CCAs...>::operator()(
size_t i,
size_t j )
const 4959 return const_cast<const MT&>( matrix_ )(idx(j),i);
4977 template<
typename MT
4978 ,
typename... CCAs >
4979 inline typename Columns<MT,
false,
false,
true,CCAs...>::Reference
4980 Columns<MT,false,false,true,CCAs...>::at(
size_t i,
size_t j )
4988 return (*
this)(i,j);
5006 template<
typename MT
5007 ,
typename... CCAs >
5008 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstReference
5009 Columns<MT,false,false,true,CCAs...>::at(
size_t i,
size_t j )
const 5017 return (*
this)(i,j);
5032 template<
typename MT
5033 ,
typename... CCAs >
5034 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5039 return matrix_.begin( idx(j) );
5054 template<
typename MT
5055 ,
typename... CCAs >
5056 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstIterator
5061 return matrix_.cbegin( idx(j) );
5076 template<
typename MT
5077 ,
typename... CCAs >
5078 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstIterator
5083 return matrix_.cbegin( idx(j) );
5098 template<
typename MT
5099 ,
typename... CCAs >
5100 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5105 return matrix_.end( idx(j) );
5120 template<
typename MT
5121 ,
typename... CCAs >
5122 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstIterator
5127 return matrix_.cend( idx(j) );
5142 template<
typename MT
5143 ,
typename... CCAs >
5144 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstIterator
5149 return matrix_.cend( idx(j) );
5169 template<
typename MT
5170 ,
typename... CCAs >
5171 inline MT& Columns<MT,false,false,true,CCAs...>::operand() noexcept
5185 template<
typename MT
5186 ,
typename... CCAs >
5187 inline const MT& Columns<MT,false,false,true,CCAs...>::operand() const noexcept
5201 template<
typename MT
5202 ,
typename... CCAs >
5205 return matrix_.rows();
5217 template<
typename MT
5218 ,
typename... CCAs >
5221 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
5236 template<
typename MT
5237 ,
typename... CCAs >
5242 return matrix_.capacity( idx(j) );
5254 template<
typename MT
5255 ,
typename... CCAs >
5258 size_t nonzeros( 0UL );
5260 for(
size_t j=0UL; j<
columns(); ++j )
5278 template<
typename MT
5279 ,
typename... CCAs >
5284 return matrix_.nonZeros( idx(j) );
5296 template<
typename MT
5297 ,
typename... CCAs >
5300 for(
size_t j=0UL; j<
columns(); ++j ) {
5301 matrix_.reset( idx(j) );
5318 template<
typename MT
5319 ,
typename... CCAs >
5322 matrix_.reset( idx(j) );
5339 template<
typename MT
5340 ,
typename... CCAs >
5341 inline void Columns<MT,false,false,true,CCAs...>::reserve(
size_t nonzeros )
5343 const size_t current(
capacity() );
5345 if( nonzeros > current ) {
5346 matrix_.reserve( matrix_.capacity() + nonzeros - current );
5365 template<
typename MT
5366 ,
typename... CCAs >
5367 void Columns<MT,false,false,true,CCAs...>::reserve(
size_t j,
size_t nonzeros )
5369 matrix_.reserve( idx(j), nonzeros );
5385 template<
typename MT
5386 ,
typename... CCAs >
5387 void Columns<MT,false,false,true,CCAs...>::trim()
5389 for(
size_t j=0UL; j<
columns(); ++j ) {
5408 template<
typename MT
5409 ,
typename... CCAs >
5410 void Columns<MT,false,false,true,CCAs...>::trim(
size_t j )
5414 matrix_.trim( idx(j) );
5441 template<
typename MT
5442 ,
typename... CCAs >
5443 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5446 return matrix_.set( idx(j), i, value );
5466 template<
typename MT
5467 ,
typename... CCAs >
5468 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5469 Columns<MT,false,false,true,CCAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
5471 return matrix_.insert( idx(j), i, value );
5521 template<
typename MT
5522 ,
typename... CCAs >
5523 inline void Columns<MT,false,false,true,CCAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
5525 if( !check || !isDefault<strict>( value ) )
5526 matrix_.insert( idx(j), i, value );
5546 template<
typename MT
5547 ,
typename... CCAs >
5548 inline void Columns<MT,false,false,true,CCAs...>::finalize(
size_t j )
5576 template<
typename MT
5577 ,
typename... CCAs >
5578 inline void Columns<MT,false,false,true,CCAs...>::erase(
size_t i,
size_t j )
5583 matrix_.erase( idx(j), i );
5599 template<
typename MT
5600 ,
typename... CCAs >
5601 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5602 Columns<MT,false,false,true,CCAs...>::erase(
size_t j, Iterator pos )
5606 return matrix_.erase( idx(j), pos );
5623 template<
typename MT
5624 ,
typename... CCAs >
5625 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5626 Columns<MT,false,false,true,CCAs...>::erase(
size_t j, Iterator first, Iterator last )
5630 return matrix_.erase( idx(j), first, last );
5659 template<
typename MT
5660 ,
typename... CCAs >
5661 template<
typename Pred >
5662 inline void Columns<MT,false,false,true,CCAs...>::erase( Pred predicate )
5664 for(
size_t j=0UL; j<
columns(); ++j ) {
5665 matrix_.erase( idx(j),
begin(j),
end(j), predicate );
5699 template<
typename MT
5700 ,
typename... CCAs >
5701 template<
typename Pred >
5702 inline void Columns<MT,false,false,true,CCAs...>::erase(
size_t j, Iterator first, Iterator last, Pred predicate )
5706 matrix_.erase( idx(j), first, last, predicate );
5735 template<
typename MT
5736 ,
typename... CCAs >
5737 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5738 Columns<MT,false,false,true,CCAs...>::find(
size_t i,
size_t j )
5740 return matrix_.find( idx(j), i );
5761 template<
typename MT
5762 ,
typename... CCAs >
5763 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstIterator
5764 Columns<MT,false,false,true,CCAs...>::find(
size_t i,
size_t j )
const 5766 return matrix_.find( idx(j), i );
5786 template<
typename MT
5787 ,
typename... CCAs >
5788 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5789 Columns<MT,false,false,true,CCAs...>::lowerBound(
size_t i,
size_t j )
5791 return matrix_.lowerBound( idx(j), i );
5811 template<
typename MT
5812 ,
typename... CCAs >
5813 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstIterator
5814 Columns<MT,false,false,true,CCAs...>::lowerBound(
size_t i,
size_t j )
const 5816 return matrix_.lowerBound( idx(j), i );
5836 template<
typename MT
5837 ,
typename... CCAs >
5838 inline typename Columns<MT,
false,
false,
true,CCAs...>::Iterator
5839 Columns<MT,false,false,true,CCAs...>::upperBound(
size_t i,
size_t j )
5841 return matrix_.upperBound( idx(j), i );
5861 template<
typename MT
5862 ,
typename... CCAs >
5863 inline typename Columns<MT,
false,
false,
true,CCAs...>::ConstIterator
5864 Columns<MT,false,false,true,CCAs...>::upperBound(
size_t i,
size_t j )
const 5866 return matrix_.upperBound( idx(j), i );
5891 template<
typename MT
5892 ,
typename... CCAs >
5893 template<
typename Other >
5894 inline bool Columns<MT,false,false,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
5896 return matrix_.isAliased( alias );
5913 template<
typename MT
5914 ,
typename... CCAs >
5915 template<
typename Other >
5916 inline bool Columns<MT,false,false,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
5918 return matrix_.isAliased( alias );
5935 template<
typename MT
5936 ,
typename... CCAs >
5937 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:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
Header file for the implementation of the Columns base template.
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,...
Definition: Assert.h:117
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
Header file for the View base class.
Header file for the IsSparseMatrix type trait.
#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
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
#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....
Definition: Submatrix.h:81
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
#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
Header file for the MAYBE_UNUSED function template.
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#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
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.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
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:482
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:416
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.
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:1361
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
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:9091
#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
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#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
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:138
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the SparseElement base class.
Constraint on the data type.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
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:438
#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
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:558
#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,...
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.
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:133
#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,...
Definition: Reference.h:79
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
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:808
#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.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
Header file for the implementation of the ColumnsData class template.
Header file for the IsComputation type trait class.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
auto operator *=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:494
#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,...
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
Header file for the IsUpper 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,...
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
constexpr bool IsSparseMatrix_v
Auxiliary variable template for the IsSparseMatrix type trait.The IsSparseMatrix_v variable template ...
Definition: IsSparseMatrix.h:138
Header file for the IsExpression type trait class.
Constraint on the data type.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825