35#ifndef _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
36#define _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
74class SparseMatrixProxy
75 :
public SparseMatrix< PT, IsColumnMajorMatrix_v<MT> >
112 inline size_t rows()
const;
115 inline size_t capacity(
size_t i )
const;
117 inline size_t nonZeros(
size_t i )
const;
118 inline void reset()
const;
119 inline void reset(
size_t i )
const;
120 inline void clear()
const;
121 inline void finalize(
size_t i )
const;
122 inline void resize(
size_t m,
size_t n,
bool preserve=
true )
const;
123 inline void reserve(
size_t n )
const;
124 inline void reserve(
size_t i,
size_t n )
const;
125 inline void trim()
const;
126 inline void trim(
size_t i )
const;
135 inline void append(
size_t i,
size_t j,
const ElementType& value,
bool check=
false )
const;
142 inline void erase(
size_t i,
size_t j )
const;
146 template<
typename Pred >
147 inline void erase( Pred predicate );
149 template<
typename Pred >
169 template<
typename Other >
inline void scale(
const Other& scalar )
const;
177 SparseMatrixProxy() =
default;
178 SparseMatrixProxy(
const SparseMatrixProxy& ) =
default;
179 SparseMatrixProxy( SparseMatrixProxy&& ) =
default;
180 ~SparseMatrixProxy() =
default;
181 SparseMatrixProxy& operator=(
const SparseMatrixProxy& ) =
default;
182 SparseMatrixProxy& operator=( SparseMatrixProxy&& ) =
default;
223 if( (**this).isRestricted() ) {
227 return (**this).get()(i,j);
251 if( (**this).isRestricted() ) {
255 return (**this).get().at(i,j);
276 return (**this).get().begin(i);
297 return (**this).get().cbegin(i);
318 return (**this).get().end(i);
339 return (**this).get().cend(i);
361 return (**this).get().rows();
375 return (**this).get().columns();
389 return (**this).get().capacity();
409 return (**this).get().capacity(i);
423 return (**this).get().nonZeros();
443 return (**this).get().nonZeros(i);
461 reset( (**this).get() );
483 reset( (**this).get(), i );
501 clear( (**this).get() );
525 if( (**this).isRestricted() ) {
529 return (**this).get().set( i, j, value );
553 if( (**this).isRestricted() ) {
557 return (**this).get().insert( i, j, value );
593 if( (**this).isRestricted() ) {
597 (**this).get().append( i, j, value, check );
620 if( (**this).isRestricted() ) {
624 (**this).get().finalize( i );
649 if( (**this).isRestricted() ) {
653 (**this).get().resize( m, n, preserve );
673 if( (**this).isRestricted() ) {
677 (**this).get().reserve( n );
701 if( (**this).isRestricted() ) {
705 (**this).get().reserve( i, n );
725 if( (**this).isRestricted() ) {
729 (**this).get().trim();
750 if( (**this).isRestricted() ) {
754 (**this).get().trim( i );
769 if( (**this).isRestricted() ) {
773 (**this).get().transpose();
788 if( (**this).isRestricted() ) {
792 (**this).get().ctranspose();
810template<
typename Other >
813 if( (**this).isRestricted() ) {
817 (**this).get().scale( scalar );
844 if( (**this).isRestricted() ) {
848 (**this).get().erase( i, j );
870 if( (**this).isRestricted() ) {
874 return (**this).get().erase( i, pos );
897 if( (**this).isRestricted() ) {
901 return (**this).get().erase( i, first, last );
921template<
typename Pred >
924 if( (**this).isRestricted() ) {
928 (**this).get().erase( predicate );
953template<
typename Pred >
956 if( (**this).isRestricted() ) {
960 (**this).get().erase( i, first, last, predicate );
993 return (**this).get().find( i, j );
1013template<
typename PT
1018 return (**this).get().lowerBound( i, j );
1038template<
typename PT
1043 return (**this).get().upperBound( i, j );
1059template<
typename PT,
typename MT >
1063template<
typename PT,
typename MT >
1067template<
typename PT,
typename MT >
1071template<
typename PT,
typename MT >
1075template<
typename PT,
typename MT >
1078template<
typename PT,
typename MT >
1081template<
typename PT,
typename MT >
1084template<
typename PT,
typename MT >
1087template<
typename PT,
typename MT >
1090template<
typename PT,
typename MT >
1093template<
typename PT,
typename MT >
1096template<
typename PT,
typename MT >
1100template<
typename PT,
typename MT >
1104template<
typename PT,
typename MT >
1124template<
typename PT
1129 return proxy.
begin(i);
1147template<
typename PT
1171template<
typename PT
1176 return proxy.
end(i);
1195template<
typename PT
1200 return proxy.
cend(i);
1212template<
typename PT
1216 return proxy.
rows();
1228template<
typename PT
1244template<
typename PT
1266template<
typename PT
1282template<
typename PT
1304template<
typename PT
1326template<
typename PT
1329 resize_backend(
const SparseMatrixProxy<PT,MT>& proxy,
size_t m,
size_t n,
bool preserve )
1331 proxy.resize( m, n, preserve );
1351template<
typename PT
1360 proxy.resize( m, preserve );
1382template<
typename PT
1386 resize_backend( proxy, m, n, preserve );
1400template<
typename PT
1405 return proxy.
find( i, j );
1419template<
typename PT
1438template<
typename PT
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition Aliases.h:470
typename T::ConstReference ConstReference_t
Alias declaration for nested ConstReference type definitions.
Definition Aliases.h:170
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition Aliases.h:310
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition Aliases.h:130
typename T::Reference Reference_t
Alias declaration for nested Reference type definitions.
Definition Aliases.h:390
typename T::Iterator Iterator_t
Alias declaration for nested Iterator type definitions.
Definition Aliases.h:210
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition Aliases.h:110
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition Aliases.h:550
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition Aliases.h:450
Header file for the EnableIf class template.
Header file for the IsColumnMajorMatrix type trait.
Header file for the IsSquare type trait.
Proxy backend for sparse matrix types.
Definition SparseMatrixProxy.h:76
size_t capacity() const
Returns the maximum capacity of the represented matrix.
Definition SparseMatrixProxy.h:387
ResultType_t< MT > ResultType
Result type for expression template evaluations.
Definition SparseMatrixProxy.h:79
void erase(size_t i, size_t j) const
Erasing an element from the sparse matrix.
Definition SparseMatrixProxy.h:842
void reserve(size_t n) const
Setting the minimum capacity of the represented matrix.
Definition SparseMatrixProxy.h:671
size_t rows() const
Returns the current number of rows of the represented matrix.
Definition SparseMatrixProxy.h:359
void scale(const Other &scalar) const
Scaling of the sparse matrix by the scalar value scalar ( ).
Definition SparseMatrixProxy.h:811
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition SparseMatrixProxy.h:295
void append(size_t i, size_t j, const ElementType &value, bool check=false) const
Appending an element to the specified row/column of the sparse matrix.
Definition SparseMatrixProxy.h:591
void reset() const
Reset to the default initial value.
Definition SparseMatrixProxy.h:457
OppositeType_t< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition SparseMatrixProxy.h:80
void ctranspose() const
In-place conjugate transpose of the represented matrix.
Definition SparseMatrixProxy.h:786
Iterator begin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition SparseMatrixProxy.h:274
Iterator insert(size_t i, size_t j, const ElementType &value) const
Inserting an element into the represented sparse matrix.
Definition SparseMatrixProxy.h:551
Iterator set(size_t i, size_t j, const ElementType &value) const
Setting an element of the represented sparse matrix.
Definition SparseMatrixProxy.h:523
ElementType_t< MT > ElementType
Type of the sparse matrix elements.
Definition SparseMatrixProxy.h:82
void trim() const
Removing all excessive capacity from all rows/columns.
Definition SparseMatrixProxy.h:723
void transpose() const
In-place transpose of the represented matrix.
Definition SparseMatrixProxy.h:767
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i of the represented matrix.
Definition SparseMatrixProxy.h:337
Reference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition SparseMatrixProxy.h:249
Iterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition SparseMatrixProxy.h:1041
CompositeType_t< MT > CompositeType
Data type for composite expression templates.
Definition SparseMatrixProxy.h:84
size_t nonZeros() const
Returns the number of non-zero elements in the represented matrix.
Definition SparseMatrixProxy.h:421
Iterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition SparseMatrixProxy.h:991
Reference operator()(size_t i, size_t j) const
Function call operator for the direct access to matrix elements.
Definition SparseMatrixProxy.h:221
void finalize(size_t i) const
Finalizing the element insertion of a row/column.
Definition SparseMatrixProxy.h:618
Iterator_t< MT > Iterator
Iterator over non-constant elements.
Definition SparseMatrixProxy.h:87
void resize(size_t m, size_t n, bool preserve=true) const
Changing the size of the represented matrix.
Definition SparseMatrixProxy.h:647
Reference_t< MT > Reference
Reference to a non-constant matrix value.
Definition SparseMatrixProxy.h:85
TransposeType_t< MT > TransposeType
Transpose type for expression template evaluations.
Definition SparseMatrixProxy.h:81
ConstIterator_t< MT > ConstIterator
Iterator over constant elements.
Definition SparseMatrixProxy.h:88
Iterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition SparseMatrixProxy.h:1016
ConstReference_t< MT > ConstReference
Reference to a constant matrix value.
Definition SparseMatrixProxy.h:86
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition SparseMatrixProxy.h:83
Iterator end(size_t i) const
Returns an iterator just past the last element of row/column i of the represented matrix.
Definition SparseMatrixProxy.h:316
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition SparseMatrixProxy.h:93
void clear() const
Clearing the represented vector.
Definition SparseMatrixProxy.h:497
size_t columns() const
Returns the current number of columns of the represented matrix.
Definition SparseMatrixProxy.h:373
Constraint on the data type.
Header file for the SparseMatrix base class.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition SparseMatrix.h:61
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition Matrix.h:960
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:628
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition Matrix.h:644
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition Matrix.h:730
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:562
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition Matrix.h:806
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition Matrix.h:660
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition Matrix.h:1108
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:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition Matrix.h:518
MT::Iterator upperBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index greater than the given index.
Definition SparseMatrix.h:244
MT::Iterator lowerBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index not less than the given index.
Definition SparseMatrix.h:194
MT::Iterator find(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Searches for a specific matrix element.
Definition SparseMatrix.h:144
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:175
Header file for the exception macros of the math module.
Header file for the clear shim.
Header file for the reset shim.
System settings for the inline keywords.
Header file for basic type definitions.