aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/integer_matrix.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-10-29 10:05:24 +0100
committerThomas White <taw@physics.org>2019-03-11 16:49:36 +0100
commit9a3ef1de0b661085a26d9be60bcff9e261783acd (patch)
treeb1861fe26f2bbc0e9642ba8921c5e1f826a92512 /libcrystfel/src/integer_matrix.h
parent4337cafe052c4ad238c969dfa4cb7c7ac52f5e07 (diff)
Add new rational number library
Diffstat (limited to 'libcrystfel/src/integer_matrix.h')
-rw-r--r--libcrystfel/src/integer_matrix.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/libcrystfel/src/integer_matrix.h b/libcrystfel/src/integer_matrix.h
index c4983aef..aeea38dd 100644
--- a/libcrystfel/src/integer_matrix.h
+++ b/libcrystfel/src/integer_matrix.h
@@ -40,17 +40,22 @@
**/
typedef struct _integermatrix IntegerMatrix;
+#include "rational.h"
+
#ifdef __cplusplus
extern "C" {
#endif
/* Alloc/dealloc */
extern IntegerMatrix *intmat_new(unsigned int rows, unsigned int cols);
-extern IntegerMatrix *intmat_copy(IntegerMatrix *m);
+extern IntegerMatrix *intmat_copy(const IntegerMatrix *m);
extern IntegerMatrix *intmat_identity(int size);
extern void intmat_free(IntegerMatrix *m);
/* Get/set */
+extern void intmat_size(const IntegerMatrix *m, unsigned int *rows,
+ unsigned int *cols);
+
extern void intmat_set(IntegerMatrix *m, unsigned int i, unsigned int j,
signed int v);
extern signed int intmat_get(const IntegerMatrix *m,
@@ -65,14 +70,21 @@ extern IntegerMatrix *intmat_create_3x3(signed int m11, signed int m12, signed i
signed int m21, signed int m22, signed int m23,
signed int m31, signed int m32, signed int m33);
-/* Matrix-(int)vector multiplication */
+/* Matrix-vector multiplication */
+extern int intmat_floatvec_mult(const IntegerMatrix *m, const float *vec,
+ float *ans);
extern signed int *intmat_intvec_mult(const IntegerMatrix *m,
const signed int *vec);
+extern int intmat_rationalvec_mult(const IntegerMatrix *m, const Rational *vec,
+ Rational *ans);
/* Matrix-matrix multiplication */
extern IntegerMatrix *intmat_intmat_mult(const IntegerMatrix *a,
const IntegerMatrix *b);
+extern int intmat_solve_rational(const IntegerMatrix *m, const Rational *vec,
+ Rational *ans);
+
/* Inverse */
extern IntegerMatrix *intmat_inverse(const IntegerMatrix *m);