Representation of a sparse matrix in compressed row format.
More...
|
psparsematrix | new_raw_sparsematrix (uint rows, uint cols, uint nz) |
| Create a sparsematrix object without initializing its arrays. More...
|
|
psparsematrix | new_identity_sparsematrix (uint rows, uint cols) |
| Creates a new sparsematrix object and initializes it to the idenity matrix . More...
|
|
psparsematrix | new_zero_sparsematrix (psparsepattern sp) |
| Create a sparsematrix based on a sparsepattern. More...
|
|
void | del_sparsematrix (psparsematrix a) |
| Delete a sparsematrix object. More...
|
|
field | addentry_sparsematrix (psparsematrix a, uint row, uint col, field x) |
| Add to a matrix entry, . More...
|
|
void | setentry_sparsematrix (psparsematrix a, uint row, uint col, field x) |
| Set a matrix entry, . More...
|
|
size_t | getsize_sparsematrix (pcsparsematrix a) |
| Get size of a given sparsematrix object. More...
|
|
void | sort_sparsematrix (psparsematrix a) |
| Sort non-zero entries to ensure that diagonal entries come first. More...
|
|
void | clear_sparsematrix (psparsematrix a) |
| Set a matrix to zero. More...
|
|
void | print_sparsematrix (pcsparsematrix a) |
| Print a sparse matrix. More...
|
|
void | print_eps_sparsematrix (pcsparsematrix a, const char *filename, uint offset) |
| Print matrix to a Postscript file. More...
|
|
void | addeval_sparsematrix_avector (field alpha, pcsparsematrix a, pcavector x, pavector y) |
| Multiply a matrix by a vector , . More...
|
|
void | addevaltrans_sparsematrix_avector (field alpha, pcsparsematrix a, pcavector x, pavector y) |
| Multiply the adjoint of a matrix by a vector , . More...
|
|
void | mvm_sparsematrix_avector (field alpha, bool trans, pcsparsematrix a, pcavector x, pavector y) |
| Multiply a matrix or its adjoint by a vector, or . More...
|
|
real | norm2_sparsematrix (pcsparsematrix S) |
| Approximate the spectral norm of a matrix . More...
|
|
real | norm2diff_sparsematrix (pcsparsematrix a, pcsparsematrix b) |
| Approximate the spectral norm of the difference of two matrices and . More...
|
|
void | add_sparsematrix_amatrix (field alpha, bool atrans, pcsparsematrix a, pamatrix b) |
| Add a sparsematrix to an amatrix, or . More...
|
|
Representation of a sparse matrix in compressed row format.
The sparsematrix class is used to store sparse matrices efficiently by avoiding to store zero entries. The internal representation is the compressed row format: the -th row is described by the entries row
[i] to row
[i+1]-1 in the arrays col
and coeff
. For each there is exactly one such that row[i]<=k<row[i+1]
, col
[k]=j and coeff[k]
.
Set a matrix to zero.
- Parameters
-
Delete a sparsematrix object.
Releases the storage corresponding to the object.
- Parameters
-
Get size of a given sparsematrix object.
Computes the size of the sparsematrix object and the storage allocated for the coefficients.
- Parameters
-
- Returns
- Size of allocated storage in bytes.
Create a sparsematrix object without initializing its arrays.
- Parameters
-
rows | Number of rows. |
cols | Number of columns. |
nz | Number of non-zero entries. |
- Returns
- Allocated sparsematrix object, arrays
row
, col
and coeff
are uninitialized.
Create a sparsematrix based on a sparsepattern.
- Parameters
-
- Returns
- Fully initialized sparsematrix object with given sparsity pattern and zero coefficients.
Print matrix to a Postscript file.
- Parameters
-
a | Source matrix. |
filename | Name of the target file. |
offset | Offset added to all coordinates, e.g., to avoid boundary clipping with some printers. |
Print a sparse matrix.
- Parameters
-
Sort non-zero entries to ensure that diagonal entries come first.
Reorder the entries of each row in col
and coeff
to place the diagonal entry first. Since many iterative solvers require us to handle this entry differently from all others, this optimization can improve the performance.
- Parameters
-