| 14 |
|
|
| 15 |
|
/* General plane-ordered component matrix */ |
| 16 |
|
typedef struct { |
| 17 |
< |
int nrows, ncols, ncomp; |
| 18 |
< |
int dtype; |
| 17 |
> |
int nrows, ncols; |
| 18 |
> |
short ncomp; |
| 19 |
> |
uby8 dtype; |
| 20 |
> |
uby8 swapin; |
| 21 |
|
char *info; |
| 22 |
|
double mtx[1]; /* extends struct */ |
| 23 |
|
} RMATRIX; |
| 24 |
|
|
| 25 |
< |
#define rmx_lval(rm,r,c,i) (rm)->mtx[(i)+(rm)->ncomp*((c)+(rm)->ncols*(r))] |
| 25 |
> |
#define rmx_lval(rm,r,c,i) (rm)->mtx[(i)+(rm)->ncomp*((c)+(size_t)(rm)->ncols*(r))] |
| 26 |
|
|
| 27 |
|
/* Allocate a nr x nc matrix with n components */ |
| 28 |
|
extern RMATRIX *rmx_alloc(int nr, int nc, int n); |
| 53 |
|
|
| 54 |
|
/* Multiply (concatenate) two matrices and allocate the result */ |
| 55 |
|
extern RMATRIX *rmx_multiply(const RMATRIX *m1, const RMATRIX *m2); |
| 56 |
+ |
|
| 57 |
+ |
/* Element-wise multiplication (or division) of m2 into m1 */ |
| 58 |
+ |
extern int rmx_elemult(RMATRIX *m1, const RMATRIX *m2, int divide); |
| 59 |
|
|
| 60 |
|
/* Sum second matrix into first, applying scale factor beforehand */ |
| 61 |
|
extern int rmx_sum(RMATRIX *msum, const RMATRIX *madd, const double sf[]); |