| CrystFEL Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include "integer_matrix.h" typedef IntegerMatrix; IntegerMatrix * intmat_new (unsigned int rows,unsigned int cols); IntegerMatrix * intmat_copy (IntegerMatrix *m); void intmat_free (IntegerMatrix *m); signed int intmat_get (const IntegerMatrix *m,unsigned int i,unsigned int j); void intmat_set (IntegerMatrix *m,unsigned int i,unsigned int j,signed int v); IntegerMatrix * intmat_intmat_mult (const IntegerMatrix *a,const IntegerMatrix *b); signed int * intmat_intvec_mult (const IntegerMatrix *m,const signed int *vec); signed int intmat_det (const IntegerMatrix *m); IntegerMatrix * intmat_inverse (const IntegerMatrix *m); int intmat_equals (const IntegerMatrix *a,const IntegerMatrix *b); int intmat_is_identity (const IntegerMatrix *m); int intmat_is_inversion (const IntegerMatrix *m); void intmat_print (const IntegerMatrix *m);
typedef struct _integermatrix IntegerMatrix;
The IntegerMatrix is an opaque data structure representing an integer matrix.
IntegerMatrix * intmat_new (unsigned int rows,unsigned int cols);
Allocates a new IntegerMatrix with all elements set to zero.
|
Number of rows that the new matrix is to have |
|
Number of columns that the new matrix is to have |
Returns : |
a new IntegerMatrix, or NULL on error. |
IntegerMatrix * intmat_copy (IntegerMatrix *m);
|
An IntegerMatrix
|
Returns : |
a newly allocated copy of m, or NULL on error/ |
void intmat_free (IntegerMatrix *m);
Frees m, unless m is NULL in which case nothing is done.
|
An IntegerMatrix
|
signed int intmat_get (const IntegerMatrix *m,unsigned int i,unsigned int j);
Gets the i,j element of m.
|
An IntegerMatrix
|
|
column number to set |
|
row number to set |
Returns : |
the i,j element of m. |
void intmat_set (IntegerMatrix *m,unsigned int i,unsigned int j,signed int v);
Sets the i,j element of m to v.
|
An IntegerMatrix
|
|
row number to set |
|
column number to set |
|
value to set to |
IntegerMatrix * intmat_intmat_mult (const IntegerMatrix *a,const IntegerMatrix *b);
Multiplies the matrix a by the matrix b.
|
An IntegerMatrix
|
|
An IntegerMatrix
|
Returns : |
a newly allocated IntegerMatrix containing the answer, or NULL on
error. |
signed int * intmat_intvec_mult (const IntegerMatrix *m,const signed int *vec);
Multiplies the matrix m by the vector vec. The size of vec must equal the
number of columns in m, and the size of the result equals the number of rows
in m.
|
An IntegerMatrix
|
|
An array of signed integers |
Returns : |
a newly allocated array of signed integers containing the answer, or NULL on error. |
signed int intmat_det (const IntegerMatrix *m);
Calculates the determinant of m. Inefficiently.
|
An IntegerMatrix
|
Returns : |
the determinant of m. |
IntegerMatrix * intmat_inverse (const IntegerMatrix *m);
Calculates the inverse of m. Inefficiently.
|
An IntegerMatrix
|
Returns : |
the inverse of m, or NULL on error. |
int intmat_equals (const IntegerMatrix *a,const IntegerMatrix *b);
|
An IntegerMatrix
|
|
An IntegerMatrix
|
Returns : |
true if a = b. |
int intmat_is_identity (const IntegerMatrix *m);
|
An IntegerMatrix
|
Returns : |
true if m is an identity matrix. |
int intmat_is_inversion (const IntegerMatrix *m);
|
An IntegerMatrix
|
Returns : |
true if m = -I, where I is an identity matrix. |
void intmat_print (const IntegerMatrix *m);
Prints m to stderr.
|
An IntegerMatrix
|