20 #ifndef OPM_SPARSE_SYS_HEADER_INCLUDED
21 #define OPM_SPARSE_SYS_HEADER_INCLUDED
231 vector_write(
size_t n,
const double *v,
const char *fn);
Basic compressed-sparse row (CSR) matrix data structure.
Definition: sparse_sys.h:38
void vector_zero(size_t n, double *v)
Zero all vector elements.
struct CSRMatrix * csrmatrix_new_count_nnz(size_t m)
Allocate a matrix structure and corresponding row pointers, ia, sufficiently initialised to support "...
void csrmatrix_write(const struct CSRMatrix *A, const char *fn)
Print matrix to file.
int * ja
Column indices.
Definition: sparse_sys.h:44
size_t csrmatrix_elm_index(int i, int j, const struct CSRMatrix *A)
Compute non-zero index of specified matrix element.
int * ia
Row pointers.
Definition: sparse_sys.h:43
void csrmatrix_sortrows(struct CSRMatrix *A)
Sort column indices within each matrix row in ascending order.
void vector_write_stream(size_t n, const double *v, FILE *fp)
Print vector to stream.
void csrmatrix_write_stream(const struct CSRMatrix *A, FILE *fp)
Print matrix to stream.
size_t csrmatrix_new_elms_pushback(struct CSRMatrix *A)
Set row pointers and allocate column index and matrix element arrays of a matrix previous obtained fr...
size_t m
Number of rows.
Definition: sparse_sys.h:40
void csrmatrix_delete(struct CSRMatrix *A)
Dispose of memory resources obtained through prior calls to allocation routines.
double * sa
Matrix elements.
Definition: sparse_sys.h:46
void csrmatrix_zero(struct CSRMatrix *A)
Zero all matrix elements, typically in preparation of elemental assembly.
size_t nnz
Number of structurally non-zero elements.
Definition: sparse_sys.h:41
struct CSRMatrix * csrmatrix_new_known_nnz(size_t m, size_t nnz)
Allocate a matrix structure and all constituent fields to hold a sparse matrix with a specified numbe...
void vector_write(size_t n, const double *v, const char *fn)
Print vector to file.