1#ifndef __JBXL_MATRIX_LIBRARY_H_
2#define __JBXL_MATRIX_LIBRARY_H_
21typedef struct _ivector {
29typedef struct _vector {
37typedef struct _quaternion {
53typedef struct _imatrix {
68typedef struct _matrix {
76#define in_vector(a, b) ((a).x*(b).x+(a).y*(b).y+(a).z*(b).z)
77#define add_vector(a, b) set_vector((a).x+(b).x,(a).y+(b).y,(a).z+(b).z)
78#define sub_vector(a, b) set_vector((a).x-(b).x,(a).y-(b).y,(a).z-(b).z)
79#define add_ivector(a, b) set_ivector((a).x+(b).x,(a).y+(b).y,(a).z+(b).z)
80#define sub_ivector(a, b) set_ivector((a).x-(b).x,(a).y-(b).y,(a).z-(b).z)
81#define normal_vector(a) (a).r = sqrt((double)((a).x*(a).x)+(a).y*(a).y+(a).z*(a).z);
83#define Vt(m, i) ((m).mx[(i)-1])
84#define Mx(m, i, j) ((m).mx[(j)-1+(m).sz[1]*((i)-1)])
86#define Mx1(m, i) ((m).mx[(i)-1])
87#define Mx2(m, i, j) ((m).mx[(j)-1+(m).sz[1]*((i)-1)])
88#define Mx3(m, i, j, k) ((m).mx[(k)-1+(m).sz[2]*((j)-1)+(m).sz[1]*(m).sz[2]*((i)-1)])
89#define Mx4(m, i, j, k, l) ((m).mx[(l)-1+(m).sz[3]*((k)-1)+(m).sz[2]*(m).sz[3]*((j)-1) +\
90 (m).sz[1]*(m).sz[2]*(m).sz[3]*((i)-1)])
void copy_matrix(matrix a, matrix b)
void copy_imatrix(imatrix a, imatrix b)
vector unit_vector(vector a)
void print_imatrix(FILE *fp, imatrix a)
void free_imatrix(imatrix *a)
matrix make_matrix1(int n)
vector unit_ivector(ivector a)
matrix add_matrix(matrix a, matrix b)
matrix sub_matrix(matrix a, matrix b)
matrix make_matrix2(int n, int m)
ivector f2ivector(vector a)
ivector set_ivector(int x, int y, int z)
vector i2vector(ivector a)
vector ex_vector(vector a, vector b)
vector set_vector(double x, double y, double z)
matrix minimum2(matrix a, matrix x)
double * get_matrix(matrix a,...)
void clear_matrix(matrix *a)
matrix decompQR(matrix xx, imatrix col)
imatrix sub_imatrix(imatrix a, imatrix b)
imatrix add_imatrix(imatrix a, imatrix b)
void free_matrix(matrix *a)
int * get_imatrix(imatrix a,...)
imatrix mlt_imatrix(imatrix a, imatrix b)
void clear_imatrix(imatrix *a)
imatrix make_imatrix2(int n, int m)
matrix mlt_matrix(matrix a, matrix b)
matrix make_matrix(int n, int *sz)
matrix invrU_matrix(matrix x)
imatrix make_imatrix(int n, int *sz)
matrix trans_matrix(matrix a)
void print_matrix(FILE *fp, matrix a)
imatrix make_imatrix1(int n)
int * sz
各次元の要素数 sz[0]?sz[n-1]
int r
全要素数 sz[0]+sz[1]+...+sz[n-1]
double * mx
要素 mx[0]?mx[r-1]
int * sz
各次元の要素数 sz[0]?sz[n-1]
int r
全要素数 sz[0]+sz[1]+...+sz[n-1]