15 |
|
/* General plane-ordered component matrix */ |
16 |
|
typedef struct { |
17 |
|
int nrows, ncols, ncomp; |
18 |
+ |
char *info; |
19 |
|
double mtx[1]; /* extends struct */ |
20 |
|
} RMATRIX; |
21 |
|
|
22 |
< |
#define rmx_indx(rm,r,c,i) (((i)*(rm)->nrows+(r))*(rm)->ncols+(c)) |
22 |
> |
#define rmx_lval(rm,r,c,i) (rm)->mtx[((i)*(rm)->nrows+(r))*(rm)->ncols+(c)] |
23 |
|
|
23 |
– |
#define rmx_lval(rm,r,c,i) (rm)->mtx[rmx_indx(rm,r,c,i)] |
24 |
– |
|
24 |
|
#define rmx_free(rm) free(rm) |
25 |
|
|
26 |
|
/* Allocate a nr x nc matrix with n components */ |
29 |
|
/* Load matrix from supported file type */ |
30 |
|
extern RMATRIX *rmx_load(const char *fname); |
31 |
|
|
32 |
+ |
/* Append header information associated with matrix data */ |
33 |
+ |
extern int rmx_addinfo(RMATRIX *rm, const char *info); |
34 |
+ |
|
35 |
|
/* Write matrix to file type indicated by dt */ |
36 |
|
extern long rmx_write(const RMATRIX *rm, int dtype, FILE *fp); |
37 |
|
|
41 |
|
/* Duplicate the given matrix */ |
42 |
|
extern RMATRIX *rmx_copy(const RMATRIX *rm); |
43 |
|
|
44 |
< |
/* Swap rows and columns in the given matrix in situ */ |
45 |
< |
extern int rmx_transpose(RMATRIX *rm); |
44 |
> |
/* Allocate and assign transposed matrix */ |
45 |
> |
extern RMATRIX *rmx_transpose(const RMATRIX *rm); |
46 |
|
|
47 |
|
/* Multiply (concatenate) two matrices and allocate the result */ |
48 |
|
extern RMATRIX *rmx_multiply(const RMATRIX *m1, const RMATRIX *m2); |