35 #ifndef _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
36 #define _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
74 class SparseMatrixProxy :
public SparseMatrix< PT, IsColumnMajorMatrix<MT>::value >
92 enum { smpAssignable = MT::smpAssignable };
98 inline Reference
operator()(
size_t i,
size_t j )
const;
100 inline Iterator
begin (
size_t i )
const;
101 inline ConstIterator
cbegin(
size_t i )
const;
102 inline Iterator
end (
size_t i )
const;
103 inline ConstIterator
cend (
size_t i )
const;
110 inline size_t rows()
const;
113 inline size_t capacity(
size_t i )
const;
115 inline size_t nonZeros(
size_t i )
const;
116 inline void reset()
const;
117 inline void reset(
size_t i )
const;
118 inline void clear()
const;
119 inline Iterator
set(
size_t i,
size_t j,
const ElementType& value )
const;
120 inline Iterator
insert(
size_t i,
size_t j,
const ElementType& value )
const;
121 inline void append(
size_t i,
size_t j,
const ElementType& value,
bool check=
false )
const;
122 inline void finalize(
size_t i )
const;
123 inline void erase(
size_t i,
size_t j )
const;
124 inline Iterator
erase(
size_t i, Iterator pos )
const;
125 inline Iterator
erase(
size_t i, Iterator first, Iterator last )
const;
126 inline void resize(
size_t m,
size_t n,
bool preserve=
true )
const;
127 inline void reserve(
size_t n )
const;
128 inline void reserve(
size_t i,
size_t n )
const;
129 inline void trim()
const;
130 inline void trim(
size_t i )
const;
134 template<
typename Other >
inline void scale(
const Other& scalar )
const;
141 inline Iterator
find (
size_t i,
size_t j )
const;
142 inline Iterator
lowerBound(
size_t i,
size_t j )
const;
143 inline Iterator
upperBound(
size_t i,
size_t j )
const;
172 template<
typename PT
177 if( (~*
this).isRestricted() ) {
181 return (~*
this).get()(i,j);
197 template<
typename PT
202 return (~*
this).get().begin(i);
218 template<
typename PT
223 return (~*
this).get().cbegin(i);
239 template<
typename PT
244 return (~*
this).get().end(i);
260 template<
typename PT
265 return (~*
this).get().cend(i);
283 template<
typename PT
287 return (~*
this).get().rows();
297 template<
typename PT
301 return (~*
this).get().columns();
311 template<
typename PT
315 return (~*
this).get().capacity();
331 template<
typename PT
335 return (~*
this).get().capacity(i);
345 template<
typename PT
349 return (~*
this).get().nonZeros();
365 template<
typename PT
369 return (~*
this).get().nonZeros(i);
381 template<
typename PT
387 reset( (~*
this).
get() );
403 template<
typename PT
409 reset( (~*
this).
get(), i );
421 template<
typename PT
427 clear( (~*
this).
get() );
445 template<
typename PT
450 if( (~*
this).isRestricted() ) {
454 return (~*
this).get().set( i, j, value );
472 template<
typename PT
477 if( (~*
this).isRestricted() ) {
481 return (~*
this).get().insert( i, j, value );
512 template<
typename PT
516 if( (~*
this).isRestricted() ) {
520 (~*
this).
get().append( i, j, value, check );
538 template<
typename PT
542 if( (~*
this).isRestricted() ) {
546 (~*
this).
get().finalize( i );
560 template<
typename PT
564 if( (~*
this).isRestricted() ) {
568 (~*
this).
get().erase( i, j );
584 template<
typename PT
589 if( (~*
this).isRestricted() ) {
593 return (~*
this).get().erase( i, pos );
610 template<
typename PT
615 if( (~*
this).isRestricted() ) {
619 return (~*
this).get().erase( i, first, last );
639 template<
typename PT
643 if( (~*
this).isRestricted() ) {
647 (~*
this).
get().resize( m, n, preserve );
662 template<
typename PT
666 if( (~*
this).isRestricted() ) {
670 (~*
this).
get().reserve( n );
689 template<
typename PT
693 if( (~*
this).isRestricted() ) {
697 (~*
this).
get().reserve( i, n );
712 template<
typename PT
716 if( (~*
this).isRestricted() ) {
720 (~*
this).
get().trim();
736 template<
typename PT
740 if( (~*
this).isRestricted() ) {
744 (~*
this).
get().trim( i );
754 template<
typename PT
758 if( (~*
this).isRestricted() ) {
762 (~*
this).
get().transpose();
772 template<
typename PT
776 if( (~*
this).isRestricted() ) {
780 (~*
this).
get().ctranspose();
791 template<
typename PT
793 template<
typename Other >
796 if( (~*
this).isRestricted() ) {
800 (~*
this).
get().scale( scalar );
828 template<
typename PT
833 return (~*
this).get().find( i, j );
853 template<
typename PT
858 return (~*
this).get().lowerBound( i, j );
878 template<
typename PT
883 return (~*
this).get().upperBound( i, j );
899 template<
typename PT,
typename MT >
903 template<
typename PT,
typename MT >
907 template<
typename PT,
typename MT >
911 template<
typename PT,
typename MT >
915 template<
typename PT,
typename MT >
918 template<
typename PT,
typename MT >
921 template<
typename PT,
typename MT >
924 template<
typename PT,
typename MT >
927 template<
typename PT,
typename MT >
930 template<
typename PT,
typename MT >
933 template<
typename PT,
typename MT >
936 template<
typename PT,
typename MT >
939 template<
typename PT,
typename MT >
942 template<
typename PT,
typename MT >
961 template<
typename PT
966 return proxy.begin(i);
984 template<
typename PT
989 return proxy.cbegin(i);
1008 template<
typename PT
1013 return proxy.end(i);
1032 template<
typename PT
1037 return proxy.cend(i);
1049 template<
typename PT
1053 return proxy.rows();
1065 template<
typename PT
1069 return proxy.columns();
1081 template<
typename PT
1085 return proxy.capacity();
1103 template<
typename PT
1107 return proxy.capacity(i);
1119 template<
typename PT
1123 return proxy.nonZeros();
1141 template<
typename PT
1145 return proxy.nonZeros(i);
1163 template<
typename PT
1166 resize_backend(
const SparseMatrixProxy<PT,MT>& proxy,
size_t m,
size_t n,
bool preserve )
1168 proxy.resize( m, n, preserve );
1188 template<
typename PT
1191 resize_backend(
const SparseMatrixProxy<PT,MT>& proxy,
size_t m,
size_t n,
bool preserve )
1197 proxy.resize( m, preserve );
1219 template<
typename PT
1223 resize_backend( proxy, m, n, preserve );
1237 template<
typename PT
1259 template<
typename PT
1277 template<
typename PT
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Iterator set(size_t i, size_t j, const ElementType &value) const
Setting an element of the represented sparse matrix.
Definition: SparseMatrixProxy.h:448
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:514
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:475
size_t nonZeros() const
Returns the number of non-zero elements in the represented matrix.
Definition: SparseMatrixProxy.h:347
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:229
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:292
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:250
MT::Iterator Iterator
Iterator over non-constant elements.
Definition: SparseMatrixProxy.h:86
void reset() const
Reset to the default initial value.
Definition: SparseMatrixProxy.h:383
void erase(size_t i, size_t j) const
Erasing an element from the sparse matrix.
Definition: SparseMatrixProxy.h:562
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:507
Iterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SparseMatrixProxy.h:881
size_t capacity() const
Returns the maximum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:313
void transpose() const
In-place transpose of the represented matrix.
Definition: SparseMatrixProxy.h:756
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
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:263
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:378
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseMatrixProxy.h:82
void finalize(size_t i) const
Finalizing the element insertion of a row/column.
Definition: SparseMatrixProxy.h:540
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:856
MT::Reference Reference
Reference to a non-constant matrix value.
Definition: SparseMatrixProxy.h:84
Iterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SparseMatrixProxy.h:831
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
MT::ResultType ResultType
Result type for expression template evaluations.
Definition: SparseMatrixProxy.h:78
Header file for the SparseMatrix base class.
Header file for the IsSquare type trait.
Constraint on the data type.
void trim() const
Removing all excessive capacity from all rows/columns.
Definition: SparseMatrixProxy.h:714
Iterator begin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:200
void reserve(size_t n) const
Setting the minimum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:664
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:2592
MT::ConstReference ConstReference
Reference to a constant matrix value.
Definition: SparseMatrixProxy.h:85
MT::ElementType ElementType
Type of the sparse matrix elements.
Definition: SparseMatrixProxy.h:81
void scale(const Other &scalar) const
Scaling of the sparse matrix by the scalar value scalar ( ).
Definition: SparseMatrixProxy.h:794
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
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:187
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:532
Proxy backend for sparse matrix types.The SparseMatrixProxy class serves as a backend for the Proxy c...
Definition: Forward.h:52
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:221
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
void clear() const
Clearing the represented vector.
Definition: SparseMatrixProxy.h:423
size_t columns() const
Returns the current number of columns of the represented matrix.
Definition: SparseMatrixProxy.h:299
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SparseMatrixProxy.h:87
Reference operator()(size_t i, size_t j) const
Function call operator for the direct access to matrix elements.
Definition: SparseMatrixProxy.h:175
MT::CompositeType CompositeType
Data type for composite expression templates.
Definition: SparseMatrixProxy.h:83
void ctranspose() const
In-place conjugate transpose of the represented matrix.
Definition: SparseMatrixProxy.h:774
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:242
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SparseMatrixProxy.h:79
size_t rows() const
Returns the current number of rows of the represented matrix.
Definition: SparseMatrixProxy.h:285
MT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseMatrixProxy.h:80
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Header file for exception macros.
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:79
void resize(size_t m, size_t n, bool preserve=true) const
Changing the size of the represented matrix.
Definition: SparseMatrixProxy.h:641