GammaLib 2.0.0
Loading...
Searching...
No Matches
GMatrixSparse.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GMatrixSparse.hpp - Sparse matrix class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2006-2020 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- *
6 * *
7 * This program is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file GMatrixSparse.hpp
23 * @brief Sparse matrix class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GMATRIXSPARSE_HPP
28#define GMATRIXSPARSE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GMatrixBase.hpp"
33
34/* __ Definitions ________________________________________________________ */
35#define G_SPARSE_MATRIX_DEFAULT_MEM_BLOCK 512 // Default Memory block size
36#define G_SPARSE_MATRIX_DEFAULT_STACK_ENTRIES 1000 // Max # of stack entries
37#define G_SPARSE_MATRIX_DEFAULT_STACK_SIZE 512 // Max # of stack elements
38
39/* __ Forward declarations _______________________________________________ */
40class GMatrix;
42class GMatrixSparse;
43class GVector;
44class GSparseSymbolic;
45class GSparseNumeric;
46
47
48/***********************************************************************//**
49 * @class GMatrixSparse
50 *
51 * @brief Sparse matrix class interface definition
52 *
53 * This class implements a sparse matrix. The class only stores non-zero
54 * elements, which can considerably reduce the memory requirements for large
55 * systems that are sparsely filled. Also the computations will be faster
56 * because only non-zero elements will be used in the operations.
57 *
58 * For a description of the common matrix methods, please refer to the
59 * GMatrixBase class.
60 *
61 * The class has been inspired from the code CSparse that can be downloaded
62 * from http://www.cise.ufl.edu/research/sparse/CSparse/ which has been
63 * written by Timothy A. Davis to accompany his book "Direct Methods for
64 * Sparse Linear Systems". In the CSparse code, a sparse matrix is
65 * implemented by the structure cs_sparse. The members of this
66 * structure map as follows to the members of the GMatrixSparse class:
67 *
68 * <table border>
69 * <tr>
70 * <td><b>CSparse</b></td>
71 * <td><b>GMatrixSparse</b></td>
72 * <td><b>Dimension</b></td>
73 * <td><b>Description</b></td>
74 * </tr>
75 * <tr>
76 * <td>nzmax</td>
77 * <td>m_elements</td>
78 * <td>n.a.</td>
79 * <td>Maximum number of entries</td>
80 * </tr>
81 * <tr>
82 * <td>m</td>
83 * <td>m_rows</td>
84 * <td>n.a.</td>
85 * <td>Number of rows</td>
86 * </tr>
87 * <tr>
88 * <td>n</td>
89 * <td>m_cols</td>
90 * <td>n.a.</td>
91 * <td>Number of columns</td>
92 * </tr>
93 * <tr>
94 * <td>*p</td>
95 * <td>*m_colstart</td>
96 * <td>m_cols+1</td>
97 * <td>Column pointers (index of first element of each column in
98 * m_data array)</td>
99 * </tr>
100 * <tr>
101 * <td>*i</td>
102 * <td>*m_rowinx</td>
103 * <td>m_elements</td>
104 * <td>Row indices for all non-zero elements</td>
105 * </tr>
106 * <tr>
107 * <td>*x</td>
108 * <td>*m_data</td>
109 * <td>m_elements</td>
110 * <td>Numerical values of all non-zero elements</td>
111 * </tr>
112 * </table>
113 *
114 * Matrix allocation is done using the constructors
115 *
116 * GMatrixSparse sparsematrix(rows, columns);
117 * GMatrixSparse sparsematrix(rows, columns, elements);
118 * GMatrixSparse sparsematrix(matrix);
119 * GMatrixSparse sparsematrix(sparsematrix);
120 * GMatrixSparse sparsematrix(symmetricmatrix);
121 *
122 * where @p rows and @p columns specify the number of rows and columns of
123 * the matrix and @p elements is the size of the memory that should be
124 * pre-allocated for matrix storage (optional). Storage conversion
125 * constructors exist that allow allocating a sparse matrix by copying from
126 * a general matrix of type GMatrix and a symmetric matrix of type
127 * GMatrixSymmetric.
128 *
129 * Because the location of a specific matrix element is not necessarily known
130 * in advance, the class implements a so called pending element for matrix
131 * element setting. A pending element is an element that is scheduled for
132 * insertion in the matrix, but which has not yet been inserted. The matrix
133 * element access operators () and at() return the reference to this pending
134 * element if a memory location for a given row and column does not yet
135 * exist. The protected method fill_pending() is then called before all
136 * operations that are done on the matrix to insert the element before the
137 * operation is executed.
138 *
139 * Another mechanism that has been implemented to speed up the fill of the
140 * sparse matrix is a "fill stack" that is used for insertion or addition
141 * of matrix columns by the
142 *
143 * matrix.column(index, vector);
144 * matrix.column(index, values, rows, number);
145 * matrix.add_to_column(index, vector);
146 * matrix.add_to_column(index, values, rows, number);
147 *
148 * methods. The fill stack is a buffer that implements a queue for columns
149 * that are to be inserted into the matrix. This is more efficient than
150 * insertion of elements one by one, as every insertion of an element may
151 * require to shift all elements back by one memory location.
152 *
153 * The fill stack is used as follows:
154 *
155 * matrix.stack_init(size, entries);
156 * ...
157 * matrix.column(index, vector); // (or one of the other column methods)
158 * ...
159 * matrix.stack_flush();
160 * ...
161 * matrix.stack_destroy();
162 *
163 * The stack_init(size, entries) method initialises the fill stack, where
164 * @p size is the size of the allocated memory buffer and @p entries is the
165 * maximum number of entries (i.e. columns) that will be held by the buffer.
166 * If @p size is set to 0 (the default value), a default @p size value of
167 * 512 is used. If @p entries is set to 0 (the default value), the number of
168 * matrix columns is taken as default @p entries value. Note that a too large
169 * number of elements will produce some overhead due to fill stack
170 * management, hence @p entries should not exceed a value of the order of
171 * 10-100.
172 *
173 * The stack_flush() method flushes the stack, which is mandatory before any
174 * usage of the matrix. Note that the fill stack IS NOT INSERTED AUTOMATICALLY
175 * before any matrix operation, hence manual stack flushing is needed to make
176 * all filled matrix elements available for usage. The stack_destroy() method
177 * will flush the stack and free all stack elements. This method
178 * should be called once no filling is required anymore. If stack_destroy()
179 * is called immediately after filling, no call to stack_flush() is needed as
180 * the stack_destroy() method flushes the stack before destroying it. The
181 * matrix stack is also destroyed by the sparse matrix destructor, hence
182 * manual stack destruction is not mandatory.
183 *
184 * Except for *m_rowinx which is implemented on the level of GMatrixSparse,
185 * all other members are implemented by the base class GMatrixBase.
186 ***************************************************************************/
188
189 // Friend classes
190 friend class GSparseSymbolic;
191 friend class GSparseNumeric;
192
193 // Some friend functions that we should not expose ... but I don't
194 // know what to do with them as they are also needed by GSparseSymbolic,
195 // yet they have to access low-level stuff from the matrix class, hence
196 // they need to be friends ...
197 friend GMatrixSparse cs_symperm(const GMatrixSparse& matrix, const int* pinv);
198 friend GMatrixSparse cs_transpose(const GMatrixSparse& matrix, int values);
199 friend double cs_cumsum(int* p, int* c, int n);
200
201public:
202 // Constructors and destructors
203 GMatrixSparse(void);
204 explicit GMatrixSparse(const int& rows, const int& columns,
205 const int& elements = 0);
206 GMatrixSparse(const GMatrix& matrix);
207 GMatrixSparse(const GMatrixSparse& matrix);
208 GMatrixSparse(const GMatrixSymmetric& matrix);
209 virtual ~GMatrixSparse(void);
210
211 // Implemented pure virtual base class operators
212 virtual double& operator()(const int& row, const int& column);
213 virtual const double& operator()(const int& row, const int& column) const;
214 virtual GVector operator*(const GVector& vector) const;
215
216 // Overloaded virtual base class operators
217 virtual bool operator==(const GMatrixSparse& matrix) const;
218 virtual bool operator!=(const GMatrixSparse& matrix) const;
219
220 // Other operators
221 virtual GMatrixSparse& operator=(const GMatrixSparse& matrix);
222 virtual GMatrixSparse& operator=(const double& value);
223 virtual GMatrixSparse operator+(const GMatrixSparse& matrix) const;
224 virtual GMatrixSparse operator+(const double& scalar) const;
225 virtual GMatrixSparse operator-(const GMatrixSparse& matrix) const;
226 virtual GMatrixSparse operator-(const double& scalar) const;
227 virtual GMatrixSparse operator*(const GMatrixSparse& matrix) const;
228 virtual GMatrixSparse operator-(void) const;
229 virtual GMatrixSparse& operator+=(const GMatrixSparse& matrix);
230 virtual GMatrixSparse& operator+=(const double& scalar);
231 virtual GMatrixSparse& operator-=(const GMatrixSparse& matrix);
232 virtual GMatrixSparse& operator-=(const double& scalar);
233 virtual GMatrixSparse& operator*=(const GMatrixSparse& matrix);
234 virtual GMatrixSparse& operator*=(const double& scalar);
235 virtual GMatrixSparse& operator/=(const double& scalar);
236
237 // Implemented pure virtual base class methods
238 virtual void clear(void);
239 virtual GMatrixSparse* clone(void) const;
240 virtual std::string classname(void) const;
241 virtual double& at(const int& row, const int& column);
242 virtual const double& at(const int& row, const int& column) const;
243 virtual GVector row(const int& row) const;
244 virtual void row(const int& row, const GVector& vector);
245 virtual GVector column(const int& column) const;
246 virtual void column(const int& column, const GVector& vector);
247 virtual void add_to_row(const int& row, const GVector& vector);
248 virtual void add_to_column(const int& column, const GVector& vector);
249 virtual double fill(void) const;
250 virtual double min(void) const;
251 virtual double max(void) const;
252 virtual double sum(void) const;
253 virtual std::string print(const GChatter& chatter = NORMAL) const;
254
255 // Other methods
256 void column(const int& column, const double* values,
257 const int* rows, int number);
258 void add_to_column(const int& column, const double* values,
259 const int* rows, int number);
260 GMatrixSparse transpose(void) const;
261 GMatrixSparse invert(void) const;
262 GVector solve(const GVector& vector) const;
263 GMatrixSparse abs(void) const;
264 GMatrixSparse cholesky_decompose(const bool& compress = true) const;
265 GVector cholesky_solver(const GVector& vector, const bool& compress = true) const;
266 GMatrixSparse cholesky_invert(const bool& compress = true) const;
267 void set_mem_block(const int& block);
268 void stack_init(const int& size = 0, const int& entries = 0);
269 int stack_push_column(const GVector& vector, const int& col);
270 int stack_push_column(const double* values, const int* rows,
271 const int& number, const int& col);
272 void stack_flush(void);
273 void stack_destroy(void);
274
275private:
276 // Private methods
277 void init_members(void);
278 void copy_members(const GMatrixSparse& m);
279 void free_members(void);
280 void alloc_members(const int& rows, const int& cols, const int& elements = 0);
281 void init_stack_members(void);
282 void free_stack_members(void);
283 int get_index(const int& row, const int& column) const;
284 void fill_pending(void);
285 void alloc_elements(int start, const int& num);
286 void free_elements(const int& start, const int& num);
287 void remove_zero_row_col(void);
288 void insert_zero_row_col(const int& rows, const int& cols);
289 void mix_column_prepare(const int* src1_row, int src1_num,
290 const int* src2_row, int src2_num,
291 int* num_1, int* num_2, int* num_mix);
292 void mix_column(const double* src1_data, const int* src1_row, int src1_num,
293 const double* src2_data, const int* src2_row, int src2_num,
294 double* dst_data, int* dst_row, int* dst_num);
295 void insert_row(const int& row, const GVector& vector, const bool& add);
296
297 // Private data members
298 int* m_rowinx; //!< Row-indices of all elements
299 double m_zero; //!< The zero element (needed for data access)
300 double m_fill_val; //!< Element to be filled
301 int m_fill_row; //!< Row into which element needs to be filled
302 int m_fill_col; //!< Column into which element needs to be filled
303 int m_mem_block; //!< Memory block to be allocated at once
304 GSparseSymbolic* m_symbolic; //!< Holds GSparseSymbolic object after decomposition
305 GSparseNumeric* m_numeric; //!< Holds GSparseNumeric object after decomposition
306
307 // Fill-stack
308 int m_stack_max_entries; //!< Maximum number of entries in the stack
309 int m_stack_size; //!< Maximum number of elements in the stack
310 int m_stack_entries; //!< Number of entries in the stack
311 int* m_stack_colinx; //!< Column index for each entry [m_stack_entries]
312 int* m_stack_start; //!< Start in stack for each entry [m_stack_entries+1]
313 double* m_stack_data; //!< Stack data [m_stack_size]
314 int* m_stack_rowinx; //!< Stack row indices [m_stack_size]
315 int* m_stack_work; //!< Stack flush integer working array [m_cols]
316 int* m_stack_rows; //!< Stack push integer working array [m_cols]
317 double* m_stack_values; //!< Stack push double buffer [m_cols]
318};
319
320
321/***********************************************************************//**
322 * @brief Return class name
323 *
324 * @return String containing the class name ("GMatrixSparse").
325 ***************************************************************************/
326inline
327std::string GMatrixSparse::classname(void) const
328{
329 return ("GMatrixSparse");
330}
331
332
333/***********************************************************************//**
334 * @brief Set memory block size
335 *
336 * @param[in] block Memory block size.
337 *
338 * Sets the size of the memory block that will be allocated at once.
339 ***************************************************************************/
340inline
341void GMatrixSparse::set_mem_block(const int& block)
342{
343 m_mem_block = (block > 0) ? block : 1;
344 return;
345}
346
347
348/***********************************************************************//**
349 * @brief Binary matrix addition
350 *
351 * @param[in] matrix Matrix.
352 * @return Result of matrix addition.
353 *
354 * Returns the sum of two matrices. The method makes use of the unary
355 * addition operator.
356 ***************************************************************************/
357inline
359{
360 GMatrixSparse result = *this;
361 result += matrix;
362 return result;
363}
364
365
366/***********************************************************************//**
367 * @brief Binary matrix scalar addition
368 *
369 * @param[in] scalar Scalar.
370 * @return Matrix with @p scalar added.
371 *
372 * Returns a matrix where a @p scalar has been added to each matrix element.
373 ***************************************************************************/
374inline
375GMatrixSparse GMatrixSparse::operator+(const double& scalar) const
376{
377 GMatrixSparse result = *this;
378 result += scalar;
379 return result;
380}
381
382
383/***********************************************************************//**
384 * @brief Binary matrix subtraction
385 *
386 * @param[in] matrix Matrix.
387 * @return Result of matrix subtraction.
388 *
389 * Returns the difference between two matrices. The method makes use of the
390 * unary subtraction operator.
391 ***************************************************************************/
392inline
394{
395 GMatrixSparse result = *this;
396 result -= matrix;
397 return result;
398}
399
400
401/***********************************************************************//**
402 * @brief Binary matrix scalar subtraction
403 *
404 * @param[in] scalar Scalar.
405 * @return Matrix with @p scalar subtracted.
406 *
407 * Returns a matrix where a @p scalar has been subtracted from each matrix
408 * element.
409 ***************************************************************************/
410inline
411GMatrixSparse GMatrixSparse::operator-(const double& scalar) const
412{
413 GMatrixSparse result = *this;
414 result -= scalar;
415 return result;
416}
417
418
419/***********************************************************************//**
420 * @brief Binary matrix multiplication
421 *
422 * @param[in] matrix Matrix.
423 * @return Result of matrix multiplication.
424 *
425 * Returns the product of two matrices. The method makes use of the unary
426 * multiplication operator.
427 ***************************************************************************/
428inline
430{
431 GMatrixSparse result = *this;
432 result *= matrix;
433 return result;
434}
435
436
437/***********************************************************************//**
438 * @brief Scale matrix elements
439 *
440 * @param[in] scalar Scale factor.
441 * @return Matrix with elements multiplied by @p scalar.
442 *
443 * Returns a matrix where all elements have been multiplied by the specified
444 * @p scalar value.
445 ***************************************************************************/
446inline
448{
449 fill_pending();
450 scale_elements(scalar);
451 return *this;
452}
453
454
455/***********************************************************************//**
456 * @brief Divide matrix elements
457 *
458 * @param[in] scalar Scalar.
459 * @return Matrix with elements divided by @p scalar.
460 *
461 * Returns a matrix where all elements have been divided by the specified
462 * @p scalar value.
463 ***************************************************************************/
464inline
466{
467 *this *= 1.0/scalar;
468 return *this;
469}
470
471
472/***********************************************************************//**
473 * @brief Multiply matrix by scalar
474 *
475 * @param[in] matrix Matrix.
476 * @param[in] scalar Scalar.
477 * @return Matrix divided by @p scalar.
478 ***************************************************************************/
479inline
480GMatrixSparse operator*(const GMatrixSparse& matrix, const double& scalar)
481{
482 GMatrixSparse result = matrix;
483 //result.fill_pending();
484 result *= scalar;
485 return result;
486}
487
488
489/***********************************************************************//**
490 * @brief Multiply matrix by scalar
491 *
492 * @param[in] scalar Scalar.
493 * @param[in] matrix Matrix.
494 * @return Matrix divided by @p scalar.
495 ***************************************************************************/
496inline
497GMatrixSparse operator*(const double& scalar, const GMatrixSparse& matrix)
498{
499 GMatrixSparse result = matrix;
500 //result.fill_pending();
501 result *= scalar;
502 return result;
503}
504
505
506/***********************************************************************//**
507 * @brief Divide matrix by scalar
508 *
509 * @param[in] matrix Matrix.
510 * @param[in] scalar Scalar.
511 * @return Matrix divided by @p scalar.
512 ***************************************************************************/
513inline
514GMatrixSparse operator/(const GMatrixSparse& matrix, const double& scalar)
515{
516 GMatrixSparse result = matrix;
517 //result.fill_pending();
518 result /= scalar;
519 return result;
520}
521
522#endif /* GMATRIXSPARSE_HPP */
Abstract matrix base class definition.
GMatrixSparse operator*(const GMatrixSparse &matrix, const double &scalar)
Multiply matrix by scalar.
GMatrixSparse operator/(const GMatrixSparse &matrix, const double &scalar)
Divide matrix by scalar.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Abstract matrix base class interface definition.
void scale_elements(const double &scalar)
Scale all matrix elements with a scalar.
const int & rows(void) const
Return number of matrix rows.
const int & size(void) const
Return number of matrix elements.
const int & columns(void) const
Return number of matrix columns.
Sparse matrix class interface definition.
virtual GVector column(const int &column) const
Extract column as vector from matrix.
GMatrixSparse transpose(void) const
Return transposed matrix.
void stack_destroy(void)
Destroy matrix stack.
virtual void add_to_column(const int &column, const GVector &vector)
Add vector column into matrix.
virtual void clear(void)
Clear matrix.
void stack_init(const int &size=0, const int &entries=0)
Initialises matrix filling stack.
virtual GMatrixSparse * clone(void) const
Clone matrix.
void free_members(void)
Delete class members.
GSparseSymbolic * m_symbolic
Holds GSparseSymbolic object after decomposition.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print matrix.
virtual ~GMatrixSparse(void)
Destructor.
GMatrixSparse abs(void) const
Return absolute of matrix.
void init_members(void)
Initialise class mambers.
void insert_zero_row_col(const int &rows, const int &cols)
Insert zero rows and columns.
GMatrixSparse cholesky_invert(const bool &compress=true) const
Invert matrix using a Cholesky decomposition.
virtual double fill(void) const
Returns fill of matrix.
void init_stack_members(void)
Initialise fill stack.
void remove_zero_row_col(void)
Remove rows and columns with zeros.
GMatrixSparse invert(void) const
Return inverted matrix.
friend GMatrixSparse cs_transpose(const GMatrixSparse &matrix, int values)
int m_mem_block
Memory block to be allocated at once.
virtual GMatrixSparse & operator+=(const GMatrixSparse &matrix)
Unary matrix addition operator.
virtual bool operator!=(const GMatrixSparse &matrix) const
Non-equality operator.
GMatrixSparse cholesky_decompose(const bool &compress=true) const
Return Cholesky decomposition.
virtual double & operator()(const int &row, const int &column)
Return reference to matrix element.
virtual double sum(void) const
Sum matrix elements.
void mix_column(const double *src1_data, const int *src1_row, int src1_num, const double *src2_data, const int *src2_row, int src2_num, double *dst_data, int *dst_row, int *dst_num)
Mix of sparse columns.
virtual std::string classname(void) const
Return class name.
virtual GMatrixSparse operator+(const GMatrixSparse &matrix) const
Binary matrix addition.
GVector solve(const GVector &vector) const
Solves linear matrix equation.
int m_stack_max_entries
Maximum number of entries in the stack.
virtual double min(void) const
Return minimum matrix element.
int * m_stack_colinx
Column index for each entry [m_stack_entries].
virtual GVector row(const int &row) const
Extract row as vector from matrix.
double m_zero
The zero element (needed for data access)
double * m_stack_values
Stack push double buffer [m_cols].
GVector cholesky_solver(const GVector &vector, const bool &compress=true) const
Cholesky solver.
void stack_flush(void)
Flush matrix stack.
GSparseNumeric * m_numeric
Holds GSparseNumeric object after decomposition.
int m_stack_size
Maximum number of elements in the stack.
int * m_stack_rowinx
Stack row indices [m_stack_size].
friend double cs_cumsum(int *p, int *c, int n)
cs_cumsum
int m_fill_col
Column into which element needs to be filled.
void set_mem_block(const int &block)
Set memory block size.
int * m_rowinx
Row-indices of all elements.
friend GMatrixSparse cs_symperm(const GMatrixSparse &matrix, const int *pinv)
cs_symperm
void alloc_members(const int &rows, const int &cols, const int &elements=0)
Allocate matrix.
void free_stack_members(void)
Delete fill-stack class members.
virtual GMatrixSparse operator-(void) const
Negate matrix elements.
int m_stack_entries
Number of entries in the stack.
virtual double & at(const int &row, const int &column)
Return reference to matrix element.
int stack_push_column(const GVector &vector, const int &col)
Push a vector column on the matrix stack.
virtual GMatrixSparse & operator/=(const double &scalar)
Divide matrix elements.
virtual GVector operator*(const GVector &vector) const
Vector multiplication.
GMatrixSparse(void)
Void matrix constructor.
virtual double max(void) const
Return maximum matrix element.
void alloc_elements(int start, const int &num)
Allocate memory for new matrix elements.
virtual GMatrixSparse & operator-=(const GMatrixSparse &matrix)
Unary matrix subtraction operator.
int * m_stack_start
Start in stack for each entry [m_stack_entries+1].
virtual GMatrixSparse & operator=(const GMatrixSparse &matrix)
Matrix assignment operator.
int m_fill_row
Row into which element needs to be filled.
void mix_column_prepare(const int *src1_row, int src1_num, const int *src2_row, int src2_num, int *num_1, int *num_2, int *num_mix)
Prepare mix of sparse columns.
void free_elements(const int &start, const int &num)
Free memory for obsolete matrix elements.
virtual GMatrixSparse & operator*=(const GMatrixSparse &matrix)
Unary matrix multiplication operator.
double m_fill_val
Element to be filled.
double * m_stack_data
Stack data [m_stack_size].
int * m_stack_rows
Stack push integer working array [m_cols].
void copy_members(const GMatrixSparse &m)
Copy class members.
void insert_row(const int &row, const GVector &vector, const bool &add)
Insert row in matrix.
int get_index(const int &row, const int &column) const
Determines element index for (row,column)
virtual bool operator==(const GMatrixSparse &matrix) const
Equalty operator.
virtual void add_to_row(const int &row, const GVector &vector)
Add row to matrix elements.
int * m_stack_work
Stack flush integer working array [m_cols].
void fill_pending(void)
Fills pending matrix element.
Symmetric matrix class interface definition.
Generic matrix class definition.
Definition GMatrix.hpp:79
Sparse matrix numeric analysis class.
Sparse matrix symbolic analysis class.
Vector class.
Definition GVector.hpp:46