ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rmatrix.h
(Generate patch)

Comparing ray/src/util/rmatrix.h (file contents):
Revision 2.1 by greg, Sat May 31 05:02:37 2014 UTC vs.
Revision 2.8 by greg, Mon Aug 28 15:59:46 2017 UTC

# Line 15 | Line 15 | extern "C" {
15   /* General plane-ordered component matrix */
16   typedef struct {
17          int     nrows, ncols, ncomp;
18 +        int     dtype;
19 +        char    *info;
20          double  mtx[1];                 /* extends struct */
21   } RMATRIX;
22  
23 < #define rmx_indx(rm,r,c,i)      (((i)*(rm)->nrows+(r))*(rm)->ncols+(c))
23 > #define rmx_lval(rm,r,c,i)      (rm)->mtx[(i)+(rm)->ncomp*((c)+(rm)->ncols*(r))]
24  
23 #define rmx_lval(rm,r,c,i)      (rm)->mtx[rmx_indx(rm,r,c,i)]
24
25 #define rmx_free(rm)            free(rm)
26
25   /* Allocate a nr x nc matrix with n components */
26   extern RMATRIX  *rmx_alloc(int nr, int nc, int n);
27  
28 < /* Load matrix from supported file type */
29 < extern RMATRIX  *rmx_load(const char *fname);
28 > /* Free a RMATRIX array */
29 > extern void     rmx_free(RMATRIX *rm);
30  
31 < /* Write matrix to file type indicated by dt */
32 < extern long     rmx_write(const RMATRIX *rm, int dtype, FILE *fp);
31 > /* Resolve data type based on two input types (returns 0 for mismatch) */
32 > extern int      rmx_newtype(int dtyp1, int dtyp2);
33  
34 + /* Load matrix from supported file type (NULL for stdin, '!' with command) */
35 + extern RMATRIX  *rmx_load(const char *inspec);
36 +
37 + /* Append header information associated with matrix data */
38 + extern int      rmx_addinfo(RMATRIX *rm, const char *info);
39 +
40 + /* Write matrix to file type indicated by dtype */
41 + extern int      rmx_write(const RMATRIX *rm, int dtype, FILE *fp);
42 +
43   /* Allocate and assign square identity matrix with n components */
44   extern RMATRIX  *rmx_identity(int dim, int n);
45  
46   /* Duplicate the given matrix */
47   extern RMATRIX  *rmx_copy(const RMATRIX *rm);
48  
49 < /* Swap rows and columns in the given matrix in situ */
50 < extern int      rmx_transpose(RMATRIX *rm);
49 > /* Allocate and assign transposed matrix */
50 > extern RMATRIX  *rmx_transpose(const RMATRIX *rm);
51  
52   /* Multiply (concatenate) two matrices and allocate the result */
53   extern RMATRIX  *rmx_multiply(const RMATRIX *m1, const RMATRIX *m2);
54 +
55 + /* Element-wise multiplication (or division) of m2 into m1 */
56 + extern int      rmx_elemult(RMATRIX *m1, const RMATRIX *m2, int divide);
57  
58   /* Sum second matrix into first, applying scale factor beforehand */
59   extern int      rmx_sum(RMATRIX *msum, const RMATRIX *madd, const double sf[]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines