#ifndef r4x4_H #define r4x4_H /* 4x4 matrices and operations on them */ /* Last edited on 2005-01-16 15:19:06 by stolfi */ /* Copyright © 2005 Jorge Stolfi, UNICAMP. See note at end of file. */ #include #include typedef struct { double c[4][4]; } r4x4_t; void r4x4_zero(r4x4_t *R); /* Stores in {R} the null matrix. */ void r4x4_ident(r4x4_t *R); /* Stores in {R} the identity matrix. */ void r4x4_map_row (r4_t *x, r4x4_t *A, r4_t *R); /* Sets {R} to the product of row vector {x} by matrix {A} */ void r4x4_map_col (r4x4_t *A, r4_t *x, r4_t *R); /* Sets {R} to the product of matrix {A} by column vector {x} */ void r4x4_mul (r4x4_t *A, r4x4_t *B, r4x4_t *R); /* Sets {R} to the product of matrices {A} and {B} */ double r4x4_det (r4x4_t *A); /* Returns the determinant of matrix {A} */ void r4x4_adj (r4x4_t *A, r4x4_t *R); /* Sets {R} to the adjoint of matrix {A} */ void r4x4_inv (r4x4_t *A, r4x4_t *R); /* Sets {R} to the inverse of matrix {A} */ void r4x4_print (FILE *f, r4x4_t *A); /* Prints matrix {A} to file {f}, with default format. */ void r4x4_gen_print ( FILE *f, r4x4_t *A, char *fmt, char *olp, char *osep, char *orp, /* Outer delimiters. */ char *ilp, char *isep, char *irp /* Inner delimiters. */ ); /* Prints matrix {A} to file {f}, using {fmt} for each element. The matrix is bounded by {olp} and {orp}, and rows are separated by {osep}. Each row is bounded by {ilp} and {irp}, and elements are separated by {isep}. Defaults are provided for any of these strings which are NULL. */ #endif /* COPYRIGHT AND AUTHORSHIP NOTICE Copyright © 2005 Jorge Stolfi, Universidade Estadual de Campinas (UNICAMP). Created by Jorge Stolfi in 1992--2005. This source file can be freely distributed, used, and modified, provided that this copyright and authorship notice is preserved in all copies, and that any modified versions of this file are clearly marked as such. This software has NO WARRANTY of correctness or applicability for any purpose. Neither the author nor his employers shall be held responsible for any losses or damages that may result from its use. END OF NOTICE */