Closed orlitzky closed 2 years ago
Branch pushed to git repo; I updated commit sha1. New commits:
882bbc2 | Trac #32037: update the doctest for the DirichletGroup(5)[1] L-function. |
6c127ff | Trac #32037: lower all lcalc tolerances to 1e-8. |
5404c18 | Trac #32037: add abs_tol to an lcalc test to fix a new failure. |
4c40554 | Trac #32037: update an lcalc doctest that counts zeros. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
fec80eb | Trac #32037: replace some ellipses with abs_tol. |
I've fixed all of the problems I know about, and deleted the one remaining failing doctest that no one knows what to do with. Pending a ptestlong, I think it's ready for a serious look.
The branch is red. Is there a merge conflict?
Replying to @DaveWitteMorris:
The branch is red. Is there a merge conflict?
Probably the gcc-11 patch that was added for the lcalc SPKG before sage-9.4. I can rebase after my ptestlong finishes.
Branch pushed to git repo; I updated commit sha1. New commits:
dce49da | Trac #32037: tweak a doctest in elliptic_curves/ell_rational_field.py. |
Doesn't merge cleanly on current develop, please rebase
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
1a4df39 | Trac #32037: update the doctest for the DirichletGroup(5)[1] L-function. |
44e5d57 | Trac #32037: lower all lcalc tolerances to 1e-8. |
d1dbfb5 | Trac #32037: add abs_tol to an lcalc test to fix a new failure. |
a84d284 | Trac #32037: update an lcalc doctest that counts zeros. |
1727c69 | Trac #32037: add tolerance to a few sage/lfunctions/lcalc.py doctests. |
191147f | Trac #32037: delete a failing doctest. |
0b668c9 | Trac #32037: replace some ellipses with abs_tol. |
9e3f55f | Trac #32037: adjust doctest tolerance for lcalc-2.0.1 in lseries_ell.py. |
7fc9b89 | Trac #32037: weaken doctest tolerance for lcalc-2.0.1 in modular/dirichlet.py. |
c5d8924 | Trac #32037: tweak a doctest in elliptic_curves/ell_rational_field.py. |
should be ok now
This breaks build of sagelib with GCC 11, which worked fine with 1.23 (will all patches on top)
In file included from /usr/include/lcalc/Lglobals.h:70,
from /usr/include/lcalc/L.h:43,
from build/cythonized/sage/libs/lcalc/lcalc_sage.h:1,
from build/cythonized/sage/libs/lcalc/lcalc_Lfunction.cpp:676:
/usr/include/c++/11.1.0/limits: In static member function ‘static constexpr double std::numeric_limits<double>::min()’:
/usr/include/c++/11.1.0/limits:1748:44: error: call to non-‘constexpr’ function ‘double lcalc_to_double(const long double&)’
1748 | min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; }
| ^~~~~~~~~~~
/usr/include/lcalc/Lcommon.h:35:15: note: ‘double lcalc_to_double(const long double&)’ declared here
35 | inline double lcalc_to_double(const long double& x) { return x; }
| ^~~~~~~~~~~~~~~
Ok, thanks, I'll have to investigate after the holiday (it would take more than a day to build gcc-11 on my laptop). The absence of constexpr
in lcalc is "correct," since lcalc can use MPFR for its double type and the MPFR type is not a constexpr.
we can add archlinux, or some other way to get gcc 11, on lcalc CI.
https://stackoverflow.com/a/67406788/557937
we can make a macro expanding to constexpr or to "", and set it up at configure time.
I'm still not 100% sure what's going on, but this is a -std=c++11
problem and not a gcc-11 problem. If you let gcc-11 pick the standard, everything works. But if you specify -std=c++11
, then even the following trivial program will fail,
#include <lcalc/L.h>
The errors suggest that somehow lcalc_to_double()
from lcalc is being invoked in the C++ standard library's min()
function that's just trying to return a constant:
In file included from /usr/include/lcalc/Lglobals.h:70,
from /usr/include/lcalc/L.h:43,
from conftest.cpp:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/limits: In static member function 'static constexpr double std::numeric_limits<double>::min()':
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/limits:1748:44: error: call to non-'constexpr' function 'double lcalc_to_double(const long double&)'
1748 | min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; }
Branch pushed to git repo; I updated commit sha1. New commits:
1a4061a | Trac #32037: update to lcalc-2.0.2 to fix the build with std=c++11. |
There was a recent change that started adding -std=gnu++11
to our CXXFLAGS
and broke lcalc. I released lcalc-2.0.2 which should work again.
I confirm sagelib builds fine again with GCC 11
what change was adding the -std=gnu++11 ?
it is certainly important that all the Sage C++ libs are compatible wrt to C++ ABI.
I haven't followed the discussion on the ticket, but if a specific C++ standard is needed to use the headers, then it is best to declare it in the .pxd
file using distutils: extra_compile_args=-std=c++11
.
sage_setup.command.sage_build_cython
does set this as a default - but I consider this only legacy behavior of our homegrown build system for sagelib.
It will have to be tested with ./configure --enable-editable
, which switches the sagelib build to a simpler build system.
Replying to @dimpase:
what change was adding the -std=gnu++11 ?
The switch to c++11 is actually pretty old (see e.g. 370c03505f290f). What must have changed is that -std=gnu++11
started being added earlier in the build process, before we try to detect lcalc (I know something changed because detecting lcalc-2.0.1 used to work before I rebased onto develop). Regardless, adding the flag early is the right thing to do if we're ultimately going to be compiling code against these libraries with -std=gnu++11
in CXXFLAGS
.
For me now, that flag gets added while detecting GCC.
Replying to @mkoeppe:
I haven't followed the discussion on the ticket, but if a specific C++ standard is needed to use the headers, then it is best to declare it in the
.pxd
file usingdistutils: extra_compile_args=-std=c++11
.
No special flags are needed. The latest lcalc-2.0.2 will work with any of the 11, 14, or 17 standards.
With my distro packages, getting one test failure only
File "/usr/lib/python3.9/site-packages/sage/lfunctions/zero_sums.pyx", line 832, in sage.lfunctions.zero_sums.LFunctionZeroSum_abstract._zerosum_cauchy
Failed example:
E.lseries().zeros(2)
Expected:
[6.36261389, 8.60353962]
Got:
[6.36261390, 8.60353962]
**********************************************************************
Branch pushed to git repo; I updated commit sha1. New commits:
12ac186 | Trac #32037: add tolerance to a test in sage/lfunctions/zero_sums.pyx. |
tests run on https://github.com/sagemath/sagetrac-mirror/actions/runs/1009717554
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
f58d06e | Trac #32037: update an lcalc doctest that counts zeros. |
3f69117 | Trac #32037: add tolerance to a few sage/lfunctions/lcalc.py doctests. |
b642382 | Trac #32037: delete a failing doctest. |
51750e3 | Trac #32037: replace some ellipses with abs_tol. |
0eeb073 | Trac #32037: adjust doctest tolerance for lcalc-2.0.1 in lseries_ell.py. |
c99d844 | Trac #32037: weaken doctest tolerance for lcalc-2.0.1 in modular/dirichlet.py. |
300ee89 | Trac #32037: tweak a doctest in elliptic_curves/ell_rational_field.py. |
1012352 | Trac #32037: update to lcalc-2.0.2 to fix the build with std=c++11. |
57d4c29 | Trac #32037: add tolerance to a test in sage/lfunctions/zero_sums.pyx. |
2d13818 | Trac #32037: upgrade to lcalc-2.0.3. |
Description changed:
---
+++
@@ -1,4 +1,4 @@
-I've just tagged a 2.0.1 release of lcalc: https://gitlab.com/sagemath/lcalc/-/tags/2.0.1
+I've just tagged a 2.0.3 release of lcalc: https://gitlab.com/sagemath/lcalc/-/tags/2.0.3
There are a few issues that need to be addressed during the upgrade.
I accidentally broke the soname in the last version, so here's v2.0.3 to fix it. Also rebased onto the latest gengetopt branch.
Branch pushed to git repo; I updated commit sha1. New commits:
dd656cf | Trac #32037: make getgetopt an order-only dependency of lcalc. |
Author: Michael Orlitzky, Frédéric Chapoton
I've been shipping this downstream for 3 months without issues
Ticket description should be cleaned up
I tried to reduce the ticket description to a digest.
Not sure what the conclusion was on item 7, so I left that out.
The ticket description from before my edit is reproduced below.
I've just tagged a 2.0.3 release of lcalc: https://gitlab.com/sagemath/lcalc/-/tags/2.0.3
There are a few issues that need to be addressed during the upgrade.
The build requires GNU gengetopt, so we'll need a new gengetopt SPKG for lcalc to depend on. (It doesn't need to go in the DEPCHECK macro though, since it's a build-only dependency.)
The build system is now sane. This should make life easier in the long run, but means that spkg-* need to be rewritten. ./configure --with-pari
should suffice.
The lcalc spkg shouldn't depend on mpfr (I'm not sure why it ever did).
spkg-configure.m4 should be modified to find the new version, for example...
diff --git a/build/pkgs/lcalc/spkg-configure.m4 b/build/pkgs/lcalc/spkg-configure.m4
index 19a87c8d30..b332294eae 100644
--- a/build/pkgs/lcalc/spkg-configure.m4
+++ b/build/pkgs/lcalc/spkg-configure.m4
@@ -1,20 +1,20 @@
SAGE_SPKG_CONFIGURE([lcalc], [
- m4_pushdef([SAGE_LCALC_MINVER],["1.22"])
- SAGE_SPKG_DEPCHECK([pari mpfr], [
+ m4_pushdef([SAGE_LCALC_MINVER],["2.0.0"])
+ SAGE_SPKG_DEPCHECK([pari], [
AC_PATH_PROG([LCALC], [lcalc])
AS_IF([test x$LCALC = x], [
AC_MSG_NOTICE([lcalc not found. Installing lcalc])
sage_spkg_install_lcalc=yes], [
AC_MSG_CHECKING([is lcalc's version good enough? ])
- lcalc_ver=`$LCALC --version 2>>/dev/null | $SED -e 's/lcalc\ //' | $SED -e 's/\ .*//g'`
+ lcalc_ver=$($LCALC --version 2>>/dev/null | $SED -e 's/lcalc\ //' | cut -d' ' -f2)
AX_COMPARE_VERSION([$lcalc_ver], [ge], [$SAGE_LCALC_MINVER], [
AC_MSG_RESULT([yes.])
- AC_CHECK_HEADER([Lfunction/L.h], [], [sage_spkg_install_lcalc=yes])
+ AC_CHECK_HEADER([lcalc/L.h], [], [sage_spkg_install_lcalc=yes])
AC_MSG_CHECKING([whether we can link and run a program using libLfunction])
LCALC_SAVED_LIBS=$LIBS
LIBS="$LIBS -lLfunction"
AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[#include <Lfunction/L.h>]],
+ AC_LANG_PROGRAM([[#include <lcalc/L.h>]],
[[initialize_globals();
Complex x;
x = Pi*I;
However, lcalc-2.0.0 comes with a pkg-config file, so we could greatly simplify that.
lcalc/L.h
:diff --git a/src/sage/libs/lcalc/lcalc_sage.h b/src/sage/libs/lcalc/lcalc_sage.h
index 498528917f..18e5232cbe 100644
--- a/src/sage/libs/lcalc/lcalc_sage.h
+++ b/src/sage/libs/lcalc/lcalc_sage.h
@@ -1,4 +1,4 @@
-#include "Lfunction/L.h"
+#include "lcalc/L.h"
int *new_ints(int l)
{
return new int[l];
find_zeros_via_N_v()
function was removed, and replaced by find_zeros()
. Here's a patch:diff --git a/src/sage/libs/lcalc/lcalc_Lfunction.pxd b/src/sage/libs/lcalc/lcalc_Lfunction.pxd
index d1dbb5d95d..5edf0844f3 100644
--- a/src/sage/libs/lcalc/lcalc_Lfunction.pxd
+++ b/src/sage/libs/lcalc/lcalc_Lfunction.pxd
@@ -21,7 +21,7 @@ cdef extern from "lcalc_sage.h":
int (* compute_rank) ()
double (* N) (double T)
void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)
+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
void (*print_data_L)()
#Constructor and destructor
@@ -38,7 +38,7 @@ cdef extern from "lcalc_sage.h":
double (* N) (double T)
double *dirichlet_coefficient
void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)
+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
void (*print_data_L)()
#Constructor and destructor
@@ -54,7 +54,7 @@ cdef extern from "lcalc_sage.h":
int (* compute_rank) ()
double (* N) (double T)
void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)
+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
void (*print_data_L)()
#Constructor and destructor
@@ -70,7 +70,7 @@ cdef extern from "lcalc_sage.h":
int (* compute_rank) ()
double (* N) (double T)
void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)#puts result in vector<double> result
+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
void (*find_zeros_via_N)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, char *filename) #puts result in filename
#Constructor and destructor
@@ -111,7 +111,7 @@ cdef class Lfunction:
#strange bug, replacing Double with double gives me a compile error
cdef Double __typedN(self, double T)
cdef void __find_zeros_v(self, double T1, double T2, double stepsize,doublevec *result)
- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula,doublevec *result)
+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
cdef str _repr
diff --git a/src/sage/libs/lcalc/lcalc_Lfunction.pyx b/src/sage/libs/lcalc/lcalc_Lfunction.pyx
index 7e54d7e78d..409987c5d0 100644
--- a/src/sage/libs/lcalc/lcalc_Lfunction.pyx
+++ b/src/sage/libs/lcalc/lcalc_Lfunction.pyx
@@ -307,8 +307,7 @@ cdef class Lfunction:
return returnvalue
#The default values are from L.h. See L.h
- def find_zeros_via_N(self, count=0, do_negative=False, max_refine=1025,
- rank=-1, test_explicit_formula=0):
+ def find_zeros_via_N(self, count=0, start=0, max_refine=1025, rank=-1):
"""
Finds ``count`` number of zeros with positive imaginary part
starting at real axis. This function also verifies that all
@@ -317,8 +316,7 @@ cdef class Lfunction:
INPUT:
- ``count`` - number of zeros to be found
- - ``do_negative`` - (default: False) False to ignore zeros below the
- real axis.
+ - ``start`` - (default: 0) how many initial zeros to skip
- ``max_refine`` - when some zeros are found to be missing, the step
size used to find zeros is refined. max_refine gives an upper limit
on when lcalc should give up. Use default value unless you know
@@ -326,13 +324,9 @@ cdef class Lfunction:
- ``rank`` - integer (default: -1) analytic rank of the L-function.
If -1 is passed, then we attempt to compute it. (Use default if in
doubt)
- - ``test_explicit_formula`` - integer (default: 0) If nonzero, test
- the explicit formula for additional confidence that all the zeros
- have been found and are accurate. This is still being tested, so
- using the default is recommended.
OUTPUT:
-
+
list -- A list of the imaginary parts of the zeros that have been found
EXAMPLES::
@@ -356,14 +350,10 @@ cdef class Lfunction:
sage: L.find_zeros_via_N(3)
[14.1347251417..., 21.0220396387..., 25.0108575801...]
"""
- cdef Integer count_I = Integer(count)
- cdef Integer do_negative_I = Integer(do_negative)
- cdef RealNumber max_refine_R = RRR(max_refine)
- cdef Integer rank_I = Integer(rank)
- cdef Integer test_explicit_I = Integer(test_explicit_formula)
+ cdef const char *message_stamp = ""
cdef doublevec result
sig_on()
- self.__find_zeros_via_N_v(mpz_get_si(count_I.value), mpz_get_si(do_negative_I.value), mpfr_get_d(max_refine_R.value, MPFR_RNDN), mpz_get_si(rank_I.value), mpz_get_si(test_explicit_I.value), &result)
+ self.__find_zeros(count, start, max_refine, rank, message_stamp, &result)
sig_off()
returnvalue = []
for i in range(result.size()):
@@ -390,7 +380,7 @@ cdef class Lfunction:
cdef void __find_zeros_v(self,double T1, double T2, double stepsize, doublevec *result):
raise NotImplementedError
- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
raise NotImplementedError
##############################################################################
@@ -486,8 +476,8 @@ cdef class Lfunction_I(Lfunction):
cdef double __typedN(self, double T):
return (<c_Lfunction_I *>self.thisptr).N(T)
- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
- (<c_Lfunction_I *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
+ (<c_Lfunction_I *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
# debug tools
def _print_data_to_standard_output(self):
@@ -624,8 +614,8 @@ cdef class Lfunction_D(Lfunction):
cdef double __typedN(self, double T):
return (<c_Lfunction_D *>self.thisptr).N(T)
- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
- (<c_Lfunction_D *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
+ cdef int __find_zeros(self, long count, long start,double max_refine, int rank, const char* message_stamp, doublevec *result):
+ (<c_Lfunction_D *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
# debug tools
def _print_data_to_standard_output(self):
@@ -769,8 +759,8 @@ cdef class Lfunction_C:
cdef double __typedN(self, double T):
return (<c_Lfunction_C *>self.thisptr).N(T)
- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
- (<c_Lfunction_C *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
+ (<c_Lfunction_C *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
# debug tools
def _print_data_to_standard_output(self):
@@ -854,8 +844,8 @@ cdef class Lfunction_Zeta(Lfunction):
cdef double __typedN(self, double T):
return (<c_Lfunction_Zeta *>self.thisptr).N(T)
- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
- (<c_Lfunction_Zeta *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
+ (<c_Lfunction_Zeta *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
def __dealloc__(self):
"""
Some tests need tolerance updates because the answers have changed slightly.
Two tests give different answers entirely and require help from someone who knows what an L-function is. These are discussed on #24820 as well:
**********************************************************************
File "src/sage/libs/lcalc/lcalc_Lfunction.pyx", line 194, in sage.libs.lcalc.lcalc_Lfunction.Lfunction.hardy_z_function
Failed example:
L.hardy_z_function(.4+.3*I)
Expected:
0.2166144222685... - 0.00408187127850...*I
Got:
0.0240947990422036 + 0.215308871779581*I
**********************************************************************
File "src/sage/libs/lcalc/lcalc_Lfunction.pyx", line 350, in sage.libs.lcalc.lcalc_Lfunction.Lfunction.find_zeros_via_N
Failed example:
L.find_zeros_via_N(3)
Expected:
[6.18357819545..., 8.45722917442..., 12.6749464170...]
Got:
[-4.13290370521286, 6.18357819545086, 8.45722917442320]
**********************************************************************
Description changed:
---
+++
@@ -1,251 +1,17 @@
-I've just tagged a 2.0.3 release of lcalc: https://gitlab.com/sagemath/lcalc/-/tags/2.0.3
+The new lcalc 2.0.3 has been released.
+Note in particular:
-There are a few issues that need to be addressed during the upgrade.
+- sane build system
+- comes with a pkg-config file
+- public API header has moved to `lcalc/L.h`
+- the `find_zeros_via_N_v()` function was removed
+ and replaced by `find_zeros()`
-0. The build requires GNU gengetopt, so we'll need a new gengetopt SPKG for lcalc to depend on. (It doesn't need to go in the DEPCHECK macro though, since it's a build-only dependency.)
-1. The build system is now sane. This should make life easier in the long run, but means that spkg-* need to be rewritten. `./configure --with-pari` should suffice.
+In this ticket we upgrade to lcalc 2.0.3 and:
-2. The lcalc spkg shouldn't depend on mpfr (I'm not sure why it ever did).
+- add gengetopt as a new standard SPKG
+- adjust dependencies
+- adjust spkg-* files for the saner build system
+- adjust spkg-configure.m4 to find the new version
+- adjust tolerance in some doctests
-3. spkg-configure.m4 should be modified to find the new version, for example...
-
-```patch
-diff --git a/build/pkgs/lcalc/spkg-configure.m4 b/build/pkgs/lcalc/spkg-configure.m4
-index 19a87c8d30..b332294eae 100644
---- a/build/pkgs/lcalc/spkg-configure.m4
-+++ b/build/pkgs/lcalc/spkg-configure.m4
-@@ -1,20 +1,20 @@
- SAGE_SPKG_CONFIGURE([lcalc], [
-- m4_pushdef([SAGE_LCALC_MINVER],["1.22"])
-- SAGE_SPKG_DEPCHECK([pari mpfr], [
-+ m4_pushdef([SAGE_LCALC_MINVER],["2.0.0"])
-+ SAGE_SPKG_DEPCHECK([pari], [
- AC_PATH_PROG([LCALC], [lcalc])
- AS_IF([test x$LCALC = x], [
- AC_MSG_NOTICE([lcalc not found. Installing lcalc])
- sage_spkg_install_lcalc=yes], [
- AC_MSG_CHECKING([is lcalc's version good enough? ])
-- lcalc_ver=`$LCALC --version 2>>/dev/null | $SED -e 's/lcalc\ //' | $SED -e 's/\ .*//g'`
-+ lcalc_ver=$($LCALC --version 2>>/dev/null | $SED -e 's/lcalc\ //' | cut -d' ' -f2)
- AX_COMPARE_VERSION([$lcalc_ver], [ge], [$SAGE_LCALC_MINVER], [
- AC_MSG_RESULT([yes.])
-- AC_CHECK_HEADER([Lfunction/L.h], [], [sage_spkg_install_lcalc=yes])
-+ AC_CHECK_HEADER([lcalc/L.h], [], [sage_spkg_install_lcalc=yes])
- AC_MSG_CHECKING([whether we can link and run a program using libLfunction])
- LCALC_SAVED_LIBS=$LIBS
- LIBS="$LIBS -lLfunction"
- AC_RUN_IFELSE([
-- AC_LANG_PROGRAM([[#include <Lfunction/L.h>]],
-+ AC_LANG_PROGRAM([[#include <lcalc/L.h>]],
- [[initialize_globals();
- Complex x;
- x = Pi*I;
-```
-
-However, lcalc-2.0.0 comes with a pkg-config file, so we could greatly simplify that.
-
-4. The public API header has moved to `lcalc/L.h`:
-
-```patch
-diff --git a/src/sage/libs/lcalc/lcalc_sage.h b/src/sage/libs/lcalc/lcalc_sage.h
-index 498528917f..18e5232cbe 100644
---- a/src/sage/libs/lcalc/lcalc_sage.h
-+++ b/src/sage/libs/lcalc/lcalc_sage.h
-@@ -1,4 +1,4 @@
--#include "Lfunction/L.h"
-+#include "lcalc/L.h"
- int *new_ints(int l)
- {
- return new int[l];
-
-```
-
-5. The `find_zeros_via_N_v()` function was removed, and replaced by `find_zeros()`. Here's a patch:
-
-```patch
-diff --git a/src/sage/libs/lcalc/lcalc_Lfunction.pxd b/src/sage/libs/lcalc/lcalc_Lfunction.pxd
-index d1dbb5d95d..5edf0844f3 100644
---- a/src/sage/libs/lcalc/lcalc_Lfunction.pxd
-+++ b/src/sage/libs/lcalc/lcalc_Lfunction.pxd
-@@ -21,7 +21,7 @@ cdef extern from "lcalc_sage.h":
- int (* compute_rank) ()
- double (* N) (double T)
- void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
-- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)
-+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
- void (*print_data_L)()
-
- #Constructor and destructor
-@@ -38,7 +38,7 @@ cdef extern from "lcalc_sage.h":
- double (* N) (double T)
- double *dirichlet_coefficient
- void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
-- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)
-+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
- void (*print_data_L)()
-
- #Constructor and destructor
-@@ -54,7 +54,7 @@ cdef extern from "lcalc_sage.h":
- int (* compute_rank) ()
- double (* N) (double T)
- void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
-- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)
-+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
- void (*print_data_L)()
-
- #Constructor and destructor
-@@ -70,7 +70,7 @@ cdef extern from "lcalc_sage.h":
- int (* compute_rank) ()
- double (* N) (double T)
- void (* find_zeros_v)(double T1, double T2, double stepsize, doublevec result )
-- void (*find_zeros_via_N_v)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec result)#puts result in vector<double> result
-+ int (*find_zeros)(long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
- void (*find_zeros_via_N)(long count,int do_negative,double max_refine, int rank, int test_explicit_formula, char *filename) #puts result in filename
-
- #Constructor and destructor
-@@ -111,7 +111,7 @@ cdef class Lfunction:
- #strange bug, replacing Double with double gives me a compile error
- cdef Double __typedN(self, double T)
- cdef void __find_zeros_v(self, double T1, double T2, double stepsize,doublevec *result)
-- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula,doublevec *result)
-+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec* result)
-
- cdef str _repr
-
-```
-
-```patch
-diff --git a/src/sage/libs/lcalc/lcalc_Lfunction.pyx b/src/sage/libs/lcalc/lcalc_Lfunction.pyx
-index 7e54d7e78d..409987c5d0 100644
---- a/src/sage/libs/lcalc/lcalc_Lfunction.pyx
-+++ b/src/sage/libs/lcalc/lcalc_Lfunction.pyx
-@@ -307,8 +307,7 @@ cdef class Lfunction:
- return returnvalue
-
- #The default values are from L.h. See L.h
-- def find_zeros_via_N(self, count=0, do_negative=False, max_refine=1025,
-- rank=-1, test_explicit_formula=0):
-+ def find_zeros_via_N(self, count=0, start=0, max_refine=1025, rank=-1):
- """
- Finds ``count`` number of zeros with positive imaginary part
- starting at real axis. This function also verifies that all
-@@ -317,8 +316,7 @@ cdef class Lfunction:
- INPUT:
-
- - ``count`` - number of zeros to be found
-- - ``do_negative`` - (default: False) False to ignore zeros below the
-- real axis.
-+ - ``start`` - (default: 0) how many initial zeros to skip
- - ``max_refine`` - when some zeros are found to be missing, the step
- size used to find zeros is refined. max_refine gives an upper limit
- on when lcalc should give up. Use default value unless you know
-@@ -326,13 +324,9 @@ cdef class Lfunction:
- - ``rank`` - integer (default: -1) analytic rank of the L-function.
- If -1 is passed, then we attempt to compute it. (Use default if in
- doubt)
-- - ``test_explicit_formula`` - integer (default: 0) If nonzero, test
-- the explicit formula for additional confidence that all the zeros
-- have been found and are accurate. This is still being tested, so
-- using the default is recommended.
-
- OUTPUT:
--
-+
- list -- A list of the imaginary parts of the zeros that have been found
-
- EXAMPLES::
-@@ -356,14 +350,10 @@ cdef class Lfunction:
- sage: L.find_zeros_via_N(3)
- [14.1347251417..., 21.0220396387..., 25.0108575801...]
- """
-- cdef Integer count_I = Integer(count)
-- cdef Integer do_negative_I = Integer(do_negative)
-- cdef RealNumber max_refine_R = RRR(max_refine)
-- cdef Integer rank_I = Integer(rank)
-- cdef Integer test_explicit_I = Integer(test_explicit_formula)
-+ cdef const char *message_stamp = ""
- cdef doublevec result
- sig_on()
-- self.__find_zeros_via_N_v(mpz_get_si(count_I.value), mpz_get_si(do_negative_I.value), mpfr_get_d(max_refine_R.value, MPFR_RNDN), mpz_get_si(rank_I.value), mpz_get_si(test_explicit_I.value), &result)
-+ self.__find_zeros(count, start, max_refine, rank, message_stamp, &result)
- sig_off()
- returnvalue = []
- for i in range(result.size()):
-@@ -390,7 +380,7 @@ cdef class Lfunction:
- cdef void __find_zeros_v(self,double T1, double T2, double stepsize, doublevec *result):
- raise NotImplementedError
-
-- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
-+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
- raise NotImplementedError
-
- ##############################################################################
-@@ -486,8 +476,8 @@ cdef class Lfunction_I(Lfunction):
- cdef double __typedN(self, double T):
- return (<c_Lfunction_I *>self.thisptr).N(T)
-
-- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
-- (<c_Lfunction_I *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
-+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
-+ (<c_Lfunction_I *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
-
- # debug tools
- def _print_data_to_standard_output(self):
-@@ -624,8 +614,8 @@ cdef class Lfunction_D(Lfunction):
- cdef double __typedN(self, double T):
- return (<c_Lfunction_D *>self.thisptr).N(T)
-
-- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
-- (<c_Lfunction_D *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
-+ cdef int __find_zeros(self, long count, long start,double max_refine, int rank, const char* message_stamp, doublevec *result):
-+ (<c_Lfunction_D *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
-
- # debug tools
- def _print_data_to_standard_output(self):
-@@ -769,8 +759,8 @@ cdef class Lfunction_C:
- cdef double __typedN(self, double T):
- return (<c_Lfunction_C *>self.thisptr).N(T)
-
-- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
-- (<c_Lfunction_C *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
-+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
-+ (<c_Lfunction_C *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
-
- # debug tools
- def _print_data_to_standard_output(self):
-@@ -854,8 +844,8 @@ cdef class Lfunction_Zeta(Lfunction):
- cdef double __typedN(self, double T):
- return (<c_Lfunction_Zeta *>self.thisptr).N(T)
-
-- cdef void __find_zeros_via_N_v(self, long count,int do_negative,double max_refine, int rank, int test_explicit_formula, doublevec *result):
-- (<c_Lfunction_Zeta *>self.thisptr).find_zeros_via_N_v(count, do_negative, max_refine, rank, test_explicit_formula, result[0])
-+ cdef int __find_zeros(self, long count, long start, double max_refine, int rank, const char* message_stamp, doublevec *result):
-+ (<c_Lfunction_Zeta *>self.thisptr).find_zeros(count, start, max_refine, rank, message_stamp, result)
-
- def __dealloc__(self):
- """
-```
-
-6. Some tests need tolerance updates because the answers have changed slightly.
-
-7. Two tests give different answers entirely and require help from someone who knows what an L-function is. These are discussed on #24820 as well:
-
-```
-**********************************************************************
-File "src/sage/libs/lcalc/lcalc_Lfunction.pyx", line 194, in sage.libs.lcalc.lcalc_Lfunction.Lfunction.hardy_z_function
-Failed example:
- L.hardy_z_function(.4+.3*I)
-Expected:
- 0.2166144222685... - 0.00408187127850...*I
-Got:
- 0.0240947990422036 + 0.215308871779581*I
-**********************************************************************
-File "src/sage/libs/lcalc/lcalc_Lfunction.pyx", line 350, in sage.libs.lcalc.lcalc_Lfunction.Lfunction.find_zeros_via_N
-Failed example:
- L.find_zeros_via_N(3)
-Expected:
- [6.18357819545..., 8.45722917442..., 12.6749464170...]
-Got:
- [-4.13290370521286, 6.18357819545086, 8.45722917442320]
-**********************************************************************
-```
Reviewer: Antonio Rojas
Replying to @slel:
I tried to reduce the ticket description to a digest.
Not sure what the conclusion was on item 7, so I left that out.
Thanks. One of those doctests was updated for the new output, an expected change now that the API automatically determines that the L-function is complex:
https://github.com/sagemath/sagetrac-mirror/commits/8d1221a4
The other was ultimately deleted, because no one can explain either the old or new output:
https://github.com/sagemath/sagetrac-mirror/commits/b642382d
add gengetopt as a new standard SPKG
This is actually still open as a dependency in #32061.
(Edit: link to the correct commits.)
should be good to go now.
Needs to be rebased on top of #31837, which brings a patch that does not apply to the new version
Changed dependencies from #32061 to #32061, #31837
... as seen in https://github.com/mkoeppe/sage/runs/4127380314?check_suite_focus=true
The new lcalc 2.0.3 has been released. Note in particular:
lcalc/L.h
find_zeros_via_N_v()
function was removed and replaced byfind_zeros()
In this ticket we upgrade to lcalc 2.0.3 and:
Depends on #32061 Depends on #31837
CC: @JohnCremona @antonio-rojas @kiwifb @dimpase
Component: packages: standard
Author: Michael Orlitzky, Frédéric Chapoton
Branch:
cbb7908
Reviewer: Antonio Rojas, Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/32037