From 75a73bb024c840dc7a917a527915ff8d8d918af8 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 19 Jun 2019 07:57:57 +0200 Subject: gnu: Add symmetrica. * gnu/packages/algebra.scm (symmetrica): New variable. * gnu/packages/patches/symmetrica-bruch.patch: * gnu/packages/patches/symmetrica-int32.patch: * gnu/packages/patches/symmetrica-return_values.patch: * gnu/packages/patches/symmetrica-sort_sum_rename.patch: New files. * gnu/local.mk (dist_patch_DATA): Add patches. --- gnu/local.mk | 6 +- gnu/packages/algebra.scm | 60 ++++ gnu/packages/patches/symmetrica-bruch.patch | 38 +++ gnu/packages/patches/symmetrica-int32.patch | 37 +++ .../patches/symmetrica-return_values.patch | 14 + .../patches/symmetrica-sort_sum_rename.patch | 340 +++++++++++++++++++++ 6 files changed, 494 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/symmetrica-bruch.patch create mode 100644 gnu/packages/patches/symmetrica-int32.patch create mode 100644 gnu/packages/patches/symmetrica-return_values.patch create mode 100644 gnu/packages/patches/symmetrica-sort_sum_rename.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index ac5f0e9dbf..336b5c89ed 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1282,6 +1282,7 @@ dist_patch_DATA = \ %D%/packages/patches/sssd-curl-compat.patch \ %D%/packages/patches/steghide-fixes.patch \ %D%/packages/patches/streamlink-update-test.patch \ + %D%/packages/patches/stumpwm-fix-broken-read-one-line.patch \ %D%/packages/patches/superlu-dist-awpm-grid.patch \ %D%/packages/patches/superlu-dist-fix-mpi-deprecations.patch \ %D%/packages/patches/superlu-dist-scotchmetis.patch \ @@ -1290,7 +1291,10 @@ dist_patch_DATA = \ %D%/packages/patches/swig-guile-gc.patch \ %D%/packages/patches/swish-e-search.patch \ %D%/packages/patches/swish-e-format-security.patch \ - %D%/packages/patches/stumpwm-fix-broken-read-one-line.patch \ + %D%/packages/patches/symmetrica-bruch.patch \ + %D%/packages/patches/symmetrica-int32.patch \ + %D%/packages/patches/symmetrica-return_values.patch \ + %D%/packages/patches/symmetrica-sort_sum_rename.patch \ %D%/packages/patches/t1lib-CVE-2010-2642.patch \ %D%/packages/patches/t1lib-CVE-2011-0764.patch \ %D%/packages/patches/t1lib-CVE-2011-1552+.patch \ diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm index 4dbf537af3..eeaee61755 100644 --- a/gnu/packages/algebra.scm +++ b/gnu/packages/algebra.scm @@ -1315,3 +1315,63 @@ multiplication algorithm.") a given height bound on a hyperelliptic curve in a very efficient way, by using an optimized quadratic sieve algorithm.") (license license:gpl2+))) + +(define-public symmetrica + (package + (name "symmetrica") + (version "2.0") + (source (origin + (method url-fetch/tarbomb) + (uri (let ((v (string-join (string-split version #\.) "_"))) + (string-append "http://www.algorithm.uni-bayreuth.de/" + "en/research/SYMMETRICA/" + "SYM" v "_tar.gz"))) + (sha256 + (base32 + "1qhfrbd5ybb0sinl9pad64rscr08qvlfzrzmi4p4hk61xn6phlmz")) + ;; Taken from + (patches (search-patches "symmetrica-bruch.patch" + "symmetrica-int32.patch" + "symmetrica-return_values.patch" + "symmetrica-sort_sum_rename.patch")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ;no test + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-makefile + (lambda _ + (substitute* "makefile" + (("cc -c") "gcc -c")) + #t)) + (add-after 'fix-makefile 'turn-off-banner + (lambda _ + (substitute* "de.c" + (("(INT no_banner = )FALSE" _ pre) (string-append pre "TRUE"))) + #t)) + (delete 'configure) ;no configure script + (replace 'install ;no install target + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib")) + (inc (string-append out "/include/symmetrica")) + (doc (string-append out "/share/doc/symmetrica-" ,version)) + (static "libsymmetrica.a")) + ;; Build static library. + (apply invoke "ar" "crs" static (find-files "." "\\.o$")) + (invoke "ranlib" static) + ;; Install static library and headers. + (for-each (lambda (f) (install-file f inc)) + (find-files "." "\\.h$")) + (install-file "libsymmetrica.a" lib) + ;; Install documentation. + (for-each (lambda (f) (install-file f doc)) + (find-files "." "\\.doc$")) + #t)))))) + (home-page "http://www.algorithm.uni-bayreuth.de/en/research/SYMMETRICA/") + (synopsis "Combinatoric C Library") + (description "Symmetrica is a library for combinatorics. It has support +for the representation theory of the symmetric group and related groups, +combinatorics of tableaux, symmetric functions and polynomials, Schubert +polynomials, and the representation theory of Hecke algebras of type A_n.") + (license license:public-domain))) diff --git a/gnu/packages/patches/symmetrica-bruch.patch b/gnu/packages/patches/symmetrica-bruch.patch new file mode 100644 index 0000000000..ae88b79206 --- /dev/null +++ b/gnu/packages/patches/symmetrica-bruch.patch @@ -0,0 +1,38 @@ +--- src/bruch.c 2007-12-06 11:30:00.000000000 -0500 ++++ b/bruch.c 2013-10-22 08:37:43.000000000 -0400 +@@ -975,14 +975,16 @@ + ggterg = ggt_i(S_B_UI(bruch),S_B_OI(bruch)); + + if (ggterg == S_B_UI(bruch)) { ++ INT tmp = S_B_OI(bruch); + freeself_bruch(bruch); +- M_I_I(S_B_OI(bruch) / ggterg,bruch); ++ M_I_I(tmp / ggterg,bruch); + goto ende; + } + + if (-ggterg == S_B_UI(bruch)) { ++ INT tmp = S_B_OI(bruch); + freeself_bruch(bruch); +- M_I_I(- S_B_OI(bruch) / ggterg,bruch); ++ M_I_I(- tmp / ggterg,bruch); + goto ende; + } + +@@ -1032,12 +1034,14 @@ + + if (S_O_K(S_B_U(bruch)) == INTEGER) + if (S_B_UI(bruch) == 1) { ++ INT tmp = S_B_OI(bruch); + freeself_bruch(bruch); +- M_I_I(S_B_OI(bruch),bruch); ++ M_I_I(tmp,bruch); + goto ende; } + else if (S_B_UI(bruch) == -1) { ++ INT tmp = S_B_OI(bruch); + freeself_bruch(bruch); +- M_I_I( - S_B_OI(bruch),bruch); ++ M_I_I( - tmp,bruch); + goto ende; } + if (NEGP(S_B_O(bruch)) && NEGP(S_B_U(bruch))) + { diff --git a/gnu/packages/patches/symmetrica-int32.patch b/gnu/packages/patches/symmetrica-int32.patch new file mode 100644 index 0000000000..b64f27d51e --- /dev/null +++ b/gnu/packages/patches/symmetrica-int32.patch @@ -0,0 +1,37 @@ +diff -ru src/def.h c/def.h +--- src/def.h 2007-12-06 17:30:56.000000000 +0100 ++++ c/def.h 2013-10-19 18:42:55.118745730 +0200 +@@ -2,14 +2,9 @@ + /* INT should always be 4 byte */ + #ifndef DEF_H + +- +-#ifdef __alpha +-typedef int INT; +-typedef unsigned int UINT; +-#else /* __alpha */ +-typedef long INT; +-typedef unsigned long UINT; +-#endif /* __alpha */ ++#include ++typedef int32_t INT; ++typedef uint32_t UINT; + + #include + #include +@@ -65,10 +60,13 @@ + + + /* definitionen fuer object.c */ +-typedef INT OBJECTKIND; /* 4 byte */ ++/* NOTE: partition code assumes that there is no unused space in the ++ * object struct when an INT is stored. This requires both OBJECTKIND ++ * and OBJECTSELF to have a size equal to a machine word. */ ++typedef intptr_t OBJECTKIND; + + typedef union { +- INT ob_INT; ++ intptr_t ob_INT; + INT * ob_INTpointer; + char *ob_charpointer; + struct bruch *ob_bruch; diff --git a/gnu/packages/patches/symmetrica-return_values.patch b/gnu/packages/patches/symmetrica-return_values.patch new file mode 100644 index 0000000000..e09c389337 --- /dev/null +++ b/gnu/packages/patches/symmetrica-return_values.patch @@ -0,0 +1,14 @@ +diff -ru src/part.c b/part.c +--- src/part.c Thu May 14 06:01:00 2009 -0400 ++++ b/part.c Thu May 14 06:01:00 2009 -0400 +@@ -1767,8 +1767,8 @@ + /* to compute number of partitions */ + { + INT erg = OK; +- if (ni<0) return; +- if (not EMPTYP(S_V_I(vec,ni))) return; ++ if (ni<0) return 0; ++ if (not EMPTYP(S_V_I(vec,ni))) return 0; + else if (ni<=1) M_I_I(1,S_V_I(vec,ni)); + else { + diff --git a/gnu/packages/patches/symmetrica-sort_sum_rename.patch b/gnu/packages/patches/symmetrica-sort_sum_rename.patch new file mode 100644 index 0000000000..2d9a2dae06 --- /dev/null +++ b/gnu/packages/patches/symmetrica-sort_sum_rename.patch @@ -0,0 +1,340 @@ +diff -r 5cd656a07aa5 src/bar.c +--- a/bar.c Thu May 14 06:01:00 2009 -0400 ++++ b/bar.c Thu May 14 07:38:17 2009 -0400 +@@ -237,7 +237,7 @@ + g = callocobject(); + e = S_V_I(a,0L); + f = S_V_I(a,1L); +- erg += sum(f,g); ++ erg += sym_sum(f,g); + j=0L; + for (i=0L;iob_kind = (OBJECTKIND)(b)) +--- a/nc.c Thu May 14 06:01:00 2009 -0400 ++++ b/nc.c Thu May 14 07:38:17 2009 -0400 +@@ -204,7 +204,7 @@ + erg += mult(S_NC_C(a),S_NC_C(b),d); + erg += m_gl_co(S_NC_GL(a),e); + erg += mult_apply(e,d); +- erg += sum(d,e); ++ erg += sym_sum(d,e); + erg += m_gl_go(S_NC_GL(a),d); + erg += div(e,d,c); + erg += freeall(e); +@@ -617,7 +617,7 @@ + erg += mult_nc_kranz(c,a,e); + erg += mult(S_V_I(e,1L),f,c); + erg += div(c,g,c); +- erg += sum(c,S_V_I(S_NC_C(b),S_I_I(d))); ++ erg += sym_sum(c,S_V_I(S_NC_C(b),S_I_I(d))); + } + erg += freeall(c); + erg += freeall(d); +@@ -712,7 +712,7 @@ + for(j = 0L; j=0;j--) +diff -r 5cd656a07aa5 src/perm.c +--- a/perm.c Thu May 14 06:01:00 2009 -0400 ++++ b/perm.c Thu May 14 07:38:17 2009 -0400 +@@ -833,9 +833,9 @@ + /* s = Anzahl der spalten */ + + s = S_V_LI(S_V_I(a,0L)); +- sum(S_V_I(a,0L),summe);/* composition ist vector */ ++ sym_sum(S_V_I(a,0L),summe);/* composition ist vector */ + z = S_I_I(summe); +- FREEALL(summe); ++ FREEALL(summe); + m_ilih_nm(s,z,b); + C_O_K(b,KRANZTYPUS); + for (i=0L;i