35 #ifndef _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
36 #define _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
75 class SparseMatrixProxy :
public SparseMatrix< PT, IsColumnMajorMatrix<MT>::value >
93 enum :
bool { smpAssignable = MT::smpAssignable };
99 inline Reference
operator()(
size_t i,
size_t j )
const;
100 inline Reference
at(
size_t i,
size_t j )
const;
102 inline Iterator
begin (
size_t i )
const;
103 inline ConstIterator
cbegin(
size_t i )
const;
104 inline Iterator
end (
size_t i )
const;
105 inline ConstIterator
cend (
size_t i )
const;
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 Iterator
set(
size_t i,
size_t j,
const ElementType& value )
const;
122 inline Iterator
insert(
size_t i,
size_t j,
const ElementType& value )
const;
123 inline void append(
size_t i,
size_t j,
const ElementType& value,
bool check=
false )
const;
124 inline void finalize(
size_t i )
const;
125 inline void erase(
size_t i,
size_t j )
const;
126 inline Iterator
erase(
size_t i, Iterator pos )
const;
127 inline Iterator
erase(
size_t i, Iterator first, Iterator last )
const;
128 inline void resize(
size_t m,
size_t n,
bool preserve=
true )
const;
129 inline void reserve(
size_t n )
const;
130 inline void reserve(
size_t i,
size_t n )
const;
131 inline void trim()
const;
132 inline void trim(
size_t i )
const;
136 template<
typename Other >
inline void scale(
const Other& scalar )
const;
143 inline Iterator
find (
size_t i,
size_t j )
const;
144 inline Iterator
lowerBound(
size_t i,
size_t j )
const;
145 inline Iterator
upperBound(
size_t i,
size_t j )
const;
181 template<
typename PT
186 if( (~*
this).isRestricted() ) {
190 return (~*
this).get()(i,j);
209 template<
typename PT
214 if( (~*
this).isRestricted() ) {
218 return (~*
this).get().at(i,j);
234 template<
typename PT
239 return (~*
this).get().begin(i);
255 template<
typename PT
260 return (~*
this).get().cbegin(i);
276 template<
typename PT
281 return (~*
this).get().end(i);
297 template<
typename PT
302 return (~*
this).get().cend(i);
320 template<
typename PT
324 return (~*
this).get().rows();
334 template<
typename PT
338 return (~*
this).get().columns();
348 template<
typename PT
352 return (~*
this).get().capacity();
368 template<
typename PT
372 return (~*
this).get().capacity(i);
382 template<
typename PT
386 return (~*
this).get().nonZeros();
402 template<
typename PT
406 return (~*
this).get().nonZeros(i);
418 template<
typename PT
424 reset( (~*
this).
get() );
440 template<
typename PT
446 reset( (~*
this).
get(), i );
458 template<
typename PT
464 clear( (~*
this).
get() );
483 template<
typename PT
488 if( (~*
this).isRestricted() ) {
492 return (~*
this).get().set( i, j, value );
511 template<
typename PT
516 if( (~*
this).isRestricted() ) {
520 return (~*
this).get().insert( i, j, value );
552 template<
typename PT
556 if( (~*
this).isRestricted() ) {
560 (~*
this).
get().append( i, j, value, check );
579 template<
typename PT
583 if( (~*
this).isRestricted() ) {
587 (~*
this).
get().finalize( i );
602 template<
typename PT
606 if( (~*
this).isRestricted() ) {
610 (~*
this).
get().erase( i, j );
627 template<
typename PT
632 if( (~*
this).isRestricted() ) {
636 return (~*
this).get().erase( i, pos );
654 template<
typename PT
659 if( (~*
this).isRestricted() ) {
663 return (~*
this).get().erase( i, first, last );
684 template<
typename PT
688 if( (~*
this).isRestricted() ) {
692 (~*
this).
get().resize( m, n, preserve );
708 template<
typename PT
712 if( (~*
this).isRestricted() ) {
716 (~*
this).
get().reserve( n );
736 template<
typename PT
740 if( (~*
this).isRestricted() ) {
744 (~*
this).
get().reserve( i, n );
760 template<
typename PT
764 if( (~*
this).isRestricted() ) {
768 (~*
this).
get().trim();
785 template<
typename PT
789 if( (~*
this).isRestricted() ) {
793 (~*
this).
get().trim( i );
804 template<
typename PT
808 if( (~*
this).isRestricted() ) {
812 (~*
this).
get().transpose();
823 template<
typename PT
827 if( (~*
this).isRestricted() ) {
831 (~*
this).
get().ctranspose();
843 template<
typename PT
845 template<
typename Other >
848 if( (~*
this).isRestricted() ) {
852 (~*
this).
get().scale( scalar );
880 template<
typename PT
885 return (~*
this).get().find( i, j );
905 template<
typename PT
910 return (~*
this).get().lowerBound( i, j );
930 template<
typename PT
935 return (~*
this).get().upperBound( i, j );
951 template<
typename PT,
typename MT >
955 template<
typename PT,
typename MT >
959 template<
typename PT,
typename MT >
963 template<
typename PT,
typename MT >
967 template<
typename PT,
typename MT >
970 template<
typename PT,
typename MT >
973 template<
typename PT,
typename MT >
976 template<
typename PT,
typename MT >
979 template<
typename PT,
typename MT >
982 template<
typename PT,
typename MT >
985 template<
typename PT,
typename MT >
988 template<
typename PT,
typename MT >
991 template<
typename PT,
typename MT >
994 template<
typename PT,
typename MT >
1013 template<
typename PT
1018 return proxy.begin(i);
1036 template<
typename PT
1041 return proxy.cbegin(i);
1060 template<
typename PT
1065 return proxy.end(i);
1084 template<
typename PT
1089 return proxy.cend(i);
1101 template<
typename PT
1105 return proxy.rows();
1117 template<
typename PT
1121 return proxy.columns();
1133 template<
typename PT
1137 return proxy.capacity();
1155 template<
typename PT
1159 return proxy.capacity(i);
1171 template<
typename PT
1175 return proxy.nonZeros();
1193 template<
typename PT
1197 return proxy.nonZeros(i);
1215 template<
typename PT
1218 resize_backend(
const SparseMatrixProxy<PT,MT>& proxy,
size_t m,
size_t n,
bool preserve )
1220 proxy.resize( m, n, preserve );
1240 template<
typename PT
1243 resize_backend(
const SparseMatrixProxy<PT,MT>& proxy,
size_t m,
size_t n,
bool preserve )
1249 proxy.resize( m, preserve );
1271 template<
typename PT
1275 resize_backend( proxy, m, n, preserve );
1289 template<
typename PT
1311 template<
typename PT
1329 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
Header file for auxiliary alias declarations.
Iterator set(size_t i, size_t j, const ElementType &value) const
Setting an element of the represented sparse matrix.
Definition: SparseMatrixProxy.h:486
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:554
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
Header file for basic type definitions.
Iterator insert(size_t i, size_t j, const ElementType &value) const
Inserting an element into the represented sparse matrix.
Definition: SparseMatrixProxy.h:514
size_t nonZeros() const
Returns the number of non-zero elements in the represented matrix.
Definition: SparseMatrixProxy.h:384
ResultType_< MT > ResultType
Result type for expression template evaluations.
Definition: SparseMatrixProxy.h:79
ConstReference_< MT > ConstReference
Reference to a constant matrix value.
Definition: SparseMatrixProxy.h:86
void reset() const
Reset to the default initial value.
Definition: SparseMatrixProxy.h:420
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
void erase(size_t i, size_t j) const
Erasing an element from the sparse matrix.
Definition: SparseMatrixProxy.h:604
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:533
Iterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SparseMatrixProxy.h:933
size_t capacity() const
Returns the maximum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:350
void transpose() const
In-place transpose of the represented matrix.
Definition: SparseMatrixProxy.h:806
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:300
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:384
void finalize(size_t i) const
Finalizing the element insertion of a row/column.
Definition: SparseMatrixProxy.h:581
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:908
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
Iterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SparseMatrixProxy.h:883
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:298
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:232
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
Header file for the SparseMatrix base class.
Reference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SparseMatrixProxy.h:212
Header file for the IsSquare type trait.
CompositeType_< MT > CompositeType
Data type for composite expression templates.
Definition: SparseMatrixProxy.h:84
Constraint on the data type.
void trim() const
Removing all excessive capacity from all rows/columns.
Definition: SparseMatrixProxy.h:762
Iterator begin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:237
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
void reserve(size_t n) const
Setting the minimum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:710
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
void scale(const Other &scalar) const
Scaling of the sparse matrix by the scalar value scalar ( ).
Definition: SparseMatrixProxy.h:846
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SparseMatrixProxy.h:83
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
Proxy backend for sparse matrix types.The SparseMatrixProxy class serves as a backend for the Proxy c...
Definition: Forward.h:52
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:258
typename T::Reference Reference_
Alias declaration for nested Reference type definitions.The Reference_ alias declaration provides a c...
Definition: Aliases.h:283
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
TransposeType_< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseMatrixProxy.h:81
void clear() const
Clearing the represented vector.
Definition: SparseMatrixProxy.h:460
size_t columns() const
Returns the current number of columns of the represented matrix.
Definition: SparseMatrixProxy.h:336
Reference_< MT > Reference
Reference to a non-constant matrix value.
Definition: SparseMatrixProxy.h:85
ElementType_< MT > ElementType
Type of the sparse matrix elements.
Definition: SparseMatrixProxy.h:82
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
Reference operator()(size_t i, size_t j) const
Function call operator for the direct access to matrix elements.
Definition: SparseMatrixProxy.h:184
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
typename T::Iterator Iterator_
Alias declaration for nested Iterator type definitions.The Iterator_ alias declaration provides a con...
Definition: Aliases.h:183
OppositeType_< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SparseMatrixProxy.h:80
typename T::ConstReference ConstReference_
Alias declaration for nested ConstReference type definitions.The ConstReference_ alias declaration pr...
Definition: Aliases.h:143
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
void ctranspose() const
In-place conjugate transpose of the represented matrix.
Definition: SparseMatrixProxy.h:825
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Iterator_< MT > Iterator
Iterator over non-constant elements.
Definition: SparseMatrixProxy.h:87
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:279
ConstIterator_< MT > ConstIterator
Iterator over constant elements.
Definition: SparseMatrixProxy.h:88
size_t rows() const
Returns the current number of rows of the represented matrix.
Definition: SparseMatrixProxy.h:322
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
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
void resize(size_t m, size_t n, bool preserve=true) const
Changing the size of the represented matrix.
Definition: SparseMatrixProxy.h:686