This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
matrices.cpp
82 lines (61 loc) · 2.34 KB
/
matrices.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "matrices.h"
void singular_define_matrices(jlcxx::Module & Singular)
{
Singular.method("ncols", [](matrix I) { return (int)MATCOLS(I); });
Singular.method("nrows", [](matrix I) { return (int)MATROWS(I); });
Singular.method("id_Module2Matrix", &id_Module2Matrix);
Singular.method("id_Matrix2Module", &id_Matrix2Module);
Singular.set_override_module(jl_base_module);
Singular.method("getindex", [](matrix M, int i, int j) {
return (poly)MATELEM(M, i, j);
});
Singular.unset_override_module();
Singular.method("setindex", [](matrix M, poly p, int i, int j, ring R) {
MATELEM(M, i, j) = p_Copy(p, R);
});
Singular.method("mp_Copy",
[](matrix M, ring R) { return mp_Copy(M, R); });
Singular.method("mp_Delete",
[](matrix M, ring R) { return mp_Delete(&M, R); });
Singular.method("mp_Add", &mp_Add);
Singular.method("mp_Sub", &mp_Sub);
Singular.method("mp_Transp", &mp_Transp);
Singular.method("mp_Mult", &mp_Mult);
Singular.method("mp_MultP", &mp_MultP);
Singular.method("pMultMp", &pMultMp);
Singular.method("mp_Equal", &mp_Equal);
Singular.method("mpNew", [](int r, int c) {
return mpNew(r, c);
});
Singular.method("mp_InitP", [](int n, poly p, ring R) {
return mp_InitP(n, n, p_Copy(p, R), R);
});
Singular.method("mp_Wedge", [](matrix M,int n, ring R) {
return mp_Wedge(M, n, R);
});
Singular.method("irrCharSeries", &singclap_irrCharSeries);
Singular.method("iiStringMatrix", [](matrix I, int d, ring o) {
auto str_ptr = iiStringMatrix(I, d, o);
std::string s(iiStringMatrix(I, d, o));
omFree(str_ptr);
return s;
});
Singular.method("bigintmat_init", [](int r, int c) {
return new bigintmat(r, c, coeffs_BIGINT);
});
Singular.method("bigintmat_clear", [](bigintmat * m) {
delete m;
});
Singular.method("bigintmat_nrows", [](bigintmat * m) {
return m->rows();
});
Singular.method("bigintmat_ncols", [](bigintmat * m) {
return m->cols();
});
Singular.method("bigintmat_viewindex", [](bigintmat * m, int i, int j) {
return m->view(i, j);
});
Singular.method("bigintmat_rawset", [](bigintmat * m, number n, int i, int j) {
m->rawset(i, j, n, NULL);
});
}