hkl-matrix

hkl-matrix

Synopsis

                    HklMatrix;
void                hkl_matrix_init                     (HklMatrix *self,
                                                         double m11,
                                                         double m12,
                                                         double m13,
                                                         double m21,
                                                         double m22,
                                                         double m23,
                                                         double m31,
                                                         double m32,
                                                         double m33);
void                hkl_matrix_init_from_two_vector     (HklMatrix *self,
                                                         const HklVector *v1,
                                                         const HklVector *v2);
void                hkl_matrix_init_from_euler          (HklMatrix *self,
                                                         double euler_x,
                                                         double euler_y,
                                                         double euler_z);
void                hkl_matrix_fprintf                  (FILE *file,
                                                         const HklMatrix *self);
void                hkl_matrix_to_euler                 (const HklMatrix *self,
                                                         double *euler_x,
                                                         double *euler_y,
                                                         double *euler_z);
int                 hkl_matrix_cmp                      (const HklMatrix *self,
                                                         const HklMatrix *m);
void                hkl_matrix_times_matrix             (HklMatrix *self,
                                                         const HklMatrix *m);
void                hkl_matrix_times_vector             (const HklMatrix *self,
                                                         HklVector *v);
void                hkl_matrix_transpose                (HklMatrix *self);
double              hkl_matrix_det                      (const HklMatrix *self);
int                 hkl_matrix_solve                    (const HklMatrix *self,
                                                         HklVector *x,
                                                         const HklVector *b);
int                 hkl_matrix_is_null                  (const HklMatrix *self);

Description

Details

HklMatrix

typedef struct {
	double data[3][3];
} HklMatrix;


hkl_matrix_init ()

void                hkl_matrix_init                     (HklMatrix *self,
                                                         double m11,
                                                         double m12,
                                                         double m13,
                                                         double m21,
                                                         double m22,
                                                         double m23,
                                                         double m31,
                                                         double m32,
                                                         double m33);

self :

the HklMatrix to initialize

m11 :

the matrix 11 value

m12 :

the matrix 12 value

m13 :

the matrix 13 value

m21 :

the matrix 21 value

m22 :

the matrix 22 value

m23 :

the matrix 23 value

m31 :

the matrix 31 value

m32 :

the matrix 32 value

m33 :

the matrix 33 value

hkl_matrix_init_from_two_vector ()

void                hkl_matrix_init_from_two_vector     (HklMatrix *self,
                                                         const HklVector *v1,
                                                         const HklVector *v2);

Create an HklMatrix which represent a direct oriented base of the space the first row correspond to the |v1|, the second row |v2| and the last one is |v1 ^ v2|

self :

The HklMatrix to initialize

v1 :

the first HklVector

v2 :

the second HklVector

hkl_matrix_init_from_euler ()

void                hkl_matrix_init_from_euler          (HklMatrix *self,
                                                         double euler_x,
                                                         double euler_y,
                                                         double euler_z);

Create a rotation HklMatrix from three eulerians angles.

self :

the HklMatrix to initialize

euler_x :

the eulerian value along X

euler_y :

the eulerian value along Y

euler_z :

the eulerian value along Z

hkl_matrix_fprintf ()

void                hkl_matrix_fprintf                  (FILE *file,
                                                         const HklMatrix *self);

printf an HklMatrix into a FILE stream.

file :

the FILE stream

self :

the HklMatrix to print into the file stream

hkl_matrix_to_euler ()

void                hkl_matrix_to_euler                 (const HklMatrix *self,
                                                         double *euler_x,
                                                         double *euler_y,
                                                         double *euler_z);

compute the three eulerians values for a given rotation HklMatrix

self :

the rotation HklMatrix use to compute the eulerians angles

euler_x :

the eulerian value along X

euler_y :

the eulerian value along Y

euler_z :

the eulerian value along Z

hkl_matrix_cmp ()

int                 hkl_matrix_cmp                      (const HklMatrix *self,
                                                         const HklMatrix *m);

compare two HklMatrix.

self :

the first HklMatrix

m :

the HklMatrix to compare with

Returns :

return HKL_TRUE if | self - m | > HKL_EPSILON

hkl_matrix_times_matrix ()

void                hkl_matrix_times_matrix             (HklMatrix *self,
                                                         const HklMatrix *m);

compute the matrix multiplication self = self * m

self :

the HklMatrix to modify

m :

the HklMatrix to multiply by

hkl_matrix_times_vector ()

void                hkl_matrix_times_vector             (const HklMatrix *self,
                                                         HklVector *v);

multiply an HklVector by an HklMatrix

self :

the HklMatrix use to multiply the HklVector

v :

the HklVector multiply by the HklMatrix

hkl_matrix_transpose ()

void                hkl_matrix_transpose                (HklMatrix *self);

transpose an HklMatrix

self :

the HklMatrix to transpose

hkl_matrix_det ()

double              hkl_matrix_det                      (const HklMatrix *self);

compute the determinant of an HklMatrix

self :

the HklMatrix use to compute the determinant

Returns :

the determinant of the self HklMatrix Todo: test

hkl_matrix_solve ()

int                 hkl_matrix_solve                    (const HklMatrix *self,
                                                         HklVector *x,
                                                         const HklVector *b);

solve the system self . X = b

self :

The HklMatrix of the system

x :

the HklVector to compute.

b :

the hklVector of the system to solve.

Returns :

-1 if the système has no solution, 0 otherwise. Todo: test

hkl_matrix_is_null ()

int                 hkl_matrix_is_null                  (const HklMatrix *self);

is all hklMatrix elementes bellow HKL_EPSILON

self :

the HklMatrix to test

Returns :

HKL_TRUE if the self HklMatrix is null Todo: test