File: sparse_mat.h

package info (click to toggle)
libocas 0.97%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 6,760 kB
  • sloc: ansic: 7,956; makefile: 103; sh: 7
file content (47 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*-----------------------------------------------------------
 * sparse_mat.h: Reimplementation of Matlab functions for 
 *  dealing with sparse matrices.
 *
  -----------------------------------------------------------*/

#ifndef _sparse_mat_h
#define _sparse_mat_h

#define mxCalloc(x...) calloc(x)
#define mxFree(x...) free(x)
#define mexPrintf(x...) printf(x)

#define INDEX_TYPE_T uint32_t
#define NNZ_TYPE_T uint64_t


typedef struct {
  INDEX_TYPE_T *ir;       
  INDEX_TYPE_T *jc;  
  INDEX_TYPE_T m;
  INDEX_TYPE_T n;
  double *pr;
  NNZ_TYPE_T nzmax;
  int sparse; 
  
} mxArray;


typedef enum {
    mxREAL,
    mxCOMPLEX
} mxComplexity;


INDEX_TYPE_T mxGetM(const mxArray *array_ptr);
INDEX_TYPE_T mxGetN(const mxArray *array_ptr);
void mxDestroyArray(mxArray *array_ptr);
mxArray *mxCreateSparse(INDEX_TYPE_T m, INDEX_TYPE_T n, NNZ_TYPE_T nzmax, mxComplexity ComplexFlag);
mxArray *mxCreateDoubleMatrix(INDEX_TYPE_T m, INDEX_TYPE_T n, mxComplexity ComplexFlag);
double *mxGetPr(const mxArray *array_ptr);
INDEX_TYPE_T *mxGetIr(const mxArray *array_ptr);
INDEX_TYPE_T *mxGetJc(const mxArray *array_ptr);
INDEX_TYPE_T mxGetNZMAX(const mxArray *array_ptr);
int mxIsSparse(const mxArray *array_ptr);

#endif