update QEXT to new dynamic version

This commit is contained in:
Florian Stecker
2022-06-11 17:36:32 +02:00
parent 2e516e718d
commit 1a85a5ef14
6 changed files with 106 additions and 64 deletions

22
mat.h
View File

@@ -22,28 +22,34 @@
#define SET_ONE(x) qext_set_int((x),1)
#define ADD qext_add
#define SUB qext_sub
#define NEG qext_neg
#define MUL qext_mul
// #define DIV qext_div
#define CMP qext_cmp
#define PRINT qext_print
#define SNPRINT qext_snprint
#define TYPE struct qext_type*
#define GETTYPE(x) ((x)->type)
#endif
#ifdef QEXT_TRIVIAL
#else
#define NUMBER mpq_t
#define INIT mpq_init
#define INIT(x,t) mpq_init(x)
#define CLEAR mpq_clear
#define SET mpq_set
#define SET_INT(x,y) mpq_set_si(x,y,1)
#define SET_Q SET
#define SET_ZERO(x) SET_INT(x,0)
#define SET_ONE(x) SET_INT(x,1)
#define ADD mpq_add
#define SUB mpq_sub
#define NEG mpq_neg
#define MUL mpq_mul
#define DIV mpq_div
#define PRINT(x) gmp_printf("%Qd", x)
#define SNPRINT(out, size, x) gmp_snprintf(out, size, "%Qd", x)
#define TYPE int
#define GETTYPE(x) 0
#endif
@@ -52,7 +58,7 @@
struct _mat{
int n;
NUMBER *x;
} ;
};
typedef struct _mat mat[1];
@@ -62,9 +68,9 @@ typedef struct _mat_workspace {
NUMBER tmp_num2;
} mat_workspace;
mat_workspace *mat_workspace_init(int n);
mat_workspace *mat_workspace_init(int n, TYPE t);
void mat_workspace_clear(mat_workspace *ws);
void mat_init(mat m, int n);
void mat_init(mat m, int n, TYPE t);
void mat_get(NUMBER out, mat m, int i, int j);
void mat_set(mat m, int i, int j, NUMBER x);
NUMBER *mat_ref(mat m, int i, int j);
@@ -73,10 +79,8 @@ void mat_identity(mat m);
void mat_copy(mat to, mat from);
void mat_clear(mat m);
int mat_same(mat m1, mat m2);
static void mat_multiply_outofplace(mat_workspace *ws, mat out, mat in1, mat in2);
void mat_multiply(mat_workspace *ws, mat out, mat in1, mat in2);
void mat_det(mat_workspace *ws, NUMBER out, mat in);
static void mat_pseudoinverse_outofplace(mat_workspace *ws, mat out, mat in);
void mat_pseudoinverse(mat_workspace *ws, mat out, mat in);
void mat_trace(NUMBER out, mat in);
void mat_print(mat in);