source: trunk/anuga_core/source/anuga/utilities/sparse_csr.h @ 8710

Last change on this file since 8710 was 8691, checked in by steve, 12 years ago

Adding in the new c files

File size: 1.2 KB
Line 
1/*
2* Sparse Matrix class implement in CSR format. Limited functionality.
3*
4* The CSR (compressed sparse row) format is implemented by using thee
5* double arrays, storing the data, column indicies and row pointers.
6* This format is used for fast matrix-matrix and matrix-vector
7* multiplication
8*
9* This function is only currently used to store the result of a
10* conversion from a DOK sparse matrix. Further functionality planned.
11*
12* Padarn Wilson, ANU 2012
13*/
14
15#include <stdio.h>   /* gets */
16#include <stdlib.h>  /* atoi, malloc */
17#include <string.h>  /* strcpy */
18#include "math.h"
19
20#ifndef SPARSE_CSR_H
21#define SPARSE_CSR_H
22
23// Struct sparse_csr, stores the three matricies which represent
24// the sparse matrix along with aiddtional information about the
25// number of rows and the number of entries in the matrix.
26typedef struct {
27        double *data;
28        int *colind;
29        int *row_ptr;
30        int num_rows;
31        int num_entries;
32} sparse_csr;
33
34// 'Constructor' function. Returns a pointer to new malloced memory
35// All struct entries are intialised appropriately (mostly to NULL).
36sparse_csr * make_csr();
37
38// delete_csr_contents - Free the memory associated with the struct
39// and set the pointer to NULL
40void delete_csr_matrix(sparse_csr * mat);
41
42#endif
Note: See TracBrowser for help on using the repository browser.