1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-15 03:14:23 +00:00

Adding lcalc, the L-function c++ class library and, the command line program

lcalc, to be used by SageMath.

Remark: this is not the latest version, but the one currently used by Sage,
with their patches.
This commit is contained in:
Thierry Thomas 2020-03-30 12:40:37 +00:00
parent 97f63e40bf
commit d9d39e0a5b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=529880
20 changed files with 724 additions and 0 deletions

View File

@ -340,6 +340,7 @@
SUBDIR += lapacke
SUBDIR += laspack
SUBDIR += latte-integrale
SUBDIR += lcalc
SUBDIR += ldouble
SUBDIR += lean
SUBDIR += lemon

31
math/lcalc/Makefile Normal file
View File

@ -0,0 +1,31 @@
# Created by: thierry@pompo.net
# $FreeBSD$
PORTNAME= lcalc
PORTVERSION= 1.23
CATEGORIES= math
MASTER_SITES= ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/upstream/lcalc/
MAINTAINER= thierry@FreeBSD.org
COMMENT= L-function c++ class library and the CLI program lcalc
LICENSE= GPLv2+
LIB_DEPENDS= libgmp.so:math/gmp \
libmpfr.so:math/mpfr \
libpari.so:math/pari
#USE_GITHUB= yes
#GH_ACCOUNT= agrawroh
#GH_PROJECT= l-calc
#GH_TAGNAME= 4c57471
USES= gmake localbase tar:bz2
PATCH_WRKSRC= ${WRKDIR}/${DISTNAME}
WRKSRC_SUBDIR= src
USE_LDCONFIG= yes
MAKE_ENV= MAKE=${GMAKE} STAGEDIR=${STAGEDIR}
.include <bsd.port.mk>

3
math/lcalc/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1585493725
SHA256 (lcalc-1.23.tar.bz2) = 83d4253ec2f38553b21190d6d0c6b71bab7ea14717f6dde5bd18f60775d3cdb0
SIZE (lcalc-1.23.tar.bz2) = 491589

View File

@ -0,0 +1,20 @@
--- include/L.h.orig 2012-08-08 21:21:55 UTC
+++ include/L.h
@@ -18,6 +18,8 @@
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
@@ -491,7 +493,7 @@ class L_function (public)
//#include "Ldirichlet_series.h" //for computing Dirichlet series
Complex partial_dirichlet_series(Complex s, long long N1, long long N2);
- Complex dirichlet_series(Complex s, long long N);
+ Complex dirichlet_series(Complex s, long long N=-1LL);
//#include "Ltaylor_series.h" //for computing taylor series for Dirichlet series
//void compute_taylor_series(int N, int K, Complex s_0, Complex *series);

View File

@ -0,0 +1,20 @@
--- include/Lcommandline.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lcommandline.h
@@ -18,6 +18,8 @@
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
@@ -39,7 +41,7 @@
#include "Lcommandline_globals.h" //command line global variables
#ifdef INCLUDE_PARI
-#include "pari.h" //for pari's elliptic curve functions
+#include "pari/pari.h" //for pari's elliptic curve functions
#undef init //pari has a '#define init pari_init' which
//causes trouble with the stream.h init.
//pari also causes trouble with things like abs.

View File

@ -0,0 +1,20 @@
--- include/Lcommandline_elliptic.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lcommandline_elliptic.h
@@ -18,6 +18,8 @@
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
@@ -32,7 +34,7 @@
#ifdef INCLUDE_PARI
-#include "pari.h" //for pari's elliptic curve functions
+#include "pari/pari.h" //for pari's elliptic curve functions
#undef init //pari has a '#define init pari_init' which
//causes trouble with the stream.h init.
//pari also causes trouble with things like abs.

View File

@ -0,0 +1,18 @@
--- include/Lcommandline_numbertheory.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lcommandline_numbertheory.h
@@ -18,12 +18,15 @@
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
#ifndef Lcommandline_numbertheory_H
#define Lcommandline_numbertheory_H
+#include <time.h>
#include <stdlib.h> //for things like srand
#include <iostream> //for input and output
#include <iomanip> //for manipulating output such as setprecision

View File

@ -0,0 +1,16 @@
--- include/Lcommon.h.orig 2020-03-29 15:43:34 UTC
+++ include/Lcommon.h
@@ -1,3 +1,4 @@
+// Patches borrowed from SageMath.
// When MPFR is enabled and double is passed to a templated function
// The function should use precise(ttype) to make sure calculations run
// within the more precise type
@@ -48,7 +49,7 @@ const bool outputSeries=true; // Whether to output t
// Loop i from m to n
// Useful in tidying up most for loops
-#define loop(i,m,n) for(typeof(m) i=(m); i!=(n); i++)
+#define loop(i,m,n) for(auto i=(m); i!=(n); i++)
// A class for calculations involving polynomials of small degree
// Not efficient enough for huge polynomials

View File

@ -0,0 +1,17 @@
--- include/Lcommon_ld.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lcommon_ld.h
@@ -1,3 +1,5 @@
+// Patches borrowed from SageMath.
+
// When MPFR is enabled and double is passed to a templated function
// The function should use precise(ttype) to make sure calculations run
// within the more precise type
@@ -53,7 +55,7 @@ const bool outputSeries=true; // Whether to output t
// Loop i from m to n
// Useful in tidying up most for loops
-#define loop(i,m,n) for(typeof(m) i=(m); i!=(n); i++)
+#define loop(i,m,n) for(auto i=(m); i!=(n); i++)
// A class for calculations involving polynomials of small degree
// Not efficient enough for huge polynomials

View File

@ -0,0 +1,28 @@
--- include/Lcomplex.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lcomplex.h
@@ -34,6 +34,7 @@
// Initially implemented by Ulrich Drepper <drepper@cygnus.com>
// Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
//
+// Patches borrowed from SageMath.
/** @file complex
* This is a Standard C++ Library header. You should @c #include this header
@@ -45,8 +46,6 @@
#pragma GCC system_header
-#include <bits/c++config.h>
-
//no longer include:
//#include <bits/cpp_type_traits.h> only thing used was is_floating...
//gcc 4.0 cpp_type_traits.h is not compatible with gcc 3.3.
@@ -135,7 +134,7 @@ namespace std
template<typename _Up>
complex<_Tp>& operator/=(const complex<_Up>&);
- friend reset(complex<_Tp>& C) {
+ friend void reset(complex<_Tp>& C) {
reset(C._M_real);
reset(C._M_imag);
}

View File

@ -0,0 +1,20 @@
--- include/Ldirichlet_series.h.orig 2012-08-08 21:21:55 UTC
+++ include/Ldirichlet_series.h
@@ -17,6 +17,8 @@
Check the License for details. You should have received a copy of it, along
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Patches borrowed from SageMath.
*/
@@ -43,7 +45,7 @@ partial_dirichlet_series(Complex s, long long N1, long
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
template <class ttype>
Complex L_function <ttype>::
-dirichlet_series(Complex s, long long N=-1)
+dirichlet_series(Complex s, long long N)
{
Complex z=0.;
long long m,n;

View File

@ -0,0 +1,43 @@
--- include/Ldokchitser.h.orig 2012-08-08 21:21:55 UTC
+++ include/Ldokchitser.h
@@ -1,3 +1,5 @@
+// Patches borrowed from SageMath.
+
#ifndef Ldokchitser_H
#define Ldokchitser_H
@@ -69,7 +71,7 @@ phi_series(int precision)
// compute the values m[j] for the respective lambda_k[j]
- Complex m[N+1];
+ std::vector<Complex> m(N+1);
for (j=1;j<=N;j++)
m[j] = -2*lambda_k[j] + 2;
@@ -78,7 +80,8 @@ phi_series(int precision)
int n,fact_n;
Complex log_Gamma[N+1][a+1][MYDIGITS+1];
- Complex sum_log_Gamma[N+1][MYDIGITS+1];
+ std::vector<std::vector<Complex> > sum_log_Gamma(N+1);
+ for (j=1;j<=N;j++) sum_log_Gamma[j].resize(MYDIGITS+1);
for (j=1;j<=N;j++)
for (n=0;n<=MYDIGITS;n++)
@@ -103,8 +106,13 @@ phi_series(int precision)
// compute the exponential taylor series for gamma = exp(sum_log_Gamma)
- Complex exp_sum_log_Gamma[N+1][MYDIGITS+1][MYDIGITS+1]; // symmetric functions
- Complex gamma[N+1][MYDIGITS+1]; // gamma(s+m[j]) for j = 1 to N
+ std::vector<std::vector<std::vector<Complex> > > exp_sum_log_Gamma(N+1); // symmetric functions
+ std::vector<std::vector<Complex> > gamma(N+1); // gamma(s+m[j]) for j = 1 to N
+ for (j=1;j<=N;j++){
+ exp_sum_log_Gamma[j].resize(MYDIGITS+1);
+ gamma[j].resize(MYDIGITS+1);
+ }
+ for (j=1;j<=N;j++) for (n=0;n<=MYDIGITS;n++) exp_sum_log_Gamma[j][n].resize(MYDIGITS+1);
Complex temp_gamma[MYDIGITS+1];
Complex temp_mult_gamma[MYDIGITS+1];
Complex temp_exp_sum_log_Gamma[MYDIGITS+1];

View File

@ -0,0 +1,17 @@
--- include/Lexplicit_formula.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lexplicit_formula.h
@@ -1,4 +1,5 @@
// This file mainly due to Kevin McGown, with modifications by Michael Rubinstein
+// Patches borrowed from SageMath.
#ifndef Lexplicit_formula_H
#define Lexplicit_formula_H
@@ -25,7 +26,7 @@ int L_function <ttype>::
dirichlet_coeffs_log_diff(int num_coeffs, Complex *c)
{
- Complex b[num_coeffs+1];
+ std::vector<Complex> b(num_coeffs+1);
int j, n, d1, ind;
Complex total, total2, temp;

View File

@ -0,0 +1,65 @@
--- include/Lgamma.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lgamma.h
@@ -18,6 +18,8 @@
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
@@ -77,7 +79,7 @@ Complex exp_recycle();
//n=0 should just give log_GAMMA(z)... thus making log_GAMMA
//code obsolete. But leave log_GAMMA intact anyways.
template <class ttype>
-precise(ttype) log_GAMMA (ttype z,int n=0)
+precise(ttype) log_GAMMA (ttype z,int n)
{
int M;
precise(ttype) log_G,r,r2,y;
@@ -230,7 +232,7 @@ Complex GAMMA (ttype z1, ttype2 delta)
//value exp_w which holds exp(-w)
//computes G(z,w), so there's an extra w^(-z) factor.
template <class ttype>
-Complex inc_GAMMA (ttype z,ttype w, const char *method="temme", ttype exp_w = 0, bool recycle=false)
+Complex inc_GAMMA (ttype z,ttype w, const char *method, ttype exp_w, bool recycle)
{
Complex G;
@@ -334,7 +336,7 @@ Complex inc_GAMMA (ttype z,ttype w, const char *method
template <class ttype>
-ttype cfrac_GAMMA (ttype z,ttype w, ttype exp_w=0, bool recycle=false) //computes G(z,w) via continued fraction
+ttype cfrac_GAMMA (ttype z,ttype w, ttype exp_w, bool recycle) //computes G(z,w) via continued fraction
{
ttype G;
@@ -424,7 +426,7 @@ ttype cfrac_GAMMA (ttype z,ttype w, ttype exp_w=0, boo
}
template <class ttype>
-ttype asympt_GAMMA (ttype z,ttype w, ttype exp_w = 0, bool recycle=false) //computes G(z,w) via asymptotic series
+ttype asympt_GAMMA (ttype z,ttype w, ttype exp_w, bool recycle) //computes G(z,w) via asymptotic series
{
if(my_verbose>3) cout << "called asympt_GAMMA("<<z<<","<<w<<")"<< endl;
@@ -446,7 +448,7 @@ ttype asympt_GAMMA (ttype z,ttype w, ttype exp_w = 0,
template <class ttype>
-ttype comp_inc_GAMMA (ttype z,ttype w,ttype exp_w = 0, bool recycle=false) //computes g(z,w)
+ttype comp_inc_GAMMA (ttype z,ttype w,ttype exp_w, bool recycle) //computes g(z,w)
{
ttype g;
@@ -604,7 +606,7 @@ ttype comp_inc_GAMMA (ttype z,ttype w,ttype exp_w = 0,
}
template <class ttype>
-Complex gamma_sum(Complex s, int what_type, ttype *coeff, int N, Double g, Complex l, Double Q, Long Period, Complex delta=1, const char *method="temme")
+Complex gamma_sum(Complex s, int what_type, ttype *coeff, int N, Double g, Complex l, Double Q, Long Period, Complex delta, const char *method)
{
Complex SUM=0;

View File

@ -0,0 +1,21 @@
--- include/Lglobals.h.orig 2012-08-08 21:21:55 UTC
+++ include/Lglobals.h
@@ -18,15 +18,17 @@
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
#ifndef Lglobals_H
#define Lglobals_H
+#include <valarray>
using namespace std;
-#include <valarray>
#ifdef USE_MPFR
#include "Lgmpfrxx.h"
typedef mpfr_class Double;

View File

@ -0,0 +1,36 @@
--- src/Lcommandline.cc.orig 2012-08-08 21:21:56 UTC
+++ src/Lcommandline.cc
@@ -18,6 +18,8 @@ Check the License for details. You should have receive
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
@@ -412,12 +414,7 @@ int main (int argc, char *argv[])
t2=.5; //t2=.5 because of the GAMMA(s+1/2)
- pari_init(1000000000,2);
- //pari_init_opts(400000000,2,INIT_DFTm); // the last option is to prevent
- //pari from giving its interrupt signal when its elliptic curve a_p
- //algorithm is called and interrupted with ctrl-c. Requires a more current
- //version of pari, so use pari_init above until I have a configure set up
- //that detects which pari, if any, is installed.
+ pari_init_opts(16000000, 2, INIT_DFTm);
coeff = new Double[3];
//compute the conductor which is copied to coeff[1]
@@ -473,7 +470,9 @@ int main (int argc, char *argv[])
#ifdef INCLUDE_PARI
if(do_elliptic_curve){
- allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
+ // Reallocate PARI stack
+ paristack_setsize((size_t)N_terms*16 + 1000000, 0); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
+
if (my_verbose>0) cout << "Will precompute " << N_terms << " elliptic L-function dirichlet coefficients..." << endl;
initialize_new_L(a1,a2,a3,a4,a6,N_terms);
}

View File

@ -0,0 +1,62 @@
--- src/Lcommandline_elliptic.cc.orig 2012-08-08 21:21:56 UTC
+++ src/Lcommandline_elliptic.cc
@@ -18,6 +18,8 @@
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ Patches borrowed from SageMath.
+
*/
#include "Lcommandline_elliptic.h"
@@ -121,11 +123,11 @@ void data_E(char *a1, char *a2, char *a3, char *a4, ch
F = cgetg(6, t_VEC);
- F[1] = lgeti(BIGDEFAULTPREC);
- F[2] = lgeti(BIGDEFAULTPREC);
- F[3] = lgeti(BIGDEFAULTPREC);
- F[4] = lgeti(BIGDEFAULTPREC);
- F[5] = lgeti(BIGDEFAULTPREC);
+ F[1] = (long)cgeti(BIGDEFAULTPREC);
+ F[2] = (long)cgeti(BIGDEFAULTPREC);
+ F[3] = (long)cgeti(BIGDEFAULTPREC);
+ F[4] = (long)cgeti(BIGDEFAULTPREC);
+ F[5] = (long)cgeti(BIGDEFAULTPREC);
//gaffsg(a1,(GEN) F[1]);
//gaffsg(a2,(GEN) F[2]);
@@ -133,15 +135,15 @@ void data_E(char *a1, char *a2, char *a3, char *a4, ch
//gaffsg(a4,(GEN) F[4]);
//gaffsg(a6,(GEN) F[5]);
- gaffect(strtoGEN(a1), (GEN) F[1]);
- gaffect(strtoGEN(a2), (GEN) F[2]);
- gaffect(strtoGEN(a3), (GEN) F[3]);
- gaffect(strtoGEN(a4), (GEN) F[4]);
- gaffect(strtoGEN(a6), (GEN) F[5]);
+ gaffect(gp_read_str(a1), (GEN) F[1]);
+ gaffect(gp_read_str(a2), (GEN) F[2]);
+ gaffect(gp_read_str(a3), (GEN) F[3]);
+ gaffect(gp_read_str(a4), (GEN) F[4]);
+ gaffect(gp_read_str(a6), (GEN) F[5]);
- E = initell(F,BIGDEFAULTPREC);
+ E = ellinit(F, NULL, BIGDEFAULTPREC);
- C=globalreduction(E);
+ C=ellglobalred(E);
x=gtodouble((GEN) C[1]);
@@ -167,8 +169,8 @@ void data_E(char *a1, char *a2, char *a3, char *a4, ch
p=n;
gaffsg(p,y);
- coeff[p] = Double(1.*llrint(gtodouble(apell(E,y))))/sqrt(Double(1.*p));
- //coeff[p] = Double(1.*Long(gtodouble(apell(E,y))+.1))/sqrt(Double(1.*p));
+ coeff[p] = Double(1.*llrint(gtodouble(ellap(E,y))))/sqrt(Double(1.*p));
+ //coeff[p] = Double(1.*Long(gtodouble(ellap(E,y))+.1))/sqrt(Double(1.*p));
if(gtolong(gmod((GEN) E[12],(GEN) y))==0) // if p|discriminant, i.e. bad reduction
{

View File

@ -0,0 +1,235 @@
--- src/Makefile.orig 2012-08-08 21:21:56 UTC
+++ src/Makefile
@@ -8,12 +8,13 @@
#the c compiler, that will generate options which are specific to the
#compilers, optimization options depending on the chip, etc
+# + Patches borrowed from SageMath.
# Comment out the following line to remove the use of pari's
# elliptic curve routines. Doing so disables the -e option.
# g++ with -DINCLUDE_PARI sends a #define INCLUDE_PARI to the preprocessor.
-#PARI_DEFINE = -DINCLUDE_PARI
+PARI_DEFINE = -DINCLUDE_PARI
#PREPROCESSOR_DEFINE = -DUSE_LONG_DOUBLE
#OPENMP_FLAG = -fopenmp
@@ -29,11 +30,21 @@ endif
OS_NAME := $(shell uname)
-CC = g++
+#CC = g++
#cc = /home/mrubinst/local/bin/gcc
#CC = /home/mrubinst/local/bin/g++
#LD = /home/mrubinst/local/bin/g++
+ifneq (,$(findstring CYGWIN,$(OS_NAME)))
+ OS_NAME := CYGWIN
+endif
+
+# Note: I've also changed various rules to use $CXX instead of $CC,
+# since we mostly compile C++, not C, and $CC is by convention
+# used for the *C* compiler.
+#CC ?= gcc
+#CXX ?= g++
+
#CC = /Users/michaelrubinstein/math/L/packages/gcc4.3/usr/local/bin/g++
#EXTRA= -pg
#EXTRA = -ftree-vectorize -ftree-vectorizer-verbose=5 -funroll-loops
@@ -58,59 +69,27 @@ ifeq ($(G5),TRUE)
#MACHINE_SPECIFIC_FLAGS = -mpowerpc -mpowerpc64 -m64
endif
-CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
-#CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
-#CCFLAGS = -Wa,-W -O2 -fno-exceptions -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
+CXXFLAGS := $(OPENMP_FLAG) $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA) $(CXXFLAGS)
#warning- O2 doesn't help with -DUSE_LONG_DOUBLE on mac, and actually seems to hurt, making runtime longer
#by a factor of 1.5
-ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
- #location of pari.h.
- LOCATION_PARI_H = /usr/local/include/pari #usual location
- #location of libpari.a or of libpari.so
- #depending on whether static or dynamic libraries are being used.
- #On mac os x it's the former, on linux I think usually the latter.
- LOCATION_PARI_LIBRARY = /usr/local/lib #usual location
-else
- #supplied as a dummy so as to avoid more ifeq's below
- LOCATION_PARI_H = .
- LOCATION_PARI_LIBRARY = .
-endif
-
-
-
#INCLUDEFILES= -I../include -I../../packages/gcc4.3/usr/local/include
INCLUDEFILES= -I../include
#For Mac os x we omit shared library options
ifeq ($(OS_NAME),Darwin)
- LDFLAGS2 =
- DYN_OPTION=dynamiclib
+ DYN_OPTION=dynamiclib -Wl,-headerpad_max_install_names
else
- LDFLAGS1 = -Xlinker -export-dynamic #not sure why pari calls these when linking but on the web I found
- #'Libtool provides the `-export-dynamic' link flag (see section Link mode), which does this declaration.
- #You need to use this flag if you are linking a shared library that will be dlopened'
- #see notes below
- #ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
- LDFLAGS2 = $(LDFLAGS1) -Xlinker -rpath -Xlinker $(LOCATION_PARI_LIBRARY)
- #else
- # LDFLAGS2 = $(LDFLAGS1)
- #endif
DYN_OPTION=shared
endif
-ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
- LDFLAGS = $(LDFLAGS2) -L$(LOCATION_PARI_LIBRARY) -lpari
-else
- LDFLAGS = $(LDFLAGS2)
-endif
+PARI_LIBS = -L$(LOCALBASE)/lib -lpari -lgmp -lm
-
#NOTES:
#for caedmon: the shared pari library is in a funny location: /usr/local/pari/pari-2.1.5/lib
#At compile time we need to specify that location with:
@@ -129,47 +108,63 @@ endif
#become clear which libraries the computer can find.
-INSTALL_DIR= /usr/local
+INSTALL_DIR = $(STAGEDIR)$(PREFIX)
+#binary and library files extensions
+LIBEXT := .so
+EXEEXT :=
+
+ifeq ($(OS_NAME),Darwin)
+ LIBEXT := .dylib
+ EXEEXT :=
+endif
+
+ifeq ($(OS_NAME),CYGWIN)
+ LIBEXT := .dll
+ EXEEXT := .exe
+endif
+
#object files for the libLfunction library
OBJ_L = Lglobals.o Lgamma.o Lriemannsiegel.o Lriemannsiegel_blfi.o Ldokchitser.o
#object files for the command line program
-OBJ2=$(OBJ_L) Lcommandline_globals.o Lcommandline_misc.o Lcommandline_numbertheory.o Lcommandline_values_zeros.o
-OBJ3=$(OBJ2) Lcommandline_elliptic.o Lcommandline_twist.o Lcommandline.o cmdline.o
+OBJ2 = $(OBJ_L) Lcommandline_globals.o Lcommandline_misc.o Lcommandline_numbertheory.o Lcommandline_values_zeros.o
+OBJ3 = $(OBJ2) Lcommandline_elliptic.o Lcommandline_twist.o Lcommandline.o cmdline.o
OBJECTS = $(OBJ3)
all:
-# make print_vars
- make libLfunction.so
- make lcalc
- make examples
-# make find_L
-# make test
+# $(MAKE) print_vars
+ $(MAKE) libLfunction$(LIBEXT)
+ $(MAKE) lcalc$(EXEEXT)
+ $(MAKE) examples$(EXEEXT)
+# $(MAKE) find_L
+# $(MAKE) test
print_vars:
@echo OS_NAME = $(OS_NAME)
-lcalc: $(OBJECTS)
- $(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(LDFLAGS) -o lcalc $(GMP_FLAGS)
+lcalc$(EXEEXT): $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) $(LDFLAGS) $(OBJECTS) -o lcalc$(EXEEXT) $(PARI_LIBS) $(GMP_FLAGS)
-examples:
- $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/example.cc libLfunction.so -o example_programs/example $(GMP_FLAGS)
+examples$(EXEEXT):
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) example_programs/example.cc $(LDFLAGS) libLfunction$(LIBEXT) -o example_programs/example$(EXEEXT) $(PARI_LIBS) $(GMP_FLAGS)
-proc:
- $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/proc.cc libLfunction.so -o example_programs/proc $(GMP_FLAGS)
+proc$(EXEEXT):
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) example_programs/proc.cc $(LDFLAGS) libLfunction$(LIBEXT) -o example_programs/proc$(EXEEXT) $(PARI_LIBS) $(GMP_FLAGS)
-test:
- $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/test.cc libLfunction.so -o example_programs/test $(GMP_FLAGS)
+test$(EXEEXT):
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) example_programs/test.cc $(LDFLAGS) libLfunction$(LIBEXT) -o example_programs/test$(EXEEXT) $(PARI_LIBS) $(GMP_FLAGS)
-find_L:
- $(CC) $(CCFLAGS) $(INCLUDEFILES) find_L_functions/find_L_functions.cc libLfunction.so -o find_L_functions/find_L $(GMP_FLAGS)
+find_L$(EXEEXT):
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) find_L_functions/find_L_functions.cc $(LDFLAGS) libLfunction$(LIBEXT) -o find_L_functions/find_L$(EXEEXT) $(PARI_LIBS) $(GMP_FLAGS)
.cc.o:
- $(CC) $(CCFLAGS) $(INCLUDEFILES) -c $<
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) -c $<
+
+# Warning: We (Sage) add $CXXFLAGS to CXXFLAGS above.
.c.o:
- $(CC) $(CCFLAGS) $(INCLUDEFILES) -c $<
+ $(CC) $(CFLAGS) $(INCLUDEFILES) -c $<
Lglobals.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
@@ -227,7 +222,7 @@ Lcommandline_elliptic.o: ../include/Lnumberzeros.h ../
Lcommandline_elliptic.o: ../include/Lvalue.h ../include/Lfind_zeros.h
Lcommandline_elliptic.o: ../include/Lcommandline_numbertheory.h
Lcommandline_elliptic.o: ../include/Lcommandline_globals.h
- $(CC) $(CCFLAGS) $(INCLUDEFILES) -I$(LOCATION_PARI_H) $(PARI_DEFINE) -c Lcommandline_elliptic.cc
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) $(PARI_DEFINE) -c Lcommandline_elliptic.cc
Lcommandline_twist.o: ../include/Lcommandline_twist.h ../include/L.h
Lcommandline_twist.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
@@ -239,7 +234,7 @@ Lcommandline_twist.o: ../include/Lvalue.h ../include/L
Lcommandline_twist.o: ../include/Lcommandline_numbertheory.h
Lcommandline_twist.o: ../include/Lcommandline_globals.h
Lcommandline_twist.o: ../include/Lcommandline_elliptic.h
- $(CC) $(CCFLAGS) $(INCLUDEFILES) -I$(LOCATION_PARI_H) $(PARI_DEFINE) -c Lcommandline_twist.cc
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) $(PARI_DEFINE) -c Lcommandline_twist.cc
cmdline.o: ../include/cmdline.h ../include/getopt.h
#$(CC) $(CCFLAGS) $(INCLUDEFILES) -DHAVE_LONG_LONG -c cmdline.c
@@ -258,21 +253,21 @@ Lcommandline.o: ../include/Lcommandline_misc.h
Lcommandline.o: ../include/Lcommandline_elliptic.h
Lcommandline.o: ../include/Lcommandline_twist.h
Lcommandline.o: ../include/Lcommandline_values_zeros.h
- $(CC) $(CCFLAGS) $(INCLUDEFILES) -I$(LOCATION_PARI_H) $(PARI_DEFINE) -c Lcommandline.cc
+ $(CXX) $(CXXFLAGS) $(INCLUDEFILES) $(PARI_DEFINE) -c Lcommandline.cc
-libLfunction.so: $(OBJ_L)
- g++ -$(DYN_OPTION) -o libLfunction.so $(OBJ_L)
+libLfunction$(LIBEXT): $(OBJ_L)
+ $(CXX) -$(DYN_OPTION) $(CXXFLAGS) -o libLfunction$(LIBEXT) $(LDFLAGS) $(OBJ_L) $(PARI_LIBS)
clean:
- rm -f *.o lcalc libLfunction.so example_programs/example
+ rm -f *.o lcalc$(EXEEXT) libLfunction$(LIBEXT) example_programs/example$(EXEEXT)
install:
- cp -f lcalc $(INSTALL_DIR)/bin/.
- cp -f libLfunction.so $(INSTALL_DIR)/lib/.
+ cp -f lcalc$(EXEEXT) $(INSTALL_DIR)/bin/.
+ cp -f libLfunction$(LIBEXT) $(INSTALL_DIR)/lib/.
cp -rf ../include $(INSTALL_DIR)/include/Lfunction
SRCS = Lcommandline.cc Lcommandline_elliptic.cc Lcommandline_globals.cc Lcommandline_misc.cc Lcommandline_numbertheory.cc Lcommandline_twist.cc Lcommandline_values_zeros.cc Lgamma.cc Lglobals.cc Lmisc.cc Lriemannsiegel.cc Lriemannsiegel_blfi.cc cmdline.c
depend:
- makedepend -f depends -- $(CCFLAGS) -Y../include -- $(SRCS)
+ makedepend -f depends -- $(CXXFLAGS) -Y../include -- $(SRCS)

6
math/lcalc/pkg-descr Normal file
View File

@ -0,0 +1,6 @@
This program computes zeros and values of L-function.
It installs the L-function c++ class library and, the command line program
lcalc.
WWW: https://github.com/agrawroh/l-calc

45
math/lcalc/pkg-plist Normal file
View File

@ -0,0 +1,45 @@
bin/lcalc
include/Lfunction/L.h
include/Lfunction/L.h.orig
include/Lfunction/Lcommandline.h
include/Lfunction/Lcommandline.h.orig
include/Lfunction/Lcommandline_elliptic.h
include/Lfunction/Lcommandline_elliptic.h.orig
include/Lfunction/Lcommandline_globals.h
include/Lfunction/Lcommandline_misc.h
include/Lfunction/Lcommandline_numbertheory.h
include/Lfunction/Lcommandline_numbertheory.h.orig
include/Lfunction/Lcommandline_twist.h
include/Lfunction/Lcommandline_values_zeros.h
include/Lfunction/Lcommon.h
include/Lfunction/Lcommon.h.orig
include/Lfunction/Lcommon_ld.h
include/Lfunction/Lcommon_ld.h.orig
include/Lfunction/Lcomplex.h
include/Lfunction/Lcomplex.h.orig
include/Lfunction/Ldirichlet_series.h
include/Lfunction/Ldirichlet_series.h.orig
include/Lfunction/Ldokchitser.h
include/Lfunction/Ldokchitser.h.orig
include/Lfunction/Lexplicit_formula.h
include/Lfunction/Lexplicit_formula.h.orig
include/Lfunction/Lfind_zeros.h
include/Lfunction/Lgamma.h
include/Lfunction/Lgamma.h.orig
include/Lfunction/Lglobals.h
include/Lfunction/Lglobals.h.orig
include/Lfunction/Lgmpfrxx.h
include/Lfunction/Lgram.h
include/Lfunction/Lint_complex.h
include/Lfunction/Lmisc.h
include/Lfunction/Lnumberzeros.h
include/Lfunction/Lnumeric.h
include/Lfunction/Lprint.h
include/Lfunction/Lriemannsiegel.h
include/Lfunction/Lriemannsiegel_blfi.h
include/Lfunction/Lvalue.h
include/Lfunction/Lvalue.h.bak
include/Lfunction/cmdline.h
include/Lfunction/getopt.h
include/Lfunction/mpfr_mul_d.h
lib/libLfunction.so