Skip to content

Commit dbc5b75

Browse files
committed
lll: Use enum definitions from fmpz_lll.h
1 parent 592dc20 commit dbc5b75

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

src/flint/flintlib/fmpz_types.pxd

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,20 @@ cdef extern from "flint/fmpz_factor.h":
5555

5656

5757
cdef extern from "flint/fmpz_lll.h":
58+
59+
cdef enum _rep_type:
60+
GRAM
61+
Z_BASIS
62+
ctypedef _rep_type rep_type
63+
64+
cdef enum _gram_type:
65+
APPROX
66+
EXACT
67+
ctypedef _gram_type gram_type
68+
5869
ctypedef struct fmpz_lll_struct:
5970
double delta
6071
double eta
61-
int rt
62-
int gt
63-
72+
rep_type rt
73+
gram_type gt
6474
ctypedef fmpz_lll_struct fmpz_lll_t[1]
65-
ctypedef int gram_type
66-
ctypedef int rep_type

src/flint/types/fmpz_mat.pyx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ cimport cython
1010

1111
from flint.flintlib.fmpz cimport fmpz_set, fmpz_init, fmpz_clear
1212
from flint.flintlib.fmpz cimport fmpz_is_zero, fmpz_is_pm1
13-
from flint.flintlib.fmpz_types cimport fmpz_mat_struct
13+
from flint.flintlib.fmpz_types cimport (
14+
fmpz_mat_struct,
15+
rep_type,
16+
gram_type,
17+
)
1418
from flint.flintlib.fmpz_poly cimport fmpz_poly_init
1519
from flint.flintlib.fmpz_mat cimport *
1620
from flint.flintlib.fmpz_lll cimport *
@@ -633,18 +637,18 @@ cdef class fmpz_mat(flint_mat):
633637
cdef fmpz_mat u, v
634638
cdef fmpz_lll_t ctx
635639
cdef long i
636-
cdef int rt
637-
cdef int gt
640+
cdef rep_type rt
641+
cdef gram_type gt
638642
if rep == "zbasis":
639-
rt = 1
643+
rt = rep_type.Z_BASIS
640644
elif rep == "gram":
641-
rt = 0
645+
rt = rep_type.GRAM
642646
else:
643647
raise ValueError("rep must be 'zbasis' or 'gram'")
644648
if gram == "approx":
645-
gt = 0
649+
gt = gram_type.APPROX
646650
elif gram == "exact":
647-
gt = 1
651+
gt = gram_type.EXACT
648652
else:
649653
raise ValueError("gram must be 'approx' or 'exact'")
650654
fmpz_lll_context_init(ctx, delta, eta, rt, gt)

0 commit comments

Comments
 (0)