Skip to content

Commit 11bb708

Browse files
Merge pull request #81 from deinst/showgood
Work around cython parameter passing bug.
2 parents 22cc77c + c27d5d4 commit 11bb708

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/flint/functions/showgood.pyx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ from flint.flintlib.acb cimport *
1313

1414
ctx = thectx
1515

16-
# xxx: this doesn't work when changed to a cdef function. why?
17-
def __goodness(x, bint parts=True, metric=None):
16+
cdef slong __goodness(x, bint parts, metric):
1817
if metric is not None:
1918
x = metric(x)
2019
if isinstance(x, arb):
2120
return arb_rel_accuracy_bits((<arb>x).val)
2221
if isinstance(x, acb):
2322
if parts:
24-
return min(__goodness(x.real), __goodness(x.imag))
23+
return min(__goodness(x.real, parts, metric), __goodness(x.imag, parts, metric))
2524
else:
2625
return acb_rel_accuracy_bits((<acb>x).val)
2726
if isinstance(x, (tuple, list, arb_mat, acb_mat, arb_poly, acb_poly, arb_series, acb_series)):
28-
return min(__goodness(y, parts) for y in x)
27+
return min(__goodness(y, parts, metric) for y in x)
2928
raise TypeError("must have arb or acb")
3029

3130
cdef goodstr(x):

src/flint/test/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def run_doctests(verbose=None):
7373
flint.types.acb_poly,
7474
flint.types.acb_mat,
7575
flint.types.acb_series,
76-
flint.types.dirichlet]
76+
flint.types.dirichlet,
77+
flint.functions.showgood]
7778
results = [doctest.testmod(x) for x in modules]
7879
# ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose)
7980
# failed, total = doctest.testmod(flint.pyflint, verbose=verbose)

0 commit comments

Comments
 (0)