mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
gnu: Add lcalc.
* gnu/packages/sagemath.scm (lcalc): New variable. * gnu/packages/patches/lcalc-default-parameters-1.patch, gnu/packages/patches/lcalc-default-parameters-2.patch, gnu/packages/patches/lcalc-lcommon-h.patch, gnu/packages/patches/lcalc-using-namespace-std.patch: New files. * gnu/local.mk (dist_patch_DATA): Register patches.
This commit is contained in:
parent
88f913e8ad
commit
fedb9571eb
6 changed files with 209 additions and 0 deletions
|
@ -973,6 +973,10 @@ dist_patch_DATA = \
|
|||
%D%/packages/patches/kodi-set-libcurl-ssl-parameters.patch \
|
||||
%D%/packages/patches/kodi-skip-test-449.patch \
|
||||
%D%/packages/patches/laby-make-install.patch \
|
||||
%D%/packages/patches/lcalc-default-parameters-1.patch \
|
||||
%D%/packages/patches/lcalc-default-parameters-2.patch \
|
||||
%D%/packages/patches/lcalc-lcommon-h.patch \
|
||||
%D%/packages/patches/lcalc-using-namespace-std.patch \
|
||||
%D%/packages/patches/lcms-CVE-2018-16435.patch \
|
||||
%D%/packages/patches/ldc-bootstrap-disable-tests.patch \
|
||||
%D%/packages/patches/ldc-disable-phobos-tests.patch \
|
||||
|
|
26
gnu/packages/patches/lcalc-default-parameters-1.patch
Normal file
26
gnu/packages/patches/lcalc-default-parameters-1.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
Patch taken from the Sage packaging system.
|
||||
|
||||
diff -Naur lcalc-1.23-vanilla/include/Ldirichlet_series.h lcalc-1.23-fixed-gcc.4.9/include/Ldirichlet_series.h
|
||||
--- lcalc-1.23-vanilla/include/Ldirichlet_series.h 2012-08-08 23:21:55.000000000 +0200
|
||||
+++ lcalc-1.23-fixed-gcc.4.9/include/Ldirichlet_series.h 2014-04-21 14:37:59.027464849 +0200
|
||||
@@ -43,7 +43,7 @@
|
||||
//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;
|
||||
diff -Naur lcalc-1.23-vanilla/include/L.h lcalc-1.23-fixed-gcc.4.9/include/L.h
|
||||
--- lcalc-1.23-vanilla/include/L.h 2012-08-08 23:21:55.000000000 +0200
|
||||
+++ lcalc-1.23-fixed-gcc.4.9/include/L.h 2014-04-21 14:32:04.003467348 +0200
|
||||
@@ -491,7 +491,7 @@
|
||||
|
||||
//#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);
|
58
gnu/packages/patches/lcalc-default-parameters-2.patch
Normal file
58
gnu/packages/patches/lcalc-default-parameters-2.patch
Normal file
|
@ -0,0 +1,58 @@
|
|||
Patch taken from the Sage packaging system.
|
||||
|
||||
--- lcalc-1.23/include/Lgamma.h 2012-08-08 23:21:55.000000000 +0200
|
||||
+++ lcalc-1.23/include/Lgamma.h 2014-05-18 21:15:27.786889718 +0200
|
||||
@@ -77,7 +77,7 @@
|
||||
//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 +230,7 @@
|
||||
//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 +334,7 @@
|
||||
|
||||
|
||||
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 +424,7 @@
|
||||
}
|
||||
|
||||
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 +446,7 @@
|
||||
|
||||
|
||||
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 +604,7 @@
|
||||
}
|
||||
|
||||
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;
|
||||
|
13
gnu/packages/patches/lcalc-lcommon-h.patch
Normal file
13
gnu/packages/patches/lcalc-lcommon-h.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
Patch taken from the Sage packaging system.
|
||||
|
||||
--- src/include/Lcommon.h 2010-01-31 15:16:45.000000000 +0000
|
||||
+++ src/include/Lcommon.h 2011-03-08 21:19:11.849443238 +0000
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifdef USE_MPFR
|
||||
inline double lcalc_to_double(const double& x) { return x; }
|
||||
#endif
|
||||
-//inline double lcalc_to_double(const long double& x) { return x; }
|
||||
+inline double lcalc_to_double(const long double& x) { return x; }
|
||||
inline double lcalc_to_double(const int& x) { return x; }
|
||||
inline double lcalc_to_double(const long long& x) { return x; }
|
||||
inline double lcalc_to_double(const short& x) { return x; }
|
43
gnu/packages/patches/lcalc-using-namespace-std.patch
Normal file
43
gnu/packages/patches/lcalc-using-namespace-std.patch
Normal file
|
@ -0,0 +1,43 @@
|
|||
Patch taken from the Sage packaging system.
|
||||
|
||||
diff --git a/include/Lcommon.h b/include/Lcommon.h
|
||||
index 1b3be43..bf40532 100644
|
||||
--- a/include/Lcommon.h
|
||||
+++ b/include/Lcommon.h
|
||||
@@ -48,7 +48,7 @@ const bool outputSeries=true; // Whether to output the coefficients or just th
|
||||
|
||||
// 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
|
||||
diff --git a/include/Lcommon_ld.h b/include/Lcommon_ld.h
|
||||
index 86ae4df..33c560c 100644
|
||||
--- a/include/Lcommon_ld.h
|
||||
+++ b/include/Lcommon_ld.h
|
||||
@@ -53,7 +53,7 @@ const bool outputSeries=true; // Whether to output the coefficients or just th
|
||||
|
||||
// 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
|
||||
diff --git a/include/Lglobals.h b/include/Lglobals.h
|
||||
index 60002e4..ca2606c 100644
|
||||
--- a/include/Lglobals.h
|
||||
+++ b/include/Lglobals.h
|
||||
@@ -24,9 +24,9 @@
|
||||
#ifndef Lglobals_H
|
||||
#define Lglobals_H
|
||||
|
||||
+#include <valarray>
|
||||
using namespace std;
|
||||
|
||||
-#include <valarray>
|
||||
#ifdef USE_MPFR
|
||||
#include "Lgmpfrxx.h"
|
||||
typedef mpfr_class Double;
|
|
@ -24,6 +24,7 @@ (define-module (gnu packages sagemath)
|
|||
#:use-module (guix git-download)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (gnu packages algebra)
|
||||
#:use-module (gnu packages autotools)
|
||||
#:use-module (gnu packages bdw-gc)
|
||||
|
@ -353,3 +354,67 @@ (define-public brial
|
|||
used as internal storage type for polynomial structures.")
|
||||
(license license:gpl2+)
|
||||
(home-page "https://gitlab.com/sagemath/zn_poly")))
|
||||
|
||||
(define-public lcalc
|
||||
(package
|
||||
(name "lcalc")
|
||||
(version "1.23")
|
||||
;; The original home page of the project has disappeared, as well as
|
||||
;; code hosted by the original author on Google Code. The latter has
|
||||
;; been copied to gitlab.com/sagemath and purportedly contains patches
|
||||
;; for a never released version 1.3, that supposedly follows 1.23.
|
||||
;; We use the tarball as well as the patches hosted inside the sage
|
||||
;; package system distributed with the sage tarball.
|
||||
(source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/"
|
||||
"upstream/lcalc/lcalc-1.23.tar.bz2"))
|
||||
(sha256
|
||||
(base32
|
||||
"1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43"))
|
||||
(patches (search-patches "lcalc-lcommon-h.patch"
|
||||
"lcalc-default-parameters-1.patch"
|
||||
"lcalc-default-parameters-2.patch"
|
||||
"lcalc-using-namespace-std.patch"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
`(#:tests? #f ;no tests
|
||||
#:phases
|
||||
(modify-phases %standard-phases
|
||||
(delete 'configure)
|
||||
(add-before 'build 'prepare-build
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(chdir "src")
|
||||
(let ((out (assoc-ref outputs "out")))
|
||||
(substitute* "Makefile"
|
||||
(("^INSTALL_DIR= /usr/local")
|
||||
(string-append "INSTALL_DIR=" out))
|
||||
;; Sage renames the include directory, so we do it also.
|
||||
(("include/Lfunction")
|
||||
"include/libLfunction")
|
||||
;; Add --std=c++11 to be compatible with the "auto" keyword
|
||||
;; introduced by lcalc-using-namespace-std.patch.
|
||||
(("^#EXTRA= -pg")
|
||||
"EXTRA=--std=c++11")))
|
||||
#t))
|
||||
(add-before 'install 'make-output-dirs
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let* ((out (assoc-ref outputs "out"))
|
||||
(bin (string-append out "/bin"))
|
||||
(lib (string-append out "/lib"))
|
||||
(include (string-append out "/include")))
|
||||
(mkdir-p bin)
|
||||
(mkdir-p lib)
|
||||
(mkdir-p include))
|
||||
#t)))))
|
||||
;; FIXME:
|
||||
;; We need to add pari-gp and probably pari related patches from the
|
||||
;; sage project, as well as uncomment the line setting PARI_DEFINE in
|
||||
;; the Makefile to get the full functionality of this package.
|
||||
;; For the time being, we hope that sage can be compiled without.
|
||||
(synopsis "C++ library for L-functions")
|
||||
(description "Lcalc computes L-functions, in particular the Riemann
|
||||
zeta function and its twists by quadratic characters.")
|
||||
(license license:gpl2+)
|
||||
(home-page "https://gitlab.com/sagemath/sage")))
|
||||
|
|
Loading…
Reference in a new issue