C API Documentation
rrSparse.h
1 /*
2  * rrCSparse.h
3  *
4  * Created on: Jul 10, 2013
5  * Author: andy
6  */
7 
8 #ifndef RRCSPARSE_H_
9 #define RRCSPARSE_H_
10 
11 #include "rrOSSpecifics.h"
12 #include <vector>
13 #include <ostream>
14 
15 namespace rr
16 {
17 
27 typedef struct csr_matrix_t
28 {
32  unsigned m;
33 
37  unsigned n;
38 
42  unsigned nnz;
43 
49  double* values;
50 
55  unsigned* colidx;
56 
66  unsigned* rowptr;
67 
68 } csr_matrix;
69 
70 
79 csr_matrix* csr_matrix_new(unsigned m, unsigned n,
80  const std::vector<unsigned>& rowidx, const std::vector<unsigned>& colidx,
81  const std::vector<double>& values);
82 
87 void csr_matrix_delete(csr_matrix *mat);
88 
94 bool csr_matrix_set_nz(csr_matrix *mat, unsigned row, unsigned col, double val);
95 
101 double csr_matrix_get_nz(const csr_matrix *mat, unsigned row, unsigned col);
102 
111 void csr_matrix_dgemv(double alpha, const csr_matrix *A,
112  double const *x, double beta, double *y);
113 
120 double csr_matrix_ddot(size_t row, const csr_matrix *x, const double *y);
121 
125 void csr_matrix_fill_dense(const csr_matrix *x, double *dense);
126 
127 void csr_matrix_dump_binary(const csr_matrix *x, std::ostream& out);
128 csr_matrix* csr_matrix_new_from_binary(std::istream&);
132 std::ostream& operator<< (std::ostream& os, const csr_matrix* mat);
133 
134 
135 }
136 
137 #endif /* RRCSPARSE_H_ */
Definition: rrSparse.h:28
double * values
Definition: rrSparse.h:49
unsigned nnz
Definition: rrSparse.h:42
unsigned m
Definition: rrSparse.h:32
unsigned * rowptr
Definition: rrSparse.h:66
unsigned * colidx
Definition: rrSparse.h:55
unsigned n
Definition: rrSparse.h:37