35 #ifndef _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_ 36 #define _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_ 75 class SparseMatrixProxy
76 :
public SparseMatrix< PT, IsColumnMajorMatrix_v<MT> >
113 inline size_t rows()
const;
116 inline size_t capacity(
size_t i )
const;
118 inline size_t nonZeros(
size_t i )
const;
119 inline void reset()
const;
120 inline void reset(
size_t i )
const;
121 inline void clear()
const;
122 inline void finalize(
size_t i )
const;
123 inline void resize(
size_t m,
size_t n,
bool preserve=
true )
const;
124 inline void reserve(
size_t n )
const;
125 inline void reserve(
size_t i,
size_t n )
const;
126 inline void trim()
const;
127 inline void trim(
size_t i )
const;
136 inline void append(
size_t i,
size_t j,
const ElementType& value,
bool check=
false )
const;
143 inline void erase(
size_t i,
size_t j )
const;
147 template<
typename Pred >
148 inline void erase( Pred predicate );
150 template<
typename Pred >
170 template<
typename Other >
inline void scale(
const Other& scalar )
const;
206 template<
typename PT
211 if( (~*
this).isRestricted() ) {
215 return (~*
this).get()(i,j);
234 template<
typename PT
239 if( (~*
this).isRestricted() ) {
243 return (~*
this).get().at(i,j);
259 template<
typename PT
264 return (~*
this).get().begin(i);
280 template<
typename PT
285 return (~*
this).get().cbegin(i);
301 template<
typename PT
306 return (~*
this).get().end(i);
322 template<
typename PT
327 return (~*
this).get().cend(i);
345 template<
typename PT
349 return (~*
this).get().rows();
359 template<
typename PT
363 return (~*
this).get().columns();
373 template<
typename PT
377 return (~*
this).get().capacity();
393 template<
typename PT
397 return (~*
this).get().capacity(i);
407 template<
typename PT
411 return (~*
this).get().nonZeros();
427 template<
typename PT
431 return (~*
this).get().nonZeros(i);
443 template<
typename PT
465 template<
typename PT
483 template<
typename PT
508 template<
typename PT
513 if( (~*
this).isRestricted() ) {
517 return (~*
this).get().set( i, j, value );
536 template<
typename PT
541 if( (~*
this).isRestricted() ) {
545 return (~*
this).get().insert( i, j, value );
577 template<
typename PT
581 if( (~*
this).isRestricted() ) {
585 (~*
this).
get().append( i, j, value, check );
604 template<
typename PT
608 if( (~*
this).isRestricted() ) {
612 (~*
this).
get().finalize( i );
633 template<
typename PT
637 if( (~*
this).isRestricted() ) {
641 (~*
this).
get().resize( m, n, preserve );
657 template<
typename PT
661 if( (~*
this).isRestricted() ) {
665 (~*
this).
get().reserve( n );
685 template<
typename PT
689 if( (~*
this).isRestricted() ) {
693 (~*
this).
get().reserve( i, n );
709 template<
typename PT
713 if( (~*
this).isRestricted() ) {
717 (~*
this).
get().trim();
734 template<
typename PT
738 if( (~*
this).isRestricted() ) {
742 (~*
this).
get().trim( i );
753 template<
typename PT
757 if( (~*
this).isRestricted() ) {
761 (~*
this).
get().transpose();
772 template<
typename PT
776 if( (~*
this).isRestricted() ) {
780 (~*
this).
get().ctranspose();
796 template<
typename PT
798 template<
typename Other >
801 if( (~*
this).isRestricted() ) {
805 (~*
this).
get().scale( scalar );
828 template<
typename PT
832 if( (~*
this).isRestricted() ) {
836 (~*
this).
get().erase( i, j );
853 template<
typename PT
858 if( (~*
this).isRestricted() ) {
862 return (~*
this).get().erase( i, pos );
880 template<
typename PT
885 if( (~*
this).isRestricted() ) {
889 return (~*
this).get().erase( i, first, last );
907 template<
typename PT
909 template<
typename Pred >
912 if( (~*
this).isRestricted() ) {
916 (~*
this).
get().erase( predicate );
939 template<
typename PT
941 template<
typename Pred >
944 if( (~*
this).isRestricted() ) {
948 (~*
this).
get().erase( i, first, last, predicate );
976 template<
typename PT
981 return (~*
this).get().find( i, j );
1001 template<
typename PT
1006 return (~*
this).get().lowerBound( i, j );
1026 template<
typename PT
1031 return (~*
this).get().upperBound( i, j );
1047 template<
typename PT,
typename MT >
1051 template<
typename PT,
typename MT >
1055 template<
typename PT,
typename MT >
1059 template<
typename PT,
typename MT >
1063 template<
typename PT,
typename MT >
1066 template<
typename PT,
typename MT >
1069 template<
typename PT,
typename MT >
1072 template<
typename PT,
typename MT >
1075 template<
typename PT,
typename MT >
1078 template<
typename PT,
typename MT >
1081 template<
typename PT,
typename MT >
1084 template<
typename PT,
typename MT >
1087 template<
typename PT,
typename MT >
1090 template<
typename PT,
typename MT >
1109 template<
typename PT
1114 return proxy.begin(i);
1132 template<
typename PT
1137 return proxy.cbegin(i);
1156 template<
typename PT
1161 return proxy.end(i);
1180 template<
typename PT
1185 return proxy.cend(i);
1197 template<
typename PT
1201 return proxy.rows();
1213 template<
typename PT
1217 return proxy.columns();
1229 template<
typename PT
1233 return proxy.capacity();
1251 template<
typename PT
1255 return proxy.capacity(i);
1267 template<
typename PT
1271 return proxy.nonZeros();
1289 template<
typename PT
1293 return proxy.nonZeros(i);
1311 template<
typename PT
1314 resize_backend(
const SparseMatrixProxy<PT,MT>& proxy,
size_t m,
size_t n,
bool preserve )
1316 proxy.resize( m, n, preserve );
1336 template<
typename PT
1339 resize_backend(
const SparseMatrixProxy<PT,MT>& proxy,
size_t m,
size_t n,
bool preserve )
1345 proxy.resize( m, preserve );
1367 template<
typename PT
1371 resize_backend( proxy, m, n, preserve );
1385 template<
typename PT
1407 template<
typename PT
1425 template<
typename PT
#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
size_t capacity() const
Returns the maximum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:375
Header file for auxiliary alias declarations.
Iterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SparseMatrixProxy.h:979
Iterator begin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:262
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: SparseMatrixProxy.h:84
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.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
typename T::Reference Reference_t
Alias declaration for nested Reference type definitions.The Reference_t alias declaration provides a ...
Definition: Aliases.h:330
ResultType_t< MT > ResultType
Result type for expression template evaluations.
Definition: SparseMatrixProxy.h:80
size_t nonZeros() const
Returns the number of non-zero elements in the represented matrix.
Definition: SparseMatrixProxy.h:409
OppositeType_t< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SparseMatrixProxy.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 trim() const
Removing all excessive capacity from all rows/columns.
Definition: SparseMatrixProxy.h:711
Header file for the IsColumnMajorMatrix type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
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:579
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Header file for the reset shim.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
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
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:283
void resize(size_t m, size_t n, bool preserve=true) const
Changing the size of the represented matrix.
Definition: SparseMatrixProxy.h:635
Header file for the SparseMatrix base class.
Header file for the IsSquare type trait.
void transpose() const
In-place transpose of the represented matrix.
Definition: SparseMatrixProxy.h:755
void scale(const Other &scalar) const
Scaling of the sparse matrix by the scalar value scalar ( ).
Definition: SparseMatrixProxy.h:799
Constraint on the data type.
Iterator_t< MT > Iterator
Iterator over non-constant elements.
Definition: SparseMatrixProxy.h:88
ConstReference_t< MT > ConstReference
Reference to a constant matrix value.
Definition: SparseMatrixProxy.h:87
size_t columns() const
Returns the current number of columns of the represented matrix.
Definition: SparseMatrixProxy.h:361
Header file for the DisableIf class template.
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: SparseMatrixProxy.h:94
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Iterator set(size_t i, size_t j, const ElementType &value) const
Setting an element of the represented sparse matrix.
Definition: SparseMatrixProxy.h:511
void reset() const
Reset to the default initial value.
Definition: SparseMatrixProxy.h:445
ConstIterator_t< MT > ConstIterator
Iterator over constant elements.
Definition: SparseMatrixProxy.h:89
Iterator insert(size_t i, size_t j, const ElementType &value) const
Inserting an element into the represented sparse matrix.
Definition: SparseMatrixProxy.h:539
Header file for the exception macros of the math module.
Reference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SparseMatrixProxy.h:237
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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
Proxy backend for sparse matrix types.The SparseMatrixProxy class serves as a backend for the Proxy c...
Definition: Forward.h:52
void clear() const
Clearing the represented vector.
Definition: SparseMatrixProxy.h:485
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
typename T::Iterator Iterator_t
Alias declaration for nested Iterator type definitions.The Iterator_t alias declaration provides a co...
Definition: Aliases.h:190
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
ElementType_t< MT > ElementType
Type of the sparse matrix elements.
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:304
Reference operator()(size_t i, size_t j) const
Function call operator for the direct access to matrix elements.
Definition: SparseMatrixProxy.h:209
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:325
CompositeType_t< MT > CompositeType
Data type for composite expression templates.
Definition: SparseMatrixProxy.h:85
void finalize(size_t i) const
Finalizing the element insertion of a row/column.
Definition: SparseMatrixProxy.h:606
typename T::ConstReference ConstReference_t
Alias declaration for nested ConstReference type definitions.The ConstReference_t alias declaration p...
Definition: Aliases.h:150
void erase(size_t i, size_t j) const
Erasing an element from the sparse matrix.
Definition: SparseMatrixProxy.h:830
void reserve(size_t n) const
Setting the minimum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:659
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Iterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SparseMatrixProxy.h:1029
TransposeType_t< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseMatrixProxy.h:82
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
Reference_t< MT > Reference
Reference to a non-constant matrix value.
Definition: SparseMatrixProxy.h:86
size_t rows() const
Returns the current number of rows of the represented matrix.
Definition: SparseMatrixProxy.h:347
void ctranspose() const
In-place conjugate transpose of the represented matrix.
Definition: SparseMatrixProxy.h:774
System settings for the inline keywords.
#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 clear shim.
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:1004
constexpr Type & get(StaticVector< Type, N, TF > &v) noexcept
Tuple-like index-based access the contents of a static vector.
Definition: StaticVector.h:2704