gnu: scalapack: Update to 2.1.0.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2019, 2020 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014, 2016, 2017 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Eric Bavier <bavier@posteo.net>
6 ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
8 ;;; Copyright © 2015–2021 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10 ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
11 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
13 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
14 ;;; Copyright © 2016, 2018, 2020, 2021 Kei Kebreau <kkebreau@posteo.net>
15 ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
16 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
17 ;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
18 ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
19 ;;; Copyright © 2017 Nikita <nikita@n0.is>
20 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
21 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
22 ;;; Copyright © 2017, 2019 Arun Isaac <arunisaac@systemreboot.net>
23 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
24 ;;; Copyright © 2017 Dave Love <me@fx@gnu.org>
25 ;;; Copyright © 2018, 2019, 2020, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
26 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
27 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
28 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
29 ;;; Copyright © 2018, 2020, 2021 Marius Bakke <marius@gnu.org>
30 ;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
31 ;;; Copyright © 2018, 2021 Julien Lepiller <julien@lepiller.eu>
32 ;;; Copyright © 2018 Amin Bandali <bandali@gnu.org>
33 ;;; Copyright © 2019, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
34 ;;; Copyright © 2019 Steve Sprang <scs@stevesprang.com>
35 ;;; Copyright © 2019 Robert Smith <robertsmith@posteo.net>
36 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
37 ;;; Copyright © 2020, 2021 Felix Gruber <felgru@posteo.net>
38 ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
39 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
40 ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
41 ;;; Copyright © 2020 B. Wilson <elaexuotee@wilsonb.com>
42 ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
43 ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
44 ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
45 ;;; Copyright © 2021 Gerd Heber <gerd.heber@gmail.com>
46 ;;; Copyright © 2021 Franck Pérignon <franck.perignon@univ-grenoble-alpes.fr>
47 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
48 ;;; Copyright © 2021 Paul A. Patience <paul@apatience.com>
49 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
50 ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
51 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
52 ;;;
53 ;;; This file is part of GNU Guix.
54 ;;;
55 ;;; GNU Guix is free software; you can redistribute it and/or modify it
56 ;;; under the terms of the GNU General Public License as published by
57 ;;; the Free Software Foundation; either version 3 of the License, or (at
58 ;;; your option) any later version.
59 ;;;
60 ;;; GNU Guix is distributed in the hope that it will be useful, but
61 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
62 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63 ;;; GNU General Public License for more details.
64 ;;;
65 ;;; You should have received a copy of the GNU General Public License
66 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
67
68 (define-module (gnu packages maths)
69 #:use-module (ice-9 regex)
70 #:use-module (ice-9 match)
71 #:use-module (gnu packages)
72 #:use-module ((guix licenses) #:prefix license:)
73 #:use-module (guix packages)
74 #:use-module (guix download)
75 #:use-module (guix git-download)
76 #:use-module (guix gexp)
77 #:use-module (guix utils)
78 #:use-module ((guix build utils) #:select (alist-replace))
79 #:use-module (guix build-system cmake)
80 #:use-module (guix build-system glib-or-gtk)
81 #:use-module (guix build-system gnu)
82 #:use-module (guix build-system ocaml)
83 #:use-module (guix build-system python)
84 #:use-module (guix build-system ruby)
85 #:use-module (gnu packages algebra)
86 #:use-module (gnu packages audio)
87 #:use-module (gnu packages autotools)
88 #:use-module (gnu packages base)
89 #:use-module (gnu packages bash)
90 #:use-module (gnu packages bison)
91 #:use-module (gnu packages boost)
92 #:use-module (gnu packages check)
93 #:use-module (gnu packages cmake)
94 #:use-module (gnu packages compression)
95 #:use-module (gnu packages coq)
96 #:use-module (gnu packages curl)
97 #:use-module (gnu packages cyrus-sasl)
98 #:use-module (gnu packages dbm)
99 #:use-module (gnu packages documentation)
100 #:use-module (gnu packages elf)
101 #:use-module (gnu packages emacs)
102 #:use-module (gnu packages file)
103 #:use-module (gnu packages flex)
104 #:use-module (gnu packages fltk)
105 #:use-module (gnu packages fontutils)
106 #:use-module (gnu packages gettext)
107 #:use-module (gnu packages gcc)
108 #:use-module (gnu packages gd)
109 #:use-module (gnu packages ghostscript)
110 #:use-module (gnu packages glib)
111 #:use-module (gnu packages graphviz)
112 #:use-module (gnu packages gtk)
113 #:use-module (gnu packages icu4c)
114 #:use-module (gnu packages image)
115 #:use-module (gnu packages java)
116 #:use-module (gnu packages less)
117 #:use-module (gnu packages lisp)
118 #:use-module (gnu packages linux)
119 #:use-module (gnu packages llvm)
120 #:use-module (gnu packages logging)
121 #:use-module (gnu packages lua)
122 #:use-module (gnu packages gnome)
123 #:use-module (gnu packages guile)
124 #:use-module (gnu packages xorg)
125 #:use-module (gnu packages gl)
126 #:use-module (gnu packages imagemagick)
127 #:use-module (gnu packages m4)
128 #:use-module (gnu packages mpi)
129 #:use-module (gnu packages multiprecision)
130 #:use-module (gnu packages ncurses)
131 #:use-module (gnu packages netpbm)
132 #:use-module (gnu packages ocaml)
133 #:use-module (gnu packages onc-rpc)
134 #:use-module (gnu packages parallel)
135 #:use-module (gnu packages pcre)
136 #:use-module (gnu packages popt)
137 #:use-module (gnu packages perl)
138 #:use-module (gnu packages pkg-config)
139 #:use-module (gnu packages pulseaudio)
140 #:use-module (gnu packages python)
141 #:use-module (gnu packages python-web)
142 #:use-module (gnu packages python-xyz)
143 #:use-module (gnu packages qt)
144 #:use-module (gnu packages readline)
145 #:use-module (gnu packages ruby)
146 #:use-module (gnu packages tbb)
147 #:use-module (gnu packages scheme)
148 #:use-module (gnu packages serialization)
149 #:use-module (gnu packages shells)
150 #:use-module (gnu packages sphinx)
151 #:use-module (gnu packages tcl)
152 #:use-module (gnu packages texinfo)
153 #:use-module (gnu packages tex)
154 #:use-module (gnu packages tls)
155 #:use-module (gnu packages version-control)
156 #:use-module (gnu packages wxwidgets)
157 #:use-module (gnu packages xml)
158 #:use-module (srfi srfi-1)
159 #:use-module (srfi srfi-26))
160
161 (define-public aris
162 (package
163 (name "aris")
164 (version "2.2")
165 (source (origin
166 (method url-fetch)
167 (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
168 (sha256 (base32
169 "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
170 (build-system gnu-build-system)
171 (inputs `(("gtk+" ,gtk+)
172 ("libxml2" ,libxml2)))
173 (native-inputs `(("pkg-config" ,pkg-config)))
174 (arguments
175 `(#:configure-flags '("CFLAGS=-O2 -g -fcommon")))
176 (synopsis "Natural deduction first-order logic interface")
177 (description "Aris is a program for performing logical proofs. It supports
178 propositional and predicate logic, as well as Boolean algebra and
179 arithmetical logic. In addition to its predefined inference and equivalence
180 rules, Aris also supports references to older proofs. Its use of standard
181 logical symbols and its natural deduction interface make it easy to use for
182 beginners.")
183 (license license:gpl3+)
184 (home-page "https://www.gnu.org/software/aris/")))
185
186 (define-public bitwise
187 (package
188 (name "bitwise")
189 (version "0.42")
190 (source (origin
191 (method url-fetch)
192 (uri (string-append "https://github.com/mellowcandle/bitwise"
193 "/releases/download/v" version
194 "/bitwise-v" version ".tar.gz"))
195 (sha256
196 (base32 "1lniw4bsb5qs5ybf018qllf95pzixb1q3lvybzl4k3xz8zpkrm6k"))))
197 (build-system gnu-build-system)
198 (inputs
199 `(("ncurses" ,ncurses)
200 ("readline" ,readline)))
201 (native-inputs
202 `(("cunit" ,cunit)
203 ("pkg-config" ,pkg-config)))
204 (synopsis "Terminal based bit manipulator in ncurses")
205 (description "Bitwise is a multi base interactive calculator supporting
206 dynamic base conversion and bit manipulation. It's a handy tool for low level
207 hackers, kernel developers and device drivers developers.
208
209 Some of the features include:
210 @itemize
211 @item Interactive ncurses interface.
212 @item Command line calculator supporting all bitwise operations.
213 @item Individual bit manipulator.
214 @item Bitwise operations such as NOT, OR, AND, XOR, and shifts.
215 @end itemize")
216 (license license:gpl3+)
217 (home-page "https://github.com/mellowcandle/bitwise/")))
218
219 (define-public c-graph
220 (package
221 (name "c-graph")
222 (version "2.0.1")
223 (source (origin
224 (method url-fetch)
225 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
226 ".tar.gz"))
227 (sha256 (base32
228 "092412jzxy6wdvpk96pfj499hpmaww8xllavbvlqspfpr7ips9id"))))
229 (build-system gnu-build-system)
230 (inputs
231 `(("fortran" ,gfortran)))
232 (synopsis "Visualizing and demonstrating convolution")
233 (description
234 "GNU C-Graph is a tool for demonstrating the theory of convolution.
235 Thus, it can serve as an excellent aid to students of signal and systems
236 theory in visualizing the convolution process. Rather than forcing the
237 student to write code, the program offers an intuitive interface with
238 interactive dialogs to guide them.")
239 (license license:gpl3+)
240 (home-page "https://www.gnu.org/software/c-graph/")))
241
242 (define-public coda
243 (package
244 (name "coda")
245 (version "2.19")
246 (source
247 (origin
248 (method url-fetch)
249 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
250 version "/coda-" version ".tar.gz"))
251 (sha256
252 (base32 "1fbxd2afm7dshd92p10yy8dwbr9gc1h1fmnnnmr7d0c5lnw80245"))
253 (patches (search-patches "coda-use-system-libs.patch"))
254 (modules '((guix build utils)))
255 (snippet
256 ;; Make sure we don't use the bundled software.
257 '(begin
258 (for-each (lambda (d)
259 (delete-file-recursively (string-append "libcoda/" d)))
260 '("zlib" "pcre" "expat"))
261 #t))))
262 (native-inputs
263 `(("fortran" ,gfortran)
264 ("python" ,python)
265 ("python-numpy" ,python-numpy)))
266 (inputs
267 `(("zlib" ,zlib)
268 ("pcre" ,pcre)
269 ("expat" ,expat)
270 ("hdf4" ,hdf4-alt)
271 ("hdf5" ,hdf5)))
272 (build-system gnu-build-system)
273 (arguments
274 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
275 "LIBS= -lz -lpcre -lexpat")))
276 (synopsis "A common interface to various earth observation data formats")
277 (description
278 "The Common Data Access toolbox (CODA) provides a set of interfaces for
279 reading remote sensing data from earth observation data files. It consists of
280 command line applications and interfaces to the C, Fortran, Python, and Java
281 programming languages.")
282 (home-page "https://stcorp.nl/coda")
283 (license license:gpl2+)))
284
285 (define-public qhull
286 (package
287 (name "qhull")
288 (version "2020.2")
289 (source (origin
290 (method url-fetch)
291 (uri (string-append "http://www.qhull.org/download/qhull-"
292 (car (string-split version #\.))
293 "-src-8.0.2.tgz"))
294 (sha256
295 (base32
296 "0zlbhg0lb6j60188c2xhcrvviskr079552icjldqhy1jhgmxghmm"))))
297 (build-system cmake-build-system)
298 (arguments
299 `(#:configure-flags '("-DLINK_APPS_SHARED=ON"
300 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")))
301 (synopsis "Calculate convex hulls and related structures")
302 (description
303 "@code{Qhull} computes the convex hull, Delaunay triangulation, Voronoi
304 diagram, halfspace intersection about a point, furthest-site Delaunay
305 triangulation, and furthest-site Voronoi diagram. The source code runs in 2-d,
306 3-d, 4-d, and higher dimensions. @code{Qhull} implements the Quickhull
307 algorithm for computing the convex hull. It handles roundoff errors from
308 floating point arithmetic. It computes volumes, surface areas, and
309 approximations to the convex hull.
310
311 @code{Qhull} does not support triangulation of non-convex surfaces, mesh
312 generation of non-convex objects, medium-sized inputs in 9-D and higher, alpha
313 shapes, weighted Voronoi diagrams, Voronoi volumes, or constrained Delaunay
314 triangulations.")
315 (home-page "http://qhull.org")
316 (license (license:non-copyleft "file://COPYING.txt"
317 "See COPYING in the distribution."))))
318
319 (define-public python-cvxopt
320 (package
321 (name "python-cvxopt")
322 (version "1.2.3")
323 (source (origin
324 (method git-fetch)
325 (uri (git-reference
326 (url "https://github.com/cvxopt/cvxopt")
327 (commit version)))
328 (file-name (git-file-name name version))
329 (sha256
330 (base32
331 "1kiy2m62xgs2d5id6dnnwy4vap85cd70p7pgkb9nh23qf9xnak7b"))))
332 (build-system python-build-system)
333 (arguments
334 `(#:phases
335 (modify-phases %standard-phases
336 (add-after 'unpack 'find-libraries
337 (lambda* (#:key inputs #:allow-other-keys)
338 (setenv "CVXOPT_BLAS_LIB" "openblas")
339 (setenv "CVXOPT_BUILD_FFTW" "1")
340 (setenv "CVXOPT_BUILD_GLPK" "1")
341 (setenv "CVXOPT_BUILD_GSL" "1")
342 #t)))))
343 (inputs
344 `(("fftw" ,fftw)
345 ("glpk" ,glpk)
346 ("gsl" ,gsl)
347 ("lapack" ,lapack)
348 ("openblas" ,openblas)
349 ("suitesparse" ,suitesparse)))
350 (home-page "https://www.cvxopt.org")
351 (synopsis "Python library for convex optimization")
352 (description
353 "CVXOPT is a package for convex optimization based on the Python
354 programming language. Its main purpose is to make the development of software
355 for convex optimization applications straightforward by building on Python’s
356 extensive standard library and on the strengths of Python as a high-level
357 programming language.")
358 (license license:gpl3+)))
359
360 (define-public python2-cvxopt
361 (package-with-python2 python-cvxopt))
362
363 (define-public units
364 (package
365 (name "units")
366 (version "2.21")
367 (source (origin
368 (method url-fetch)
369 (uri (string-append "mirror://gnu/units/units-" version
370 ".tar.gz"))
371 (sha256 (base32
372 "1bybhqs4yrly9myb5maz3kdmf8k4fhk2m1d5cbcryn40z6lq0gkc"))))
373 (build-system gnu-build-system)
374 (inputs
375 `(("readline" ,readline)
376 ("python" ,python-wrapper) ;for 'units_cur' script
377 ("python-requests" ,python-requests)))
378 (arguments
379 `(#:phases (modify-phases %standard-phases
380 (add-after 'install 'wrap-units_cur
381 (lambda* (#:key outputs #:allow-other-keys)
382 (let* ((out (assoc-ref outputs "out"))
383 (bin (string-append out "/bin")))
384 (wrap-program (string-append bin "/units_cur")
385 `("GUIX_PYTHONPATH" ":" prefix
386 ,(search-path-as-string->list (getenv "GUIX_PYTHONPATH"))))
387 #t))))))
388 (synopsis "Conversion between thousands of scales")
389 (description
390 "GNU Units converts numeric quantities between units of measure. It
391 can handle scale changes through adaptive usage of standard scale
392 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
393 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
394 enough to be used effectively as a scientific calculator.")
395 (license license:gpl3+)
396 (home-page "https://www.gnu.org/software/units/")))
397
398 (define-public double-conversion
399 (package
400 (name "double-conversion")
401 (version "3.1.5")
402 (home-page "https://github.com/google/double-conversion")
403 (source (origin
404 (method git-fetch)
405 (uri (git-reference (url home-page)
406 (commit (string-append "v" version))))
407 (file-name (git-file-name name version))
408 (sha256
409 (base32
410 "0csy4pjw1p8rp6g5qxi2h0ychhhp1fldv7gb761627fs2mclw9gv"))))
411 (build-system cmake-build-system)
412 (arguments
413 '(#:test-target "test"
414 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
415 "-DBUILD_TESTING=ON")))
416 (synopsis "Conversion routines for IEEE doubles")
417 (description
418 "The double-conversion library provides binary-decimal and decimal-binary
419 routines for IEEE doubles. The library consists of efficient conversion
420 routines that have been extracted from the V8 JavaScript engine.")
421 (license license:bsd-3)))
422
423 (define-public dionysus
424 (package
425 (name "dionysus")
426 (version "1.4.0")
427 (source (origin
428 (method url-fetch)
429 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
430 ".tar.xz"))
431 (sha256
432 (base32
433 "194pzs1mlsj4ww6v37qq3961h5hckm5h805cv0r14xj3g9wfx2sk"))))
434 (build-system gnu-build-system)
435 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
436 (synopsis "Local search for universal constants and scientific values")
437 (description
438 "GNU Dionysus is a convenient system for quickly retrieving the values of
439 mathematical constants used in science and engineering. Values can be
440 searched using a simple command-line tool, choosing from three databases:
441 universal constants, atomic numbers, and constants related to
442 semiconductors.")
443 (license license:gpl3+)
444 (home-page "https://www.gnu.org/software/dionysus/")))
445
446 (define-public dsfmt
447 (package
448 (name "dsfmt")
449 (version "2.2.3")
450 (source
451 (origin
452 (method url-fetch)
453 (uri
454 (string-append
455 "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/"
456 "dSFMT-src-" version ".tar.gz"))
457 (sha256
458 (base32
459 "03kaqbjbi6viz0n33dk5jlf6ayxqlsq4804n7kwkndiga9s4hd42"))
460 (modules '((guix build utils)))
461 ;; Don't distribute html documentation with bundled jquery.
462 (snippet
463 '(begin
464 (delete-file-recursively "html") #t))
465 ;; Add patches borrowed from Julia.
466 (patches
467 (list
468 (origin
469 (method url-fetch)
470 (uri (string-append
471 "https://raw.githubusercontent.com/JuliaLang/julia/"
472 "v1.3.0/deps/patches/dSFMT.c.patch"))
473 (sha256 (base32
474 "09mhv11bms8jsmkmdqvlcgljwhzw3b6n9nncpi2b6dla9798hw2y"))
475 (file-name "dSFMT.c.patch"))
476 (origin
477 (method url-fetch)
478 (uri (string-append
479 "https://raw.githubusercontent.com/JuliaLang/julia/"
480 "v1.3.0/deps/patches/dSFMT.h.patch"))
481 (sha256 (base32
482 "1py5rd0yxic335lzka23f6x2dhncrpizpyrk57gi2f28c0p98y5n"))
483 (file-name "dSFMT.h.patch"))))))
484 (build-system gnu-build-system)
485 (arguments
486 `(#:phases
487 (modify-phases %standard-phases
488 (delete 'configure) ; no configure script
489 (replace 'build
490 ;; Upstream Makefile does not build a shared library. Borrow from Julia
491 ;; https://github.com/JuliaLang/julia/blob/v1.3.0/deps/dsfmt.mk
492 (lambda _
493 (invoke
494 "gcc" "-DNDEBUG" "-DDSFMT_MEXP=19937"
495 "-fPIC" "-DDSFMT_DO_NOT_USE_OLD_NAMES"
496 "-O3" "-finline-functions" "-fomit-frame-pointer"
497 "-fno-strict-aliasing" "--param" "max-inline-insns-single=1800"
498 "-Wmissing-prototypes" "-Wall" "-std=c99" "-shared" "dSFMT.c"
499 "-o" "libdSFMT.so")))
500 (replace 'install ; no "install" target
501 (lambda* (#:key outputs #:allow-other-keys)
502 (let* ((out (assoc-ref outputs "out"))
503 (lib (string-append out "/lib"))
504 (inc (string-append out "/include"))
505 (doc (string-append out "/share/doc/" ,name "-" ,version)))
506 (install-file "libdSFMT.so" lib)
507 (install-file "dSFMT.h" inc)
508 (install-file "LICENSE.txt" doc)
509 #t))))))
510 (synopsis "Double precision SIMD-oriented Fast Mersenne Twister")
511 (description
512 "The dSMFT package speeds up Fast Mersenne Twister generation by avoiding
513 the expensive conversion of integer to double (floating point). dSFMT directly
514 generates double precision floating point pseudorandom numbers which have the
515 IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985)
516 format. dSFMT is only available on the CPUs which use IEEE 754 format double
517 precision floating point numbers.")
518 (home-page "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/")
519 (license license:bsd-3)))
520
521 (define-public gsl
522 (package
523 (name "gsl")
524 (version "2.7")
525 (source (origin
526 (method url-fetch)
527 (uri (string-append "mirror://gnu/gsl/gsl-"
528 version ".tar.gz"))
529 (sha256
530 (base32
531 "0av04cpblphvvs3kl5rwphniarml503501vrpqw31rd0bmwg7fzg"))))
532 (build-system gnu-build-system)
533 (arguments
534 (let ((system (%current-system)))
535 `(#:configure-flags (list "--disable-static") ;halves package size
536 #:phases
537 (modify-phases %standard-phases
538 ,@(cond
539 ((or (string-prefix? "aarch64" system)
540 (string-prefix? "powerpc" system))
541 ;; Some sparse matrix tests are failing on AArch64 and PowerPC:
542 ;; https://lists.gnu.org/archive/html/bug-gsl/2020-04/msg00001.html
543 '((add-before 'check 'disable-failing-tests
544 (lambda _
545 (substitute* "spmatrix/test.c"
546 ((".*test_complex.*") "\n"))))))
547
548 ((string-prefix? "i686" system)
549 ;; There are rounding issues with these tests on i686:
550 ;; https://lists.gnu.org/archive/html/bug-gsl/2016-10/msg00000.html
551 ;; https://lists.gnu.org/archive/html/bug-gsl/2020-04/msg00000.html
552 '((add-before 'check 'disable-failing-tests
553 (lambda _
554 (substitute* "linalg/test.c"
555 ((".*gsl_test\\(test_LU_decomp.*") "\n")
556 ((".*gsl_test\\(test_LUc_decomp.*") "\n")
557 ((".*gsl_test\\(test_QR_decomp_r.*") "\n")
558 ((".*gsl_test\\(test_cholesky_decomp.*") "\n")
559 ((".*gsl_test\\(test_pcholesky_solve.*") "\n")
560 ((".*gsl_test\\(test_COD_lssolve2.*") "\n"))
561 (substitute* "spmatrix/test.c"
562 ((".*test_all.*") "\n")
563 ((".*test_float.*") "\n")
564 ((".*test_complex.*") "\n"))
565
566 ;; XXX: These tests abort with:
567 ;; gsl: cholesky.c:645: ERROR: matrix is not positive definite
568 (substitute* '("multifit_nlinear/test.c"
569 "multilarge_nlinear/test.c")
570 (("gsl_ieee_env_setup.*" all)
571 (string-append "exit (77);\n" all)))))))
572
573 (else '()))))))
574 (home-page "https://www.gnu.org/software/gsl/")
575 (synopsis "Numerical library for C and C++")
576 (description
577 "The GNU Scientific Library is a library for numerical analysis in C
578 and C++. It includes a wide range of mathematical routines, with over 1000
579 functions in total. Subject areas covered by the library include:
580 differential equations, linear algebra, Fast Fourier Transforms and random
581 numbers.")
582 (license license:gpl3+)))
583
584 (define-public sleef
585 (package
586 (name "sleef")
587 (version "3.5.1")
588 (source
589 (origin
590 (method git-fetch)
591 (uri (git-reference
592 (url "https://github.com/shibatch/sleef")
593 (commit version)))
594 (file-name (git-file-name name version))
595 (sha256
596 (base32 "1jybqrl2dvjxzg30xrhh847s375n2jr1pix644wi6hb5wh5mx3f7"))))
597 (build-system cmake-build-system)
598 (arguments
599 '(#:configure-flags (list "-DCMAKE_BUILD_TYPE=Release"
600 (string-append "-DCMAKE_INSTALL_LIBDIR="
601 (assoc-ref %outputs "out")
602 "/lib")
603 (string-append "-DCMAKE_INSTALL_PREFIX="
604 (assoc-ref %outputs "out")))
605 #:phases
606 (modify-phases %standard-phases
607 ;; SLEEF generates a header library during the build process and writes
608 ;; to it via shell redirection. Make the checkout writable so the
609 ;; build can succeed.
610 (add-after 'unpack 'make-git-checkout-writable
611 (lambda _
612 (for-each make-file-writable (find-files "."))
613 #t)))))
614 (inputs
615 `(("fftw" ,fftw)
616 ("gmp" ,gmp)
617 ("mpfr" ,mpfr)
618 ("openssl" ,openssl)))
619 (home-page "https://sleef.org/")
620 (synopsis "SIMD library for evaluating elementary functions and DFT")
621 (description
622 "SLEEF (SIMD Library for Evaluating Elementary Functions) is a library that
623 implements vectorized versions of all C99 real floating point math functions.
624 It can utilize SIMD instructions that are available on modern processors.")
625 (license (list license:boost1.0 ;sleef
626 license:cc-by4.0)))) ;simplex algorithm
627
628 (define-public glpk
629 (package
630 (name "glpk")
631 (version "5.0")
632 (source
633 (origin
634 (method url-fetch)
635 (uri (string-append "mirror://gnu/glpk/glpk-"
636 version ".tar.gz"))
637 (sha256
638 (base32
639 "05bgxidxj8d9xdp82niy7cy36w181cxq7p8vc3y2ixshpgp1642a"))))
640 (build-system gnu-build-system)
641 (inputs
642 `(("gmp" ,gmp)))
643 (arguments
644 `(#:configure-flags '("--with-gmp"
645 "--disable-static")))
646 (home-page "https://www.gnu.org/software/glpk/")
647 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
648 (description
649 "GLPK is a C library for solving large-scale linear programming (LP),
650 mixed integer programming (MIP), and other related problems. It supports the
651 GNU MathProg modeling language, a subset of the AMPL language, and features a
652 translator for the language. In addition to the C library, a stand-alone
653 LP/MIP solver is included in the package.")
654 (license license:gpl3+)))
655
656 (define-public glpk-4
657 (package
658 (inherit glpk)
659 (name "glpk")
660 (version "4.65")
661 (source
662 (origin
663 (method url-fetch)
664 (uri (string-append "mirror://gnu/glpk/glpk-"
665 version ".tar.gz"))
666 (sha256
667 (base32
668 "040sfaa9jclg2nqdh83w71sv9rc1sznpnfiripjdyr48cady50a2"))))))
669
670 (define-public 4ti2
671 (package
672 (name "4ti2")
673 (version "1.6.9")
674 (source
675 (origin
676 (method url-fetch)
677 (uri (string-append "https://github.com/4ti2/4ti2/releases/download/"
678 "Release_"
679 (string-map (lambda (c) (if (char=? c #\.) #\_ c))
680 version)
681 "/4ti2-" version ".tar.gz"))
682 (sha256
683 (base32 "0rj92x6p9m3la5gasjbj7sa569im527ffmka5y2sv1amgd3fflrh"))))
684 (build-system gnu-build-system)
685 (native-inputs
686 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
687 (inputs
688 `(("glpk" ,glpk)
689 ("gmp" ,gmp)))
690 (home-page "http://www.4ti2.de/")
691 (synopsis "Mathematical tool suite for problems on linear spaces")
692 (description
693 "4ti2 implements algorithms for solving algebraic, geometric and
694 combinatorial problems on linear spaces. Among others, it solves systems
695 of linear equations, computes extreme rays of polyhedral cones, solves
696 integer programming problems and computes Markov bases for statistics.")
697 (license license:gpl2+)))
698
699 (define-public cddlib
700 (package
701 (name "cddlib")
702 (version "0.94i")
703 (source
704 (origin
705 (method url-fetch)
706 (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
707 (string-delete #\. version) ".tar.gz"))
708 (sha256
709 (base32
710 "00zdgiqb91vx6gd2103h3ijij0llspsxc6zz3iw2bll39fvkl4xq"))))
711 (build-system gnu-build-system)
712 (inputs
713 `(("gmp" ,gmp)))
714 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
715 (synopsis "Library for convex hulls and extreme rays of polyhedra")
716 (description
717 "The C-library cddlib implements the Double Description Method of
718 Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
719 rays of a general convex polyhedron given by a system of linear inequalities
720 in arbitrary dimension. It can also be used for the converse operation of
721 computing convex hulls.")
722 (license license:gpl2+)))
723
724 (define-public lrslib
725 (package
726 (name "lrslib")
727 (version "7.1")
728 (source
729 (origin
730 (method url-fetch)
731 (uri (string-append "http://cgm.cs.mcgill.ca/~avis/C/lrslib/archive/"
732 "lrslib-0"
733 (string-delete #\. version) ".tar.gz"))
734 (sha256
735 (base32
736 "05kq3hzam31dlmkccv3v358r478kpvx76mw37ka12c6ypwv5dsnk"))))
737 (build-system gnu-build-system)
738 (inputs
739 `(("gmp" ,gmp)))
740 (arguments
741 `(#:tests? #f ; no check phase
742 #:make-flags `("CC=gcc"
743 ,(string-append "prefix=" (assoc-ref %outputs "out"))
744 "all-shared")
745 #:phases
746 (modify-phases %standard-phases
747 (replace 'configure
748 (lambda _
749 (substitute* "makefile"
750 (("-L \\.") "-L . -Wl,-rpath='$$ORIGIN/../lib'"))
751 #t)))))
752 (home-page "http://cgm.cs.mcgill.ca/~avis/C/lrs.html")
753 (synopsis "Convex hulls of polyhedra with exact arithmetic")
754 (description
755 "The C code of lrslib implements the reverse search algorithm for
756 vertex enumeration and convex hull problems. Its input file format is
757 compatible with cddlib. All computations are done exactly in either
758 multiple precision or fixed integer arithmetic. Output is not stored
759 in memory, so even problems with very large output sizes can sometimes
760 be solved.")
761 (license license:gpl2+)))
762
763 (define-public libcerf
764 (package
765 (name "libcerf")
766 (version "1.14")
767 (source
768 (origin
769 (method git-fetch)
770 (uri (git-reference
771 (url "https://jugit.fz-juelich.de/mlz/libcerf")
772 (commit (string-append "v" version))))
773 (file-name (git-file-name name version))
774 (sha256
775 (base32 "1ic2q7kvxpqmgxlishygvx8d00i4wn51vkq4fyac44ahhf6c3kwd"))))
776 (build-system cmake-build-system)
777 (native-inputs
778 `(("perl" ,perl)))
779 (home-page "https://jugit.fz-juelich.de/mlz/libcerf")
780 (synopsis "Library for complex error functions")
781 (description
782 "@code{libcerf} is a self-contained numeric library that provides an
783 efficient and accurate implementation of complex error functions, along with
784 Dawson, Faddeeva, and Voigt functions.")
785 (license license:expat)))
786
787 (define-public vinci
788 (package
789 (name "vinci")
790 (version "1.0.5")
791 (source
792 (origin
793 (method url-fetch)
794 (uri (string-append "https://www.math.u-bordeaux.fr/~aenge/software/"
795 "vinci/vinci-" version ".tar.gz"))
796 (sha256
797 (base32
798 "1aq0qc1y27iw9grhgnyji3290wwfznsrk3sg6ynqpxwjdda53h4m"))))
799 (build-system gnu-build-system)
800 (inputs
801 `(("lrslib" ,lrslib)))
802 (arguments
803 `(#:tests? #f ; no check phase
804 #:phases
805 (modify-phases %standard-phases
806 (replace 'configure
807 ;; register the lrs location in the config file
808 (lambda* (#:key inputs #:allow-other-keys)
809 (let* ((lrs (assoc-ref inputs "lrslib"))
810 (lrsexec (string-append lrs "/bin/lrs")))
811 (substitute* "vinci.h"
812 (("#define LRS_EXEC \"lrs\"")
813 (string-append "#define LRS_EXEC \"" lrsexec "\""))))
814 #t))
815 (replace 'install
816 (lambda* (#:key outputs #:allow-other-keys)
817 (let* ((out (assoc-ref outputs "out"))
818 (bin (string-append out "/bin")))
819 (install-file "vinci" bin))
820 #t)))))
821 (home-page
822 "https://www.math.u-bordeaux.fr/~aenge/?category=software&page=vinci")
823 (synopsis "Volume computation for polytopes")
824 (description
825 "Vinci implements a number of volume computation algorithms for convex
826 polytopes in arbitrary dimension. The polytopes can be given by their
827 V-representation (as the convex hull of a finite number of vertices), by
828 their H-representation (as the bounded intersection of a finite number of
829 halfspaces) or by their double description with both representations.")
830 (license license:gpl2+)))
831
832 (define-public arpack-ng
833 (package
834 (name "arpack-ng")
835 (version "3.8.0")
836 (home-page "https://github.com/opencollab/arpack-ng")
837 (source (origin
838 (method git-fetch)
839 (uri (git-reference (url home-page) (commit version)))
840 (file-name (git-file-name name version))
841 (sha256
842 (base32
843 "0l7as5z6xvbxly8alam9s4kws70952qq35a6vkljzayi4b9gbklx"))))
844 (build-system gnu-build-system)
845 (native-inputs
846 `(("autoconf" ,autoconf)
847 ("automake" ,automake)
848 ("libtool" ,libtool)
849 ("pkg-config" ,pkg-config)))
850 (inputs
851 `(("eigen" ,eigen)
852 ("lapack" ,lapack)
853 ("fortran" ,gfortran)))
854 (synopsis "Fortran subroutines for solving eigenvalue problems")
855 (description
856 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
857 large scale eigenvalue problems.")
858 (license (license:non-copyleft "file://COPYING"
859 "See COPYING in the distribution."))))
860
861 (define-public arpack-ng-3.3.0
862 (package
863 (inherit arpack-ng)
864 (version "3.3.0")
865 (source
866 (origin
867 (method git-fetch)
868 (uri (git-reference (url (package-home-page arpack-ng))
869 (commit version)))
870 (file-name (git-file-name (package-name arpack-ng) version))
871 (sha256
872 (base32
873 "00h6bjvxjq7bv0b8pwnc0gw33ns6brlqv00xx2rh3w9b5n205918"))))))
874
875 (define-public arpack-ng-openmpi
876 (package (inherit arpack-ng)
877 (name "arpack-ng-openmpi")
878 (inputs
879 `(("mpi" ,openmpi)
880 ,@(package-inputs arpack-ng)))
881 (arguments
882 (substitute-keyword-arguments (package-arguments arpack-ng)
883 ((#:configure-flags _ '())
884 ''("--enable-mpi"))
885 ((#:phases phases '%standard-phases)
886 `(modify-phases ,phases
887 (add-before 'check 'mpi-setup
888 ,%openmpi-setup)))))
889 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
890
891 (define-public lapack
892 (package
893 (name "lapack")
894 (version "3.9.0")
895 (source
896 (origin
897 (method url-fetch)
898 (uri (string-append "http://www.netlib.org/lapack/lapack-"
899 version ".tgz"))
900 (sha256
901 (base32
902 "1155qixp26c12yrxc76z9mlfw2h3xxymxxv5znpgzh5gaykpndgj"))))
903 (build-system cmake-build-system)
904 (home-page "http://www.netlib.org/lapack/")
905 (inputs `(("fortran" ,gfortran)
906 ("python" ,python-wrapper)))
907 (arguments
908 `(#:configure-flags (list
909 "-DBUILD_SHARED_LIBS:BOOL=YES"
910 "-DLAPACKE=ON"
911 ;; Build the 'LAPACKE_clatms' functions.
912 "-DLAPACKE_WITH_TMG=ON"
913 "-DBUILD_TESTING=ON")))
914 (synopsis "Library for numerical linear algebra")
915 (description
916 "LAPACK is a Fortran 90 library for solving the most commonly occurring
917 problems in numerical linear algebra.")
918 (license (license:non-copyleft "file://LICENSE"
919 "See LICENSE in the distribution."))))
920
921 (define-public clapack
922 (package
923 (name "clapack")
924 (version "3.2.1")
925 (source
926 (origin
927 (method url-fetch)
928 (uri (string-append "http://www.netlib.org/clapack/clapack-"
929 version "-CMAKE.tgz"))
930 (sha256
931 (base32
932 "0nnap9q1mv14g57dl3vkvxrdr10k5w7zzyxs6rgxhia8q8mphgqb"))))
933 (build-system cmake-build-system)
934 (arguments
935 `(#:phases
936 (modify-phases %standard-phases
937 ;; These tests use a lot of stack variables and segfault without
938 ;; lifting resource limits.
939 (add-after 'unpack 'disable-broken-tests
940 (lambda _
941 (substitute* "TESTING/CMakeLists.txt"
942 (("add_lapack_test.* xeigtstz\\)") ""))
943 #t))
944 (replace 'install
945 (lambda* (#:key outputs #:allow-other-keys)
946 (let* ((out (assoc-ref outputs "out"))
947 (libdir (string-append out "/lib"))
948 (f2cinc (string-append out "/include/libf2c")))
949 (mkdir-p f2cinc)
950 (display (getcwd))
951 (for-each (lambda (file)
952 (install-file file libdir))
953 '("SRC/liblapack.a"
954 "F2CLIBS/libf2c/libf2c.a"
955 "TESTING/MATGEN/libtmglib.a"
956 "BLAS/SRC/libblas.a"))
957 (for-each (lambda (file)
958 (install-file file f2cinc))
959 (cons "F2CLIBS/libf2c/arith.h"
960 (find-files (string-append "../clapack-"
961 ,version "-CMAKE/F2CLIBS/libf2c")
962 "\\.h$")))
963 (copy-recursively (string-append "../clapack-"
964 ,version "-CMAKE/INCLUDE")
965 (string-append out "/include"))
966 #t))))))
967 (home-page "https://www.netlib.org/clapack/")
968 (synopsis "Numerical linear algebra library for C")
969 (description
970 "The CLAPACK library was built using a Fortran to C conversion utility
971 called f2c. The entire Fortran 77 LAPACK library is run through f2c to obtain
972 C code, and then modified to improve readability. CLAPACK's goal is to
973 provide LAPACK for someone who does not have access to a Fortran compiler.")
974 (license (license:non-copyleft "file://LICENSE"
975 "See LICENSE in the distribution."))))
976
977 (define-public scalapack
978 (package
979 (name "scalapack")
980 (version "2.1.0")
981 (source
982 (origin
983 (method url-fetch)
984 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
985 version ".tgz"))
986 (sha256
987 (base32
988 "19i0h9vdc3zsy58r6fy1vs2kz2l7amifkz0cf926j90xz1n23nb1"))
989 (patches (search-patches "scalapack-gcc-10-compilation.patch"))))
990 (build-system cmake-build-system)
991 (inputs
992 `(("mpi" ,openmpi)
993 ("fortran" ,gfortran)
994 ("lapack" ,lapack))) ;for testing only
995 (arguments
996 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")
997 #:phases (modify-phases %standard-phases
998 (add-before 'check 'mpi-setup
999 ,%openmpi-setup)
1000 (add-after 'unpack 'skip-faulty-test
1001 (lambda _
1002 ;; FIXME: Skip these two tests that fail to complete for
1003 ;; unknown reasons:
1004 ;; <https://github.com/Reference-ScaLAPACK/scalapack/issues/43>.
1005 (substitute* "TESTING/CMakeLists.txt"
1006 (("^add_test\\(x[sd]hseqr.*" all)
1007 (string-append "# " all "\n"))))))))
1008 (home-page "http://www.netlib.org/scalapack/")
1009 (synopsis "Library for scalable numerical linear algebra")
1010 (description
1011 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
1012 routines on parallel distributed memory machines. ScaLAPACK solves dense and
1013 banded linear systems, least squares problems, eigenvalue problems, and
1014 singular value problems.")
1015 (license (license:non-copyleft "file://LICENSE"
1016 "See LICENSE in the distribution."))))
1017
1018 (define-public gnuplot
1019 (package
1020 (name "gnuplot")
1021 (version "5.4.2")
1022 (source (origin
1023 (method url-fetch)
1024 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
1025 version "/gnuplot-"
1026 version ".tar.gz"))
1027 (sha256
1028 (base32 "1fp7rbhjmz2w63r72kicf8lfszzimz2csfx868fracw167hpaz75"))))
1029 (build-system gnu-build-system)
1030 (inputs `(("readline" ,readline)
1031 ("cairo" ,cairo)
1032 ("pango" ,pango)
1033 ("gd" ,gd)
1034 ("lua" ,lua)))
1035 (native-inputs
1036 `(("pkg-config" ,pkg-config)
1037 ("texlive" ,texlive-tiny)))
1038 (arguments `(#:configure-flags (list (string-append
1039 "--with-texdir=" %output
1040 "/texmf-local/tex/latex/gnuplot"))
1041 ;; Plot on a dumb terminal during tests.
1042 #:make-flags '("GNUTERM=dumb")))
1043 (home-page "http://www.gnuplot.info")
1044 (synopsis "Command-line driven graphing utility")
1045 (description "Gnuplot is a portable command-line driven graphing
1046 utility. It was originally created to allow scientists and students to
1047 visualize mathematical functions and data interactively, but has grown to
1048 support many non-interactive uses such as web scripting. It is also used as a
1049 plotting engine by third-party applications like Octave.")
1050 ;; X11 Style with the additional restriction that derived works may only be
1051 ;; distributed as patches to the original.
1052 (license (license:fsf-free
1053 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
1054
1055 (define-public gctp
1056 (package
1057 (name "gctp")
1058 (version "2.0.0")
1059 (source
1060 (origin
1061 (method git-fetch)
1062 (uri (git-reference
1063 (url "https://github.com/OkoSanto/GCTP")
1064 (commit (string-append "v" version))))
1065 (file-name (git-file-name name version))
1066 (sha256
1067 (base32 "11wqmd443b4nksdbzp1msdws3av948nmwq1xz80w6hka3ss2aigd"))))
1068 (native-inputs
1069 `(("fortran" ,gfortran)))
1070 (build-system gnu-build-system)
1071 (synopsis "General Cartographic Transformation Package (GCTP)")
1072 (description
1073 "The General Cartographic Transformation Package (GCTP) is a system of
1074 software routines designed to permit the transformation of coordinate pairs
1075 from one map projection to another. The GCTP is the standard computer
1076 software used by the National Mapping Division for map projection
1077 computations.")
1078 (home-page "https://github.com/OkoSanto/GCTP")
1079 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
1080
1081 (define-public hdf4
1082 (package
1083 (name "hdf4")
1084 (version "4.2.14")
1085 (source
1086 (origin
1087 (method url-fetch)
1088 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
1089 version "/src/hdf-" version ".tar.bz2"))
1090 (sha256
1091 (base32 "0n29klrrbwan9307np0d9hr128dlpc4nnlf57a140080ll3jmp8l"))
1092 (patches (search-patches "hdf4-architectures.patch"
1093 "hdf4-reproducibility.patch"
1094 "hdf4-shared-fortran.patch"
1095 "hdf4-tirpc.patch"))))
1096 (build-system gnu-build-system)
1097 (native-inputs
1098 `(("gfortran" ,gfortran)
1099 ("bison" ,bison)
1100 ("flex" ,flex)))
1101 (inputs
1102 `(("zlib" ,zlib)
1103 ("libjpeg" ,libjpeg-turbo)
1104 ("libtirpc" ,libtirpc)))
1105 (arguments
1106 `(#:parallel-tests? #f
1107 #:configure-flags (list "--enable-shared"
1108 "FCFLAGS=-fallow-argument-mismatch"
1109 "FFLAGS=-fallow-argument-mismatch"
1110 (string-append "CPPFLAGS=-I"
1111 (assoc-ref %build-inputs "libtirpc")
1112 "/include/tirpc"))
1113 #:phases
1114 (modify-phases %standard-phases
1115 ;; This is inspired by two of Debian's patches.
1116 (add-before 'configure 'add-more-aarch64-support
1117 (lambda _
1118 (substitute* '("mfhdf/ncgen/ncgen.l"
1119 "mfhdf/ncgen/ncgenyy.c"
1120 "mfhdf/libsrc/netcdf.h.in")
1121 (("AIX5L64") "__aarch64__"))
1122 #t))
1123 (add-before 'configure 'patchbuild
1124 (lambda _
1125 (substitute*
1126 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
1127 (("/bin/rm") "rm")
1128 (("/bin/mkdir") "mkdir"))
1129 (substitute* (find-files "." "^Makefile\\.in$")
1130 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
1131 -R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
1132 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
1133 -R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
1134 -R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
1135 #t))
1136 (add-after 'configure 'patch-settings
1137 (lambda _
1138 ;; libhdf4.settings contains the full path of the
1139 ;; compilers used, and its contents are included in
1140 ;; .so-files. We truncate the hashes to avoid
1141 ;; unnecessary store references to those compilers:
1142 (substitute* "libhdf4.settings"
1143 (("(/gnu/store/)([0-9A-Za-z]*)" all prefix hash)
1144 (string-append prefix (string-take hash 10) "...")))
1145 #t))
1146 (add-after 'install 'provide-absolute-libjpeg-reference
1147 (lambda* (#:key inputs outputs #:allow-other-keys)
1148 (let ((out (assoc-ref outputs "out"))
1149 (libjpeg (assoc-ref inputs "libjpeg")))
1150 ;; libjpeg-turbo does not provide a .la file, so libtool is
1151 ;; unable to add an absolute reference for -ljpeg in the .la
1152 ;; files. Fix it manually to avoid having to propagate it.
1153 (substitute* (find-files (string-append out "/lib") "\\.la$")
1154 (("-ljpeg")
1155 (string-append "-L" libjpeg "/lib -ljpeg")))
1156 #t))))))
1157 (home-page "https://www.hdfgroup.org/products/hdf4/")
1158 (synopsis
1159 "Library and multi-object file format for storing and managing data")
1160 (description "HDF4 is a library and multi-object file format for storing
1161 and managing data between machines. HDF4 is an older hierarchical data format,
1162 incompatible with HDF5.")
1163 (license
1164 (license:non-copyleft
1165 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
1166
1167 (define-public hdf4-alt
1168 (package
1169 (inherit hdf4)
1170 (name "hdf4-alt")
1171 (arguments
1172 (substitute-keyword-arguments (package-arguments hdf4)
1173 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
1174 (synopsis
1175 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
1176
1177 (define-public hdf5-1.8
1178 (package
1179 (name "hdf5")
1180 (version "1.8.22")
1181 (source
1182 (origin
1183 (method url-fetch)
1184 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
1185 "hdf5-" (version-major+minor version)
1186 "/hdf5-" version "/src/hdf5-"
1187 version ".tar.bz2")
1188 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
1189 "current"
1190 (match (string-split version #\.)
1191 ((major minor _ ...)
1192 (string-append major minor)))
1193 "/src/hdf5-" version ".tar.bz2")))
1194 (sha256
1195 (base32 "194ki2s5jrgl4czkvy5nc9nwjyapah0fj72l0gb0aysplp38i6v8"))
1196 (patches (search-patches "hdf5-config-date.patch"))))
1197 (build-system gnu-build-system)
1198 (inputs
1199 `(("zlib" ,zlib)))
1200 (native-inputs
1201 `(("gfortran" ,gfortran)
1202 ("perl" ,perl))) ;part of the test machinery needs Perl
1203 (outputs '("out" ; core library
1204 "fortran")) ; fortran interface
1205 (arguments
1206 `(;; Some of the users, notably Flann, need the C++ interface.
1207 #:configure-flags '("--enable-cxx"
1208 "--enable-fortran"
1209 "--enable-fortran2003"
1210
1211 ;; Build a thread-safe library. Unfortunately,
1212 ;; 'configure' invites you to either turn off C++,
1213 ;; Fortran, and the high-level interface (HL), or
1214 ;; to pass '--enable-unsupported'. Debian
1215 ;; packagers chose to pass '--enable-unsupported'
1216 ;; and we follow their lead here.
1217 "--enable-threadsafe"
1218 "--with-pthread"
1219 "--enable-unsupported")
1220 ;; Use -fPIC to allow the R bindings to link with the static libraries
1221 #:make-flags (list "CFLAGS=-fPIC"
1222 "CXXFLAGS=-fPIC")
1223 #:phases
1224 (modify-phases %standard-phases
1225 (add-before 'configure 'patch-configure
1226 (lambda* (#:key outputs #:allow-other-keys)
1227 (substitute* "configure"
1228 (("/bin/mv") "mv"))
1229 (substitute* "fortran/src/Makefile.in"
1230 (("libhdf5_fortran_la_LDFLAGS =")
1231 (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
1232 (assoc-ref outputs "fortran") "/lib")))
1233 (substitute* "hl/fortran/src/Makefile.in"
1234 (("libhdf5hl_fortran_la_LDFLAGS =")
1235 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
1236 (assoc-ref outputs "fortran") "/lib")))
1237 #t))
1238 (add-after 'configure 'patch-settings
1239 (lambda _
1240 ;; libhdf5.settings contains the full path of the
1241 ;; compilers used, and its contents are included in
1242 ;; libhdf5.so. We truncate the hashes to avoid
1243 ;; unnecessary store references to those compilers:
1244 (substitute* "src/libhdf5.settings"
1245 (("(/gnu/store/)([a-zA-Z0-9]*)" all prefix hash)
1246 (string-append prefix (string-take hash 10) "..."))
1247 ;; Don't record the build-time kernel version to make the
1248 ;; settings file reproducible.
1249 (("Uname information:.*")
1250 "Uname information: Linux\n"))
1251 #t))
1252 (add-after 'install 'patch-references
1253 (lambda* (#:key inputs outputs #:allow-other-keys)
1254 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
1255 (zlib (assoc-ref inputs "zlib")))
1256 (substitute* (find-files bin "h5p?cc")
1257 (("-lz" lib)
1258 (string-append "-L" zlib "/lib " lib)))
1259 #t)))
1260 (add-after 'install 'split
1261 (lambda* (#:key inputs outputs #:allow-other-keys)
1262 ;; Move all fortran-related files
1263 (let* ((out (assoc-ref outputs "out"))
1264 (bin (string-append out "/bin"))
1265 (lib (string-append out "/lib"))
1266 (inc (string-append out "/include"))
1267 (ex (string-append out "/share/hdf5_examples/fortran"))
1268 (fort (assoc-ref outputs "fortran"))
1269 (fbin (string-append fort "/bin"))
1270 (flib (string-append fort "/lib"))
1271 (finc (string-append fort "/include"))
1272 (fex (string-append fort "/share/hdf5_examples/fortran")))
1273 (mkdir-p fbin)
1274 (mkdir-p flib)
1275 (mkdir-p finc)
1276 (mkdir-p fex)
1277 ;; Note: When built with --enable-parallel, the 'h5fc' file
1278 ;; doesn't exist, hence this condition.
1279 (when (file-exists? (string-append bin "/h5fc"))
1280 (rename-file (string-append bin "/h5fc")
1281 (string-append fbin "/h5fc")))
1282 (for-each (lambda (file)
1283 (rename-file file
1284 (string-append flib "/" (basename file))))
1285 (find-files lib ".*fortran.*"))
1286 (for-each (lambda (file)
1287 (rename-file file
1288 (string-append finc "/" (basename file))))
1289 (find-files inc ".*mod"))
1290 (for-each (lambda (file)
1291 (rename-file file
1292 (string-append fex "/" (basename file))))
1293 (find-files ex ".*"))
1294 (delete-file-recursively ex))
1295 #t)))))
1296 (home-page "https://www.hdfgroup.org")
1297 (synopsis "Management suite for extremely large and complex data")
1298 (description "HDF5 is a suite that makes possible the management of
1299 extremely large and complex data collections.")
1300 (license (license:x11-style
1301 "https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
1302
1303 (define-public hdf5-1.10
1304 (package
1305 (inherit hdf5-1.8)
1306 (version "1.10.7")
1307 (source
1308 (origin
1309 (method url-fetch)
1310 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
1311 "hdf5-" (version-major+minor version)
1312 "/hdf5-" version "/src/hdf5-"
1313 version ".tar.bz2")
1314 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
1315 "current"
1316 (apply string-append
1317 (take (string-split version #\.) 2))
1318 "/src/hdf5-" version ".tar.bz2")))
1319 (sha256
1320 (base32 "0pm5xxry55i0h7wmvc7svzdaa90rnk7h78rrjmnlkz2ygsn8y082"))
1321 (patches (search-patches "hdf5-config-date.patch"))))))
1322
1323 (define-public hdf5-1.12
1324 (package
1325 (inherit hdf5-1.8)
1326 (version "1.12.1")
1327 (source
1328 (origin
1329 (method url-fetch)
1330 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
1331 "hdf5-" (version-major+minor version)
1332 "/hdf5-" version "/src/hdf5-"
1333 version ".tar.bz2")
1334 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
1335 "current"
1336 (apply string-append
1337 (take (string-split version #\.) 2))
1338 "/src/hdf5-" version ".tar.bz2")))
1339 (sha256
1340 (base32 "074g3z504xf77ff38igs30i1aqxpm508p7yw78ykva7dncrgbyda"))
1341 (patches (search-patches "hdf5-config-date.patch"))))))
1342
1343 (define-public hdf5
1344 ;; Default version of HDF5.
1345 hdf5-1.10)
1346
1347 (define-public hdf-java
1348 (package
1349 (name "hdf-java")
1350 (version "3.3.2")
1351 (source
1352 (origin
1353 (method url-fetch)
1354 (uri (string-append
1355 "https://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
1356 version "/src/CMake-hdfjava-" version ".tar.gz"))
1357 (sha256
1358 (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
1359 (modules '((guix build utils)))
1360 (snippet ; Make sure we don't use the bundled sources and binaries.
1361 `(begin
1362 (for-each delete-file
1363 (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
1364 "HDF4.tar.gz" "HDF5.tar.gz"))
1365 (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))
1366 #t))))
1367 (build-system gnu-build-system)
1368 (native-inputs
1369 `(("jdk" ,icedtea "jdk")
1370 ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
1371 ;; For tests:
1372 ("hamcrest-core" ,java-hamcrest-core)
1373 ("junit" ,java-junit)
1374 ("slf4j-simple" ,java-slf4j-simple)))
1375 (inputs
1376 `(("hdf4" ,hdf4)
1377 ("hdf5" ,hdf5-1.8)
1378 ("zlib" ,zlib)
1379 ("libjpeg" ,libjpeg-turbo)
1380 ("slf4j-api" ,java-slf4j-api)))
1381 (arguments
1382 `(#:configure-flags
1383 (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
1384 (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
1385 (assoc-ref %build-inputs "jdk") "/lib" )
1386 (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
1387 (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
1388
1389 #:make-flags
1390 (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
1391 (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
1392 (string-append "ZLIB=" (search-input-file %build-inputs "/lib/libz.so"))
1393 (string-append "JPEGLIB="
1394 (search-input-file %build-inputs "/lib/libjpeg.so"))
1395 "LLEXT=so")
1396
1397 #:phases
1398 (modify-phases %standard-phases
1399 (add-before 'configure 'chdir-to-source
1400 (lambda _ (chdir ,(string-append "hdfjava-" version)) #t))
1401 (add-before 'configure 'patch-build
1402 (lambda* (#:key inputs outputs #:allow-other-keys)
1403 (substitute* "configure"
1404 (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
1405 (("/bin/cat") (which "cat")))
1406 ;; Set classpath for compilation
1407 (substitute* '("hdf/hdf5lib/Makefile.in"
1408 "hdf/hdf5lib/exceptions/Makefile.in"
1409 "hdf/hdflib/Makefile.in")
1410 (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
1411 ;; 'slf4j-api-X.Y.Z.jar' is installed in a Maven-style
1412 ;; directory, so use 'find-files' to find it.
1413 (car (find-files (assoc-ref inputs "slf4j-api")
1414 "^slf4j-api.*\\.jar$"))))
1415 ;; Replace outdated config.sub and config.guess:
1416 (with-directory-excursion "config"
1417 (for-each (lambda (file)
1418 (install-file
1419 (search-input-file inputs
1420 (string-append
1421 "/share/automake-"
1422 ,(version-major+minor (package-version automake))
1423 "/" file))
1424 "."))
1425 '("config.sub" "config.guess")))
1426
1427 ;; Fix embedded version number
1428 (let ((hdf5version (list ,@(string-split (package-version hdf5) #\.))))
1429 (substitute* "hdf/hdf5lib/H5.java"
1430 (("1, 8, 19")
1431 (string-join hdf5version ", "))))
1432
1433 (mkdir-p (string-append (assoc-ref outputs "out")))
1434 ;; Set classpath for tests
1435 (let* ((build-dir (getcwd))
1436 (lib (string-append build-dir "/lib"))
1437 (jhdf (string-append lib "/jhdf.jar"))
1438 (jhdf5 (string-append lib "/jhdf5.jar"))
1439 (testjars
1440 (append
1441 (map (lambda (i)
1442 (car (find-files (assoc-ref inputs i)
1443 (string-append "^" i
1444 ".*\\.jar$"))))
1445 '("slf4j-api" "slf4j-simple"))
1446 (list
1447 (car (find-files (assoc-ref inputs "junit") "jar$"))
1448 (car (find-files (assoc-ref inputs "hamcrest-core")
1449 "jar$")))))
1450 (class-path
1451 (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
1452
1453 (substitute* '("test/hdf5lib/Makefile.in"
1454 "test/hdf5lib/junit.sh.in"
1455 "examples/runExample.sh.in")
1456 (("/usr/bin/test")
1457 (search-input-file inputs "/bin/test"))
1458 (("/usr/bin/uname")
1459 (search-input-file inputs "/bin/uname"))
1460 (("CLASSPATH=[^\n]*")
1461 (string-append "CLASSPATH=" class-path)))
1462 (setenv "CLASSPATH" class-path))
1463 #t))
1464 (add-before 'check 'build-examples
1465 (lambda _
1466 (apply invoke `("javac"
1467 ,@(find-files "examples" ".*\\.java"))))))
1468
1469 #:parallel-build? #f
1470
1471 #:parallel-tests? #f ))
1472 (home-page "https://support.hdfgroup.org/products/java")
1473 (synopsis "Java interface for the HDF4 and HDF5 libraries")
1474 (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
1475 the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
1476 implemented in C.")
1477
1478 ;; BSD-style license:
1479 (license (license:x11-style
1480 "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
1481 /current/src/unpacked/COPYING"))))
1482
1483 (define-public hdf-eos2
1484 (package
1485 (name "hdf-eos2")
1486 (version "19.1.0")
1487 (source
1488 (origin
1489 (method url-fetch)
1490 (uri "ftp://edhs1.gsfc.nasa.gov\
1491 /edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
1492 (sha256
1493 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
1494 (patches (search-patches "hdf-eos2-remove-gctp.patch"
1495 "hdf-eos2-build-shared.patch"
1496 "hdf-eos2-fortrantests.patch"))))
1497 (build-system gnu-build-system)
1498 (native-inputs
1499 `(("gfortran" ,gfortran)))
1500 (inputs
1501 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
1502 ;; XXX: These inputs are really dependencies of hdf4.
1503 ("zlib" ,zlib)
1504 ("libjpeg" ,libjpeg-turbo)
1505 ("libtirpc" ,libtirpc)
1506
1507 ("gctp" ,gctp)))
1508 (arguments
1509 `( #:configure-flags '("--enable-install-include" "--enable-shared"
1510 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
1511 #:parallel-tests? #f))
1512 (home-page "https://hdfeos.org/software/library.php#HDF-EOS2")
1513 (synopsis "HDF4-based data format for NASA's Earth Observing System")
1514 (description "HDF-EOS2 is a software library built on HDF4 which supports
1515 the construction of data structures used in NASA's Earth Observing
1516 System (Grid, Point and Swath).")
1517
1518 ;; Source files carry a permissive license header.
1519 (license (license:non-copyleft home-page))))
1520
1521 (define-public hdf-eos5
1522 (package
1523 (name "hdf-eos5")
1524 (version "1.15")
1525 (source (origin
1526 (method url-fetch)
1527 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
1528 /edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
1529 (sha256
1530 (base32
1531 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
1532 (patches (search-patches "hdf-eos5-build-shared.patch"
1533 "hdf-eos5-remove-gctp.patch"
1534 "hdf-eos5-fix-szip.patch"
1535 "hdf-eos5-fortrantests.patch"))))
1536 (native-inputs
1537 `(("gfortran" ,gfortran)))
1538 (build-system gnu-build-system)
1539 (inputs
1540 `(("hdf5" ,hdf5-1.8)
1541 ("zlib" ,zlib)
1542 ("gctp" ,gctp)))
1543 (arguments
1544 `(#:configure-flags '("--enable-install-include" "--enable-shared"
1545 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
1546 #:parallel-tests? #f))
1547 (synopsis "HDF5-based data format for NASA's Earth Observing System")
1548 (description
1549 "HDF-EOS5 is a software library built on HDF5 to support the construction
1550 of data structures used in NASA's Earth Observing System (Grid, Point and
1551 Swath).")
1552 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
1553
1554 ;; Source files carry a permissive license header.
1555 (license (license:non-copyleft home-page))))
1556
1557 (define-public hdf5-parallel-openmpi
1558 (package/inherit hdf5-1.10 ;use the latest
1559 (name "hdf5-parallel-openmpi")
1560 (inputs
1561 `(("mpi" ,openmpi)
1562 ,@(package-inputs hdf5)))
1563 (arguments
1564 (substitute-keyword-arguments (package-arguments hdf5)
1565 ((#:configure-flags flags)
1566 ``("--enable-parallel"
1567 ,@(delete "--enable-cxx"
1568 (delete "--enable-threadsafe" ,flags))))
1569 ((#:phases phases)
1570 `(modify-phases ,phases
1571 (add-after 'build 'mpi-setup
1572 ,%openmpi-setup)
1573 (add-before 'check 'patch-tests
1574 (lambda _
1575 ;; OpenMPI's mpirun will exit with non-zero status if it
1576 ;; detects an "abnormal termination", i.e. any process not
1577 ;; calling MPI_Finalize(). Since the test is explicitly
1578 ;; avoiding MPI_Finalize so as not to have at_exit and thus
1579 ;; H5C_flush_cache from being called, mpirun will always
1580 ;; complain, so turn this test off.
1581 (substitute* "testpar/Makefile"
1582 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
1583 (string-append front back "\n")))
1584 (substitute* "tools/test/h5diff/testph5diff.sh"
1585 (("/bin/sh") (which "sh")))
1586 #t))))))
1587 (synopsis "Management suite for data with parallel IO support")))
1588
1589 (define-public hdf5-blosc
1590 (package
1591 (name "hdf5-blosc")
1592 (version "1.0.0")
1593 (source
1594 (origin
1595 (method git-fetch)
1596 (uri (git-reference
1597 (url "https://github.com/Blosc/hdf5-blosc")
1598 (commit (string-append "v" version))))
1599 (file-name (git-file-name name version))
1600 (sha256
1601 (base32 "1nj2bm1v6ymm3fmyvhbn6ih5fgdiapavlfghh1pvbmhw71cysyqs"))))
1602 (build-system cmake-build-system)
1603 (arguments
1604 `(#:configure-flags
1605 (list (string-append "-DBLOSC_INSTALL_DIR="
1606 (assoc-ref %build-inputs "c-blosc"))
1607 (string-append "-DPLUGIN_INSTALL_PATH="
1608 (assoc-ref %outputs "out")
1609 "/hdf5/lib/plugin"))
1610 #:phases
1611 (modify-phases %standard-phases
1612 (add-after 'unpack 'do-not-build-blosc
1613 (lambda _
1614 (substitute* "CMakeLists.txt"
1615 (("set\\(BLOSC_INSTALL_DIR.*") "")
1616 (("ExternalProject_Add\\(project_blosc") "message("))
1617 #t)))))
1618 (inputs
1619 `(("c-blosc" ,c-blosc)
1620 ("hdf5" ,hdf5-1.10)))
1621 (home-page "https://github.com/Blosc/hdf5-blosc")
1622 (synopsis "Filter for HDF5 using the Blosc compressor")
1623 (description "This is a filter for HDF5 that uses the Blosc compressor; by
1624 installing this filter, you can read and write HDF5 files with
1625 Blosc-compressed datasets.")
1626 (license license:expat)))
1627
1628 (define-public h5check
1629 (package
1630 (name "h5check")
1631 (version "2.0.1")
1632 (source
1633 (origin
1634 (method url-fetch)
1635 (uri (string-append "https://www.hdfgroup.org/ftp/HDF5/tools/"
1636 "h5check/src/h5check-" version ".tar.gz"))
1637 (sha256
1638 (base32
1639 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
1640 (build-system gnu-build-system)
1641 (inputs `(("hdf5" ,hdf5-1.8))) ;h5cc for tests
1642 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
1643 (synopsis "HDF5 format checker")
1644 (description "@code{h5check} is a validation tool for verifying that an
1645 HDF5 file is encoded according to the HDF File Format Specification.")
1646 (license (license:x11-style "file://COPYING"))))
1647
1648 (define-public itpp
1649 (package
1650 (name "itpp")
1651 (version "4.3.1")
1652 (source (origin
1653 (method url-fetch)
1654 (uri (string-append "mirror://sourceforge/itpp/itpp/"
1655 version "/itpp-"
1656 version ".tar.gz"))
1657 (sha256
1658 (base32
1659 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
1660 (build-system cmake-build-system)
1661 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
1662 (inputs `(("lapack" ,lapack)
1663 ("fftw" ,fftw)))
1664 ;; FIXME: Even though the fonts are available dvips complains:
1665 ;; "Font cmmi10 not found; characters will be left blank."
1666 (native-inputs
1667 `(("texlive" ,texlive-tiny)
1668 ("ghostscript" ,ghostscript)
1669 ("doxygen" ,doxygen)))
1670 (home-page "http://itpp.sourceforge.net")
1671 (synopsis "C++ library of maths, signal processing and communication classes")
1672 (description "IT++ is a C++ library of mathematical, signal processing and
1673 communication classes and functions. Its main use is in simulation of
1674 communication systems and for performing research in the area of
1675 communications. The kernel of the library consists of generic vector and
1676 matrix classes, and a set of accompanying routines. Such a kernel makes IT++
1677 similar to MATLAB, GNU Octave or SciPy.")
1678 (license license:gpl3+)))
1679
1680 (define-public netcdf
1681 (package
1682 (name "netcdf")
1683 (version "4.7.4")
1684 (source
1685 (origin
1686 (method url-fetch)
1687 (uri (string-append
1688 "https://www.unidata.ucar.edu/downloads/netcdf/ftp/"
1689 "netcdf-c-" version ".tar.gz"))
1690 (sha256
1691 (base32
1692 "1a2fpp15a2rl1m50gcvvzd9y6bavl6vjf9zzf63sz5gdmq06yiqf"))
1693 (modules '((guix build utils)))
1694 (snippet
1695 ;; Make sure this variable is defined only once. Failing to do so
1696 ;; would break builds of 'netcdf-parallel-openmpi' with a
1697 ;; multiple-definition link error with GCC 10.
1698 '(substitute* "ncdump/ocprint.c"
1699 (("^int ocdebug") "static int ocdebug")))
1700 (patches (search-patches "netcdf-date-time.patch"))))
1701 (build-system gnu-build-system)
1702 (native-inputs
1703 `(("m4" ,m4)
1704 ("doxygen" ,doxygen)
1705 ("graphviz" ,graphviz)))
1706 (inputs
1707 `(("hdf4" ,hdf4-alt)
1708 ("hdf5" ,hdf5)
1709 ("curl" ,curl)
1710 ("zlib" ,zlib)
1711 ("libjpeg" ,libjpeg-turbo)))
1712 (arguments
1713 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
1714
1715 #:phases (modify-phases %standard-phases
1716 (add-before 'configure 'fix-source-date
1717 (lambda _
1718 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
1719 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
1720 ;; to '1st hour of the current day', and therefore makes the
1721 ;; package not reproducible.
1722 (substitute* "./configure"
1723 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
1724 "date --date='@0'"))
1725 #t))
1726 (add-after 'configure 'patch-settings
1727 (lambda _
1728 ;; libnetcdf.settings contains the full filename of the compilers
1729 ;; used to build the library. We truncate the hashes of those
1730 ;; filenames to avoid unnecessary references to the corresponding
1731 ;; store items.
1732 (substitute* "libnetcdf.settings"
1733 (("(/gnu/store/)([0-9A-Za-z]*)" all prefix hash)
1734 (string-append prefix (string-take hash 10) "...")))
1735 #t)))
1736
1737 #:parallel-tests? #f)) ;various race conditions
1738 (home-page "https://www.unidata.ucar.edu/software/netcdf/")
1739 (synopsis "Library for scientific data")
1740 (description "NetCDF is an interface for scientific data access and a
1741 software library that provides an implementation of the interface. The netCDF
1742 library defines a machine-independent format for representing scientific data.
1743 Together, the interface, library, and format support the creation, access, and
1744 sharing of scientific data.")
1745 (license (license:x11-style "file://COPYRIGHT"))))
1746
1747 (define-public netcdf-parallel-openmpi
1748 (package (inherit netcdf)
1749 (name "netcdf-parallel-openmpi")
1750 (inputs
1751 `(("mpi" ,openmpi)
1752 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
1753 (package-inputs netcdf))))
1754 ;; TODO: Replace pkg-config references in nc-config with absolute references
1755 (arguments
1756 (substitute-keyword-arguments (package-arguments netcdf)
1757 ((#:configure-flags flags)
1758 `(cons* "CC=mpicc" "CXX=mpicxx"
1759 "--enable-parallel-tests"
1760 ;; Shared libraries not supported with parallel IO.
1761 "--disable-shared" "--with-pic"
1762 ,flags))
1763 ((#:phases phases '%standard-phases)
1764 `(modify-phases ,phases
1765 (add-after 'build 'mpi-setup
1766 ,%openmpi-setup)))))))
1767
1768 (define-public netcdf-fortran
1769 (package
1770 (name "netcdf-fortran")
1771 (version "4.5.3")
1772 (source (origin
1773 (method url-fetch)
1774 (uri (string-append
1775 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
1776 version ".tar.gz"))
1777 (sha256
1778 (base32
1779 "0x4acvfhbsx1q79dkkwrwbgfhm0w5ngnp4zj5kk92s1khihmqfhj"))))
1780 (build-system gnu-build-system)
1781 (arguments
1782 `(#:configure-flags '("FCFLAGS=-fallow-argument-mismatch"
1783 "FFLAGS=-fallow-argument-mismatch")
1784 #:parallel-tests? #f))
1785 (inputs
1786 `(("netcdf" ,netcdf)))
1787 (native-inputs
1788 `(("gfortran" ,gfortran)))
1789 (synopsis "Fortran interface for the netCDF library")
1790 (description (package-description netcdf))
1791 (home-page (package-home-page netcdf))
1792 (license (package-license netcdf))))
1793
1794 (define-public nlopt
1795 (package
1796 (name "nlopt")
1797 (version "2.4.2")
1798 (source (origin
1799 (method url-fetch)
1800 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1801 version ".tar.gz"))
1802 (sha256
1803 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1804 (build-system gnu-build-system)
1805 (arguments
1806 `(;; Shared libraries are not built by default. They are required to
1807 ;; build the Guile, Octave, and Python bindings.
1808 #:configure-flags '("--enable-shared")
1809
1810 #:phases
1811 (modify-phases %standard-phases
1812 (add-before 'configure 'set-libnlopt-file-name
1813 (lambda* (#:key outputs #:allow-other-keys)
1814 ;; Make sure the Scheme module refers to the library by its
1815 ;; absolute file name (we cannot do that from a snippet
1816 ;; because the expansion of @libdir@ contains
1817 ;; ${exec_prefix}.)
1818 (let ((out (assoc-ref outputs "out")))
1819 (substitute* "swig/nlopt.scm.in"
1820 (("libnlopt")
1821 (string-append out "/lib/libnlopt")))
1822 #t))))))
1823 (inputs `(("guile" ,guile-2.0)))
1824 (native-inputs `(("pkg-config" ,pkg-config)))
1825 (home-page "http://ab-initio.mit.edu/wiki/")
1826 (synopsis "Library for nonlinear optimization")
1827 (description "NLopt is a library for nonlinear optimization, providing a
1828 common interface for a number of different free optimization routines available
1829 online as well as original implementations of various other algorithms.")
1830 (license license:lgpl2.1+)))
1831
1832 (define-public ipopt
1833 (package
1834 (name "ipopt")
1835 (version "3.13.4")
1836 (source (origin
1837 (method git-fetch)
1838 (uri (git-reference
1839 (url "https://github.com/coin-or/Ipopt")
1840 (commit (string-append "releases/" version))))
1841 (file-name (git-file-name name version))
1842 (sha256
1843 (base32
1844 "08gznhwhqv1x4baksz350ih8q16r5rd0k8vals6078m3h94khr4b"))))
1845 (build-system gnu-build-system)
1846 (arguments
1847 '(#:phases (modify-phases %standard-phases
1848 (add-after 'install 'add--L-flags-in-ipopt.pc
1849 (lambda* (#:key inputs outputs #:allow-other-keys)
1850 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1851 ;; move it to "Libs.private" where it belongs, and add a
1852 ;; '-L' flag for LAPACK.
1853 (let ((out (assoc-ref outputs "out"))
1854 (lapack (assoc-ref inputs "lapack")))
1855 (substitute* (string-append out "/lib/pkgconfig/"
1856 "ipopt.pc")
1857 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1858 (string-append "Libs: " before " " after "\n"
1859 "Libs.private: " before
1860 "-L" lapack "/lib -llapack -lblas "
1861 after "\n")))
1862 #t))))))
1863 (native-inputs
1864 `(("gfortran" ,gfortran)
1865 ("pkg-config" ,pkg-config)))
1866 (inputs
1867 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
1868 `(("lapack" ,lapack))) ;for both libblas and liblapack
1869 (home-page "https://www.coin-or.org")
1870 (synopsis "Large-scale nonlinear optimizer")
1871 (description
1872 "The Interior Point Optimizer (IPOPT) is a software package for
1873 large-scale nonlinear optimization. It provides C++, C, and Fortran
1874 interfaces.")
1875 (license license:epl2.0)))
1876
1877 (define-public nomad-optimizer
1878 (package
1879 (name "nomad-optimizer")
1880 (version "4.1.0")
1881 (source
1882 (origin
1883 (method git-fetch)
1884 (uri (git-reference
1885 (url "https://github.com/bbopt/nomad/")
1886 (commit (string-append "v" version))))
1887 (file-name (git-file-name name version))
1888 (sha256
1889 (base32
1890 "0w386d8r5ldbvnv0c0g7vz95pfpvwdxis26vaalk2amsa5akl775"))))
1891 (build-system cmake-build-system)
1892 (native-inputs
1893 `(("python" ,python-wrapper)
1894 ("python-cython" ,python-cython)))
1895 (arguments
1896 `(#:imported-modules ((guix build python-build-system)
1897 ,@%cmake-build-system-modules)
1898 #:modules (((guix build python-build-system)
1899 #:select (python-version site-packages))
1900 (guix build cmake-build-system)
1901 (guix build utils))
1902 #:configure-flags
1903 '("-DBUILD_INTERFACES=ON"
1904 "-DBUILD_TESTS=ON")
1905 #:phases
1906 (modify-phases %standard-phases
1907 (add-after 'unpack 'fix-sources-for-build
1908 (lambda* (#:key outputs #:allow-other-keys)
1909 (substitute* "CMakeLists.txt"
1910 ;; CMAKE_INSTALL_PREFIX is accidentally hardcoded.
1911 (("set\\(CMAKE_INSTALL_PREFIX .* FORCE\\)") "")
1912 ;; Requiring GCC version 8 or later is unwarranted.
1913 (("message\\(FATAL_ERROR \"GCC version < 8")
1914 "message(STATUS \"GCC version < 8"))
1915
1916 (let ((out (assoc-ref outputs "out")))
1917 (substitute* "interfaces/PyNomad/CMakeLists.txt"
1918 ;; We don't want to build in-place, and anyway the install
1919 ;; command further below runs build_ext as a prerequisite.
1920 (("COMMAND python setup_PyNomad\\.py .* build_ext --inplace\n")
1921 "")
1922 ;; Don't install locally.
1923 (("COMMAND python (setup_PyNomad\\.py .* install) --user\n"
1924 _ args)
1925 (string-append "COMMAND ${CMAKE_COMMAND} -E env"
1926 " CC=" ,(cc-for-target)
1927 " CXX=" ,(cxx-for-target)
1928 " " (which "python")
1929 " " args
1930 " --prefix=" out
1931 "\n")))
1932 ;; Fix erroneous assumptions about the paths of the include and
1933 ;; library directories.
1934 (substitute* "interfaces/PyNomad/setup_PyNomad.py"
1935 (("^( +os_include_dirs = ).*" _ prefix)
1936 (string-append prefix "[\"../../src\"]\n"))
1937 (("^(installed_lib_dir = ).*" _ prefix)
1938 (string-append prefix "\"" out "/lib\"\n"))))
1939 #t))
1940
1941 ;; Fix the tests so they run in out-of-source builds.
1942 (add-after 'fix-sources-for-build 'fix-sources-for-tests
1943 (lambda _
1944 (substitute*
1945 (map (lambda (d) (string-append "examples/" d "/CMakeLists.txt"))
1946 (append
1947 (map (lambda (d) (string-append "basic/library/" d))
1948 '("example1" "example2" "example3"
1949 "single_obj_parallel"))
1950 (map (lambda (d) (string-append "advanced/library/" d))
1951 '("FixedVariable" "NMonly" "PSDMads" "Restart"
1952 "c_api/example1" "c_api/example2"
1953 "exampleSuggestAndObserve"))))
1954 ;; The built examples are assumed to be in the source tree
1955 ;; (which isn't the case here).
1956 (("(COMMAND \\$\\{CMAKE_BINARY_DIR\\}/examples/runExampleTest\\.sh )\\.(/.*)"
1957 _ command test)
1958 (string-append command "${CMAKE_CURRENT_BINARY_DIR}" test)))
1959 ;; (Unrelated to support for out-of-source testing.)
1960 (make-file-writable
1961 "examples/advanced/library/exampleSuggestAndObserve/cache0.txt")
1962
1963 (let* ((builddir (string-append (getcwd) "/../build"))
1964 ;; The BB_EXE and SURROGATE_EXE paths are interpreted
1965 ;; relative to the configuration file provided to NOMAD.
1966 ;; However, the configuration files are all in the source
1967 ;; tree rather than in the build tree (unlike the compiled
1968 ;; executables).
1969 (fix-exe-path (lambda* (dir #:optional
1970 (file "param.txt")
1971 (exe-opt "BB_EXE"))
1972 (substitute* (string-append dir "/" file)
1973 (((string-append "^" exe-opt " +"))
1974 ;; The $ prevents NOMAD from prefixing
1975 ;; the executable with the path of the
1976 ;; parent directory of the configuration
1977 ;; file NOMAD was provided with as
1978 ;; argument (param.txt or some such).
1979 (string-append exe-opt " $"
1980 builddir "/" dir "/"))))))
1981 (for-each
1982 (lambda (dir)
1983 (let ((dir (string-append "examples/" dir)))
1984 (substitute* (string-append dir "/CMakeLists.txt")
1985 ;; The install phase has not yet run.
1986 (("COMMAND \\$\\{CMAKE_INSTALL_PREFIX\\}/bin/nomad ")
1987 "COMMAND ${CMAKE_BINARY_DIR}/src/nomad "))
1988 (fix-exe-path dir)
1989 (when (equal? dir "examples/basic/batch/surrogate_sort")
1990 (fix-exe-path dir "param.txt" "SURROGATE_EXE"))))
1991 (append (map (lambda (d) (string-append "basic/batch/" d))
1992 '("example1" "example2"
1993 "single_obj" "single_obj_parallel"
1994 "surrogate_sort"))
1995 '("advanced/batch/LHonly")))
1996
1997 (let ((dir "examples/advanced/batch/FixedVariable"))
1998 (substitute* (string-append dir "/runFixed.sh")
1999 ;; Hardcoded path to NOMAD executable.
2000 (("^\\.\\./\\.\\./\\.\\./\\.\\./bin/nomad ")
2001 (string-append builddir "/src/nomad ")))
2002 (for-each
2003 (lambda (f) (fix-exe-path dir f))
2004 '("param1.txt" "param2.txt" "param3.txt" "param10.txt"))))
2005 #t))
2006
2007 ;; The information in the .egg-info file is not kept up to date.
2008 (add-after 'install 'delete-superfluous-egg-info
2009 (lambda* (#:key inputs outputs #:allow-other-keys)
2010 (delete-file (string-append
2011 (site-packages inputs outputs)
2012 "PyNomad-0.0.0-py"
2013 (python-version (assoc-ref inputs "python"))
2014 ".egg-info"))
2015 #t)))))
2016 (home-page "https://www.gerad.ca/nomad/")
2017 (synopsis "Nonlinear optimization by mesh-adaptive direct search")
2018 (description
2019 "NOMAD is a C++ implementation of the mesh-adaptive direct search (MADS)
2020 algorithm, designed for difficult blackbox optimization problems. These
2021 problems occur when the functions defining the objective and constraints are
2022 the result of costly computer simulations.")
2023 (license license:lgpl3+)))
2024
2025 (define-public cbc
2026 (package
2027 (name "cbc")
2028 (version "2.10.5")
2029 (source (origin
2030 (method url-fetch)
2031 (uri (string-append "https://www.coin-or.org/download/source/"
2032 "Cbc/Cbc-" version ".tgz"))
2033 (sha256
2034 (base32
2035 "0wk9vr6zc62gw71v7gnra5wxqlcljcgbhm5lasx236v791b986ns"))
2036 (modules '((guix build utils)))
2037 (snippet
2038 ;; Make sure we don't use the bundled software.
2039 '(delete-file-recursively "ThirdParty"))))
2040 (build-system gnu-build-system)
2041 (native-inputs
2042 `(("gfortran" ,gfortran)
2043 ("pkg-config" ,pkg-config)))
2044 (inputs
2045 `(("openblas" ,openblas)))
2046 (home-page "https://www.coin-or.org")
2047 (synopsis "Branch-and-cut solver")
2048 (description
2049 "Cbc (Coin-or branch and cut) is a mixed integer linear programming
2050 solver written in C++. It can be used as a library or as a standalone
2051 executable.")
2052 (license license:epl1.0)))
2053
2054 (define-public clp
2055 (package
2056 (name "clp")
2057 (version "1.17.6")
2058 (source (origin
2059 (method url-fetch)
2060 (uri (string-append "https://www.coin-or.org/download/source/"
2061 "Clp/Clp-" version ".tgz"))
2062 (sha256
2063 (base32
2064 "0ap1f0lxppa6pnbc4bg7ih7a96avwaki482nig8w5fr3vg9wvkzr"))
2065 (modules '((guix build utils)))
2066 (snippet
2067 ;; Make sure we don't use the bundled software.
2068 '(begin
2069 (delete-file-recursively "ThirdParty")
2070 #t))))
2071 (build-system gnu-build-system)
2072 (native-inputs
2073 `(("gfortran" ,gfortran)
2074 ("pkg-config" ,pkg-config)))
2075 (inputs
2076 `(("openblas" ,openblas)))
2077 (home-page "https://www.coin-or.org")
2078 (synopsis "Linear programming solver")
2079 (description
2080 "CLP is a high quality linear programming solver. Its main strengths are
2081 its dual and primal Simplex algorithms. It also has a barrier algorithm for
2082 linear and quadratic objectives. There are limited facilities for nonlinear
2083 and quadratic objectives using the Simplex algorithm.")
2084 (license license:epl1.0)))
2085
2086 (define-public gecode
2087 (package
2088 (name "gecode")
2089 (version "6.2.0")
2090 (source (origin
2091 (method git-fetch)
2092 (uri (git-reference
2093 (url "https://github.com/Gecode/gecode")
2094 (commit (string-append "release-" version))))
2095 (file-name (git-file-name name version))
2096 (sha256
2097 (base32
2098 "0b1cq0c810j1xr2x9y9996p894571sdxng5h74py17c6nr8c6dmk"))
2099 (modules '((guix build utils)))
2100 (snippet
2101 '(begin
2102 ;; delete generated sources
2103 (for-each delete-file
2104 '("gecode/kernel/var-imp.hpp"
2105 "gecode/kernel/var-type.hpp"))))))
2106 (outputs '("out" "examples"))
2107 (build-system gnu-build-system)
2108 (arguments
2109 `(#:configure-flags
2110 (list (string-append "GLDFLAGS=-Wl,-rpath="
2111 (assoc-ref %outputs "out")
2112 "/lib")
2113 "--enable-examples=no")
2114 #:modules ((guix build gnu-build-system)
2115 (guix build utils)
2116 (ice-9 rdelim)
2117 (ice-9 popen))
2118 #:phases
2119 (modify-phases %standard-phases
2120 (add-after 'build 'build-examples
2121 (lambda* (#:key outputs #:allow-other-keys)
2122 (invoke "make" "compileexamples")))
2123 ;; The Makefile disrespects GLDFLAGS for some reason, so we have to
2124 ;; patch it ourselves... *sigh*
2125 (add-after 'install 'fix-rpath
2126 (lambda* (#:key outputs #:allow-other-keys)
2127 (let ((libdir (string-append (assoc-ref outputs "out") "/lib")))
2128 (for-each
2129 (lambda (file)
2130 (let* ((pipe (open-pipe* OPEN_READ "patchelf"
2131 "--print-rpath" file))
2132 (line (read-line pipe)))
2133 (and (zero? (close-pipe pipe))
2134 (invoke "patchelf" "--set-rpath"
2135 (string-append libdir ":" line)
2136 file))))
2137 (find-files libdir ".*\\.so$")))))
2138 (add-after 'install 'install-examples
2139 (lambda* (#:key outputs #:allow-other-keys)
2140 (invoke "make" "installexamples"
2141 (string-append "bindir=" (assoc-ref outputs "examples")
2142 "/bin"))))
2143 ;; Tests depend on installed libraries.
2144 (delete 'check)
2145 (add-after 'fix-rpath 'check
2146 (assoc-ref %standard-phases 'check)))))
2147 (native-inputs
2148 `(("patchelf" ,patchelf)
2149 ("perl" ,perl)
2150 ("sed" ,sed)))
2151 (home-page "https://www.gecode.org")
2152 (synopsis "Toolkit for developing constraint-based systems")
2153 (description "Gecode is a C++ toolkit for developing constraint-based
2154 systems and applications. It provides a modular and extensible solver.")
2155 (license license:expat)))
2156
2157 (define-public libflame
2158 (package
2159 (name "libflame")
2160 (version "5.2.0")
2161 (outputs '("out" "static"))
2162 (source
2163 (origin
2164 (method git-fetch)
2165 (uri (git-reference
2166 (url "https://github.com/flame/libflame")
2167 (commit version)))
2168 (file-name (git-file-name name version))
2169 (sha256
2170 (base32
2171 "1n6lf0wvpp77lxqlr721h2jbfbzigphdp19wq8ajiccilcksh7ay"))))
2172 (build-system gnu-build-system)
2173 (arguments
2174 `(#:configure-flags
2175 ;; Sensible defaults: https://github.com/flame/libflame/issues/28
2176 (list "--enable-dynamic-build"
2177 "--enable-max-arg-list-hack"
2178 "--enable-lapack2flame"
2179 "--enable-verbose-make-output"
2180 "--enable-multithreading=pthreads" ; Openblas isn't built with openmp.
2181 ,@(if (any (cute string-prefix? <> (or (%current-target-system)
2182 (%current-system)))
2183 '("x86_64" "i686"))
2184 '("--enable-vector-intrinsics=sse")
2185 '())
2186 "--enable-supermatrix"
2187 "--enable-memory-alignment=16"
2188 "--enable-ldim-alignment")
2189 #:phases
2190 (modify-phases %standard-phases
2191 (add-after 'unpack 'patch-/usr/bin/env-bash
2192 (lambda _
2193 (substitute* "build/config.mk.in"
2194 (("/usr/bin/env bash") (which "bash")))
2195 #t))
2196 (replace 'check
2197 (lambda* (#:key tests? #:allow-other-keys)
2198 (substitute* "test/Makefile"
2199 (("LIBBLAS .*") "LIBBLAS = -lblas\n")
2200 (("LIBLAPACK .*") "LIBLAPACK = -llapack\n"))
2201 (if tests?
2202 (with-directory-excursion "test"
2203 (mkdir "obj")
2204 (invoke "make")
2205 (invoke "./test_libflame.x"))
2206 #t)))
2207 (add-after 'install 'install-static
2208 (lambda* (#:key outputs #:allow-other-keys)
2209 (let ((out (assoc-ref outputs "out"))
2210 (static (assoc-ref outputs "static")))
2211 (mkdir-p (string-append static "/lib"))
2212 (rename-file (string-append out "/lib/libflame.a")
2213 (string-append static "/lib/libflame.a"))
2214 (install-file (string-append out "/include/FLAME.h")
2215 (string-append static "/include"))
2216 #t))))))
2217 (inputs
2218 `(("gfortran" ,gfortran)))
2219 (native-inputs
2220 `(("lapack" ,lapack)
2221 ("openblas" ,openblas)
2222 ("perl" ,perl)
2223 ("python" ,python-wrapper)))
2224 (home-page "https://github.com/flame/libflame")
2225 (synopsis "High-performance object-based library for DLA computations")
2226 (description "@code{libflame} is a portable library for dense matrix
2227 computations, providing much of the functionality present in LAPACK, developed
2228 by current and former members of the @acronym{SHPC, Science of High-Performance
2229 Computing} group in the @url{https://www.ices.utexas.edu/, Institute for
2230 Computational Engineering and Sciences} at The University of Texas at Austin.
2231 @code{libflame} includes a compatibility layer, @code{lapack2flame}, which
2232 includes a complete LAPACK implementation.")
2233 (license license:bsd-3)))
2234
2235 (define-public libpotassco
2236 ;; No public release, update together with clasp
2237 (let ((revision "1")
2238 (commit "2f9fb7ca2c202f1b47643aa414054f2f4f9c1821"))
2239 (package
2240 (name "libpotassco")
2241 (version (git-version "0.0" revision commit))
2242 (source (origin
2243 (method git-fetch)
2244 (uri (git-reference
2245 (url "https://github.com/potassco/libpotassco")
2246 (commit commit)))
2247 (file-name (git-file-name name version))
2248 (sha256
2249 (base32
2250 "1c32f9gqclf7qx07lpx8wd720vfhkjqhzc6nyy8mjmgwpmb3iyyn"))))
2251 (arguments
2252 `(#:configure-flags '("-DLIB_POTASSCO_BUILD_TESTS=on"
2253 "-DLIB_POTASSCO_INSTALL_LIB=on"
2254 "-DBUILD_SHARED_LIBS=on")
2255 #:phases
2256 (modify-phases %standard-phases
2257 (add-after 'unpack 'patch-cmake
2258 (lambda _
2259 (substitute* "CMakeLists.txt"
2260 ;; clasp expects lowercase potassco and include directory is
2261 ;; lowercase as well, so let's use that
2262 (("\"cmake/Potassco\"") "\"cmake/potassco\"")
2263 (("PotasscoConfig\\.cmake") "potassco-config.cmake")
2264 (("PotasscoConfigVersion\\.cmake")
2265 "potassco-config-version.cmake"))
2266 (rename-file "cmake/PotasscoConfig.cmake.in"
2267 "cmake/potassco-config.cmake.in"))))))
2268 (build-system cmake-build-system)
2269 (home-page "https://potassco.org/")
2270 (synopsis "Utility library for Potassco's projects")
2271 (description "@code{libpotassco} is a utility library providing functions
2272 and datatypes for
2273 @itemize
2274 @item parsing, writing, and converting logic programs in aspif and smodels
2275 format,
2276 @item passing information between a grounder and a solver,
2277 @item and defining and parsing command-line options and for creating
2278 command-line applications.
2279 @end itemize
2280 Furthermore, it comes with the tool @command{lpconvert} that converts either
2281 between aspif and smodels format or to a human-readable text format.")
2282 (license license:expat))))
2283
2284 (define-public clasp
2285 (package
2286 (name "clasp")
2287 (version "3.3.6")
2288 (source (origin
2289 (method git-fetch)
2290 (uri (git-reference
2291 (url "https://github.com/potassco/clasp")
2292 (commit (string-append "v" version))))
2293 (file-name (git-file-name name version))
2294 (sha256
2295 (base32
2296 "0rahqiq530jckvx717858h1q5p8znp1kb6sjm95p8blkr4n3pvmj"))))
2297 (build-system cmake-build-system)
2298 (arguments
2299 `(#:configure-flags '("-DCLASP_BUILD_TESTS=on"
2300 "-DCLASP_INSTALL_LIB=on"
2301 "-DCLASP_USE_LOCAL_LIB_POTASSCO=off"
2302 "-DBUILD_SHARED_LIBS=on")
2303 #:phases
2304 (modify-phases %standard-phases
2305 (add-after 'unpack 'patch-cmake
2306 (lambda _
2307 (substitute* "CMakeLists.txt"
2308 ;; Use lowercase to be consistent with libpotassco
2309 (("\"cmake/Clasp\"") "\"cmake/clasp\"")
2310 (("ClaspConfig\\.cmake") "clasp-config.cmake")
2311 (("ClaspConfigVersion\\.cmake")
2312 "clasp-config-version.cmake"))
2313 (substitute* "cmake/ClaspConfig.cmake.in"
2314 (("find_package\\(Potassco") "find_package(potassco"))
2315 (rename-file "cmake/ClaspConfig.cmake.in"
2316 "cmake/clasp-config.cmake.in"))))))
2317 (inputs
2318 `(("libpotassco" ,libpotassco)))
2319 (home-page "https://potassco.org/")
2320 (synopsis "Answer set solver")
2321 (description "clasp is an answer set solver for (extended) normal and
2322 disjunctive logic programs. The primary algorithm of clasp relies on
2323 conflict-driven nogood learning, a technique that proved very successful for
2324 satisfiability checking (SAT).")
2325 (license license:expat)))
2326
2327 (define-public clingo
2328 (package
2329 (name "clingo")
2330 (version "5.5.0")
2331 (source (origin
2332 (method git-fetch)
2333 (uri (git-reference
2334 (url "https://github.com/potassco/clingo")
2335 (commit (string-append "v" version))))
2336 (file-name (git-file-name name version))
2337 (sha256
2338 (base32
2339 "0rfjwkcwm0mmf3r4i7asyjwb6cia4i7px7fn2kdbi9j85qvas4pb"))))
2340 (build-system cmake-build-system)
2341 (arguments
2342 `(#:configure-flags `("-DCLINGO_BUILD_TESTS=on"
2343 "-DCLINGO_INSTALL_LIB=on"
2344 "-DCLINGO_BUILD_STATIC=off"
2345 "-DCLINGO_BUILD_SHARED=on"
2346 ;; XXX: Clingo requries private headers and
2347 ;; sources from clasp
2348 ,(string-append
2349 "-DCLASP_SOURCE_DIR="
2350 (assoc-ref %build-inputs "clasp-src")))
2351 #:phases
2352 (modify-phases %standard-phases
2353 (add-after 'unpack 'patch-cmake
2354 (lambda _
2355 (substitute* "CMakeLists.txt"
2356 (("add_subdirectory\\(clasp\\)")
2357 "find_package(clasp REQUIRED)"))
2358 (substitute* "libclingo/CMakeLists.txt"
2359 (("\"cmake/Clingo\"") "\"cmake/clingo\"")
2360 (("ClingoConfig\\.cmake") "clingo-config.cmake")
2361 (("ClingoConfigVersion\\.cmake")
2362 "clingo-config-version.cmake"))
2363 (substitute* "cmake/ClingoConfig.cmake.in"
2364 (("find_package\\(Clasp") "find_package(clasp"))
2365 (rename-file "cmake/ClingoConfig.cmake.in"
2366 "cmake/clingo-config.cmake.in")))
2367 (add-after 'unpack 'skip-failing-tests
2368 (lambda _
2369 (with-directory-excursion "libclingo/tests"
2370 (substitute* "CMakeLists.txt"
2371 (("COMMAND test_clingo" all)
2372 (string-append all
2373 " -f "
2374 "\"${CMAKE_CURRENT_SOURCE_DIR}/good.txt\"")))
2375 (call-with-output-file "good.txt"
2376 (lambda (port)
2377 (for-each (lambda (test) (format port "~s~%" test))
2378 '("parse-ast-v2" "add-ast-v2" "build-ast-v2"
2379 "unpool-ast-v2" "parse_term"
2380 "propagator" "propgator-sequence-mining"
2381 "symbol" "visitor"))))))))))
2382 (inputs
2383 `(("clasp" ,clasp)
2384 ("libpotassco" ,libpotassco)))
2385 (native-inputs
2386 `(("clasp-src" ,(package-source clasp))))
2387 (home-page "https://potassco.org/")
2388 (synopsis "Grounder and solver for logic programs")
2389 (description "Clingo computes answer sets for a given logic program.")
2390 (license license:expat)))
2391
2392 (define-public ceres
2393 (package
2394 (name "ceres-solver")
2395 (version "1.14.0")
2396 (home-page "http://ceres-solver.org/")
2397 (source (origin
2398 (method url-fetch)
2399 (uri (string-append home-page "ceres-solver-"
2400 version ".tar.gz"))
2401 (sha256
2402 (base32
2403 "13lfxy8x58w8vprr0nkbzziaijlh0vvqshgahvcgw0mrqdgh0i27"))))
2404 (build-system cmake-build-system)
2405 (arguments
2406 ;; TODO: Build HTML user documentation and install separately.
2407 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
2408 "-DBUILD_SHARED_LIBS=ON")
2409
2410 #:phases (modify-phases %standard-phases
2411 (add-before 'configure 'set-library-directory
2412 (lambda _
2413 ;; Install libraries to lib/, not lib64/.
2414 (substitute* "internal/ceres/CMakeLists.txt"
2415 (("set\\(LIB_SUFFIX \"64\"\\)")
2416 "set(LIB_SUFFIX \"\")"))
2417 #t)))))
2418 (native-inputs
2419 `(("pkg-config" ,pkg-config)))
2420 (propagated-inputs
2421 `(("glog" ,glog))) ;for #include <glog/glog.h>
2422 (inputs
2423 `(("eigen" ,eigen)
2424 ("blas" ,openblas)
2425 ("lapack" ,lapack)
2426 ("suitesparse" ,suitesparse)
2427 ("gflags" ,gflags)))
2428 (synopsis "C++ library for solving large optimization problems")
2429 (description
2430 "Ceres Solver is a C++ library for modeling and solving large,
2431 complicated optimization problems. It is a feature rich, mature and
2432 performant library which has been used in production since 2010. Ceres Solver
2433 can solve two kinds of problems:
2434 @enumerate
2435 @item non-linear least squares problems with bounds constraints;
2436 @item general unconstrained optimization problems.
2437 @end enumerate\n")
2438 (license license:bsd-3)))
2439
2440 ;; For a fully featured Octave, users are strongly recommended also to install
2441 ;; the following packages: less, ghostscript, gnuplot.
2442 (define-public octave-cli
2443 (package
2444 (name "octave-cli")
2445 (version "6.2.0")
2446 (source
2447 (origin
2448 (method url-fetch)
2449 (uri (string-append "mirror://gnu/octave/octave-"
2450 version ".tar.xz"))
2451 (sha256
2452 (base32
2453 "06id09zspya24gshcwgp039cp35c06150mdlxysawgnbrhj16wkv"))))
2454 (build-system gnu-build-system)
2455 (inputs
2456 `(("alsa-lib" ,alsa-lib)
2457 ("arpack" ,arpack-ng)
2458 ("bdb" ,bdb)
2459 ("curl" ,curl)
2460 ("fftw" ,fftw)
2461 ("fftwf" ,fftwf)
2462 ("fltk" ,fltk)
2463 ("fontconfig" ,fontconfig)
2464 ("freetype" ,freetype)
2465 ("gl2ps" ,gl2ps)
2466 ("glpk" ,glpk)
2467 ("glu" ,glu)
2468 ("graphicsmagick" ,graphicsmagick)
2469
2470 ;; TODO: libjpeg-turbo is indirectly required through libtiff. In
2471 ;; the next rebuild cycle, add an absolute reference for -ljpeg in
2472 ;; libtiff.la instead of having to provide it here.
2473 ("libjpeg" ,libjpeg-turbo)
2474
2475 ("hdf5" ,hdf5)
2476 ("lapack" ,lapack)
2477 ("libsndfile" ,libsndfile)
2478 ("libxft" ,libxft)
2479 ("mesa" ,mesa)
2480 ("pcre" ,pcre)
2481 ("portaudio" ,portaudio)
2482 ("qhull" ,qhull)
2483 ("readline" ,readline)
2484 ("suitesparse" ,suitesparse)
2485 ("texinfo" ,texinfo)
2486 ("zlib" ,zlib)))
2487 (native-inputs
2488 `(("gfortran" ,gfortran)
2489 ("pkg-config" ,pkg-config)
2490 ("perl" ,perl)
2491 ;; The following inputs are not actually used in the build process.
2492 ;; However, the ./configure gratuitously tests for their existence and
2493 ;; assumes that programs not present at build time are also not, and
2494 ;; can never be, available at run time! If these inputs are therefore
2495 ;; not present, support for them will be built out. However, Octave
2496 ;; will still run without them, albeit without the features they
2497 ;; provide.
2498 ("less" ,less)
2499 ("ghostscript" ,ghostscript)
2500 ("gnuplot" ,gnuplot)))
2501 ;; Octave code uses this variable to detect directories holding multiple CA
2502 ;; certificates to verify peers with. This is required for the networking
2503 ;; functions that require encryption to work properly.
2504 (native-search-paths
2505 (list (search-path-specification
2506 (variable "CURLOPT_CAPATH")
2507 (files '("etc/ssl/certs")))))
2508 (arguments
2509 `(#:configure-flags
2510 (list (string-append "--with-shell="
2511 (assoc-ref %build-inputs "bash")
2512 "/bin/sh")
2513
2514 ;; XXX: Without this flag, linking octave-cli fails with
2515 ;; undefined references to 'logf@GLIBCXX_3.4' et.al. due to
2516 ;; not pulling in liboctinterp.la for -lstdc++.
2517 "--enable-link-all-dependencies")
2518 #:phases
2519 (modify-phases %standard-phases
2520 (add-after 'configure 'configure-makeinfo
2521 (lambda* (#:key inputs #:allow-other-keys)
2522 (substitute* "libinterp/corefcn/help.h"
2523 (("\"makeinfo\"")
2524 (string-append
2525 "\"" (assoc-ref inputs "texinfo") "/bin/makeinfo\"")))
2526 #t)))))
2527 (home-page "https://www.gnu.org/software/octave/")
2528 (synopsis "High-level language for numerical computation (no GUI)")
2529 (description "GNU Octave is a high-level interpreted language that is
2530 specialized for numerical computations. It can be used for both linear and
2531 non-linear applications and it provides great support for visualizing results.
2532 Work may be performed both at the interactive command-line as well as via
2533 script files.")
2534 (license license:gpl3+)))
2535
2536 (define-public octave
2537 (package (inherit octave-cli)
2538 (name "octave")
2539 (inputs
2540 `(("qscintilla" ,qscintilla)
2541 ("qt" ,qtbase-5)
2542 ,@(package-inputs octave-cli)))
2543 (native-inputs
2544 `(("qttools" , qttools) ;for lrelease
2545 ("texlive" ,(texlive-updmap.cfg (list texlive-epsf))) ; for texi2dvi
2546 ,@(package-native-inputs octave-cli)))
2547 (arguments
2548 (substitute-keyword-arguments (package-arguments octave-cli)
2549 ((#:phases phases)
2550 `(modify-phases ,phases
2551 (add-before 'configure 'patch-qscintilla-library-name
2552 (lambda* (#:key inputs #:allow-other-keys)
2553 ;; The QScintilla library that the Octave configure script tries
2554 ;; to link with should be named libqscintilla-qt5.so, but the
2555 ;; QScintilla input provides the shared library as
2556 ;; libqscintilla2_qt5.so.
2557 (substitute* "configure"
2558 (("qscintilla2-qt5")
2559 "qscintilla2_qt5"))
2560 #t))))))
2561 (synopsis "High-level language for numerical computation (with GUI)")))
2562
2563 (define-public opencascade-oce
2564 (package
2565 (name "opencascade-oce")
2566 (version "0.17.2")
2567 (source
2568 (origin
2569 (method git-fetch)
2570 (uri (git-reference
2571 (url "https://github.com/tpaviot/oce")
2572 (commit (string-append "OCE-" version))))
2573 (file-name (git-file-name name version))
2574 (patches (search-patches "opencascade-oce-glibc-2.26.patch"))
2575 (sha256
2576 (base32 "0rg5wzkvfmzfl6v2amyryb8dnjad0nn9kyr607wy2gch6rciah69"))))
2577 (build-system cmake-build-system)
2578 (arguments
2579 '(#:configure-flags
2580 (list "-DOCE_TESTING:BOOL=ON"
2581 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
2582 "-DOCE_DRAW:BOOL=ON"
2583 (string-append "-DOCE_INSTALL_PREFIX:PATH="
2584 (assoc-ref %outputs "out"))
2585 "-UCMAKE_INSTALL_RPATH")))
2586 (inputs
2587 `(("freetype" ,freetype)
2588 ("glu" ,glu)
2589 ("libxmu" ,libxmu)
2590 ("mesa" ,mesa)
2591 ("tcl" ,tcl)
2592 ("tk" ,tk)))
2593 (native-inputs
2594 `(("python" ,python-wrapper)))
2595 (home-page "https://github.com/tpaviot/oce")
2596 (synopsis "Libraries for 3D modeling and numerical simulation")
2597 (description
2598 "Open CASCADE is a set of libraries for the development of applications
2599 dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
2600 C++ class libraries providing services for 3D surface and solid modeling, CAD
2601 data exchange, and visualization. It is used for development of specialized
2602 software dealing with 3D models in design (CAD), manufacturing (CAM),
2603 numerical simulation (CAE), measurement equipment (CMM), and quality
2604 control (CAQ) domains.
2605
2606 This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
2607 patches, improvements, and experiments contributed by users over the official
2608 Open CASCADE library.")
2609 (license (list license:lgpl2.1; OCE libraries, with an exception for the
2610 ; use of header files; see
2611 ; OCCT_LGPL_EXCEPTION.txt
2612 license:public-domain; files
2613 ; src/Standard/Standard_StdAllocator.hxx and
2614 ; src/NCollection/NCollection_StdAllocator.hxx
2615 license:expat; file src/OpenGl/OpenGl_glext.h
2616 license:bsd-3)))); test framework gtest
2617
2618 (define-public opencascade-occt
2619 (package
2620 (name "opencascade-occt")
2621 (version "7.3.0p3")
2622 (source
2623 (origin
2624 (method git-fetch)
2625 (uri (git-reference
2626 (url "https://git.dev.opencascade.org/repos/occt.git")
2627 (commit
2628 (string-append "V"
2629 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
2630 version)))))
2631 (file-name (git-file-name name version))
2632 (sha256
2633 (base32 "0bdywwxb6mk0ykbiajlvsb37295akqjp0a60y672qjfa67k0ljv4"))
2634 (modules '((guix build utils)))
2635 (snippet
2636 '(begin
2637 ;; Remove files specific to non-free operating systems.
2638 (delete-file-recursively "samples/ios")
2639 (delete-file-recursively "samples/mfc")
2640 (delete-file-recursively "samples/qt/FuncDemo")
2641 (delete-file "genconf.bat")
2642 (delete-file "gendoc.bat")
2643 (delete-file "genproj.bat")
2644 (delete-file "upgrade.bat")
2645 ;; Remove references to deleted files.
2646 (substitute* "dox/FILES_HTML.txt"
2647 ((".*standard.*") "" )
2648 ((".*UIKitSample.*") ""))
2649 #t))))
2650 (build-system cmake-build-system)
2651 (arguments
2652 '(;; There is no test target for make. OCCT provides an
2653 ;; 'Automated Testing System', which may be accessed after
2654 ;; installation via the draw.sh script. draw.sh is located in
2655 ;; the bin directory. For details see:
2656 ;; https://www.opencascade.com/doc/occt-7.3.0/overview/html/\
2657 ;; occt_dev_guides__tests.html
2658 #:tests? #f
2659 ;; Configure without freeimage: attempting to link against the
2660 ;; freeimage version 3.17 library leads to 'undefined
2661 ;; reference' errors.
2662 #:configure-flags
2663 (list "-DUSE_FREEIMAGE:BOOL=OFF"
2664 "-DUSE_TBB:BOOL=ON"
2665 "-DUSE_VTK:BOOL=OFF"
2666 "-DBUILD_DOC_Overview:BOOL=OFF"
2667 "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
2668 "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
2669 "-UCMAKE_INSTALL_LIBDIR")))
2670 (inputs
2671 `(("doxygen" ,doxygen)
2672 ;("freeimage" ,freeimage)
2673 ("freetype" ,freetype)
2674 ("glu" ,glu)
2675 ("libxext" ,libxext)
2676 ("libxi" ,libxi)
2677 ("libxmu" ,libxmu)
2678 ("mesa" ,mesa)
2679 ("tbb" ,tbb-2020)
2680 ("tcl" ,tcl)
2681 ("tk" ,tk)))
2682 ;; TODO: build Overview documentation and add 'doc' output.
2683 (home-page "https://www.opencascade.com")
2684 (synopsis "Libraries for 3D modeling and numerical simulation")
2685 (description
2686 "Open CASCADE is a set of libraries for the development of applications
2687 dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
2688 C++ class libraries providing services for 3D surface and solid modeling, CAD
2689 data exchange, and visualization. It is used for development of specialized
2690 software dealing with 3D models in design (CAD), manufacturing (CAM),
2691 numerical simulation (CAE), measurement equipment (CMM), and quality
2692 control (CAQ) domains.
2693
2694 This is the certified version of the Open Cascade Technology (OCCT) library.")
2695 (license (list ;; OCCT library:
2696 license:lgpl2.1; with an exception for the use of header
2697 ; files, see OCCT_LGPL_EXCEPTION.txt.
2698 ;; Files src/OpenGl/glext.h, adm/cmake/cotire.cmake and
2699 ;; src/OpenGl/OpenGl_HaltonSampler.hxx:
2700 license:expat
2701 ;; Files src/ExprIntrp/ExprIntrp.tab.* and
2702 ;; src/StepFile/step.tab.*:
2703 license:gpl3+ ; with Bison 2.2 exception.
2704 ;; File src/NCollection/NCollection_UtfIterator.lxx:
2705 (license:non-copyleft
2706 "https://www.unicode.org/license.html")
2707 ;; File src/NCollection/NCollection_StdAllocator.hxx:
2708 license:public-domain))))
2709
2710 (define-public gmsh
2711 (package
2712 (name "gmsh")
2713 (version "4.8.4")
2714 (source
2715 (origin
2716 (method git-fetch)
2717 (uri (git-reference
2718 (url "https://gitlab.onelab.info/gmsh/gmsh.git")
2719 (commit
2720 (string-append "gmsh_"
2721 (string-replace-substring version "." "_")))))
2722 (file-name (git-file-name name version))
2723 (sha256
2724 (base32 "07mi6ja3b9libgcdp2b4dwnkap1b9ha2wi2zdn9mhmwvp3g1pxhp"))
2725 (modules '((guix build utils)))
2726 (snippet
2727 '(begin
2728 (delete-file-recursively "contrib/metis")
2729 #t))))
2730 (build-system cmake-build-system)
2731 (propagated-inputs
2732 `(("fltk" ,fltk)
2733 ("gfortran" ,gfortran)
2734 ("glu" ,glu)
2735 ("gmp" ,gmp)
2736 ("hdf5" ,hdf5)
2737 ("lapack" ,lapack)
2738 ("libx11" ,libx11)
2739 ("libxext" ,libxext)
2740 ("mesa" ,mesa)
2741 ("metis" ,metis)
2742 ("opencascade-occt" ,opencascade-occt)))
2743 (inputs
2744 `(("fontconfig" ,fontconfig)
2745 ("libxft" ,libxft)
2746 ("python" ,python)))
2747 (arguments
2748 `(#:configure-flags `("-DENABLE_SYSTEM_CONTRIB:BOOL=ON"
2749 "-DENABLE_BUILD_SHARED:BOOL=ON"
2750 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
2751 #:imported-modules (,@%cmake-build-system-modules
2752 (guix build python-build-system))
2753 #:modules (((guix build python-build-system) #:select (site-packages))
2754 (guix build cmake-build-system)
2755 (guix build utils))
2756 #:phases
2757 (modify-phases %standard-phases
2758 (add-after 'unpack 'patch-paths
2759 (lambda* (#:key inputs outputs #:allow-other-keys)
2760 ;; Use the standard Guix site-package path for
2761 ;; installation of the Python API.
2762 (substitute* "CMakeLists.txt"
2763 (("include\\(GNUInstallDirs\\)\n")
2764 (string-append "include(GNUInstallDirs)\n"
2765 " set(GMSH_PY_LIB "
2766 (site-packages inputs outputs) ")\n"))
2767 (("\\$\\{GMSH\\_PY\\} DESTINATION \\$\\{GMSH\\_LIB\\}")
2768 "${GMSH_PY} DESTINATION ${GMSH_PY_LIB}"))
2769 ;; Find the shared library.
2770 (let ((libgmsh (string-append (assoc-ref outputs "out")
2771 "/lib/libgmsh.so")))
2772 (substitute* "api/gmsh.py"
2773 (("find_library\\(\"gmsh\"\\)")
2774 (simple-format #f "\"~a\"" libgmsh))))
2775 #t)))))
2776 (home-page "http://gmsh.info/")
2777 (synopsis "3D finite element grid generator")
2778 (description "Gmsh is a 3D finite element grid generator with a built-in
2779 CAD engine and post-processor. Its design goal is to provide a fast, light
2780 and user-friendly meshing tool with parametric input and advanced
2781 visualization capabilities. Gmsh is built around four modules: geometry,
2782 mesh, solver and post-processing. The specification of any input to these
2783 modules is done either interactively using the graphical user interface or in
2784 ASCII text files using Gmsh's own scripting language.")
2785 (license license:gpl2+)))
2786
2787 (define-public veusz
2788 (package
2789 (name "veusz")
2790 (version "3.3.1")
2791 (source
2792 (origin
2793 (method url-fetch)
2794 (uri (pypi-uri "veusz" version))
2795 (sha256
2796 (base32 "1q7hi1qwwg4pgiz62isvv1pia85m13bspdpp1q3mrnwl11in0ag0"))))
2797 (build-system python-build-system)
2798 (arguments
2799 `(;; Tests will fail because they depend on optional packages like
2800 ;; python-astropy, which is not packaged.
2801 #:tests? #f
2802 #:phases
2803 (modify-phases %standard-phases
2804 ;; Veusz will append 'PyQt5' to sip_dir by default. That is not how
2805 ;; the path is defined in Guix, therefore we have to change it.
2806 (add-after 'unpack 'fix-sip-dir
2807 (lambda _
2808 (substitute* "pyqtdistutils.py"
2809 (("os.path.join\\(sip_dir, 'PyQt5'\\)") "sip_dir"))
2810 #t))
2811 ;; Now we have to pass the correct sip_dir to setup.py.
2812 (replace 'build
2813 (lambda* (#:key inputs #:allow-other-keys)
2814 ;; We need to tell setup.py where to locate QtCoremod.sip
2815 ((@@ (guix build python-build-system) call-setuppy)
2816 "build_ext"
2817 (list (string-append "--sip-dir="
2818 (assoc-ref inputs "python-pyqt")
2819 "/share/sip"))
2820 #t)))
2821 ;; Ensure that icons are found at runtime.
2822 (add-after 'install 'wrap-executable
2823 (lambda* (#:key inputs outputs #:allow-other-keys)
2824 (let ((out (assoc-ref outputs "out")))
2825 (wrap-program (string-append out "/bin/veusz")
2826 `("QT_PLUGIN_PATH" prefix
2827 ,(list (string-append (assoc-ref inputs "qtsvg")
2828 "/lib/qt5/plugins/"))))))))))
2829 (native-inputs
2830 `(("pkg-config" ,pkg-config)
2831 ;;("python-astropy" ,python-astropy) ;; FIXME: Package this.
2832 ("qttools" ,qttools)
2833 ("python-sip" ,python-sip-4)))
2834 (inputs
2835 `(("ghostscript" ,ghostscript) ;optional, for EPS/PS output
2836 ("python-dbus" ,python-dbus)
2837 ("python-h5py" ,python-h5py) ;optional, for HDF5 data
2838 ("python-pyqt" ,python-pyqt)
2839 ("qtbase" ,qtbase-5)
2840 ("qtsvg" ,qtsvg)))
2841 (propagated-inputs
2842 `(("python-numpy" ,python-numpy)))
2843 (home-page "https://veusz.github.io/")
2844 (synopsis "Scientific plotting package")
2845 (description
2846 "Veusz is a scientific plotting and graphing program with a graphical
2847 user interface, designed to produce publication-ready 2D and 3D plots. In
2848 addition it can be used as a module in Python for plotting. It supports
2849 vector and bitmap output, including PDF, Postscript, SVG and EMF.")
2850 (license license:gpl2+)))
2851
2852 (define-public maxflow
2853 (package
2854 (name "maxflow")
2855 ;; Versioning is ambiguous: the git tag matching this commit is ‘3.0.5’,
2856 ;; which matches CMakeLists.txt, but README.md and CHANGES say ‘3.04’.
2857 (version "3.0.5")
2858 (source (origin
2859 (method git-fetch)
2860 (uri (git-reference
2861 (url "https://github.com/gerddie/maxflow")
2862 (commit version)))
2863 (file-name (git-file-name name version))
2864 (sha256
2865 (base32
2866 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
2867 (build-system cmake-build-system)
2868 (home-page "https://pub.ist.ac.at/~vnk/software.html")
2869 (synopsis "Library implementing Maxflow algorithm")
2870 (description "An implementation of the maxflow algorithm described in
2871 @cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
2872 Energy Minimization in Computer Vision.\n
2873 Yuri Boykov and Vladimir Kolmogorov.\n
2874 In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
2875 September 2004}")
2876 (license license:gpl3+)))
2877
2878 (define-public petsc
2879 (package
2880 (name "petsc")
2881 (version "3.16.1")
2882 (source
2883 (origin
2884 (method url-fetch)
2885 ;; The *-lite-* tarball does not contain the *large* documentation
2886 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
2887 "petsc-lite-" version ".tar.gz"))
2888 (sha256
2889 (base32 "0sm03vpg010q9icidiq587n325m0598cj6hab2rdv85nwyygg74h"))))
2890 (outputs '("out" ; libraries and headers
2891 "examples")) ; ~30MiB of examples
2892 (build-system gnu-build-system)
2893 (native-inputs
2894 `(("python" ,python)
2895 ("which" ,which)))
2896 (inputs
2897 `(("gfortran" ,gfortran)
2898 ("openblas" ,openblas)
2899 ("superlu" ,superlu)
2900 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
2901 ;; leaving out opengl, as configuration seems to only be for mac
2902 ))
2903 (arguments
2904 (list
2905 #:test-target "test"
2906 #:parallel-build? #f ; build is parallel by default
2907 #:configure-flags
2908 #~(list "--with-mpi=0"
2909 "--with-openmp=1"
2910 "--with-openblas=1"
2911 (string-append "--with-openblas-dir="
2912 #$(this-package-input "openblas"))
2913 "--with-superlu=1")
2914 #:make-flags
2915 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
2916 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
2917 #~(list (format #f "MAKE_NP=~a" (parallel-job-count)))
2918 #:phases
2919 #~(modify-phases %standard-phases
2920 (replace 'configure
2921 ;; PETSc's configure script is actually a python script, so we can't
2922 ;; run it with bash.
2923 (lambda* (#:key outputs (configure-flags '())
2924 #:allow-other-keys)
2925 (let* ((prefix (assoc-ref outputs "out"))
2926 (flags `(,(string-append "--prefix=" prefix)
2927 ,@configure-flags)))
2928 (format #t "build directory: ~s~%" (getcwd))
2929 (format #t "configure flags: ~s~%" flags)
2930 (apply invoke "./configure" flags)
2931
2932 ;; Generate test scripts with the right shebang.
2933 (substitute* "config/example_template.py"
2934 (("#!/usr/bin/env bash")
2935 (string-append "#!" (which "bash")))))))
2936 (add-after 'configure 'clean-local-references
2937 (lambda* (#:key outputs #:allow-other-keys)
2938 (let ((out (assoc-ref outputs "out")))
2939 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
2940 ;; Prevent build directory from leaking into compiled code
2941 (((getcwd)) out)
2942 ;; Scrub timestamp for reproducibility
2943 ((".*Libraries compiled on.*") ""))
2944 (substitute* (find-files "." "petscvariables")
2945 ;; Do not expose build machine characteristics, set to defaults.
2946 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
2947 (("NPMAX = [:digit:]+") "NPMAX = 2")))))
2948 (add-after 'install 'clean-install
2949 ;; Try to keep installed files from leaking build directory names.
2950 (lambda* (#:key inputs outputs #:allow-other-keys)
2951 (let ((out (assoc-ref outputs "out")))
2952 (substitute* (map (lambda (file)
2953 (string-append out "/lib/petsc/conf/" file))
2954 '("petscvariables"))
2955 (((getcwd)) out))
2956 ;; Make compiler references point to the store
2957 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
2958 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
2959 (string-append "= " (which compiler))))
2960 ;; PETSc installs some build logs, which aren't necessary.
2961 (for-each (lambda (file)
2962 (let ((f (string-append out "/lib/petsc/conf/" file)))
2963 (when (file-exists? f)
2964 (delete-file f))))
2965 '("configure.log" "make.log" "gmake.log"
2966 "test.log" "error.log" "RDict.db"
2967 "PETScBuildInternal.cmake"
2968 ;; Once installed, should uninstall with Guix
2969 "uninstall.py")))))
2970 (add-after 'install 'move-examples
2971 (lambda* (#:key outputs #:allow-other-keys)
2972 (let* ((out (assoc-ref outputs "out"))
2973 (examples (assoc-ref outputs "examples"))
2974 (exdir (string-append out "/share/petsc/examples"))
2975 (exdir' (string-append examples "/share/petsc/examples")))
2976 (copy-recursively exdir exdir')
2977 (delete-file-recursively exdir)))))))
2978 (home-page "https://www.mcs.anl.gov/petsc")
2979 (synopsis "Library to solve PDEs")
2980 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
2981 data structures and routines for the scalable (parallel) solution of
2982 scientific applications modeled by partial differential equations.")
2983 (license (license:non-copyleft
2984 "https://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
2985
2986 (define-public petsc-complex
2987 (package (inherit petsc)
2988 (name "petsc-complex")
2989 (arguments
2990 (substitute-keyword-arguments (package-arguments petsc)
2991 ((#:configure-flags cf)
2992 `(cons "--with-scalar-type=complex" ,cf))))
2993 (synopsis "Library to solve PDEs (with complex scalars)")))
2994
2995 (define-public petsc-openmpi
2996 (package (inherit petsc)
2997 (name "petsc-openmpi")
2998 (inputs
2999 `(("hdf5" ,hdf5-parallel-openmpi)
3000 ("hypre" ,hypre-openmpi)
3001 ("metis" ,metis)
3002 ("mumps" ,mumps-openmpi)
3003 ("openmpi" ,openmpi)
3004 ("scalapack" ,scalapack)
3005 ("scotch" ,pt-scotch32)
3006 ,@(package-inputs petsc)))
3007 (arguments
3008 (substitute-keyword-arguments (package-arguments petsc)
3009 ((#:configure-flags cf)
3010 ``("--with-hypre=1"
3011 "--with-mpiexec=mpirun"
3012 "--with-metis=1"
3013 "--with-mumps=1"
3014 "--with-scalapack=1"
3015 "--with-ptscotch=1"
3016 ,(string-append "--with-mpi-dir="
3017 (assoc-ref %build-inputs "openmpi"))
3018 ,(string-append "--with-hdf5-include="
3019 (assoc-ref %build-inputs "hdf5") "/include")
3020 ,(string-append "--with-hdf5-lib="
3021 (assoc-ref %build-inputs "hdf5") "/lib/libhdf5.a")
3022 ,@(delete "--with-mpi=0" ,cf)))
3023 ((#:phases phases)
3024 `(modify-phases ,phases
3025 (add-before 'configure 'mpi-setup
3026 ,%openmpi-setup)))))
3027 (synopsis "Library to solve PDEs (with MUMPS and MPI support)")))
3028
3029 (define-public petsc-complex-openmpi
3030 (package (inherit petsc-complex)
3031 (name "petsc-complex-openmpi")
3032 (inputs
3033 `(("openmpi" ,openmpi)
3034 ,@(package-inputs petsc-complex)))
3035 (arguments
3036 (substitute-keyword-arguments (package-arguments petsc-complex)
3037 ((#:configure-flags cf)
3038 ``("--with-mpiexec=mpirun"
3039 ,(string-append "--with-mpi-dir="
3040 (assoc-ref %build-inputs "openmpi"))
3041 ,@(delete "--with-mpi=0" ,cf)))
3042 ((#:phases phases)
3043 `(modify-phases ,phases
3044 (add-before 'configure 'mpi-setup
3045 ,%openmpi-setup)))))
3046 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
3047
3048 (define-public python-petsc4py
3049 (package
3050 (name "python-petsc4py")
3051 (version "3.11.0")
3052 (source
3053 (origin
3054 (method url-fetch)
3055 (uri (pypi-uri "petsc4py" version))
3056 (sha256
3057 (base32
3058 "1rm1qj5wlkhxl39by9n78lh3gbmii31wsnb8j1rr5hvfr5xgbx2q"))
3059 (modules '((guix build utils)))
3060 (snippet
3061 '(begin
3062 ;; Ensure source file is regenerated in the build phase.
3063 (delete-file "src/petsc4py.PETSc.c")
3064 ;; Remove legacy GC code. See
3065 ;; https://bitbucket.org/petsc/petsc4py/issues/125.
3066 (substitute* "src/PETSc/cyclicgc.pxi"
3067 ((".*gc_refs.*") "" )
3068 ((".*PyGC_Head.*") ""))
3069 #t))))
3070 (build-system python-build-system)
3071 (arguments
3072 `(#:phases
3073 (modify-phases %standard-phases
3074 (add-before 'build 'pre-build
3075 (lambda _
3076 ;; Define path to PETSc installation.
3077 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
3078 #t))
3079 (add-before 'check 'mpi-setup
3080 ,%openmpi-setup))))
3081 (native-inputs
3082 `(("python-cython" ,python-cython)))
3083 (inputs
3084 `(("petsc" ,petsc-openmpi)
3085 ("python-numpy" ,python-numpy)))
3086 (home-page "https://bitbucket.org/petsc/petsc4py/")
3087 (synopsis "Python bindings for PETSc")
3088 (description "PETSc, the Portable, Extensible Toolkit for
3089 Scientific Computation, is a suite of data structures and routines for
3090 the scalable (parallel) solution of scientific applications modeled by
3091 partial differential equations. It employs the MPI standard for all
3092 message-passing communication. @code{petsc4py} provides Python
3093 bindings to almost all functions of PETSc.")
3094 (license license:bsd-3)))
3095
3096 (define-public python-kiwisolver
3097 (package
3098 (name "python-kiwisolver")
3099 (version "1.0.1")
3100 (source (origin
3101 (method url-fetch)
3102 (uri (pypi-uri "kiwisolver" version))
3103 (sha256
3104 (base32
3105 "0y22ci86znwwwfhbmvbgdfnbi6lv5gv2xkdlxvjw7lml43ayafyf"))))
3106 (build-system python-build-system)
3107 (home-page "https://github.com/nucleic/kiwi")
3108 (synopsis "Fast implementation of the Cassowary constraint solver")
3109 (description
3110 "Kiwi is an efficient C++ implementation of the Cassowary constraint
3111 solving algorithm. Kiwi has been designed from the ground up to be
3112 lightweight and fast. Kiwi ranges from 10x to 500x faster than the original
3113 Cassowary solver with typical use cases gaining a 40x improvement. Memory
3114 savings are consistently > 5x.")
3115 (license license:bsd-3)))
3116
3117 (define-public python2-kiwisolver
3118 (package-with-python2 python-kiwisolver))
3119
3120 (define-public slepc
3121 (package
3122 (name "slepc")
3123 (version "3.16.1")
3124 (source
3125 (origin
3126 (method url-fetch)
3127 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
3128 version ".tar.gz"))
3129 (sha256
3130 (base32
3131 "1ysfm77s5fcissv3q0k5d65mlp93zi4anqg62q3cd25dn66sva5i"))))
3132 (build-system gnu-build-system)
3133 (native-inputs
3134 `(("python" ,python)
3135 ("which" ,which)
3136 ("petsc:examples" ,petsc "examples"))) ;for gmakegen.py script
3137 (inputs
3138 `(("arpack" ,arpack-ng)
3139 ("gfortran" ,gfortran)))
3140 (propagated-inputs
3141 `(("petsc" ,petsc)))
3142 (arguments
3143 `(#:parallel-build? #f ;build is parallel by default
3144 #:configure-flags
3145 `(,(string-append "--with-arpack-dir="
3146 (assoc-ref %build-inputs "arpack") "/lib"))
3147 #:make-flags ;honor (parallel-job-count)
3148 `(,(format #f "MAKE_NP=~a" (parallel-job-count))
3149 ,(string-append "PETSCCONFIGDIR="
3150 (assoc-ref %build-inputs "petsc:examples")
3151 "/share/petsc/examples/config"))
3152 #:phases
3153 (modify-phases %standard-phases
3154 (replace 'configure
3155 ;; configure is a python script, so we can't run it with bash.
3156 (lambda* (#:key inputs outputs (configure-flags '())
3157 #:allow-other-keys)
3158 (let* ((prefix (assoc-ref outputs "out"))
3159 (flags `(,(string-append "--prefix=" prefix)
3160 ,@configure-flags)))
3161 (format #t "build directory: ~s~%" (getcwd))
3162 (format #t "configure flags: ~s~%" flags)
3163 (setenv "SLEPC_DIR" (getcwd))
3164 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
3165 (apply invoke "./configure" flags))))
3166 (add-after 'install 'delete-doc
3167 ;; TODO: SLEPc installs HTML documentation alongside headers in
3168 ;; $out/include. We'd like to move them to share/doc, but delete
3169 ;; them for now, as they are incomplete and installing the complete
3170 ;; documentation is difficult.
3171 (lambda* (#:key outputs #:allow-other-keys)
3172 (let* ((out (assoc-ref outputs "out")))
3173 (for-each delete-file (find-files out "\\.html$"))
3174 #t)))
3175 (add-after 'install 'clean-install
3176 ;; Clean up unnecessary build logs from installation.
3177 (lambda* (#:key outputs #:allow-other-keys)
3178 (let ((out (assoc-ref outputs "out")))
3179 (for-each (lambda (file)
3180 (let ((f (string-append out "/lib/slepc/conf/" file)))
3181 (when (file-exists? f)
3182 (delete-file f))))
3183 '("configure.log" "make.log" "gmake.log"
3184 "test.log" "error.log" "RDict.db"
3185 "uninstall.py"))
3186 #t))))))
3187 (home-page "https://slepc.upv.es")
3188 (synopsis "Scalable library for eigenproblems")
3189 (description "SLEPc is a software library for the solution of large sparse
3190 eigenproblems on parallel computers. It can be used for the solution of
3191 linear eigenvalue problems formulated in either standard or generalized form,
3192 as well as other related problems such as the singular value decomposition.
3193 The emphasis of the software is on methods and techniques appropriate for
3194 problems in which the associated matrices are sparse, for example, those
3195 arising after the discretization of partial differential equations.")
3196 (license license:bsd-2)
3197 (properties
3198 `((release-monitoring-url . "http://slepc.upv.es/download/")))))
3199
3200 (define-public slepc-complex
3201 (package (inherit slepc)
3202 (name "slepc-complex")
3203 (propagated-inputs
3204 `(("petsc" ,petsc-complex)
3205 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
3206 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
3207
3208 (define-public slepc-openmpi
3209 (package (inherit slepc)
3210 (name "slepc-openmpi")
3211 (arguments
3212 (substitute-keyword-arguments (package-arguments slepc)
3213 ((#:phases phases '%standard-phases)
3214 `(modify-phases ,phases
3215 (add-before 'check 'mpi-setup
3216 ,%openmpi-setup)))))
3217 (inputs
3218 `(("mpi" ,openmpi)
3219 ("arpack" ,arpack-ng-openmpi)
3220 ,@(alist-delete "arpack" (package-inputs slepc))))
3221 (propagated-inputs
3222 `(("petsc" ,petsc-openmpi)
3223 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
3224 (synopsis "Scalable library for eigenproblems (with MPI support)")))
3225
3226 (define-public slepc-complex-openmpi
3227 (package (inherit slepc-openmpi)
3228 (name "slepc-complex-openmpi")
3229 (propagated-inputs
3230 `(("petsc" ,petsc-complex-openmpi)
3231 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
3232 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
3233
3234 (define-public python-slepc4py
3235 (package
3236 (name "python-slepc4py")
3237 (version "3.11.0")
3238 (source
3239 (origin
3240 (method url-fetch)
3241 (uri (pypi-uri "slepc4py" version))
3242 (sha256
3243 (base32
3244 "1ksp08kxf4wg408b9nn39z3qfhy643j22d4rfbl30vzxk2rxh4lq"))))
3245 (build-system python-build-system)
3246 (arguments
3247 `(#:phases
3248 (modify-phases %standard-phases
3249 (add-before 'build 'pre-build
3250 (lambda _
3251 ;; Define path to PETSc installation.
3252 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
3253 ;; Define path to SLEPc installation.
3254 (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
3255 #t))
3256 (add-before 'check 'mpi-setup
3257 ,%openmpi-setup))))
3258 (inputs
3259 `(("python-numpy" ,python-numpy)
3260 ("python-petsc4py" ,python-petsc4py)
3261 ("slepc" ,slepc-openmpi)))
3262 (home-page "https://bitbucket.org/slepc/slepc4py/")
3263 (synopsis "Python bindings for SLEPc")
3264 (description "SLEPc, the Scalable Library for Eigenvalue Problem
3265 Computations, is based on PETSc, the Portable, Extensible Toolkit for
3266 Scientific Computation. It employs the MPI standard for all
3267 message-passing communication. @code{slepc4py} provides Python
3268 bindings to almost all functions of SLEPc.")
3269 (license license:bsd-3)))
3270
3271 (define-public metamath
3272 (package
3273 (name "metamath")
3274 (version "0.193")
3275 (source
3276 (origin
3277 (method git-fetch)
3278 (uri (git-reference
3279 (url "https://github.com/metamath/metamath-exe")
3280 (commit (string-append "v" version))))
3281 (file-name (git-file-name name version))
3282 (sha256
3283 (base32 "1s9hyknfvhj86g3giayyf3dxzg23iij0rs7bdvj075v9qbyhqn9b"))))
3284 (build-system gnu-build-system)
3285 (native-inputs
3286 `(("autoconf" ,autoconf)
3287 ("automake" ,automake)))
3288 (home-page "http://us.metamath.org/")
3289 (synopsis "Proof verifier based on a minimalistic formalism")
3290 (description
3291 "Metamath is a tiny formal language and that can express theorems in
3292 abstract mathematics, with an accompyaning @command{metamath} executable that
3293 verifies databases of these proofs. There is a public database,
3294 @url{https://github.com/metamath/set.mm, set.mm}, implementing first-order
3295 logic and Zermelo-Frenkel set theory with Choice, along with a large swath of
3296 associated, high-level theorems, e.g.@: the fundamental theorem of arithmetic,
3297 the Cauchy-Schwarz inequality, Stirling's formula, etc. See the Metamath
3298 book.")
3299 (license license:gpl2+)))
3300
3301 (define-public minizinc
3302 (package
3303 (name "minizinc")
3304 (version "2.5.5")
3305 (source (origin
3306 (method git-fetch)
3307 (uri (git-reference
3308 (url "https://github.com/MiniZinc/libminizinc")
3309 (commit version)))
3310 (file-name (git-file-name name version))
3311 (sha256
3312 (base32
3313 "10b2hsl1fx9psh0iagmp8ki3f60f3qg5hmvra5aczjlfmbl88ggp"))
3314 (modules '((guix build utils)
3315 (ice-9 ftw)
3316 (srfi srfi-1)))
3317 (snippet
3318 '(begin
3319 ;; Do not advertise proprietary solvers
3320 (with-directory-excursion "cmake/targets"
3321 (let ((targets '("libminizinc_fzn.cmake"
3322 "libminizinc_gecode.cmake"
3323 "libminizinc_mip.cmake"
3324 "libminizinc_nl.cmake"
3325 "libminizinc_osicbc.cmake"
3326 "libminizinc_parser.cmake"
3327 "libmzn.cmake"
3328 "minizinc.cmake"
3329 "mzn2doc.cmake")))
3330 (for-each delete-file
3331 (remove
3332 (lambda (file)
3333 (member file (cons* "." ".." targets)))
3334 (scandir ".")))
3335 (substitute* "libmzn.cmake"
3336 (("include\\(cmake/targets/(.*)\\)" all target)
3337 (if (member target targets) all "")))))
3338 (with-directory-excursion "include/minizinc/solvers/MIP"
3339 (for-each delete-file
3340 (remove
3341 (lambda (file)
3342 (member file '("." ".."
3343 "MIP_osicbc_solverfactory.hh"
3344 "MIP_osicbc_wrap.hh"
3345 "MIP_solverinstance.hh"
3346 "MIP_solverinstance.hpp"
3347 "MIP_wrap.hh")))
3348 (scandir "."))))
3349 (with-directory-excursion "solvers/MIP"
3350 (for-each delete-file
3351 (remove
3352 (lambda (file)
3353 (member file '("." ".."
3354 "MIP_osicbc_solverfactory.cpp"
3355 "MIP_osicbc_wrap.cpp"
3356 "MIP_solverinstance.cpp"
3357 "MIP_wrap.cpp")))
3358 (scandir "."))))
3359 (substitute* "CMakeLists.txt"
3360 (("find_package\\(([^ ]*).*\\)" all pkg)
3361 (if (member pkg '("Gecode" "OsiCBC" "Threads"))
3362 all
3363 "")))
3364 ;; TODO: swap out miniz for zlib
3365 #t))))
3366 (build-system cmake-build-system)
3367 (arguments
3368 `(#:tests? #f ; no ‘check’ target
3369 #:modules ((guix build cmake-build-system)
3370 (guix build utils)
3371 (srfi srfi-1))
3372 #:phases
3373 (modify-phases %standard-phases
3374 (add-after 'install 'install-solver-configs
3375 (lambda* (#:key inputs outputs #:allow-other-keys)
3376 (let ((gecode (assoc-ref inputs "gecode"))
3377 (pkgdatadir (string-append (assoc-ref outputs "out")
3378 "/share/minizinc")))
3379 (call-with-output-file (string-append pkgdatadir
3380 "/Preferences.json")
3381 (lambda (port)
3382 (display "\
3383 {
3384 \"tagDefaults\": [
3385 [\"\", \"org.gecode.gecode\"],
3386 [\"gecode\", \"org.gecode.gecode\"]
3387 ],
3388 \"solverDefaults\": []
3389 }"
3390 port)
3391 (newline port)))
3392
3393 (mkdir-p (string-append pkgdatadir "/solvers"))
3394 (call-with-output-file (string-append pkgdatadir
3395 "/solvers/gecode.msc")
3396 (lambda (port)
3397 (format port
3398 "\
3399 {
3400 \"id\": \"org.gecode.gecode\",
3401 \"name\": \"Gecode\",
3402 \"description\": \"Gecode FlatZinc executable\",
3403 \"version\": ~s,
3404 \"mznlib\": ~s,
3405 \"executable\": ~s,
3406 \"supportsMzn\": false,
3407 \"supportsFzn\": true,
3408 \"needsSolns2Out\": true,
3409 \"needsMznExecutable\": false,
3410 \"needsStdlibDir\": false,
3411 \"isGUIApplication\": false
3412 }"
3413 (last (string-split gecode #\-))
3414 (string-append gecode "/share/gecode/mznlib")
3415 (string-append gecode "/bin/fzn-gecode"))
3416 (newline port)))))))))
3417 (native-inputs
3418 `(("bison" ,bison)
3419 ("flex" ,flex)))
3420 (inputs
3421 `(("cbc" ,cbc)
3422 ("gecode" ,gecode)
3423 ("zlib" ,zlib)))
3424 (home-page "https://www.minizinc.org")
3425 (synopsis "High-level constraint modeling language")
3426 (description "MiniZinc is a high-level modeling language for constraint
3427 satisfaction and optimization problems. Models are compiled to FlatZinc, a
3428 language understood by many solvers.")
3429 (license license:mpl2.0)))
3430
3431 (define-public mumps
3432 (package
3433 (name "mumps")
3434 (version "5.2.1")
3435 (source
3436 (origin
3437 (method url-fetch)
3438 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
3439 version ".tar.gz"))
3440 (sha256
3441 (base32
3442 "0jklh54x4y3ik1zkw6db7766kakjm5910diyaghfxxf8vwsgr26r"))
3443 (patches (search-patches "mumps-build-parallelism.patch"
3444 "mumps-shared-libseq.patch"
3445 "mumps-shared-mumps.patch"
3446 "mumps-shared-pord.patch"))))
3447 (build-system gnu-build-system)
3448 (inputs
3449 `(("fortran" ,gfortran)
3450 ;; These are required for linking against mumps, but we let the user
3451 ;; declare the dependency.
3452 ("blas" ,openblas)
3453 ("metis" ,metis)
3454 ("scotch" ,scotch)))
3455 (arguments
3456 `(#:modules ((ice-9 match)
3457 (ice-9 popen)
3458 (srfi srfi-1)
3459 ,@%gnu-build-system-modules)
3460 #:phases
3461 (modify-phases %standard-phases
3462 (replace 'configure
3463 (lambda* (#:key inputs #:allow-other-keys)
3464 (call-with-output-file "Makefile.inc"
3465 (lambda (port)
3466 (format port "
3467 PLAT =
3468 LIBEXT = .a
3469 OUTC = -o
3470 OUTF = -o
3471 RM = rm -f~:[
3472 CC = gcc
3473 FC = gfortran
3474 FL = gfortran
3475 INCSEQ = -I$(topdir)/libseq
3476 LIBSEQ = $(topdir)/libseq/libmpiseq.a
3477 LIBSEQNEEDED = libseqneeded~;
3478 CC = mpicc
3479 FC = mpifort
3480 FL = mpifort~]
3481 AR = ar vr # rules require trailing space, ugh...
3482 RANLIB = ranlib
3483 BLASDIR = ~a
3484 LIBBLAS = -Wl,-rpath=$(BLASDIR) -Wl,-rpath='$$ORIGIN' -L$(BLASDIR) -lopenblas~@[
3485 SCALAPDIR = ~a
3486 SCALAP = -Wl,-rpath=$(SCALAPDIR) -Wl,-rpath='$$ORIGIN' -L$(SCALAPDIR) -lscalapack~]
3487 LIBOTHERS = -pthread
3488 CDEFS = -DAdd_
3489 PIC = -fPIC
3490 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
3491 OPTL = -O2 $(PIC)
3492 OPTC = -O2 $(PIC)
3493 INCS = $(INCSEQ)
3494 LIBS = $(SCALAP) $(LIBSEQ)
3495 LPORDDIR = $(topdir)/PORD/lib
3496 IPORD = -I$(topdir)/PORD/include
3497 LPORD = $(LPORDDIR)/libpord.a
3498 ORDERINGSF = -Dpord~@[
3499 METISDIR = ~a
3500 IMETIS = -I$(METISDIR)/include
3501 LMETIS = -Wl,-rpath $(METISDIR)/lib -L$(METISDIR)/lib -lmetis
3502 ORDERINGSF += -Dmetis~]~@[~:{
3503 SCOTCHDIR = ~a
3504 ISCOTCH = -I$(SCOTCHDIR)/include
3505 LSCOTCH = -Wl,-rpath $(SCOTCHDIR)/lib -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
3506 ORDERINGSF += ~a~}~]
3507 ORDERINGSC = $(ORDERINGSF)
3508 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH) $(LIBSEQ)
3509 IORDERINGSF = $(ISCOTCH)
3510 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
3511 (assoc-ref inputs "mpi")
3512 (assoc-ref inputs "blas")
3513 (assoc-ref inputs "scalapack")
3514 (assoc-ref inputs "metis")
3515 (match (list (assoc-ref inputs "pt-scotch")
3516 (assoc-ref inputs "scotch"))
3517 ((#f #f)
3518 #f)
3519 ((#f scotch)
3520 `((,scotch "" "-Dscotch")))
3521 ((ptscotch _)
3522 `((,ptscotch
3523 "-lptesmumps -lptscotch -lptscotcherr "
3524 "-Dptscotch")))))))))
3525 (replace 'build
3526 ;; By default only the d-precision library is built. Make with "all"
3527 ;; target so that all precision libraries and examples are built.
3528 (lambda _
3529 (invoke "make" "all"
3530 (format #f "-j~a" (parallel-job-count)))))
3531 (replace 'check
3532 ;; Run the simple test drivers, which read test input from stdin:
3533 ;; from the "real" input for the single- and double-precision
3534 ;; testers, and from the "cmplx" input for complex-precision
3535 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
3536 ;; package to prefix execution with "mpirun".
3537 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
3538 (with-directory-excursion "examples"
3539 (every
3540 (lambda (prec type)
3541 (let ((tester (apply open-pipe*
3542 `(,OPEN_WRITE
3543 ,@exec-prefix
3544 ,(string-append "./" prec
3545 "simpletest"))))
3546 (input (open-input-file
3547 (string-append "input_simpletest_" type))))
3548 (begin
3549 (dump-port input tester)
3550 (close-port input)
3551 (zero? (close-pipe tester)))))
3552 '("s" "d" "c" "z")
3553 '("real" "real" "cmplx" "cmplx")))))
3554 (replace 'install
3555 (lambda* (#:key outputs #:allow-other-keys)
3556 (let* ((out (assoc-ref outputs "out"))
3557 (libdir (string-append out "/lib")))
3558 (copy-recursively "lib" libdir)
3559 (copy-recursively "include" (string-append out "/include"))
3560 (when (file-exists? "libseq/libmpiseq.a")
3561 (install-file "libseq/libmpiseq.a" libdir))
3562 (when (file-exists? "libseq/libmpiseq.so")
3563 (install-file "libseq/libmpiseq.so" libdir))
3564 #t))))))
3565 (home-page "http://mumps.enseeiht.fr")
3566 (synopsis "Multifrontal sparse direct solver")
3567 (description
3568 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
3569 sparse system of linear equations A x = b using Gaussian elimination.")
3570 (license license:cecill-c)))
3571
3572 (define-public mumps-metis
3573 (package (inherit mumps)
3574 (name "mumps-metis")
3575 (inputs
3576 (alist-delete "scotch" (package-inputs mumps)))))
3577
3578 (define-public mumps-openmpi
3579 (package (inherit mumps)
3580 (name "mumps-openmpi")
3581 (inputs
3582 `(("mpi" ,openmpi)
3583 ("scalapack" ,scalapack)
3584 ("pt-scotch" ,pt-scotch)
3585 ,@(alist-delete "scotch" (package-inputs mumps))))
3586 (arguments
3587 (substitute-keyword-arguments (package-arguments mumps)
3588 ((#:phases phases)
3589 `(modify-phases ,phases
3590 (add-before 'check 'mpi-setup
3591 ,%openmpi-setup)
3592 (replace 'check
3593 (lambda _
3594 ((assoc-ref ,phases 'check)
3595 #:exec-prefix '("mpirun" "-n" "2"))))))))
3596 (synopsis "Multifrontal sparse direct solver (with MPI)")))
3597
3598 (define-public mumps-metis-openmpi
3599 (package (inherit mumps-openmpi)
3600 (name "mumps-metis-openmpi")
3601 (inputs
3602 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
3603
3604 (define-public ruby-asciimath
3605 (package
3606 (name "ruby-asciimath")
3607 (version "2.0.1")
3608 (source
3609 (origin
3610 (method url-fetch)
3611 (uri (rubygems-uri "asciimath" version))
3612 (sha256
3613 (base32
3614 "1aapydwwkydbwgz07n7ma3a5jy9n3v0shy6q6j8mi4wr3crhx45a"))))
3615 (build-system ruby-build-system)
3616 (native-inputs
3617 `(("ruby-nokogiri" ,ruby-nokogiri)
3618 ("ruby-rspec" ,ruby-rspec)))
3619 (synopsis "AsciiMath parsing and conversion library")
3620 (description
3621 "A pure Ruby AsciiMath parsing and conversion library. AsciiMath is an
3622 easy-to-write markup language for mathematics.")
3623 (home-page "https://github.com/asciidoctor/asciimath")
3624 (license license:expat)))
3625
3626 (define-public superlu
3627 (package
3628 (name "superlu")
3629 (version "5.2.2")
3630 (source
3631 (origin
3632 (method url-fetch)
3633 (uri (string-append "https://portal.nersc.gov/project/sparse/superlu/"
3634 "superlu_" version ".tar.gz"))
3635 (sha256
3636 (base32 "13520vk6fqspyl22cq4ak2jh3rlmhja4czq56j75fdx65fkk80s7"))
3637 (modules '((guix build utils)))
3638 (snippet
3639 ;; Replace the non-free implementation of MC64 with a stub adapted
3640 ;; from Debian
3641 '(begin
3642 (use-modules (ice-9 regex)
3643 (ice-9 rdelim))
3644 (call-with-output-file "SRC/mc64ad.c"
3645 (lambda (port)
3646 (display "
3647 #include <stdio.h>
3648 #include <stdlib.h>
3649 void mc64id_(int *a) {
3650 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
3651 abort ();
3652 }
3653 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
3654 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
3655 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
3656 abort ();
3657 }\n" port)))
3658 ;; Remove the corresponding license verbiage. MC64 license follows
3659 ;; a "------" line separator.
3660 (with-atomic-file-replacement "License.txt"
3661 (let ((rx (make-regexp "-{8}")))
3662 (lambda (in out)
3663 (let loop ()
3664 (let ((line (read-line in 'concat)))
3665 (unless (regexp-exec rx line)
3666 (display line out)
3667 (loop))))
3668 #t)))))))
3669 (build-system cmake-build-system)
3670 (native-inputs
3671 `(("tcsh" ,tcsh)))
3672 (inputs
3673 `(("blas" ,openblas)
3674 ("gfortran" ,gfortran)))
3675 (arguments
3676 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
3677 "-DTPL_BLAS_LIBRARIES=openblas"
3678 "-DBUILD_SHARED_LIBS:BOOL=YES")))
3679 (home-page "https://portal.nersc.gov/project/sparse/superlu/")
3680 (synopsis "Supernodal direct solver for sparse linear systems")
3681 (description
3682 "SuperLU is a general purpose library for the direct solution of large,
3683 sparse, nonsymmetric systems of linear equations on high performance machines.
3684 The library is written in C and is callable from either C or Fortran. The
3685 library routines perform an LU decomposition with partial pivoting and
3686 triangular system solves through forward and back substitution. The library
3687 also provides threshold-based ILU factorization preconditioners.")
3688 (license (list license:bsd-3
3689 license:gpl2+ ;EXAMPLE/*fgmr.c
3690 (license:fsf-free "file://SRC/colamd.h")))))
3691
3692 (define-public superlu-dist
3693 (package
3694 (name "superlu-dist")
3695 (version "6.4.0")
3696 (source
3697 (origin
3698 (method git-fetch)
3699 (uri (git-reference
3700 (url "https://github.com/xiaoyeli/superlu_dist")
3701 (commit (string-append "v" version))))
3702 (file-name (git-file-name name version))
3703 (sha256
3704 (base32 "0fa29yr72p4yq5ln4rgfsawmi5935n4qcr5niz6864bjladz4lql"))
3705 (modules '((guix build utils)))
3706 (snippet
3707 ;; Replace the non-free implementation of MC64 with a stub
3708 '(begin
3709 (make-file-writable "SRC/mc64ad_dist.c")
3710 (call-with-output-file "SRC/mc64ad_dist.c"
3711 (lambda (port)
3712 (display "
3713 #include <stdio.h>
3714 #include <stdlib.h>
3715 void mc64id_dist(int *a) {
3716 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
3717 abort ();
3718 }
3719 void mc64ad_dist (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
3720 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
3721 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
3722 abort ();
3723 }\n" port)))
3724 (substitute* "SRC/util.c" ;adjust default algorithm
3725 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag_MC64;")
3726 ;; TODO: set to "LargeDiag_AWPM" once combinatorial-blas has
3727 ;; general (i.e. non-square) processor-grid support.
3728 "RowPerm = NOROWPERM;"))
3729 #t))
3730 (patches (search-patches "superlu-dist-scotchmetis.patch"
3731 "superlu-dist-awpm-grid.patch"))))
3732 (build-system cmake-build-system)
3733 (native-inputs
3734 `(("tcsh" ,tcsh)))
3735 (inputs
3736 `(("gfortran" ,gfortran)
3737 ("blas" ,openblas)
3738 ("lapack" ,lapack)
3739 ("combblas" ,combinatorial-blas)))
3740 (propagated-inputs
3741 `(("mpi" ,openmpi) ;headers include MPI heades
3742 ("parmetis" ,pt-scotch32 "metis")
3743 ("pt-scotch" ,pt-scotch32)))
3744 (arguments
3745 `(#:parallel-tests? #f ;tests use MPI and OpenMP
3746 #:configure-flags (list "-DBUILD_SHARED_LIBS:BOOL=YES"
3747 "-DTPL_ENABLE_COMBBLASLIB=YES"
3748 "-DTPL_BLAS_LIBRARIES=-lopenblas"
3749 "-DTPL_LAPACK_LIBRARIES=-llapack"
3750 (string-append "-DTPL_PARMETIS_LIBRARIES="
3751 (string-join
3752 '("ptscotchparmetis" "ptscotch" "ptscotcherr"
3753 "scotchmetis" "scotch" "scotcherr")
3754 ";"))
3755 (string-append "-DTPL_PARMETIS_INCLUDE_DIRS="
3756 (assoc-ref %build-inputs "parmetis")
3757 "/include")
3758 "-DTPL_ENABLE_COMBBLASLIB=ON"
3759 (string-append "-DTPL_COMBBLAS_INCLUDE_DIRS="
3760 (assoc-ref %build-inputs "combblas")
3761 "/include/CombBLAS;"
3762 (assoc-ref %build-inputs "combblas")
3763 "/include/BipartiteMatchings")
3764 "-DTPL_COMBBLAS_LIBRARIES=CombBLAS")
3765 #:phases
3766 (modify-phases %standard-phases
3767 (add-before 'configure 'set-c++-standard
3768 (lambda _
3769 (substitute* "CMakeLists.txt"
3770 ;; AWPM headers require C++14
3771 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
3772 (add-before 'check 'mpi-setup
3773 ,%openmpi-setup)
3774 (add-before 'check 'omp-setup
3775 (lambda _ (setenv "OMP_NUM_THREADS" "1") #t)))))
3776 (home-page (package-home-page superlu))
3777 (synopsis "Parallel supernodal direct solver")
3778 (description
3779 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
3780 It is targeted for distributed memory parallel machines. SuperLU_DIST is
3781 implemented in ANSI C, and MPI for communications.")
3782 (license license:bsd-3)))
3783
3784 (define-public scotch
3785 (package
3786 (name "scotch")
3787 (version "6.1.1")
3788 (source
3789 (origin
3790 (method url-fetch)
3791 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
3792 "latestfile/298/scotch_" version ".tar.gz"))
3793 (sha256
3794 (base32 "04dkz24a2g20wq703fnyi4440ac4mwycy9gwrrllljj7zxcjy19r"))
3795 (patches (search-patches "scotch-build-parallelism.patch"
3796 "scotch-integer-declarations.patch"))))
3797 (build-system gnu-build-system)
3798 (inputs
3799 `(("zlib" ,zlib)))
3800 (native-inputs
3801 `(("flex" ,flex)
3802 ("bison" ,bison)
3803 ("gfortran" ,gfortran)))
3804 (outputs '("out" "metis"))
3805 (arguments
3806 `(#:make-flags (list (string-append "prefix=" %output))
3807 #:phases
3808 (modify-phases %standard-phases
3809 (add-after
3810 'unpack 'chdir-to-src
3811 (lambda _ (chdir "src") #t))
3812 (replace
3813 'configure
3814 (lambda _
3815 (call-with-output-file "Makefile.inc"
3816 (lambda (port)
3817 (format port "
3818 EXE =
3819 LIB = .a
3820 OBJ = .o
3821 MAKE = make
3822 AR = ar
3823 ARFLAGS = -ruv
3824 CAT = cat
3825 CCS = gcc
3826 CCP = mpicc
3827 CCD = gcc
3828 FC = gfortran
3829 CPPFLAGS =~{ -D~a~}
3830 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
3831 LDFLAGS = -lz -lm -lrt -lpthread
3832 CP = cp
3833 LEX = flex -Pscotchyy -olex.yy.c
3834 LN = ln
3835 MKDIR = mkdir
3836 MV = mv
3837 RANLIB = ranlib
3838 YACC = bison -pscotchyy -y -b y
3839 "
3840 '("COMMON_FILE_COMPRESS_GZ"
3841 "COMMON_PTHREAD"
3842 "COMMON_RANDOM_FIXED_SEED"
3843 "INTSIZE64" ;use 'int64_t'
3844 ;; Prevents symbol clashes with libesmumps
3845 "SCOTCH_RENAME"
3846 ;; XXX: Causes invalid frees in superlu-dist tests
3847 ;; "SCOTCH_PTHREAD"
3848 ;; "SCOTCH_PTHREAD_NUMBER=2"
3849 "restrict=__restrict"))))
3850 #t))
3851 (add-after 'build 'build-esmumps
3852 (lambda _
3853 (invoke "make"
3854 (format #f "-j~a" (parallel-job-count))
3855 "esmumps")))
3856 (add-before 'install 'make-install-dirs
3857 (lambda* (#:key outputs #:allow-other-keys)
3858 (mkdir (assoc-ref outputs "out"))))
3859 (add-after 'install 'install-metis
3860 (lambda* (#:key outputs #:allow-other-keys)
3861 (let ((out (assoc-ref outputs "metis")))
3862 (mkdir out)
3863 ;; metis files are not installed with 'make install'
3864 (for-each (lambda (f)
3865 (install-file f (string-append out "/include")))
3866 (find-files "../include/" ".*metis\\.h"))
3867 (for-each (lambda (f)
3868 (install-file f (string-append out "/lib")))
3869 (find-files "../lib/" ".*metis\\..*"))
3870 #t))))))
3871 (home-page "https://www.labri.fr/perso/pelegrin/scotch/")
3872 (properties
3873 `((release-monitoring-url . "https://gforge.inria.fr/frs/?group_id=248")))
3874 (synopsis "Programs and libraries for graph algorithms")
3875 (description "SCOTCH is a set of programs and libraries which implement
3876 the static mapping and sparse matrix reordering algorithms developed within
3877 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
3878 conquer approach, to scientific computing problems such as graph and mesh
3879 partitioning, static mapping, and sparse matrix ordering, in application
3880 domains ranging from structural mechanics to operating systems or
3881 bio-chemistry.")
3882 ;; See LICENSE_en.txt
3883 (license license:cecill-c)))
3884
3885 (define-public scotch32
3886 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
3887 ;; some applications.
3888 (package (inherit scotch)
3889 (name "scotch32")
3890 (arguments
3891 (substitute-keyword-arguments (package-arguments scotch)
3892 ((#:phases scotch-phases)
3893 `(modify-phases ,scotch-phases
3894 (replace
3895 'configure
3896 (lambda _
3897 (call-with-output-file "Makefile.inc"
3898 (lambda (port)
3899 (format port "
3900 EXE =
3901 LIB = .a
3902 OBJ = .o
3903 MAKE = make
3904 AR = ar
3905 ARFLAGS = -ruv
3906 CAT = cat
3907 CCS = gcc
3908 CCP = mpicc
3909 CCD = gcc
3910 FC = gfortran
3911 CPPFLAGS =~{ -D~a~}
3912 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
3913 LDFLAGS = -lz -lm -lrt -lpthread
3914 CP = cp
3915 LEX = flex -Pscotchyy -olex.yy.c
3916 LN = ln
3917 MKDIR = mkdir
3918 MV = mv
3919 RANLIB = ranlib
3920 YACC = bison -pscotchyy -y -b y
3921 "
3922 '("COMMON_FILE_COMPRESS_GZ"
3923 "COMMON_PTHREAD"
3924 "COMMON_RANDOM_FIXED_SEED"
3925 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
3926 ;; Prevents symbolc clashes with libesmumps
3927 "SCOTCH_RENAME"
3928 ;; XXX: Causes invalid frees in superlu-dist tests
3929 ;; "SCOTCH_PTHREAD"
3930 ;; "SCOTCH_PTHREAD_NUMBER=2"
3931 "restrict=__restrict"))))))))))
3932 (synopsis
3933 "Programs and libraries for graph algorithms (32-bit integers)")))
3934
3935 (define-public scotch-shared
3936 (package (inherit scotch)
3937 (name "scotch-shared")
3938 (native-inputs
3939 `(("gcc" ,gcc)
3940 ("flex" ,flex)
3941 ("bison" ,bison)))
3942 (arguments
3943 (substitute-keyword-arguments (package-arguments scotch)
3944 ((#:phases scotch-shared-phases)
3945 `(modify-phases ,scotch-shared-phases
3946 (replace
3947 'configure
3948 (lambda _
3949 ;; Otherwise, the RUNPATH will lack the final path component.
3950 (setenv "RPATHFLAGS" (string-append "-Wl,-rpath="
3951 (assoc-ref %outputs "out") "/lib"))
3952 (call-with-output-file "Makefile.inc"
3953 (lambda (port)
3954 (format port "
3955 EXE =
3956 LIB = .so
3957 OBJ = .o
3958 MAKE = make
3959 AR = gcc
3960 ARFLAGS = -shared -o
3961 CAT = cat
3962 CCS = gcc
3963 CCP = mpicc
3964 CCD = gcc
3965 FC = gfortran
3966 CPPFLAGS =~{ -D~a~}
3967 CFLAGS = -O2 -g -fPIC $(CPPFLAGS) $(RPATHFLAGS)
3968 CLIBFLAGS = -shared -fPIC
3969 LDFLAGS = -lz -lm -lrt -lpthread -Xlinker --no-as-needed
3970 CP = cp
3971 LEX = flex -Pscotchyy -olex.yy.c
3972 LN = ln
3973 MKDIR = mkdir
3974 MV = mv
3975 RANLIB = echo
3976 YACC = bison -pscotchyy -y -b y
3977 "
3978 '("COMMON_FILE_COMPRESS_GZ"
3979 "COMMON_PTHREAD"
3980 "COMMON_RANDOM_FIXED_SEED"
3981 "INTSIZE64" ;use 'int64_t'
3982 ;; Prevents symbolc clashes with libesmumps
3983 "SCOTCH_RENAME"
3984 ;; XXX: Causes invalid frees in superlu-dist tests
3985 ;; "SCOTCH_PTHREAD"
3986 ;; "SCOTCH_PTHREAD_NUMBER=2"
3987 "restrict=__restrict"
3988 ))))#t))
3989 (delete 'check)))))
3990 (synopsis
3991 "Programs and libraries for graph algorithms (shared libraries version)")))
3992
3993 (define-public pt-scotch
3994 (package (inherit scotch)
3995 (name "pt-scotch")
3996 (propagated-inputs
3997 `(("openmpi" ,openmpi))) ;Headers include MPI headers
3998 (arguments
3999 (substitute-keyword-arguments (package-arguments scotch)
4000 ((#:phases scotch-phases)
4001 `(modify-phases ,scotch-phases
4002 (replace
4003 'build
4004 (lambda _
4005 (invoke "make" (format #f "-j~a" (parallel-job-count))
4006 "ptscotch" "ptesmumps")
4007
4008 ;; Install the serial metis compatibility library
4009 (invoke "make" "-C" "libscotchmetis" "install")))
4010 (add-before 'check 'mpi-setup
4011 ,%openmpi-setup)
4012 (replace 'check
4013 (lambda _
4014 (invoke "make" "ptcheck")))))))
4015 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
4016
4017 (define-public pt-scotch32
4018 (package (inherit scotch32)
4019 (name "pt-scotch32")
4020 (propagated-inputs
4021 `(("openmpi" ,openmpi))) ;headers include MPI headers
4022 (arguments
4023 (substitute-keyword-arguments (package-arguments scotch32)
4024 ((#:phases scotch32-phases)
4025 `(modify-phases ,scotch32-phases
4026 (replace 'build
4027 (lambda _
4028 (invoke "make" (format #f "-j~a" (parallel-job-count))
4029 "ptscotch" "ptesmumps")
4030 ;; Install the serial metis compatibility library
4031 (invoke "make" "-C" "libscotchmetis" "install")))
4032 (add-before 'check 'mpi-setup
4033 ,%openmpi-setup)
4034 (replace 'check
4035 (lambda _
4036 (invoke "make" "ptcheck")))))))
4037 (synopsis
4038 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
4039
4040 (define-public pt-scotch-shared
4041 (package (inherit scotch-shared)
4042 (name "pt-scotch-shared")
4043 (propagated-inputs
4044 `(("openmpi" ,openmpi))) ;Headers include MPI headers
4045 (arguments
4046 (substitute-keyword-arguments (package-arguments scotch-shared)
4047 ((#:phases scotch-shared-phases)
4048 `(modify-phases ,scotch-shared-phases
4049 (replace
4050 'build
4051 (lambda _
4052 (invoke "make" (format #f "-j~a" (parallel-job-count))
4053 "ptscotch" "ptesmumps")
4054
4055 ;; Install the serial metis compatibility library
4056 (invoke "make" "-C" "libscotchmetis" "install")))
4057 (add-before 'check 'mpi-setup
4058 ,%openmpi-setup)))))
4059 (synopsis "Graph algorithms (shared libraries version, with MPI)")))
4060
4061
4062 (define-public metis
4063 (package
4064 (name "metis")
4065 (version "5.1.0")
4066 (source
4067 (origin
4068 (method url-fetch)
4069 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
4070 "metis-" version ".tar.gz"))
4071 (sha256
4072 (base32
4073 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
4074 (properties
4075 `((release-monitoring-url
4076 . "http://glaros.dtc.umn.edu/gkhome/metis/metis/download")))
4077 (build-system cmake-build-system)
4078 (inputs
4079 `(("blas" ,openblas)))
4080 (arguments
4081 `(#:tests? #f ;no tests
4082 #:configure-flags `("-DSHARED=ON"
4083 ,(string-append "-DGKLIB_PATH=" (getcwd)
4084 "/metis-" ,version "/GKlib"))))
4085 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
4086 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
4087 (description
4088 "METIS is a set of serial programs for partitioning graphs, partitioning
4089 finite element meshes, and producing fill-reducing orderings for sparse
4090 matrices. The algorithms implemented in METIS are based on the multilevel
4091 recursive-bisection, multilevel k-way, and multi-constraint partitioning
4092 schemes.")
4093 (license license:asl2.0))) ;As of version 5.0.3
4094
4095 (define-public p4est
4096 (package
4097 (name "p4est")
4098 (version "2.0")
4099 (source
4100 (origin
4101 (method url-fetch)
4102 (uri (string-append "http://p4est.github.io/release/p4est-"
4103 version ".tar.gz"))
4104 (sha256
4105 (base32
4106 "16h267z256kxcxfjs390qqzv19hr58vrj4x8lndb7alnk2vca8n5"))))
4107 (build-system gnu-build-system)
4108 (inputs
4109 `(("fortran" ,gfortran)
4110 ("blas" ,openblas)
4111 ("lapack" ,lapack)
4112 ("zlib" ,zlib)))
4113 (arguments
4114 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
4115 (assoc-ref %build-inputs "blas")
4116 " -lopenblas")
4117 ,(string-append "LAPACK_LIBS=-L"
4118 (assoc-ref %build-inputs "lapack")
4119 " -llapack"))
4120 #:phases (modify-phases %standard-phases
4121 (add-before 'check 'mpi-setup
4122 ,%openmpi-setup))))
4123 (home-page "http://www.p4est.org")
4124 (synopsis "Adaptive mesh refinement on forests of octrees")
4125 (description
4126 "The p4est software library enables the dynamic management of a
4127 collection of adaptive octrees, conveniently called a forest of octrees.
4128 p4est is designed to work in parallel and scales to hundreds of thousands of
4129 processor cores.")
4130 (license license:gpl2+)))
4131
4132 (define-public p4est-openmpi
4133 (package (inherit p4est)
4134 (name "p4est-openmpi")
4135 (inputs
4136 `(("mpi" ,openmpi)
4137 ,@(package-inputs p4est)))
4138 (arguments
4139 (substitute-keyword-arguments (package-arguments p4est)
4140 ((#:configure-flags cf)
4141 ``("--enable-mpi" ,@,cf))))
4142 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
4143
4144 (define-public gsegrafix
4145 ;; This is an old and equally dead "experimental fork" of the longer-dead
4146 ;; original. At least it no longer requires the even-deader libgnomeprint{,ui}
4147 ;; libraries, instead rendering plots with Pango.
4148 (package
4149 (name "gsegrafix")
4150 (version "1.0.7.2")
4151 (source
4152 (origin
4153 (method url-fetch)
4154 (uri (string-append "mirror://savannah/gsegrafix-experimental/"
4155 "gsegrafix-experimental-" version ".tar.gz"))
4156 (sha256
4157 (base32 "0fwh6719xy2zasmqlp0vdx6kzm45hn37ga88xmw5cz0yx7xw4j6f"))))
4158 (build-system gnu-build-system)
4159 (arguments
4160 `(#:configure-flags
4161 (list "--disable-static")))
4162 (inputs
4163 `(("glib" ,glib)
4164 ("gtk+" ,gtk+)))
4165 (native-inputs
4166 `(("pkg-config" ,pkg-config)))
4167 (home-page "https://www.gnu.org/software/gsegrafix/")
4168 (synopsis "GNOME application to create scientific and engineering plots")
4169 (description
4170 "GSEGrafix is an application which produces high-quality graphical
4171 plots for science and engineering. Plots are specified via simple ASCII
4172 parameter files and data files and are presented in an anti-aliased GNOME
4173 canvas. The program supports rectangular two-dimensional plots, histograms,
4174 polar-axis plots and three-dimensional plots. Plots can be printed or saved
4175 to BMP, JPEG or PNG image formats.")
4176 (license license:gpl3+)))
4177
4178 (define-public maxima
4179 (package
4180 (name "maxima")
4181 (version "5.45.1")
4182 (source
4183 (origin
4184 (method url-fetch)
4185 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
4186 version "-source/" name "-" version ".tar.gz"))
4187 (sha256
4188 (base32
4189 "1p77nk5sz1qfkn5zr97szpbi8ib4b22k8i52l4ag5gkhd4kid47y"))
4190 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
4191 (build-system gnu-build-system)
4192 (inputs
4193 `(("bash" ,bash-minimal)
4194 ("gnuplot" ,gnuplot) ;for plots
4195 ("sbcl" ,sbcl)
4196 ("sed" ,sed)
4197 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
4198 (native-inputs
4199 `(("texinfo" ,texinfo)
4200 ("perl" ,perl)
4201 ("python" ,python)))
4202 (arguments
4203 `(#:configure-flags
4204 ,#~(list "--enable-sbcl"
4205 (string-append "--with-sbcl=" #$sbcl "/bin/sbcl")
4206 (string-append "--with-posix-shell=" #$bash-minimal "/bin/sh")
4207 (string-append "--with-wish=" #$tk "/bin/wish"
4208 #$(version-major+minor (package-version tk))))
4209 ;; By default Maxima attempts to write temporary files to
4210 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
4211 ;; Work around that.
4212 #:make-flags (list "TMPDIR=/tmp")
4213 #:phases
4214 (modify-phases %standard-phases
4215 (add-after 'unpack 'patch-paths
4216 (lambda* (#:key inputs #:allow-other-keys)
4217 (let* ((sed (search-input-file inputs "/bin/sed"))
4218 (coreutils (assoc-ref inputs "coreutils"))
4219 (dirname (string-append coreutils "/bin/dirname"))
4220 (head (string-append coreutils "/bin/head"))
4221 (perl (search-input-file inputs "/bin/perl"))
4222 (python (search-input-file inputs "/bin/python3")))
4223 (substitute* "src/maxima.in"
4224 (("sed ") (string-append sed " "))
4225 (("dirname") dirname)
4226 (("head") head))
4227 (substitute* "doc/info/Makefile.in"
4228 (("/usr/bin/env perl") perl))
4229 (substitute* "doc/info/build_html.sh.in"
4230 (("python") python))
4231 #t)))
4232 (add-before 'check 'pre-check
4233 (lambda _
4234 (chmod "src/maxima" #o555)
4235 #t))
4236 (replace 'check
4237 (lambda _
4238 ;; This is derived from the testing code in the "debian/rules" file
4239 ;; of Debian's Maxima package.
4240 ;; If Maxima can successfully run this, the binary to be installed
4241 ;; should be fine.
4242 (invoke "sh" "-c"
4243 (string-append
4244 "./maxima-local "
4245 "--lisp=sbcl "
4246 "--batch-string=\"run_testsuite();\" "
4247 "| grep -q \"No unexpected errors found\""))))
4248 ;; Make sure the doc and emacs files are found in the
4249 ;; standard location. Also configure maxima to find gnuplot
4250 ;; without having it on the PATH.
4251 (add-after 'install 'post-install
4252 (lambda* (#:key outputs inputs #:allow-other-keys)
4253 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
4254 (out (assoc-ref outputs "out"))
4255 (datadir (string-append out "/share/maxima/" ,version))
4256 (binutils (dirname (search-input-file inputs "/bin/as"))))
4257 (with-directory-excursion out
4258 (mkdir-p "share/emacs")
4259 (mkdir-p "share/doc")
4260 (symlink
4261 (string-append datadir "/doc/")
4262 (string-append out "/share/doc/maxima"))
4263 (with-atomic-file-replacement
4264 (string-append datadir "/share/maxima-init.lisp")
4265 (lambda (in out)
4266 (format out "~a ~s~a~%"
4267 "(setf $gnuplot_command "
4268 (string-append gnuplot "/bin/gnuplot") ")")
4269 (dump-port in out))))
4270 ;; Ensure that Maxima will have access to the GNU binutils
4271 ;; components at runtime.
4272 (wrap-program (string-append out "/bin/maxima")
4273 `("PATH" prefix (,binutils))))
4274 #t)))))
4275 (home-page "https://maxima.sourceforge.io")
4276 (synopsis "Numeric and symbolic expression manipulation")
4277 (description "Maxima is a system for the manipulation of symbolic and
4278 numerical expressions. It yields high precision numeric results by using
4279 exact fractions, arbitrary precision integers, and variable precision floating
4280 point numbers.")
4281 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
4282 ;; Others simply say "GNU General Public License" without stating a
4283 ;; version (which implicitly means gpl1+).
4284 ;; At least one file (src/maxima.asd) says "version 2."
4285 ;; GPLv2 only is therefore the smallest subset.
4286 (license license:gpl2)))
4287
4288 (define-public wxmaxima
4289 (package
4290 (name "wxmaxima")
4291 (version "21.05.2")
4292 (source
4293 (origin
4294 (method git-fetch)
4295 (uri (git-reference
4296 (url "https://github.com/wxMaxima-developers/wxmaxima")
4297 (commit (string-append "Version-" version))))
4298 (file-name (git-file-name name version))
4299 (sha256
4300 (base32 "0h7ryykh2dapcyvpp4f1j1b3vrrz80x9k8nkci2yxifgdb29vyhw"))))
4301 (build-system cmake-build-system)
4302 (native-inputs
4303 `(("gettext" ,gettext-minimal)))
4304 (inputs
4305 `(("wxwidgets" ,wxwidgets)
4306 ("maxima" ,maxima)
4307 ;; Runtime support.
4308 ("adwaita-icon-theme" ,adwaita-icon-theme)
4309 ("gtk+" ,gtk+)
4310 ("shared-mime-info" ,shared-mime-info)))
4311 (arguments
4312 `(#:tests? #f ; tests fail non-deterministically
4313 #:phases
4314 (modify-phases %standard-phases
4315 (add-after 'unpack 'patch-doc-path
4316 (lambda _
4317 ;; Don't look in share/doc/wxmaxima-xx.xx.x for the
4318 ;; documentation. Only licensing information is placed there by
4319 ;; Guix.
4320 (substitute* "src/Dirstructure.cpp"
4321 (("/doc/wxmaxima-\\%s") "/doc/wxmaxima"))
4322 #t))
4323 (add-after 'install 'wrap-program
4324 (lambda* (#:key inputs outputs #:allow-other-keys)
4325 (wrap-program (string-append (assoc-ref outputs "out")
4326 "/bin/wxmaxima")
4327 `("PATH" ":" prefix
4328 (,(string-append (assoc-ref inputs "maxima")
4329 "/bin")))
4330 ;; For GtkFileChooserDialog.
4331 `("GSETTINGS_SCHEMA_DIR" =
4332 (,(string-append (assoc-ref inputs "gtk+")
4333 "/share/glib-2.0/schemas")))
4334 `("XDG_DATA_DIRS" ":" prefix
4335 (;; Needed by gdk-pixbuf to know supported icon formats.
4336 ,(string-append
4337 (assoc-ref inputs "shared-mime-info") "/share")
4338 ;; The default icon theme of GTK+.
4339 ,(string-append
4340 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
4341 #t)))))
4342 (home-page "https://wxmaxima-developers.github.io/wxmaxima/")
4343 (synopsis "Graphical user interface for the Maxima computer algebra system")
4344 (description
4345 "wxMaxima is a graphical user interface for the Maxima computer algebra
4346 system. It eases the use of Maxima by making most of its commands available
4347 through a menu system and by providing input dialogs for commands that require
4348 more than one argument. It also implements its own display engine that
4349 outputs mathematical symbols directly instead of depicting them with ASCII
4350 characters.
4351
4352 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
4353 text and mathematical calculations to create documents, exporting of input and
4354 output to TeX, and a browser for Maxima's manual including command index and
4355 full text searching.")
4356 (license license:gpl2+)))
4357
4358 (define-public armadillo
4359 (package
4360 (name "armadillo")
4361 (version "9.100.5")
4362 (source (origin
4363 (method url-fetch)
4364 (uri (string-append "mirror://sourceforge/arma/armadillo-"
4365 version ".tar.xz"))
4366 (sha256
4367 (base32
4368 "1ka1vd9fcmvp12qkcm4888dkfqwnalvv00x04wy29f3nx3qwczby"))))
4369 (build-system cmake-build-system)
4370 (arguments `(#:tests? #f)) ; no test target
4371 (inputs
4372 `(("openblas" ,openblas)
4373 ("lapack" ,lapack)
4374 ("arpack" ,arpack-ng)))
4375 (home-page "http://arma.sourceforge.net/")
4376 (synopsis "C++ linear algebra library")
4377 (description
4378 "Armadillo is a C++ linear algebra library, aiming towards a good balance
4379 between speed and ease of use. It is useful for algorithm development
4380 directly in C++, or quick conversion of research code into production
4381 environments. It can be used for machine learning, pattern recognition,
4382 signal processing, bioinformatics, statistics, econometrics, etc. The library
4383 provides efficient classes for vectors, matrices and cubes, as well as 150+
4384 associated functions (e.g., contiguous and non-contiguous submatrix views).")
4385 (license license:asl2.0)))
4386
4387 (define-public muparser
4388 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
4389 ;; different hash. In order to make `guix package --upgrade` work correctly,
4390 ;; we set a Guix packaging revision.
4391 ;; When the next version of muparser is released, we can remove
4392 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
4393 (let ((upstream-version "2.2.5")
4394 (revision "2"))
4395 (package
4396 (name "muparser")
4397 (version (string-append upstream-version "-" revision))
4398 (source
4399 (origin
4400 (method git-fetch)
4401 (uri (git-reference
4402 (url "https://github.com/beltoforion/muparser")
4403 (commit (string-append "v" upstream-version))))
4404 (file-name (git-file-name name version))
4405 (sha256
4406 (base32 "0f0g4995xngf1pp3zr4p6ai2f8v6f8bxwa0k8ayjjiv1l8h44m24"))))
4407 (build-system gnu-build-system)
4408 (arguments
4409 `(#:configure-flags '("--enable-samples=no")
4410 #:tests? #f)) ;no "check" target
4411 (home-page "http://muparser.beltoforion.de/")
4412 (synopsis "Fast parser library for mathematical expressions")
4413 (description
4414 "muParser is an extensible high performance math parser library. It is
4415 based on transforming an expression into a bytecode and precalculating constant
4416 parts of it.")
4417 (license license:expat))))
4418
4419 (define-public openblas
4420 (package
4421 (name "openblas")
4422 (version "0.3.18")
4423 (source
4424 (origin
4425 (method git-fetch)
4426 (uri (git-reference
4427 (url "https://github.com/xianyi/OpenBLAS")
4428 (commit (string-append "v" version))))
4429 (file-name (git-file-name name version))
4430 (sha256
4431 (base32
4432 "17zdd8asylz2w71hczrz5y344p6d5ds1jn4901maw7zcp3dbk63g"))))
4433 (build-system gnu-build-system)
4434 (arguments
4435 `(#:test-target "test"
4436 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
4437 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
4438 ;; we need to disable substitutions.
4439 #:substitutable?
4440 ,(let ((system (or (%current-target-system) (%current-system))))
4441 (or (string-prefix? "x86_64" system)
4442 (string-prefix? "i686" system)
4443 (string-prefix? "mips" system)
4444 (string-prefix? "aarch64" system)))
4445 #:make-flags
4446 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
4447 "SHELL=bash"
4448 "MAKE_NB_JOBS=0" ;use jobserver for submakes
4449 "NO_STATIC=1" ;avoid a 67 MiB static archive
4450
4451 ;; This is the maximum number of threads OpenBLAS will ever use (that
4452 ;; is, if $OPENBLAS_NUM_THREADS is greater than that, then NUM_THREADS
4453 ;; is used.) If we don't set it, the makefile sets it to the number
4454 ;; of cores of the build machine, which is obviously wrong.
4455 "NUM_THREADS=128"
4456
4457 ;; Build the library for all supported CPUs. This allows
4458 ;; switching CPU targets at runtime with the environment variable
4459 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
4460 ;; Unfortunately, this is not supported on all architectures,
4461 ;; where it leads to failed builds.
4462 ,@(let ((system (or (%current-target-system) (%current-system))))
4463 (cond
4464 ((or (string-prefix? "x86_64" system)
4465 (string-prefix? "i686" system)
4466 (string-prefix? "powerpc64le" system)
4467 (string-prefix? "aarch64" system))
4468 ;; Dynamic older enables a few extra CPU architectures that
4469 ;; were released before 2010.
4470 '("DYNAMIC_ARCH=1" "DYNAMIC_OLDER=1" "TARGET=GENERIC"))
4471 ;; On some of these architectures the CPU can't be detected.
4472 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
4473 ;; two available MIPS targets special extended instructions
4474 ;; for Loongson cores are used.
4475 ((string-prefix? "mips" system)
4476 '("TARGET=SICORTEX"))
4477 ;; Failed to detect CPU.
4478 ((string-prefix? "armhf" system)
4479 '("TARGET=ARMV7"))
4480 (else '()))))
4481 ;; no configure script
4482 #:phases
4483 (modify-phases %standard-phases
4484 (delete 'configure)
4485 (add-before 'build 'set-extralib
4486 (lambda* (#:key inputs #:allow-other-keys)
4487 ;; Get libgfortran found when building in utest.
4488 (setenv "FEXTRALIB"
4489 (string-append "-L" (assoc-ref inputs "fortran-lib")
4490 "/lib")))))))
4491 (inputs
4492 `(("fortran-lib" ,gfortran "lib")))
4493 (native-inputs
4494 `(("cunit" ,cunit)
4495 ("fortran" ,gfortran)
4496 ("perl" ,perl)))
4497 (home-page "https://www.openblas.net/")
4498 (synopsis "Optimized BLAS library based on GotoBLAS")
4499 (description
4500 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
4501 (license license:bsd-3)))
4502
4503 (define-public openblas-ilp64
4504 (package/inherit openblas
4505 (name "openblas-ilp64")
4506 (supported-systems '("x86_64-linux" "aarch64-linux" "mips64el-linux"))
4507 (arguments
4508 (substitute-keyword-arguments (package-arguments openblas)
4509 ((#:make-flags flags '())
4510 `(append (list "INTERFACE64=1" "LIBNAMESUFFIX=ilp64")
4511 ,flags))))
4512 (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
4513 (license license:bsd-3)))
4514
4515 (define-public blis
4516 (package
4517 (name "blis")
4518 (version "0.8.1")
4519 (home-page "https://github.com/flame/blis")
4520 (source (origin
4521 (method git-fetch)
4522 (uri (git-reference (url home-page) (commit version)))
4523 (sha256
4524 (base32
4525 "05ifil6jj9424sr8kmircl8k4bmxnl3y12a79vwj1kxxva5gz50g"))
4526 (file-name (git-file-name "blis" version))))
4527 (native-inputs
4528 `(("python" ,python)
4529 ("perl" ,perl)))
4530 (build-system gnu-build-system)
4531 (arguments
4532 `(#:modules
4533 ((guix build gnu-build-system)
4534 (guix build utils)
4535 (srfi srfi-1))
4536 #:test-target "test"
4537 #:phases
4538 (modify-phases %standard-phases
4539 (replace 'configure
4540 (lambda* (#:key outputs
4541 target
4542 system
4543 (configure-flags '())
4544 #:allow-other-keys)
4545 ;; This is a home-made 'configure' script.
4546 (let* ((out (assoc-ref outputs "out"))
4547 ;; Guix-specific support for choosing the configuration
4548 ;; via #:configure-flags: see below for details.
4549 (config-flag-prefix "--blis-config=")
4550 (maybe-config-flag (find
4551 (lambda (s)
4552 (string-prefix? config-flag-prefix s))
4553 configure-flags))
4554 (configure-flags (if maybe-config-flag
4555 (delete maybe-config-flag
4556 configure-flags)
4557 configure-flags))
4558 ;; Select the "configuration" to build.
4559 ;; The "generic" configuration is non-optimized but
4560 ;; portable (no assembly).
4561 ;; The "x86_64" configuration family includes
4562 ;; sub-configurations for all supported
4563 ;; x86_64 microarchitectures.
4564 ;; BLIS currently lacks runtime hardware detection
4565 ;; for other architectures: see
4566 ;; <https://github.com/flame/blis/commit/c534da6>.
4567 ;; Conservatively, we stick to "generic" on armhf,
4568 ;; aarch64, and ppc64le for now. (But perhaps
4569 ;; "power9", "cortexa9", and "cortexa57" might be
4570 ;; general enough to use?)
4571 ;; Another approach would be to use the "auto"
4572 ;; configuration and make this package
4573 ;; non-substitutable.
4574 ;; The build is fairly intensive, though.
4575 (blis-config
4576 (cond
4577 (maybe-config-flag
4578 (substring maybe-config-flag
4579 (string-length config-flag-prefix)))
4580 ((string-prefix? "x86_64" (or target system))
4581 "x86_64")
4582 (else
4583 "generic")))
4584 (configure-args
4585 `("-p" ,out
4586 "-d" "opt"
4587 "--disable-static"
4588 "--enable-shared"
4589 "--enable-threading=openmp"
4590 "--enable-verbose-make"
4591 ,@configure-flags
4592 ,blis-config)))
4593 (format #t "configure args: ~s~%" configure-args)
4594 (apply invoke
4595 "./configure"
4596 configure-args)
4597 #t)))
4598 (add-before 'check 'show-test-output
4599 (lambda _
4600 ;; By default "make check" is silent. Make it verbose.
4601 (system "tail -F output.testsuite &")
4602 #t)))))
4603 (synopsis "High-performance basic linear algebra (BLAS) routines")
4604 (description
4605 "BLIS is a portable software framework for instantiating high-performance
4606 BLAS-like dense linear algebra libraries. The framework was designed to
4607 isolate essential kernels of computation that, when optimized, immediately
4608 enable optimized implementations of most of its commonly used and
4609 computationally intensive operations. While BLIS exports a new BLAS-like API,
4610 it also includes a BLAS compatibility layer which gives application developers
4611 access to BLIS implementations via traditional BLAS routine calls.")
4612 (license license:bsd-3)))
4613
4614 (define-public blis-sandybridge (deprecated-package "blis-sandybridge" blis))
4615 (define-public blis-haswell (deprecated-package "blis-haswell" blis))
4616 (define-public blis-knl (deprecated-package "blis-knl" blis))
4617
4618 (define ignorance blis)
4619
4620 (define-public openlibm
4621 (package
4622 (name "openlibm")
4623 (version "0.7.4")
4624 (source
4625 (origin
4626 (method git-fetch)
4627 (uri (git-reference
4628 (url "https://github.com/JuliaLang/openlibm")
4629 (commit (string-append "v" version))))
4630 (file-name (git-file-name name version))
4631 (sha256
4632 (base32 "1azms0lpxb7vxb3bln5lyz0wpwx6jnzbffkclclpq2v5aiw8d14i"))))
4633 (build-system gnu-build-system)
4634 (arguments
4635 `(#:make-flags
4636 (list (string-append "prefix=" (assoc-ref %outputs "out"))
4637 ,(string-append "CC=" (cc-for-target)))
4638 #:phases
4639 ;; no configure script
4640 (modify-phases %standard-phases (delete 'configure))
4641 #:tests? #f)) ;the tests are part of the default target
4642 (home-page "https://openlibm.org/")
4643 (synopsis "Portable C mathematical library (libm)")
4644 (description
4645 "OpenLibm is an effort to have a high quality, portable, standalone C
4646 mathematical library (libm). It can be used standalone in applications and
4647 programming language implementations. The project was born out of a need to
4648 have a good libm for the Julia programming language that worked consistently
4649 across compilers and operating systems, and in 32-bit and 64-bit
4650 environments.")
4651 ;; Each architecture has its own make target, and there is none for mips.
4652 (supported-systems (delete "mips64el-linux" %supported-systems))
4653 ;; See LICENSE.md for details.
4654 (license (list license:expat
4655 license:isc
4656 license:bsd-2
4657 license:public-domain
4658 license:lgpl2.1+))))
4659
4660 (define-public openspecfun
4661 (package
4662 (name "openspecfun")
4663 (version "0.5.3")
4664 (source
4665 (origin
4666 (method git-fetch)
4667 (uri (git-reference
4668 (url "https://github.com/JuliaLang/openspecfun")
4669 (commit (string-append "v" version))))
4670 (file-name (git-file-name name version))
4671 (sha256
4672 (base32 "0pfw6l3ch7isz403llx7inxlvavqh01jh1hb9dpidi86sjjx9kfh"))))
4673 (build-system gnu-build-system)
4674 (arguments
4675 '(#:tests? #f ; no "check" target
4676 #:make-flags
4677 (list (string-append "prefix=" (assoc-ref %outputs "out")))
4678 #:phases
4679 (modify-phases %standard-phases
4680 (delete 'configure)))) ; no configure script
4681 (inputs
4682 `(("fortran" ,gfortran)))
4683 (home-page "https://github.com/JuliaLang/openspecfun")
4684 (synopsis "Collection of special mathematical functions")
4685 (description
4686 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
4687 portable package for Bessel Functions of a Complex Argument and Nonnegative
4688 Order; it contains subroutines for computing Bessel functions and Airy
4689 functions. Faddeeva allows computing the various error functions of arbitrary
4690 complex arguments (Faddeeva function, error function, complementary error
4691 function, scaled complementary error function, imaginary error function, and
4692 Dawson function); given these, one can also easily compute Voigt functions,
4693 Fresnel integrals, and similar related functions as well.")
4694 ;; Faddeeva is released under the Expat license; AMOS is included as
4695 ;; public domain software.
4696 (license (list license:expat license:public-domain))))
4697
4698 (define-public suitesparse
4699 (package
4700 (name "suitesparse")
4701 (version "5.10.1")
4702 (source
4703 (origin
4704 (method git-fetch)
4705 (uri (git-reference
4706 (url "https://github.com/DrTimothyAldenDavis/SuiteSparse")
4707 (commit (string-append "v" version))))
4708 (file-name (git-file-name name version))
4709 (sha256
4710 (base32
4711 "19gx5wlgqnqpgz6mvam9lalyzpbfwgqhppps8z3np9sh0mgaiyw9"))
4712 (patches (search-patches "suitesparse-mongoose-cmake.patch"))
4713 (modules '((guix build utils)))
4714 (snippet
4715 ;; Remove bundled metis source
4716 '(begin
4717 (delete-file-recursively "metis-5.1.0")
4718 #t))))
4719 (build-system gnu-build-system)
4720 (arguments
4721 `(#:tests? #f ;no "check" target
4722 #:make-flags
4723 (list (string-append "CC=" ,(cc-for-target))
4724 "TBB=-ltbb"
4725 "MY_METIS_LIB=-lmetis"
4726
4727 ;; The default is to link against netlib lapack. Use OpenBLAS
4728 ;; instead.
4729 "BLAS=-lopenblas" "LAPACK=-lopenblas"
4730
4731 ;; Flags for cmake (required to build GraphBLAS and Mongoose)
4732 (string-append "CMAKE_OPTIONS=-DCMAKE_INSTALL_PREFIX="
4733 (assoc-ref %outputs "out")
4734 " -DCMAKE_VERBOSE_MAKEFILE=ON"
4735 " -DCMAKE_C_FLAGS_RELEASE=\"$(CFLAGS) $(CPPFLAGS)\""
4736 " -DCMAKE_CXX_FLAGS_RELEASE=\"$(CXXFLAGS) $(CPPFLAGS)\""
4737 " -DCMAKE_SKIP_RPATH=TRUE"
4738 " -DCMAKE_BUILD_TYPE=Release"
4739 " -DCMAKE_INSTALL_LIBDIR=lib")
4740 (string-append "INSTALL_LIB="
4741 (assoc-ref %outputs "out") "/lib")
4742 (string-append "INSTALL_INCLUDE="
4743 (assoc-ref %outputs "out") "/include")
4744 "library")
4745 #:phases
4746 (modify-phases %standard-phases
4747 (delete 'configure)))) ;no configure script
4748 (inputs
4749 `(("tbb" ,tbb)
4750 ("openblas" ,openblas)
4751 ("gmp" ,gmp)
4752 ("mpfr" ,mpfr)
4753 ("metis" ,metis)))
4754 (native-inputs
4755 `(("cmake" ,cmake-minimal)
4756 ("m4" ,m4)))
4757 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
4758 (synopsis "Suite of sparse matrix software")
4759 (description
4760 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
4761 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
4762 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
4763 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
4764 CXSparse, a concise sparse Cholesky factorization package; and many other
4765 packages.")
4766 ;; LGPLv2.1+:
4767 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
4768 ;; GPLv2+:
4769 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
4770 (license (list license:gpl2+ license:lgpl2.1+))))
4771
4772 (define-public atlas
4773 (package
4774 (name "atlas")
4775 (version "3.10.3")
4776 (source (origin
4777 (method url-fetch)
4778 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
4779 version "/atlas" version ".tar.bz2"))
4780 (patches (search-patches "atlas-gfortran-compat.patch"))
4781 (sha256
4782 (base32
4783 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
4784 (build-system gnu-build-system)
4785 (home-page "http://math-atlas.sourceforge.net/")
4786 (inputs `(("gfortran" ,gfortran)
4787 ("lapack-tar" ,(package-source lapack))))
4788 (outputs '("out" "doc"))
4789 ;; For the moment we drop support for MIPS at it fails to compile. See
4790 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
4791 (supported-systems (delete "mips64el-linux" %supported-systems))
4792 (arguments
4793 `(#:parallel-build? #f
4794 #:parallel-tests? #f
4795
4796 ;; ATLAS tunes itself for the machine it is built on, as explained at
4797 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
4798 ;; For this reason, we want users to build it locally instead of using
4799 ;; substitutes.
4800 #:substitutable? #f
4801
4802 #:modules ((srfi srfi-26)
4803 (guix build gnu-build-system)
4804 (guix build utils))
4805 #:configure-flags
4806 `(;; Generate position independent code suitable for dynamic libraries
4807 ;; and use WALL timer to get more accurate timing.
4808 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
4809 ;; Set word width.
4810 "-b"
4811 ,,(if (string-match "64" (%current-system))
4812 "64"
4813 "32")
4814 ;; Disable parallel build as it gives errors: atlas_pthread.h is
4815 ;; needed to compile C files before it is generated.
4816 "-Ss" "pmake" "make -j 1"
4817 ;; Probe is failing for MIPS. We therefore define the system
4818 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
4819 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
4820 ,,@(if (string-prefix? "mips" (%current-system))
4821 (list "-A" "49" "-V" "1")
4822 (list))
4823 ;; Generate shared libraries.
4824 "--shared"
4825 ;; Build a full LAPACK library.
4826 ,(string-append "--with-netlib-lapack-tarfile="
4827 (assoc-ref %build-inputs "lapack-tar")))
4828 #:phases
4829 (modify-phases %standard-phases
4830 (add-after 'install 'install-doc
4831 (lambda* (#:key outputs inputs #:allow-other-keys)
4832 (let ((doc (string-append (assoc-ref outputs "doc")
4833 "/share/doc/atlas")))
4834 (mkdir-p doc)
4835 (for-each (cut install-file <> doc)
4836 (find-files "../ATLAS/doc" ".*"))
4837 #t)))
4838 (add-after 'check 'check-pt
4839 (lambda _ (invoke "make" "ptcheck")))
4840 ;; Fix files required to run configure.
4841 (add-before 'configure 'fix-/bin/sh
4842 (lambda _
4843 ;; Use `sh', not `/bin/sh'.
4844 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
4845 (("/bin/sh")
4846 "sh"))
4847 #t))
4848 ;; Fix /bin/sh in generated make files.
4849 (add-after 'configure 'fix-/bin/sh-in-generated-files
4850 (lambda _
4851 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
4852 (("/bin/sh")
4853 "sh"))
4854 #t))
4855 ;; ATLAS configure program does not accepts the default flags
4856 ;; passed by the 'gnu-build-system'.
4857 (replace 'configure
4858 (lambda* (#:key native-inputs inputs outputs
4859 (configure-flags '())
4860 #:allow-other-keys #:rest args)
4861 (let* ((prefix (assoc-ref outputs "out"))
4862 (bash (or (and=> (assoc-ref
4863 (or native-inputs inputs) "bash")
4864 (cut string-append <> "/bin/bash"))
4865 "/bin/sh"))
4866 (flags `(,(string-append "--prefix=" prefix)
4867 ,@configure-flags))
4868 (abs-srcdir (getcwd))
4869 (srcdir (string-append "../" (basename abs-srcdir))))
4870 (format #t "source directory: ~s (relative from build: ~s)~%"
4871 abs-srcdir srcdir)
4872 (mkdir "../build")
4873 (chdir "../build")
4874 (format #t "build directory: ~s~%" (getcwd))
4875 (format #t "configure flags: ~s~%" flags)
4876 (apply invoke bash
4877 (string-append srcdir "/configure")
4878 flags)))))))
4879 (synopsis "Automatically Tuned Linear Algebra Software")
4880 (description
4881 "ATLAS is an automatically tuned linear algebra software library
4882 providing C and Fortran77 interfaces to a portably efficient BLAS
4883 implementation, as well as a few routines from LAPACK.
4884
4885 Optimization occurs at build time. For this reason, the library is built on
4886 the machine where it is installed, without resorting to pre-built substitutes.
4887
4888 Before building the library, CPU throttling should be disabled. This can be
4889 done in the BIOS, or, on GNU/Linux, with the following command:
4890
4891 @example
4892 # cpupower --governor performance
4893 @end example
4894
4895 Failure to do so will result in a library with poor performance.")
4896 ;; The test suite is notoriously lengthy and routinely exceeds the default
4897 ;; timeout of 21600 seconds on the not unbeefy berlin build nodes.
4898 (properties '((timeout . 86400))) ; 1 day
4899 (license license:bsd-3)))
4900
4901 (define-public cglm
4902 (package
4903 (name "cglm")
4904 (version "0.8.2")
4905 (source
4906 (origin
4907 (method git-fetch)
4908 (uri (git-reference
4909 (url "https://github.com/recp/cglm")
4910 (commit (string-append "v" version))))
4911 (file-name (git-file-name name version))
4912 (sha256
4913 (base32 "1lcfl9ph4bnl3hckpx4hzwh8r4llnw94ik75igc5qy38wk468gmk"))))
4914 (build-system cmake-build-system)
4915 (arguments
4916 `(#:configure-flags
4917 (list "-DCGLM_USE_TEST=ON")))
4918 (home-page "https://github.com/recp/cglm")
4919 (synopsis "Mathematics C library for graphics programming")
4920 (description
4921 "@acronym{CGLM, C OpenGL Mathematics} is an optimised 3D maths library
4922 for graphics software based on the @acronym{GLSL, OpenGL Shading Language}
4923 specifications.
4924
4925 It's similar to the original C++ GLM library but written in C99 and compatible
4926 with C89.")
4927 (license license:expat)))
4928
4929 (define-public glm
4930 (package
4931 (name "glm")
4932 (version "0.9.9.8")
4933 (source
4934 (origin
4935 (method url-fetch)
4936 (uri (string-append "https://github.com/g-truc/glm/releases/download/"
4937 version "/glm-" version ".zip"))
4938 (sha256
4939 (base32 "0k6yk9v46h690rshdx49x98y5qspkzibld1wb51jwcm35vba7qip"))))
4940 (build-system cmake-build-system)
4941 (arguments
4942 `(#:phases (modify-phases %standard-phases
4943 (replace 'install
4944 (lambda* (#:key outputs #:allow-other-keys)
4945 ;; Since version 0.9.9.6, 'make install' is not supported
4946 ;; and we have to do it "manually". Upstream discussion:
4947 ;; <https://github.com/g-truc/glm/pull/968>.
4948 (let* ((source (string-append "../glm"))
4949 (out (assoc-ref outputs "out"))
4950 (inc (string-append out "/include"))
4951 (lib (string-append out "/lib"))
4952 (pkgconfig (string-append lib "/pkgconfig")))
4953 (with-directory-excursion source
4954 (mkdir-p inc)
4955 (mkdir-p pkgconfig)
4956 (copy-recursively "glm" (string-append inc "/glm"))
4957 (copy-recursively "cmake" (string-append lib "/cmake"))
4958 (call-with-output-file (string-append pkgconfig "/glm.pc")
4959 (lambda (port)
4960 (format port
4961 "prefix=~a
4962 includedir=${prefix}/include
4963
4964 Name: GLM
4965 Description: OpenGL Mathematics
4966 Version: ~a
4967 Cflags: -I${includedir}~%" out ,(version-prefix version 3)))))
4968 #t))))))
4969 (native-inputs
4970 `(("unzip" ,unzip)))
4971 (home-page "https://glm.g-truc.net/")
4972 (synopsis "OpenGL Mathematics library")
4973 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
4974 library for graphics software based on the OpenGL Shading Language (GLSL)
4975 specifications.")
4976 (license license:expat)))
4977
4978 (define-public lpsolve
4979 (package
4980 (name "lpsolve")
4981 (version "5.5.2.5")
4982 (source
4983 (origin
4984 (method url-fetch)
4985 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
4986 "/lp_solve_" version "_source.tar.gz"))
4987 (sha256
4988 (base32
4989 "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0"))
4990 (modules '((guix build utils)))
4991 (snippet
4992 '(begin
4993 (substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
4994 (("^c=cc") "c=gcc")
4995 ;; Pretend to be on a 64 bit platform to obtain a common directory
4996 ;; name for the build results on all architectures; nothing else
4997 ;; seems to depend on it.
4998 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
4999
5000 ;; The check for 'isnan' as it is written fails with
5001 ;; "non-floating-point argument in call to function
5002 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
5003 ;; definition, which in turn leads to bad things. Fix the feature
5004 ;; test.
5005 (("isnan\\(0\\)") "isnan(0.)"))
5006 #t))))
5007 (build-system gnu-build-system)
5008 (arguments
5009 `(#:tests? #f ; no check target
5010 #:phases
5011 (modify-phases %standard-phases
5012 (delete 'configure) ; no configure script
5013 (replace 'build
5014 (lambda _
5015 (with-directory-excursion "lpsolve55"
5016 (invoke "bash" "ccc"))
5017 (with-directory-excursion "lp_solve"
5018 (invoke "bash" "ccc"))
5019 #t))
5020 (replace 'install
5021 (lambda* (#:key outputs #:allow-other-keys)
5022 (let* ((out (assoc-ref outputs "out"))
5023 (bin (string-append out "/bin"))
5024 (lib (string-append out "/lib"))
5025 ;; This is where LibreOffice expects to find the header
5026 ;; files, and where they are installed by Debian.
5027 (include (string-append out "/include/lpsolve")))
5028 (install-file "lpsolve55/bin/ux64/liblpsolve55.a" lib)
5029 (install-file "lpsolve55/bin/ux64/liblpsolve55.so" lib)
5030 (install-file "lp_solve/bin/ux64/lp_solve" bin)
5031
5032 ;; Install a subset of the header files as on Debian
5033 ;; (plus lp_bit.h, which matches the regular expression).
5034 (for-each (lambda (name)
5035 (install-file name include))
5036 (find-files "." "lp_[HMSa-z].*\\.h$"))
5037 (with-directory-excursion "shared"
5038 (for-each (lambda (name)
5039 (install-file name include))
5040 (find-files "." "\\.h$")))
5041 #t))))))
5042 (home-page "http://lpsolve.sourceforge.net/")
5043 (synopsis "Mixed integer linear programming (MILP) solver")
5044 (description
5045 "lp_solve is a mixed integer linear programming solver based on the
5046 revised simplex and the branch-and-bound methods.")
5047 (license license:lgpl2.1+)))
5048
5049 ;; Private Trilinos package for dealii-openmpi (similar to
5050 ;; trilinos-serial-xyce and trilinos-parallel-xyce).
5051 ;; This version is the latest known to be compatible with deal.II [1].
5052 ;; Since the latest version of Trilinos is not necessarily supported by
5053 ;; deal.II, it may be worth keeping this package even if and when Trilinos
5054 ;; gets packaged separately for Guix (unless various versions of Trilinos are
5055 ;; packaged).
5056 ;;
5057 ;; An insightful source of information for building Trilinos for deal.II lies
5058 ;; in the Trilinos package for candi [2], which is a source-based installer
5059 ;; for deal.II and its dependencies.
5060 ;;
5061 ;; [1]: https://www.dealii.org/current/external-libs/trilinos.html
5062 ;; [2]: https://github.com/dealii/candi/blob/master/deal.II-toolchain/packages/trilinos.package
5063 (define trilinos-for-dealii-openmpi
5064 (package
5065 (name "trilinos-for-dealii-openmpi")
5066 (version "12.18.1")
5067 (source
5068 (origin
5069 (method git-fetch)
5070 (uri (git-reference
5071 (url "https://github.com/trilinos/Trilinos/")
5072 (commit
5073 (string-append "trilinos-release-"
5074 (string-replace-substring version "." "-")))))
5075 (file-name (git-file-name "trilinos" version))
5076 (sha256
5077 (base32 "0fnwlhzsh85qj38cq3igbs8nm1b2jdgr2z734sapmyyzsy21mkgp"))))
5078 (build-system cmake-build-system)
5079 (native-inputs
5080 `(("gfortran" ,gfortran)
5081 ;; Trilinos's repository contains several C-shell scripts, but adding
5082 ;; tcsh to the native inputs does not result in the check phase running
5083 ;; any more tests than without it (nor is tcsh required to build
5084 ;; Trilinos).
5085 ;; It seems that Trilinos has replaced its use of C-shell test scripts
5086 ;; with CMake's testing facilities.
5087 ;; For example,
5088 ;; packages/zoltan/doc/Zoltan_html/dev_html/dev_test_script.html [1]
5089 ;; states that Zoltan's C-shell test script
5090 ;; packages/zoltan/test/test_zoltan has been obsoleted by the tests now
5091 ;; performed through CMake.
5092 ;;
5093 ;; Perl is required for some Zoltan tests and Python 2 for one ML test.
5094 ;;
5095 ;; [1]: https://cs.sandia.gov/zoltan/dev_html/dev_test_script.html
5096 ("perl" ,perl)
5097 ("python" ,python-2)))
5098 (inputs
5099 `(("blas" ,openblas)
5100 ("lapack" ,lapack)
5101 ("mumps" ,mumps-openmpi)
5102 ("scalapack" ,scalapack)))
5103 (propagated-inputs
5104 `(("mpi" ,openmpi)))
5105 (arguments
5106 `(#:build-type "Release"
5107 #:configure-flags
5108 `("-DBUILD_SHARED_LIBS=ON"
5109 ;; Obtain the equivalent of RelWithDebInfo but with -O3 (the Release
5110 ;; default) rather than -O2 (the RelWithDebInfo default), to conform
5111 ;; to candi's trilinos.package's compilation flags, which are -g -O3.
5112 "-DCMAKE_C_FLAGS=-g"
5113 "-DCMAKE_CXX_FLAGS=-g"
5114 "-DCMAKE_Fortran_FLAGS=-g"
5115
5116 ;; Trilinos libraries that deal.II can interface with.
5117 "-DTrilinos_ENABLE_Amesos=ON"
5118 "-DTrilinos_ENABLE_AztecOO=ON"
5119 "-DTrilinos_ENABLE_Epetra=ON"
5120 "-DTrilinos_ENABLE_EpetraExt=ON"
5121 "-DTrilinos_ENABLE_Ifpack=ON"
5122 "-DTrilinos_ENABLE_ML=ON"
5123 "-DTrilinos_ENABLE_MueLu=ON"
5124 "-DTrilinos_ENABLE_ROL=ON"
5125 ;; Optional; required for deal.II's GridIn::read_exodusii, but
5126 ;; depends on netcdf.
5127 ;; Enable if and when someone needs it.
5128 ;;"-DTrilinos_ENABLE_SEACAS=ON"
5129 "-DTrilinos_ENABLE_Sacado=ON"
5130 "-DTrilinos_ENABLE_Teuchos=ON"
5131 "-DTrilinos_ENABLE_Tpetra=ON"
5132 "-DTrilinos_ENABLE_Zoltan=ON"
5133
5134 ;; Third-party libraries (TPLs) that Trilinos can interface with.
5135 "-DBLAS_LIBRARY_NAMES=openblas"
5136 "-DTPL_ENABLE_MPI=ON"
5137 "-DTPL_ENABLE_MUMPS=ON"
5138 "-DTPL_ENABLE_SCALAPACK=ON"
5139
5140 ;; Enable the tests but not the examples (which are enabled by
5141 ;; default when enabling tests).
5142 ;; Although some examples are run as tests, they are otherwise
5143 ;; unnecessary since this is a private package meant for
5144 ;; dealii-openmpi.
5145 ;; Besides, some MueLu and ROL examples require a lot of memory to
5146 ;; compile.
5147 ;;
5148 ;; (For future reference, note that some ROL and SEACAS examples
5149 ;; require removing gfortran from CPLUS_INCLUDE_PATH as in the
5150 ;; dune-istl, dune-localfunctions and dune-alugrid packages.)
5151 "-DTrilinos_ENABLE_TESTS=ON"
5152 "-DTrilinos_ENABLE_EXAMPLES=OFF"
5153 ;; MueLu tests require considerably more time and memory to compile
5154 ;; than the rest of the tests.
5155 "-DMueLu_ENABLE_TESTS=OFF"
5156
5157 ;; The following options were gleaned from candi's trilinos.package.
5158 ;; (We do not enable the complex instantiations, which are anyway
5159 ;; provided only as an option in trilinos.package, because they are
5160 ;; costly in compilation time and memory usage, and disk space [1].)
5161 ;;
5162 ;; [1]: https://www.docs.trilinos.org/files/TrilinosBuildReference.html#enabling-float-and-complex-scalar-types
5163 "-DTrilinos_ENABLE_Ifpack2=OFF"
5164 "-DTeuchos_ENABLE_FLOAT=ON"
5165 "-DTpetra_INST_INT_LONG=ON"
5166 "-DTPL_ENABLE_Boost=OFF")
5167 #:phases
5168 (modify-phases %standard-phases
5169 (add-after 'configure 'fix-kokkos-config
5170 (lambda _
5171 ;; GNU Make 4.3 accidentally leaves the backslash preceding the
5172 ;; number sign in strings containing a literal backslash–number
5173 ;; sign (\#) [1, 2].
5174 ;; This is still an issue in Trilinos 13.0.1, but should be fixed
5175 ;; in the following version.
5176 ;; (The latest versions of Kokkos incorporate the fix [2].)
5177 ;;
5178 ;; [1]: https://github.com/GEOSX/thirdPartyLibs/issues/136
5179 ;; [2]: https://github.com/kokkos/kokkos/blob/3.4.00/Makefile.kokkos#L441
5180 (substitute* "KokkosCore_config.h"
5181 (("\\\\#") "#"))
5182 #t))
5183 (add-before 'check 'mpi-setup
5184 ,%openmpi-setup))))
5185 (home-page "https://trilinos.github.io/")
5186 (synopsis "Algorithms for engineering and scientific problems")
5187 (description
5188 "The Trilinos Project is an effort to develop algorithms and enabling
5189 technologies within an object-oriented software framework for the solution of
5190 large-scale, complex multi-physics engineering and scientific problems.
5191 A unique design feature of Trilinos is its focus on packages.")
5192 ;; The packages are variously licensed under more than just BSD-3 and
5193 ;; LGPL-2.1+, but all the licenses are either BSD- or LGPL-compatible.
5194 ;; See https://trilinos.github.io/license.html.
5195 (license (list license:bsd-3 license:lgpl2.1+))))
5196
5197 (define-public dealii
5198 (package
5199 (name "dealii")
5200 (version "9.3.1")
5201 (source
5202 (origin
5203 (method url-fetch)
5204 (uri (string-append "https://github.com/dealii/dealii/releases/"
5205 "download/v" version "/dealii-" version ".tar.gz"))
5206 (sha256
5207 (base32 "1f0sqvlxvl0myqcn0q6xrn1vnp5pgx143lai4a4jkh1dmdv4cbx6"))
5208 (modules '((guix build utils)))
5209 (snippet
5210 '(begin
5211 ;; Remove bundled boost, muparser, TBB and UMFPACK.
5212 (delete-file-recursively "bundled")
5213 #t))))
5214 (build-system cmake-build-system)
5215 (outputs '("out" "doc"))
5216 (native-inputs
5217 ;; Required to build the documentation.
5218 `(("dot" ,graphviz)
5219 ("doxygen" ,doxygen)
5220 ("perl" ,perl)))
5221 (inputs
5222 `(("arpack" ,arpack-ng)
5223 ("blas" ,openblas)
5224 ("gfortran" ,gfortran)
5225 ("lapack" ,lapack)
5226 ("muparser" ,muparser)
5227 ("zlib" ,zlib)))
5228 (propagated-inputs
5229 ;; Some scripts are installed into share/deal.II/scripts that require
5230 ;; perl and python, but they are not executable (and some are missing the
5231 ;; shebang line) and therefore must be explicitly passed to the
5232 ;; interpreter.
5233 ;; Anyway, they are meant to be used at build time, so rather than adding
5234 ;; the interpreters here, any package depending on them should just add
5235 ;; the requisite interpreter to its native inputs.
5236 `(("boost" ,boost)
5237 ("hdf5" ,hdf5)
5238 ("suitesparse" ,suitesparse) ; For UMFPACK.
5239 ("tbb" ,tbb)))
5240 (arguments
5241 `(#:build-type "DebugRelease" ; Supports only Debug, Release and DebugRelease.
5242 ;; The tests take too long and must be explicitly enabled with "make
5243 ;; setup_tests".
5244 ;; See https://www.dealii.org/developer/developers/testsuite.html.
5245 ;; (They can also be run for an already installed deal.II.)
5246 #:tests? #f
5247 #:configure-flags
5248 (let ((doc (string-append (assoc-ref %outputs "doc")
5249 "/share/doc/" ,name "-" ,version)))
5250 `("-DDEAL_II_COMPONENT_DOCUMENTATION=ON"
5251 ,(string-append "-DDEAL_II_DOCREADME_RELDIR=" doc)
5252 ,(string-append "-DDEAL_II_DOCHTML_RELDIR=" doc "/html")
5253 ;; Don't compile the examples because the source and CMakeLists.txt
5254 ;; are installed anyway, allowing users to do so for themselves.
5255 "-DDEAL_II_COMPILE_EXAMPLES=OFF"
5256 ,(string-append "-DDEAL_II_EXAMPLES_RELDIR=" doc "/examples")))
5257 #:phases
5258 (modify-phases %standard-phases
5259 (add-after 'install 'remove-build-logs
5260 ;; These build logs leak the name of the build directory by storing
5261 ;; the values of CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR.
5262 (lambda* (#:key outputs #:allow-other-keys)
5263 (let ((doc (string-append (assoc-ref outputs "doc")
5264 "/share/doc/" ,name "-" ,version)))
5265 (for-each delete-file (map (lambda (f) (string-append doc "/" f))
5266 '("detailed.log" "summary.log"))))
5267 #t)))))
5268 (home-page "https://www.dealii.org/")
5269 (synopsis "Finite element library")
5270 (description
5271 "Deal.II is a C++ program library targeted at the computational solution
5272 of partial differential equations using adaptive finite elements. The main
5273 aim of deal.II is to enable rapid development of modern finite element codes,
5274 using among other aspects adaptive meshes and a wide array of tools often used
5275 in finite element programs.")
5276 (license license:lgpl2.1+)))
5277
5278 (define-public dealii-openmpi
5279 (package/inherit dealii
5280 (name "dealii-openmpi")
5281 (inputs
5282 `(("arpack" ,arpack-ng-openmpi)
5283 ("metis" ,metis)
5284 ("scalapack" ,scalapack)
5285 ,@(alist-delete "arpack" (package-inputs dealii))))
5286 (propagated-inputs
5287 `(("hdf5" ,hdf5-parallel-openmpi)
5288 ("mpi" ,openmpi)
5289 ("p4est" ,p4est-openmpi)
5290 ("petsc" ,petsc-openmpi)
5291 ("slepc" ,slepc-openmpi)
5292 ("trilinos" ,trilinos-for-dealii-openmpi)
5293 ,@(alist-delete "hdf5" (package-propagated-inputs dealii))))
5294 (arguments
5295 (substitute-keyword-arguments (package-arguments dealii)
5296 ((#:configure-flags flags)
5297 `(cons "-DDEAL_II_WITH_MPI=ON" ,flags))))
5298 (synopsis "Finite element library (with MPI support)")))
5299
5300 (define-public flann
5301 (package
5302 (name "flann")
5303 (version "1.9.1")
5304 (home-page "https://github.com/mariusmuja/flann/")
5305 (source
5306 (origin
5307 (method git-fetch)
5308 (uri (git-reference (url home-page) (commit version)))
5309 (file-name (git-file-name name version))
5310 (sha256
5311 (base32
5312 "0p56fl2yx1r86ds1mgjq40926jdcgq3hka7p3l1hv2acv9jxp15x"))
5313 (patches (search-patches "flann-cmake-3.11.patch"))))
5314 (build-system cmake-build-system)
5315 (outputs '("out"))
5316 (native-inputs
5317 `(("unzip" ,unzip)))
5318 (inputs
5319 `(("hdf5" ,hdf5)
5320 ;; FIXME: 'mkoctfile' fails with a linker error:
5321 ;; ld: cannot find -loctinterp
5322 ;; ld: cannot find -loctave
5323 ;; Disable it for now.
5324 ;;("octave" ,octave-cli)
5325 ("python" ,python-2) ; print syntax
5326 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
5327 ("zlib" ,zlib)))
5328 (arguments
5329 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
5330 ;; taken 46 MiB unstripped, and 6 MiB stripped.
5331 #:strip-directories '("lib" "lib64" "libexec"
5332 "bin" "sbin" "share/flann/octave")
5333
5334 ;; Save 12 MiB by not installing .a files. Passing
5335 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
5336 #:phases (modify-phases %standard-phases
5337 (add-after 'install 'remove-static-libraries
5338 (lambda* (#:key outputs #:allow-other-keys)
5339 (let* ((out (assoc-ref outputs "out"))
5340 (lib (string-append out "/lib")))
5341 (for-each delete-file
5342 (find-files lib "\\.a$"))
5343 #t))))
5344
5345 #:tests? #f)) ; The test data are downloaded from the Internet.
5346 (synopsis "Library for approximate nearest neighbors computation")
5347 (description "FLANN is a library for performing fast approximate
5348 nearest neighbor searches in high dimensional spaces. It implements a
5349 collection of algorithms and a system for automatically choosing the best
5350 algorithm and optimum parameters depending on the dataset.
5351
5352 FLANN is written in C++ and contains bindings for C, Octave and Python.")
5353 (license (license:non-copyleft "file://COPYING"
5354 "See COPYING in the distribution."))))
5355
5356 (define-public wcalc
5357 (package
5358 (name "wcalc")
5359 (version "2.5")
5360 (source
5361 (origin
5362 (method url-fetch)
5363 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
5364 "wcalc-" version ".tar.bz2"))
5365 (sha256
5366 (base32
5367 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
5368 (build-system gnu-build-system)
5369 (inputs
5370 `(("mpfr" ,mpfr)
5371 ("readline" ,readline)))
5372 (home-page "http://w-calc.sourceforge.net/index.php")
5373 (synopsis "Flexible command-line scientific calculator")
5374 (description "Wcalc is a very capable calculator. It has standard functions
5375 (sin, asin, and sinh for example, in either radians or degrees), many
5376 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
5377 variables, a command history, hex/octal/binary input and output, unit
5378 conversions, embedded comments, and an expandable expression entry field. It
5379 evaluates expressions using the standard order of operations.")
5380 (license license:gpl2+)))
5381
5382 (define-public xaos
5383 (package
5384 (name "xaos")
5385 (version "4.2.1")
5386 (source (origin
5387 (method git-fetch)
5388 (uri (git-reference
5389 (url "https://github.com/xaos-project/XaoS")
5390 (commit (string-append "release-" version))))
5391 (file-name (git-file-name name version))
5392 (sha256
5393 (base32
5394 "0maw5am6rrkyjrprfg113zjq37mqj0iaznkg4h2927ff7wrprc94"))))
5395 (build-system gnu-build-system)
5396 (native-inputs `(("gettext" ,gettext-minimal)
5397 ("qtbase" ,qtbase-5)
5398 ("qttools" ,qttools)))
5399 (inputs `(("libx11" ,libx11)
5400 ("zlib" ,zlib)
5401 ("libpng" ,libpng)
5402 ("gsl" ,gsl)))
5403 ;; The upstream project file ("XaoS.pro") and the Makefile it generates are
5404 ;; not enough for this package to install properly. These phases fix that.
5405 (arguments
5406 `(#:tests? #f ;no "check" target
5407 #:phases
5408 (modify-phases %standard-phases
5409 (add-before 'configure 'make-qt-deterministic
5410 (lambda _
5411 ;; Make Qt deterministic.
5412 (setenv "QT_RCC_SOURCE_DATE_OVERRIDE" "1")
5413 #t))
5414 (replace 'configure
5415 (lambda* (#:key outputs #:allow-other-keys)
5416 (let ((out (assoc-ref outputs "out")))
5417 (substitute* "XaoS.pro"
5418 ;; The DESTDIR is originally set to install the xaos binary to
5419 ;; the "bin" folder inside the build directory. Setting make
5420 ;; flags doesn't seem to change this.
5421 (("DESTDIR.*$")
5422 (string-append "DESTDIR=" out "/bin"))
5423 ;; Set the correct path to the lrelease binary.
5424 (("lrelease-qt5") "lrelease"))
5425 (substitute* "src/include/config.h"
5426 (("/usr/share/XaoS")
5427 (string-append out "/share/XaoS")))
5428 (invoke "qmake"))))
5429 (add-after 'install 'install-data
5430 (lambda* (#:key outputs #:allow-other-keys)
5431 (let* ((out (assoc-ref outputs "out"))
5432 (share (string-append out "/share")))
5433 (mkdir-p share)
5434 (for-each
5435 (lambda (folder)
5436 (copy-recursively folder
5437 (string-append share "/XaoS/" folder)))
5438 '("catalogs" "examples" "tutorial"))
5439 (install-file "xdg/xaos.png"
5440 (string-append share "/pixmaps"))
5441 (install-file "xdg/xaos.desktop"
5442 (string-append share "/applications")))
5443 #t)))))
5444 (synopsis "Real-time fractal zoomer")
5445 (description "GNU XaoS is a graphical program that generates fractal
5446 patterns and allows you to zoom in and out of them infinitely in a fluid,
5447 continuous manner. It also includes tutorials that help to explain how fractals
5448 are built. It can generate many different fractal types such as the Mandelbrot
5449 set.")
5450 (home-page "https://xaos-project.github.io/")
5451 (license license:gpl2+)))
5452
5453 (define-public hypre
5454 (package
5455 (name "hypre")
5456 (version "2.20.0")
5457 (source
5458 (origin
5459 (method git-fetch)
5460 (uri (git-reference
5461 (url "https://github.com/hypre-space/hypre")
5462 (commit (string-append "v" version))))
5463 (file-name (git-file-name name version))
5464 (sha256
5465 (base32 "14iqjwg5sv1qjn7c2cfv0xxmn9rwamjrhh9hgs8fjbywcbvrkjdi"))))
5466 (build-system gnu-build-system)
5467 (outputs '("out" ;5.3 MiB of headers and libraries
5468 "doc")) ;12 MiB of documentation
5469 (native-inputs
5470 `(("doc++" ,doc++)
5471 ("doxygen" ,doxygen)
5472 ("python" ,python)
5473 ("python-breathe" ,python-breathe)
5474 ("python-sphinx" ,python-sphinx)
5475 ("texlive" ,(texlive-updmap.cfg (list texlive-adjustbox
5476 texlive-amsfonts
5477 texlive-bibtex
5478 texlive-caption
5479 texlive-cm
5480 texlive-etoolbox
5481 texlive-jknappen
5482 texlive-sectsty
5483 texlive-tex-gyre
5484 texlive-wasy
5485 texlive-xcolor
5486 texlive-xypic
5487 texlive-generic-listofitems
5488 texlive-generic-ulem
5489 texlive-latex-capt-of
5490 texlive-latex-cmap
5491 texlive-latex-colortbl
5492 texlive-latex-etoc
5493 texlive-latex-fancyhdr
5494 texlive-latex-fancyvrb
5495 texlive-latex-float
5496 texlive-latex-fncychap
5497 texlive-latex-framed
5498 texlive-latex-geometry
5499 texlive-latex-hanging
5500 texlive-hyperref
5501 texlive-latex-multirow
5502 texlive-latex-natbib
5503 texlive-latex-needspace
5504 texlive-latex-newunicodechar
5505 texlive-latex-parskip
5506 texlive-latex-stackengine
5507 texlive-latex-tabulary
5508 texlive-latex-titlesec
5509 texlive-latex-tocloft
5510 texlive-latex-upquote
5511 texlive-latex-varwidth
5512 texlive-wasysym
5513 texlive-latex-wrapfig)))))
5514 (inputs
5515 `(("blas" ,openblas)
5516 ("lapack" ,lapack)))
5517 (arguments
5518 `(#:modules ((srfi srfi-1)
5519 ,@%gnu-build-system-modules)
5520 #:configure-flags '("--enable-shared"
5521 "--disable-fortran"
5522 "--without-MPI"
5523 "--with-openmp"
5524 "--with-fei"
5525 "--with-lapack"
5526 "--with-blas")
5527 #:phases
5528 (modify-phases %standard-phases
5529 (add-before 'configure 'chdir-src
5530 (lambda _ (chdir "src")))
5531 (replace 'configure
5532 (lambda* (#:key build target configure-flags
5533 #:allow-other-keys #:rest args)
5534 (let* ((configure (assoc-ref %standard-phases 'configure)))
5535 (apply configure
5536 (append args
5537 (list #:configure-flags
5538 (cons (string-append
5539 "--host=" (or target build))
5540 configure-flags)))))))
5541 (add-after 'build 'build-docs
5542 (lambda _
5543 (invoke "make" "-C" "docs")))
5544 (replace 'check
5545 (lambda _
5546 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
5547 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
5548 (invoke "make" "check" "CHECKRUN=")
5549 (for-each (lambda (filename)
5550 (let ((size (stat:size (stat filename))))
5551 (when (positive? size)
5552 (error (format #f "~a size ~d; error indication~%"
5553 filename size)))))
5554 (find-files "test" ".*\\.err$"))))
5555 (add-after 'install 'install-docs
5556 (lambda* (#:key outputs #:allow-other-keys)
5557 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
5558 (let* ((doc (assoc-ref outputs "doc"))
5559 (docdir (string-append doc "/share/doc/hypre-" ,version)))
5560 (with-directory-excursion "docs"
5561 (for-each (lambda (base)
5562 (install-file (string-append base ".pdf") docdir)
5563 (copy-recursively (string-append base "-html")
5564 (string-append docdir "/" base)))
5565 '("usr-manual" "ref-manual")))))))))
5566 (home-page "https://computing.llnl.gov/projects\
5567 /hypre-scalable-linear-solvers-multigrid-methods")
5568 (synopsis "Library of solvers and preconditioners for linear equations")
5569 (description
5570 "HYPRE is a software library of high performance preconditioners and
5571 solvers for the solution of large, sparse linear systems of equations. It
5572 features multigrid solvers for both structured and unstructured grid
5573 problems.")
5574 (license license:lgpl2.1)))
5575
5576 (define-public hypre-openmpi
5577 (package (inherit hypre)
5578 (name "hypre-openmpi")
5579 (inputs
5580 `(("mpi" ,openmpi)
5581 ,@(package-inputs hypre)))
5582 (arguments
5583 (substitute-keyword-arguments (package-arguments hypre)
5584 ((#:configure-flags flags)
5585 ``("--with-MPI"
5586 ,@(delete "--without-MPI" ,flags)))
5587 ((#:phases phases)
5588 `(modify-phases ,phases
5589 (add-before 'check 'mpi-setup
5590 ,%openmpi-setup)))))
5591 (synopsis "Parallel solvers and preconditioners for linear equations")
5592 (description
5593 "HYPRE is a software library of high performance preconditioners and
5594 solvers for the solution of large, sparse linear systems of equations on
5595 parallel computers. It features parallel multigrid solvers for both
5596 structured and unstructured grid problems.")))
5597
5598 (define-public matio
5599 (package
5600 (name "matio")
5601 (version "1.5.19")
5602 (source
5603 (origin
5604 (method url-fetch)
5605 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
5606 "matio-" version ".tar.gz"))
5607 (sha256
5608 (base32
5609 "0vr8c1mz1k6mz0sgh6n3scl5c3a71iqmy5fnydrgq504icj4vym4"))))
5610 (build-system gnu-build-system)
5611 (inputs
5612 `(("zlib" ,zlib)
5613 ("hdf5" ,hdf5-1.8)))
5614 (home-page "http://matio.sourceforge.net/")
5615 (synopsis "Library for reading and writing MAT files")
5616 (description "Matio is a library for reading and writing MAT files. It
5617 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
5618 (license license:bsd-2)))
5619
5620 (define-public vc
5621 (package
5622 (name "vc")
5623 (version "1.4.2")
5624 (source
5625 (origin (method url-fetch)
5626 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
5627 "download/" version "/Vc-" version ".tar.gz"))
5628 (sha256
5629 (base32
5630 "0lirdqzcxys9walz04bllsphydynk7973aimd5k1h1qbwi8z3lsh"))))
5631 (build-system cmake-build-system)
5632 (arguments
5633 '(#:configure-flags
5634 '("-DBUILD_TESTING=ON"
5635 ;; By default, Vc will optimize for the CPU of the build machine.
5636 ;; Setting this to "none" makes it create portable binaries. See
5637 ;; "cmake/OptimizeForArchitecture.cmake".
5638 "-DTARGET_ARCHITECTURE=none")
5639 #:phases (modify-phases %standard-phases
5640 (add-after 'unpack 'copy-testdata
5641 (lambda* (#:key inputs native-inputs #:allow-other-keys)
5642 (let ((testdata (assoc-ref (or native-inputs inputs)
5643 "testdata")))
5644 (copy-recursively testdata "tests/testdata")
5645 #t))))))
5646 (native-inputs
5647 `(("virtest" ,virtest)
5648
5649 ;; This is a submodule in the git project, but not part of the
5650 ;; released sources. See the git branch for the commit to take.
5651 ("testdata" ,(let ((commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3"))
5652 (origin
5653 (method git-fetch)
5654 (uri (git-reference
5655 (url "https://github.com/VcDevel/vc-testdata")
5656 (commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3")))
5657 (file-name (git-file-name "vc-testdata"
5658 (string-take commit 7)))
5659 (sha256
5660 (base32
5661 "1hkhqib03qlcq412ym2dciynfxcdr2ygqhnplz4l1vissr1wnqn2")))))))
5662 (synopsis "SIMD vector classes for C++")
5663 (description "Vc provides portable, zero-overhead C++ types for explicitly
5664 data-parallel programming. It is a library designed to ease explicit
5665 vectorization of C++ code. Its types enable explicitly stating data-parallel
5666 operations on multiple values. The parallelism is therefore added via the type
5667 system. Vc has an intuitive API and provides portability between different
5668 compilers and compiler versions as well as portability between different vector
5669 instruction sets. Thus, an application written with Vc can be compiled for:
5670 @enumerate
5671 @item AVX and AVX2
5672 @item SSE2 up to SSE4.2 or SSE4a
5673 @item Scalar
5674 @item MIC
5675 @item NEON (in development)
5676 @item NVIDIA GPUs / CUDA (in development)
5677 @end enumerate\n")
5678 (home-page "https://github.com/VcDevel/Vc")
5679 ;; "No support_???.cpp file exists for this architecture."
5680 (supported-systems '("x86_64-linux" "i686-linux"))
5681 (license license:bsd-3)))
5682
5683 (define-public reducelcs
5684 ;; This is the last commit which is available upstream, no
5685 ;; release happened since 2010.
5686 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
5687 (revision "1"))
5688 (package
5689 (name "reducelcs")
5690 (version (string-append "1.0-" revision "." (string-take commit 7)))
5691 (source
5692 (origin
5693 (method git-fetch)
5694 (uri (git-reference
5695 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
5696 (commit commit)))
5697 (file-name (string-append name "-" version "-checkout"))
5698 (sha256
5699 (base32
5700 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
5701 (build-system gnu-build-system)
5702 (inputs
5703 `(("openlibm" ,openlibm)))
5704 (arguments
5705 `(#:tests? #f ; no tests
5706 #:phases
5707 (modify-phases %standard-phases
5708 (delete 'configure) ; No configure script exists.
5709 (replace 'install ; No install phase exists.
5710 (lambda* (#:key outputs #:allow-other-keys)
5711 (let* ((out (assoc-ref outputs "out"))
5712 (bin (string-append out "/bin")))
5713 (install-file "Approximation" bin)
5714 (install-file "CollectResults" bin)
5715 (install-file "GenerateInstances" bin)
5716 #t))))))
5717 (synopsis "Approximate Longest Commons Subsequence computation tool")
5718 (description
5719 "@code{reduceLCS} is an implementation of the Reduce-Expand
5720 algorithm for LCS. It is a fast program to compute the approximate
5721 Longest Commons Subsequence of a set of strings.")
5722 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
5723 (license license:gpl3+))))
5724
5725 (define-public jacal
5726 (package
5727 (name "jacal")
5728 (version "1c4")
5729 (source (origin
5730 (method url-fetch)
5731 (uri (string-append
5732 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
5733 version ".zip"))
5734 (sha256 (base32
5735 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
5736 (patches (search-patches "jacal-fix-texinfo.patch"))))
5737 (build-system gnu-build-system)
5738 (arguments
5739 `(#:phases
5740 (modify-phases %standard-phases
5741 (add-before 'build 'pre-build
5742 ;; Don't use upstream's script - it really doesn't fit into
5743 ;; Guix's functional paradigm.
5744 (lambda* (#:key inputs outputs #:allow-other-keys)
5745 (substitute* "Makefile"
5746 (("^install: install-script") "install: "))))
5747 (add-after 'install 'post-install
5748 ;; Instead, we provide our own simplified script.
5749 (lambda* (#:key inputs outputs #:allow-other-keys)
5750 (let ((wrapper (string-append (assoc-ref outputs "out")
5751 "/bin/jacal")))
5752 (format (open wrapper (logior O_WRONLY O_CREAT))
5753 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
5754 "-e '(slib:load \"~a/lib/jacal/math\") "
5755 "(math)' \"$@\"\n")
5756 (which "bash")
5757 (assoc-ref inputs "scm")
5758 (assoc-ref outputs "out"))
5759 (chmod wrapper #o555))))
5760 (replace 'configure
5761 (lambda* (#:key outputs #:allow-other-keys)
5762 (invoke "./configure"
5763 (string-append "--prefix="
5764 (assoc-ref outputs "out"))))))))
5765 (inputs `(("scm" ,scm)))
5766 (native-inputs `(("unzip" ,unzip)
5767 ("texinfo" ,texinfo)))
5768 (synopsis "Symbolic mathematics system")
5769 (description "GNU JACAL is an interactive symbolic mathematics program based on
5770 Scheme. It manipulate and simplify a range of mathematical expressions such
5771 as equations, scalars, vectors, and matrices.")
5772 (home-page "https://www.gnu.org/software/jacal/")
5773 (license license:gpl3+)))
5774
5775 (define-public z3
5776 (package
5777 (name "z3")
5778 (version "4.8.9")
5779 (home-page "https://github.com/Z3Prover/z3")
5780 (source (origin
5781 (method git-fetch)
5782 (uri (git-reference (url home-page)
5783 (commit (string-append "z3-" version))))
5784 (file-name (git-file-name name version))
5785 (sha256
5786 (base32
5787 "1hnbzq10d23drd7ksm3c1n2611c3kd0q0yxgz8y78zaafwczvwxx"))))
5788 (build-system gnu-build-system)
5789 (arguments
5790 `(#:imported-modules ((guix build python-build-system)
5791 ,@%gnu-build-system-modules)
5792 #:modules (((guix build python-build-system) #:select (site-packages))
5793 (guix build gnu-build-system)
5794 (guix build utils))
5795 #:phases
5796 (modify-phases %standard-phases
5797 (add-after 'unpack 'enable-bytecode-determinism
5798 (lambda _
5799 (setenv "PYTHONHASHSEED" "0")
5800 #t))
5801 (add-after 'unpack 'fix-compatability
5802 ;; Versions after 4.8.3 have immintrin.h IFDEFed for Windows only.
5803 (lambda _
5804 (substitute* "src/util/mpz.cpp"
5805 (("#include <immintrin.h>") ""))
5806 #t))
5807 (add-before 'configure 'bootstrap
5808 (lambda _
5809 (invoke "python" "scripts/mk_make.py")))
5810 ;; work around gnu-build-system's setting --enable-fast-install
5811 ;; (z3's `configure' is a wrapper around the above python file,
5812 ;; which fails when passed --enable-fast-install)
5813 (replace 'configure
5814 (lambda* (#:key inputs outputs #:allow-other-keys)
5815 (invoke "./configure"
5816 "--python"
5817 (string-append "--prefix=" (assoc-ref outputs "out"))
5818 (string-append "--pypkgdir=" (site-packages inputs outputs)))))
5819 (add-after 'configure 'change-directory
5820 (lambda _
5821 (chdir "build")
5822 #t))
5823 (add-before 'check 'make-test-z3
5824 (lambda _
5825 ;; Build the test suite executable.
5826 (invoke "make" "test-z3" "-j"
5827 (number->string (parallel-job-count)))))
5828 (replace 'check
5829 (lambda _
5830 ;; Run all the tests that don't require arguments.
5831 (invoke "./test-z3" "/a"))))))
5832 (native-inputs
5833 `(("which" ,which)
5834 ("python" ,python-wrapper)))
5835 (synopsis "Theorem prover")
5836 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
5837 theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
5838 (license license:expat)))
5839
5840 (define-public ocaml-z3
5841 (package
5842 (inherit z3)
5843 (name "ocaml-z3")
5844 (arguments
5845 `(#:imported-modules ((guix build python-build-system)
5846 ,@%gnu-build-system-modules)
5847 #:modules (((guix build python-build-system) #:select (site-packages))
5848 (guix build gnu-build-system)
5849 (guix build utils))
5850 #:tests? #f; no ml tests
5851 #:phases
5852 (modify-phases %standard-phases
5853 (add-before 'configure 'bootstrap
5854 (lambda* (#:key outputs #:allow-other-keys)
5855 (let ((out (assoc-ref outputs "out")))
5856 (setenv "OCAMLFIND_LDCONF" "ignore")
5857 (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib"))
5858 (mkdir-p (string-append out "/lib/ocaml/site-lib"))
5859 (substitute* "scripts/mk_util.py"
5860 (("LIBZ3 = LIBZ3")
5861 (string-append "LIBZ3 = LIBZ3 + ' -dllpath " out "/lib'"))
5862 ;; Do not build z3 again, use the library passed as input
5863 ;; instead
5864 (("z3linkdep,") "\"\",")
5865 (("z3linkdep)") "\"\")"))
5866 (invoke "python" "scripts/mk_make.py"))))
5867 (replace 'configure
5868 (lambda* (#:key inputs outputs #:allow-other-keys)
5869 (invoke "./configure"
5870 "--ml"
5871 (string-append "--prefix=" (assoc-ref outputs "out")))))
5872 (add-after 'configure 'change-directory
5873 (lambda _
5874 (chdir "build")
5875 #t))
5876 (replace 'build
5877 (lambda _
5878 (invoke "make" "ml")))
5879 (replace 'install
5880 (lambda* (#:key outputs #:allow-other-keys)
5881 (invoke "ocamlfind" "install" "-destdir"
5882 (string-append (assoc-ref outputs "out") "/lib/ocaml/site-lib")
5883 "z3" "api/ml/META" "api/ml/z3enums.mli" "api/ml/z3enums.cmi"
5884 "api/ml/z3enums.cmx" "api/ml/z3native.mli"
5885 "api/ml/z3native.cmi" "api/ml/z3native.cmx"
5886 "../src/api/ml/z3.mli" "api/ml/z3.cmi" "api/ml/z3.cmx"
5887 "api/ml/libz3ml.a" "api/ml/z3ml.a" "api/ml/z3ml.cma"
5888 "api/ml/z3ml.cmxa" "api/ml/z3ml.cmxs" "api/ml/dllz3ml.so"))))))
5889 (native-inputs
5890 `(("which" ,which)
5891 ("python" ,python-wrapper)
5892 ("ocaml" ,ocaml)
5893 ("ocaml-findlib" ,ocaml-findlib)))
5894 (propagated-inputs
5895 `(("ocaml-zarith" ,ocaml-zarith)))
5896 (inputs
5897 `(("z3" ,z3)))))
5898
5899 (define-public elpa
5900 (package
5901 (name "elpa")
5902 (version "2018.11.001")
5903 (source (origin
5904 (method url-fetch)
5905 (uri (string-append "http://elpa.mpcdf.mpg.de/html/Releases/"
5906 version "/elpa-" version ".tar.gz"))
5907 (sha256
5908 (base32
5909 "05hv3v5i6xmziaizw350ff72y1c3k662r85fm3xfdrkclj5zw9yc"))))
5910 (build-system gnu-build-system)
5911 (native-inputs
5912 `(("fortran" ,gfortran)
5913 ("perl" ,perl))) ;for configure and deps
5914 (inputs
5915 `(("blas" ,openblas)))
5916 (arguments
5917 `(#:configure-flags
5918 `("--enable-openmp"
5919 "--with-mpi=no"
5920 ;; ELPA unfortunately does not support runtime dispatch, so we can
5921 ;; only enable the "generic" kernels. See the "Cross compilation"
5922 ;; section of INSTALL.md.
5923 "--enable-generic"
5924 "--disable-sse" "--disable-sse-assembly" ;Require SSE3
5925 "--disable-avx" "--disable-avx2" "--disable-avx512"
5926 ,(string-append "CFLAGS=-O3 "
5927 "-funsafe-loop-optimizations -funsafe-math-optimizations "
5928 "-ftree-vect-loop-version -ftree-vectorize "
5929 ,(let ((system (or (%current-target-system)
5930 (%current-system))))
5931 (cond
5932 ((or (string-prefix? "x86_64" system)
5933 (string-prefix? "i686" system))
5934 "-msse2")
5935 (else "")))))
5936 #:parallel-tests? #f ;tests are multi-threaded, via BLAS
5937 #:phases
5938 (modify-phases %standard-phases
5939 (add-before 'configure 'patch-header-generation
5940 (lambda _
5941 (substitute* "configure"
5942 (("^ *make.*top_srcdir=\"\\$srcdir\"" &)
5943 (string-append & " CPP=\"$CPP\"")))
5944 #t))
5945 (add-before 'check 'setup-tests
5946 (lambda _
5947 ;; Decrease test time and RAM use by computing fewer eigenvalues.
5948 ;; The flags are (MATRIX-SIZE, EIGENVALUES, BLOCK-SIZE), where
5949 ;; the default is (500, 250, 16) for C tests and (5000, 150, 16)
5950 ;; for Fortran. This also causes several tests to pass that
5951 ;; otherwise would otherwise fail with matrix size 5000; possibly
5952 ;; due to floating point tolerances that are too tight.
5953 (setenv "TEST_FLAGS" "1500 50 16") ;from elpa.spec
5954 (setenv "OMP_NUM_THREADS" (number->string (parallel-job-count)))
5955 (substitute* "Makefile"
5956 ;; Test scripts are generated, patch the shebang
5957 (("#!/bin/bash") (string-append "#!" (which "sh"))))
5958 #t)))))
5959 (home-page "https://elpa.mpcdf.mpg.de")
5960 (synopsis "Eigenvalue solvers for symmetric matrices")
5961 (description
5962 "The ELPA library provides efficient and scalable direct eigensolvers for
5963 symmetric matrices.")
5964 (license license:lgpl3)))
5965
5966 (define-public elpa-openmpi
5967 (package (inherit elpa)
5968 (name "elpa-openmpi")
5969 (inputs
5970 `(("mpi" ,openmpi)
5971 ("scalapack" ,scalapack)
5972 ,@(package-inputs elpa)))
5973 (arguments
5974 (substitute-keyword-arguments (package-arguments elpa)
5975 ((#:configure-flags cf '())
5976 `(cons "--with-mpi=yes" (delete "--with-mpi=no" ,cf)))
5977 ((#:phases phases '%standard-phases)
5978 `(modify-phases ,phases
5979 (add-before 'check 'mpi-setup
5980 (lambda _
5981 ;; Tests use 2 mpi tasks by default, use our remaining build
5982 ;; cores as OpenMP threads.
5983 (setenv "OMP_NUM_THREADS" (number->string
5984 (max (quotient (parallel-job-count) 2)
5985 1)))
5986 (,%openmpi-setup)))))))
5987 (synopsis "Eigenvalue solvers for symmetric matrices (with MPI support)")))
5988
5989 (define-public elemental
5990 (package
5991 (name "elemental")
5992 (version "0.87.7")
5993 (source (origin
5994 (method git-fetch)
5995 (uri (git-reference
5996 (url "https://github.com/elemental/Elemental")
5997 (commit (string-append "v" version))))
5998 (file-name (git-file-name name version))
5999 (sha256
6000 (base32
6001 "1687xpjjzig27y2pnqv7hv09smpijyfdpz7qjgmcxf4shfajlfkc"))))
6002 (build-system cmake-build-system)
6003 (home-page "https://github.com/elemental/Elemental")
6004 (native-inputs
6005 `(("gfortran" ,gfortran)))
6006 (inputs
6007 `(("blas" ,openblas)
6008 ("gfortran:lib" ,gfortran "lib")
6009 ("gmp" ,gmp)
6010 ("lapack" ,lapack)
6011 ("metis" ,metis)
6012 ("mpc" ,mpc)
6013 ("mpfr" ,mpfr)
6014 ("mpi" ,openmpi)
6015 ("qd" ,qd)))
6016 (arguments
6017 `(#:build-type "Release" ;default RelWithDebInfo not supported
6018 #:configure-flags `("-DEL_DISABLE_PARMETIS:BOOL=YES"
6019 "-DEL_AVOID_COMPLEX_MPI:BOOL=NO"
6020 "-DEL_CACHE_WARNINGS:BOOL=YES"
6021 "-DEL_TESTS:BOOL=YES"
6022 "-DCMAKE_INSTALL_LIBDIR=lib"
6023 "-DGFORTRAN_LIB=gfortran")
6024 #:phases (modify-phases %standard-phases
6025 (add-before 'check 'mpi-setup
6026 ,%openmpi-setup)
6027 (add-before 'check 'setup-tests
6028 (lambda _
6029 ;; Parallelism is done at the MPI layer.
6030 (setenv "OMP_NUM_THREADS" "1")
6031 #t))
6032 (add-after 'install 'remove-tests
6033 (lambda* (#:key outputs #:allow-other-keys)
6034 ;; Tests are installed, with no easy configuration
6035 ;; switch to prevent this, so delete them.
6036 (delete-file-recursively
6037 (string-append (assoc-ref outputs "out") "/bin"))
6038 #t)))))
6039 (synopsis "Dense and sparse-direct linear algebra and optimization")
6040 (description "Elemental is a modern C++ library for distributed-memory
6041 dense and sparse-direct linear algebra, conic optimization, and lattice
6042 reduction.")
6043 (license license:bsd-2)))
6044
6045 (define-public mcrl2
6046 (package
6047 (name "mcrl2")
6048 (version "202106.0")
6049 (source (origin
6050 (method url-fetch)
6051 (uri (string-append
6052 "https://www.mcrl2.org/download/release/mcrl2-"
6053 version ".tar.gz"))
6054 (sha256
6055 (base32
6056 "1xgx3cd57vc7gbjic24j1q2za6j3ybz6nk4afvvpbwsf33xnlf4v"))))
6057 (inputs
6058 `(("boost" ,boost)
6059 ("glu" ,glu)
6060 ("mesa" ,mesa)
6061 ("qtbase" ,qtbase-5)))
6062 (build-system cmake-build-system)
6063 (synopsis "Toolset for the mCRL2 formal specification language")
6064 (description
6065 "@dfn{mCRL2} (micro Common Representation Language 2) is a formal
6066 specification language for describing concurrent discrete event systems. Its
6067 toolset supports analysis and automatic verification, linearisation, simulation,
6068 state-space exploration and generation, and tools to optimise and analyse
6069 specifications. Also, state spaces can be manipulated, visualised and
6070 analysed.")
6071 (home-page "https://mcrl2.org")
6072 (license license:boost1.0)))
6073
6074 (define-public mcrl2-minimal
6075 (package
6076 (inherit mcrl2)
6077 (name "mcrl2-minimal")
6078 (inputs
6079 `(("boost" ,boost)))
6080 (arguments
6081 '(#:configure-flags '("-DMCRL2_ENABLE_GUI_TOOLS=OFF")))))
6082
6083 (define-public tcalc
6084 (package
6085 (name "tcalc")
6086 (version "2.0")
6087 (source
6088 (origin
6089 (method url-fetch)
6090 (uri (string-append "https://sites.google.com/site/mohammedisam2000/tcalc/tcalc-"
6091 version ".tar.gz"))
6092 (sha256
6093 (base32
6094 "0jq806m4dqfia85nppfm75mml9w57g0cgv4cdw9bp3zymda83s0m"))))
6095 (build-system gnu-build-system)
6096 (synopsis "The terminal calculator")
6097 (description
6098 "The terminal calculator is a small program to help users of the GNU/Linux
6099 terminal do calculations simply and quickly. The formula to be calculated can
6100 be fed to @command{tcalc} through the command line.")
6101 (home-page "https://sites.google.com/site/mohammedisam2000/tcalc")
6102 (license license:gpl3+)))
6103
6104 (define-public tiny-bignum
6105 (let ((commit "1d7a1f9b8e77316187a6b3eae8e68d60a6f9a4d4"))
6106 (package
6107 (name "tiny-bignum")
6108 (version (git-version "0" "0" commit))
6109 (source
6110 (origin
6111 (method git-fetch)
6112 (uri (git-reference
6113 (url "https://github.com/kokke/tiny-bignum-c")
6114 (commit commit)))
6115 (file-name (git-file-name "tiny-bignum" commit))
6116 (sha256
6117 (base32 "0vj71qlhlaa7d92bfar1kwqv6582dqrby8x3kdw0yzh82k2023g6"))))
6118 (build-system gnu-build-system)
6119 (arguments
6120 `(#:phases
6121 (modify-phases %standard-phases
6122 (delete 'configure)
6123 (add-after 'unpack 'patch-tests
6124 (lambda _
6125 (substitute* "scripts/test_rand.py"
6126 (("\t") " ")
6127 (("\" % (\\w+)" _ symbol) (string-append "\" % int(" symbol ")")))
6128 #t))
6129 (replace 'check
6130 (lambda* (#:key tests? #:allow-other-keys)
6131 (when tests?
6132 (invoke "make" "test"))
6133 #t))
6134 (replace 'install
6135 (lambda* (#:key outputs #:allow-other-keys)
6136 (let ((share (string-append (assoc-ref outputs "out") "/share"))
6137 (doc (string-append (assoc-ref outputs "out") "/doc")))
6138 (mkdir-p share)
6139 (install-file "bn.c" share)
6140 (install-file "bn.h" share)
6141 (mkdir-p doc)
6142 (install-file "LICENSE" doc)
6143 (install-file "README.md" doc))
6144 #t)))))
6145 (native-inputs
6146 `(("python" ,python-wrapper)))
6147 (home-page "https://github.com/kokke/tiny-bignum-c")
6148 (synopsis "Small portable multiple-precision unsigned integer arithmetic in C")
6149 (description
6150 "This library provides portable Arbitrary-precision unsigned integer
6151 arithmetic in C, for calculating with large numbers. Basic arithmetic (+, -,
6152 *, /, %) and bitwise operations (&, |, ^. <<, >>) plus increments, decrements
6153 and comparisons are supported.")
6154 (license license:unlicense))))
6155
6156 (define-public sundials
6157 (package
6158 (name "sundials")
6159 (version "3.1.1")
6160 (source
6161 (origin
6162 (method url-fetch)
6163 (uri (string-append "https://computation.llnl.gov/projects/sundials/download/"
6164 "sundials-" version ".tar.gz"))
6165 (sha256
6166 (base32
6167 "090s8ymhd0g1s1d44fa73r5yi32hb4biwahhbfi327zd64yn8kd2"))))
6168 (build-system cmake-build-system)
6169 (native-inputs
6170 `(("python" ,python-2))) ;for tests; syntax incompatible with python 3
6171 (inputs
6172 `(("fortran" ,gfortran) ;for fcmix
6173 ("blas" ,openblas)
6174 ("suitesparse" ,suitesparse))) ;TODO: Add hypre
6175 (arguments
6176 `(#:configure-flags `("-DEXAMPLES_ENABLE_C:BOOL=ON"
6177 "-DEXAMPLES_ENABLE_CXX:BOOL=ON"
6178 "-DEXAMPLES_ENABLE_F77:BOOL=ON"
6179 "-DEXAMPLES_ENABLE_F90:BOOL=ON"
6180 "-DEXAMPLES_INSTALL:BOOL=OFF"
6181
6182 "-DFCMIX_ENABLE:BOOL=ON"
6183
6184 "-DKLU_ENABLE:BOOL=ON"
6185 ,(string-append "-DKLU_INCLUDE_DIR="
6186 (assoc-ref %build-inputs "suitesparse")
6187 "/include")
6188 ,(string-append "-DKLU_LIBRARY_DIR="
6189 (assoc-ref %build-inputs "suitesparse")
6190 "/lib"))))
6191 (home-page "https://computation.llnl.gov/projects/sundials")
6192 (synopsis "Suite of nonlinear and differential/algebraic equation solvers")
6193 (description "SUNDIALS is a family of software packages implemented with
6194 the goal of providing robust time integrators and nonlinear solvers that can
6195 easily be incorporated into existing simulation codes.")
6196 (license license:bsd-3)))
6197
6198 (define-public sundials-openmpi
6199 (package (inherit sundials)
6200 (name "sundials-openmpi")
6201 (inputs
6202 `(("mpi" ,openmpi)
6203 ("petsc" ,petsc-openmpi) ;support in SUNDIALS requires MPI
6204 ,@(package-inputs sundials)))
6205 (arguments
6206 (substitute-keyword-arguments (package-arguments sundials)
6207 ((#:configure-flags flags '())
6208 `(cons* "-DMPI_ENABLE:BOOL=ON"
6209 "-DPETSC_ENABLE:BOOL=ON"
6210 (string-append "-DPETSC_INCLUDE_DIR="
6211 (assoc-ref %build-inputs "petsc")
6212 "/include")
6213 (string-append "-DPETSC_LIBRARY_DIR="
6214 (assoc-ref %build-inputs "petsc")
6215 "/lib")
6216 ,flags))
6217 ((#:phases phases '%standard-phases)
6218 `(modify-phases ,phases
6219 (add-before 'check 'mpi-setup
6220 ,%openmpi-setup)))))
6221 (synopsis "SUNDIALS with OpenMPI support")))
6222
6223 (define-public sundials-julia
6224 (package
6225 (inherit sundials)
6226 (name "sundials-julia")
6227 (version "5.2.0")
6228 (source
6229 (origin
6230 (method git-fetch)
6231 (uri (git-reference
6232 (url "https://github.com/LLNL/sundials")
6233 (commit (string-append "v" version))))
6234 (file-name (git-file-name name version))
6235 (sha256
6236 (base32
6237 "0nx4sqhmi126m14myzm7syv2053harav9snl0a247wnkcgs5rxrv"))))
6238 (inputs
6239 `(("lapack" ,lapack)
6240 ,@(package-inputs sundials)))
6241 (arguments
6242 (substitute-keyword-arguments (package-arguments sundials)
6243 ((#:configure-flags flags '())
6244 `(cons* "-DLAPACK_ENABLE:BOOL=ON"
6245 ,flags))))
6246 (synopsis "SUNDIALS with lapack support as required by julia-sundials-jll")))
6247
6248 (define-public combinatorial-blas
6249 (package
6250 (name "combinatorial-blas")
6251 (version "1.6.2")
6252 (source
6253 (origin
6254 (method url-fetch)
6255 (uri (string-append "http://eecs.berkeley.edu/~aydin/CombBLAS_FILES/"
6256 "CombBLAS_beta_"
6257 (match (string-split version #\.)
6258 ((major minor patch)
6259 (string-append major minor "_" patch))) ;e.g. "16_2"
6260 ".tgz"))
6261 (sha256
6262 (base32
6263 "1a9wbgdqyy1whhfc0yl0yqkax3amnqa6iihhq48d063gc0jwfd9a"))
6264 (patches (search-patches "combinatorial-blas-awpm.patch"
6265 "combinatorial-blas-io-fix.patch"))))
6266 (build-system cmake-build-system)
6267 (inputs
6268 `(("mpi" ,openmpi)
6269 ("test-data" ,(origin
6270 (method url-fetch)
6271 (uri (string-append "https://people.eecs.berkeley.edu/~aydin/"
6272 "CombBLAS_FILES/testdata_combblas1.6.1.tgz"))
6273 (sha256
6274 (base32
6275 "01y2781cy3fww7znmidrp85mf8zx0c905w5vzvk1mgrmhhynim87"))))))
6276 (arguments
6277 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
6278 "-DCMAKE_CXX_FLAGS=-DUSE_FUNNEL")
6279 #:parallel-tests? #f ;tests use 'mpiexec -n4'
6280 #:phases
6281 (modify-phases %standard-phases
6282 (add-before 'check 'mpi-setup
6283 ,%openmpi-setup)
6284 (add-before 'check 'test-setup
6285 (lambda* (#:key inputs #:allow-other-keys)
6286 (setenv "OMP_NUM_THREADS" "2")
6287 (invoke "tar" "xf" (assoc-ref inputs "test-data")))))))
6288 (home-page "https://people.eecs.berkeley.edu/~aydin/CombBLAS/html/")
6289 (synopsis "Linear algebra primitives for graph analytics")
6290 (description "The Combinatorial BLAS (CombBLAS) is an extensible
6291 distributed-memory parallel graph library offering a small but powerful set of
6292 linear algebra primitives specifically targeting graph analytics.")
6293 (license (list
6294 license:gpl2+ ;include/psort/(funnel|sort)*.h
6295 license:x11 ;usort and psort
6296 license:bsd-3)))) ;CombBLAS and MersenneTwister.h
6297
6298 (define-public dune-common
6299 (package
6300 (name "dune-common")
6301 (version "2.7.0")
6302 (source
6303 (origin
6304 (method url-fetch)
6305 (uri (string-append "https://dune-project.org/download/"
6306 version "/dune-common-" version ".tar.gz"))
6307 (sha256
6308 (base32
6309 "140q1zh44cr5yrjwg4b5ga803rkqv55vk30l2cqm29aklj1wb0rw"))))
6310 (build-system cmake-build-system)
6311 (arguments
6312 `(#:phases
6313 (modify-phases %standard-phases
6314 (add-after 'build 'build-tests
6315 (lambda* (#:key make-flags #:allow-other-keys)
6316 (apply invoke "make" "build_tests" make-flags))))))
6317 (inputs
6318 `(("gmp" ,gmp)
6319 ("metis" ,metis)
6320 ("openblas" ,openblas)
6321 ("python" ,python)
6322 ("superlu" ,superlu)))
6323 (native-inputs
6324 `(("gfortran" ,gfortran)
6325 ("pkg-config" ,pkg-config)))
6326 (home-page "https://dune-project.org/")
6327 (synopsis "Distributed and Unified Numerics Environment")
6328 (description "DUNE, the Distributed and Unified Numerics Environment is a
6329 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
6330 grid-based methods. It supports the easy implementation of methods like
6331 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
6332 Differences} (FD).")
6333 ;; GPL version 2 with "runtime exception" to make it behave like LGPLv2.
6334 (license license:gpl2)))
6335
6336 (define-public dune-geometry
6337 (package
6338 (name "dune-geometry")
6339 (version "2.7.0")
6340 (source
6341 (origin
6342 (method url-fetch)
6343 (uri (string-append "https://dune-project.org/download/"
6344 version "/dune-geometry-" version ".tar.gz"))
6345 (sha256
6346 (base32
6347 "1cicvlwbyyw76npicnblxckyvhbfn3ip8isydiv3hlrlz8zcg5nr"))))
6348 (build-system cmake-build-system)
6349 (arguments
6350 `(#:phases
6351 (modify-phases %standard-phases
6352 (add-after 'build 'build-tests
6353 (lambda* (#:key make-flags #:allow-other-keys)
6354 (apply invoke "make" "build_tests" make-flags))))))
6355 (inputs
6356 `(("dune-common" ,dune-common)
6357 ;; Optional
6358 ("openblas" ,openblas)
6359 ("gmp" ,gmp)
6360 ("python" ,python)))
6361 (native-inputs
6362 `(("gfortran" ,gfortran)
6363 ("pkg-config" ,pkg-config)))
6364 (home-page "https://dune-project.org/")
6365 (synopsis "Distributed and Unified Numerics Environment")
6366 (description "DUNE, the Distributed and Unified Numerics Environment is a
6367 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
6368 grid-based methods. It supports the easy implementation of methods like
6369 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
6370 Differences} (FD).
6371
6372 This package contains the basic DUNE geometry classes.")
6373 ;; GPL version 2 with "runtime exception"
6374 (license license:gpl2)))
6375
6376 (define-public dune-uggrid
6377 (package
6378 (name "dune-uggrid")
6379 (version "2.7.0")
6380 (source
6381 (origin
6382 (method git-fetch)
6383 (uri (git-reference
6384 (url "https://gitlab.dune-project.org/staging/dune-uggrid.git")
6385 (commit (string-append "v" version))))
6386 (file-name (git-file-name name version))
6387 (sha256
6388 (base32
6389 "192miqgmfj6jwk969gydzpbv9ki7jg5nky3ydnrwa2nq29b5xkh0"))))
6390 (build-system cmake-build-system)
6391 (arguments
6392 `(#:phases
6393 (modify-phases %standard-phases
6394 (add-after 'build 'build-tests
6395 (lambda* (#:key make-flags #:allow-other-keys)
6396 (apply invoke "make" "build_tests" make-flags))))))
6397 (inputs
6398 `(("dune-common" ,dune-common)))
6399 (native-inputs
6400 `(("gfortran" ,gfortran)
6401 ("pkg-config" ,pkg-config)))
6402 (home-page "https://dune-project.org/")
6403 (synopsis "Distributed and Unified Numerics Environment")
6404 (description "DUNE, the Distributed and Unified Numerics Environment is a
6405 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
6406 grid-based methods. It supports the easy implementation of methods like
6407 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
6408 Differences} (FD).
6409
6410 This package contains the DUNE UG grid classes.")
6411 (license license:lgpl2.1)))
6412
6413 (define-public dune-grid
6414 (package
6415 (name "dune-grid")
6416 (version "2.7.0")
6417 (source
6418 (origin
6419 (method url-fetch)
6420 (uri (string-append "https://dune-project.org/download/"
6421 version "/dune-grid-" version ".tar.gz"))
6422 (sha256
6423 (base32
6424 "17fjz30qazjgl11sryyxnw9klai4yz1ji4bs68013xcxc5hdv27s"))))
6425 (build-system cmake-build-system)
6426 (arguments
6427 `(#:phases
6428 (modify-phases %standard-phases
6429 (add-after 'build 'build-tests
6430 (lambda* (#:key make-flags #:allow-other-keys)
6431 (apply invoke "make" "build_tests" make-flags))))))
6432 (inputs
6433 `(("dune-common" ,dune-common)
6434 ("dune-geometry" ,dune-geometry)
6435 ("gmp" ,gmp)
6436 ("metis" ,metis)
6437 ("openblas" ,openblas)
6438 ("python" ,python)))
6439 (propagated-inputs
6440 `(("dune-uggrid" ,dune-uggrid)))
6441 (native-inputs
6442 `(("gfortran" ,gfortran)
6443 ("pkg-config" ,pkg-config)))
6444 (home-page "https://dune-project.org/")
6445 (synopsis "Distributed and Unified Numerics Environment")
6446 (description "DUNE, the Distributed and Unified Numerics Environment is a
6447 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
6448 grid-based methods. It supports the easy implementation of methods like
6449 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
6450 Differences} (FD).
6451
6452 This package contains the basic DUNE grid classes.")
6453 ;; GPL version 2 with "runtime exception"
6454 (license license:gpl2)))
6455
6456 (define-public dune-istl
6457 (package
6458 (name "dune-istl")
6459 (version "2.7.0")
6460 (source
6461 (origin
6462 (method url-fetch)
6463 (uri (string-append "https://dune-project.org/download/"
6464 version "/dune-istl-" version ".tar.gz"))
6465 (sha256
6466 (base32
6467 "0gl3wgz5rs6sb4m83440ny45sbx7z7lnbi3gx6r9nm3rvy5j33f9"))
6468 (patches (search-patches "dune-istl-2.7-fix-non-mpi-tests.patch"))))
6469 (build-system cmake-build-system)
6470 (arguments
6471 `(#:phases
6472 (modify-phases %standard-phases
6473 ;; XXX: istl/test/matrixtest.cc includes <fenv.h> and fails to find
6474 ;; the stdlib types when the gfortran header is used. Remove gfortran
6475 ;; from CPLUS_INCLUDE_PATH as a workaround.
6476 (add-after 'set-paths 'hide-gfortran
6477 (lambda* (#:key inputs #:allow-other-keys)
6478 (let ((gfortran (assoc-ref inputs "gfortran")))
6479 (setenv "CPLUS_INCLUDE_PATH"
6480 (string-join
6481 (delete (string-append gfortran "/include/c++")
6482 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
6483 ":"))
6484 #t)))
6485 (add-after 'build 'build-tests
6486 (lambda* (#:key make-flags #:allow-other-keys)
6487 (apply invoke "make" "build_tests" make-flags))))))
6488 (inputs
6489 `(("dune-common" ,dune-common)
6490 ;; Optional
6491 ("metis" ,metis)
6492 ("suitesparse" ,suitesparse)
6493 ("superlu" ,superlu)
6494 ("openblas" ,openblas)
6495 ("gmp" ,gmp)
6496 ("python" ,python)))
6497 (native-inputs
6498 `(("gfortran" ,gfortran)
6499 ("pkg-config" ,pkg-config)))
6500 (home-page "https://dune-project.org/")
6501 (synopsis "Distributed and Unified Numerics Environment")
6502 (description "DUNE, the Distributed and Unified Numerics Environment is a
6503 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
6504 grid-based methods.
6505
6506 This is the iterative solver template library which provides generic sparse
6507 matrix/vector classes and a variety of solvers based on these classes. A
6508 special feature is the use of templates to exploit the recursive block
6509 structure of finite element matrices at compile time. Available solvers
6510 include Krylov methods, (block-) incomplete decompositions and
6511 aggregation-based algebraic multigrid.")
6512 ;; GPL version 2 with "runtime exception"
6513 (license license:gpl2)))
6514
6515 (define-public dune-localfunctions
6516 (package
6517 (name "dune-localfunctions")
6518 (version "2.7.0")
6519 (source
6520 (origin
6521 (method url-fetch)
6522 (uri (string-append "https://dune-project.org/download/"
6523 version "/dune-localfunctions-" version ".tar.gz"))
6524 (sha256
6525 (base32
6526 "1yih59h6vngii696bx1c2vil02lriij4kz0nc583mjn9kiaqxfqd"))))
6527 (build-system cmake-build-system)
6528 (arguments
6529 `(#:phases
6530 (modify-phases %standard-phases
6531 ;; XXX: localfunctions/test/lagrangeshapefunctiontest.cc includes <fenv.h>
6532 ;; and fails to find the stdlib types when the gfortran header is used.
6533 ;; Hide gfortran from CPLUS_INCLUDE_PATH to ensure we get the GCC header.
6534 (add-after 'set-paths 'hide-gfortran
6535 (lambda* (#:key inputs #:allow-other-keys)
6536 (let ((gfortran (assoc-ref inputs "gfortran")))
6537 (setenv "CPLUS_INCLUDE_PATH"
6538 (string-join
6539 (delete (string-append gfortran "/include/c++")
6540 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
6541 ":"))
6542 #t)))
6543 (add-after 'build 'build-tests
6544 (lambda* (#:key make-flags #:allow-other-keys)
6545 (apply invoke "make" "build_tests" make-flags))))))
6546 (inputs
6547 `(("dune-common" ,dune-common)
6548 ("dune-geometry" ,dune-geometry)
6549 ;; Optional
6550 ("metis" ,metis)
6551 ("superlu" ,superlu)
6552 ("gmp" ,gmp)))
6553 (native-inputs
6554 `(("gfortran" ,gfortran)
6555 ("pkg-config" ,pkg-config)))
6556 (home-page "https://dune-project.org/")
6557 (synopsis "Distributed and Unified Numerics Environment") ; TODO
6558 (description "This DUNE module provides interface and implementation for
6559 shape functions defined on the DUNE reference elements. In addition to the
6560 shape function, interpolation operators and special keys are provided which
6561 can be used to assemble global function spaces on finite-element grids.
6562
6563 This package provides an interface and implementation for shape functions
6564 defined on the DUNE reference elements. In addition to the shape function,
6565 interpolation operators and special keys are provided which can be used to
6566 assemble global function spaces on finite-element grids.")
6567 ;; GPL version 2 with "runtime exception"
6568 (license license:gpl2)))
6569
6570 (define-public dune-alugrid
6571 (package
6572 (name "dune-alugrid")
6573 (version "2.7.0-git-81d35682")
6574 (source
6575 (origin
6576 (method git-fetch)
6577 (uri (git-reference
6578 (url "https://gitlab.dune-project.org/extensions/dune-alugrid.git")
6579 (commit "81d356827c84454b971937db02c02b90bbcd7fe5")))
6580 (file-name (git-file-name name version))
6581 (sha256
6582 (base32
6583 "0z54lwfp53prcrs94k8gwh047l9z642jll3l56xlyfr69z0b2zz1"))))
6584 (build-system cmake-build-system)
6585 (arguments
6586 `(#:phases
6587 (modify-phases %standard-phases
6588 (add-after 'unpack 'patch-include
6589 (lambda _
6590 (substitute* "dune/alugrid/test/test-alugrid.cc"
6591 (("doc/grids/gridfactory/testgrids")
6592 "doc/dune-grid/grids/gridfactory/testgrids"))
6593 #t))
6594 (add-after 'build 'build-tests
6595 (lambda* (#:key inputs make-flags #:allow-other-keys)
6596 (setenv "CPLUS_INCLUDE_PATH"
6597 (string-append (assoc-ref inputs "dune-grid") "/share"))
6598 (apply invoke "make" "build_tests" make-flags))))))
6599 (inputs
6600 `(("dune-common" ,dune-common)
6601 ("dune-geometry" ,dune-geometry)
6602 ("dune-grid" ,dune-grid)
6603 ;; Optional
6604 ("metis" ,metis)
6605 ("openblas" ,openblas)
6606 ("python" ,python)
6607 ("superlu" ,superlu)
6608 ("gmp" ,gmp)
6609 ("zlib" ,zlib)))
6610 (native-inputs
6611 `(("gfortran" ,gfortran)
6612 ("pkg-config" ,pkg-config)))
6613 (home-page "https://dune-project.org/")
6614 (synopsis "Distributed and Unified Numerics Environment")
6615 (description "ALUGrid is an adaptive, loadbalancing, unstructured
6616 implementation of the DUNE grid interface supporting either simplices or
6617 cubes.")
6618 (license license:gpl2+)))
6619
6620 (define-public dune-subgrid
6621 (package
6622 (name "dune-subgrid")
6623 (version "2.7.0-git-2103a363")
6624 (source
6625 (origin
6626 (method git-fetch)
6627 (uri (git-reference
6628 (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
6629 (commit "2103a363f32e8d7b60e66eee7ddecf969f6cf762")))
6630 (file-name (git-file-name name version))
6631 (sha256
6632 (base32
6633 "1wsjlypd3835c3arqjkw836cxx5q67zy447wa65q634lf6f6v9ia"))))
6634 (build-system cmake-build-system)
6635 (arguments
6636 `(#:phases
6637 (modify-phases %standard-phases
6638 (add-after 'build 'build-tests
6639 (lambda* (#:key make-flags #:allow-other-keys)
6640 (apply invoke "make" "build_tests" make-flags))))))
6641 (inputs
6642 `(("dune-common" ,dune-common)
6643 ("dune-geometry" ,dune-geometry)
6644 ("dune-grid" ,dune-grid)
6645 ;; Optional
6646 ("metis" ,metis)
6647 ("openblas" ,openblas)
6648 ("gmp" ,gmp)))
6649 (native-inputs
6650 `(("gfortran" ,gfortran)
6651 ("pkg-config" ,pkg-config)))
6652 (home-page "http://numerik.mi.fu-berlin.de/dune-subgrid/index.php")
6653 (synopsis "Distributed and Unified Numerics Environment")
6654 (description "The dune-subgrid module marks elements of
6655 another hierarchical dune grid. The set of marked elements can then be
6656 accessed as a hierarchical dune grid in its own right. Dune-Subgrid
6657 provides the full grid interface including adaptive mesh refinement.")
6658 (license license:gpl2+)))
6659
6660 (define-public dune-typetree
6661 (package
6662 (name "dune-typetree")
6663 (version "2.7.0")
6664 (source
6665 (origin
6666 (method git-fetch)
6667 (uri (git-reference
6668 (url "https://gitlab.dune-project.org/staging/dune-typetree.git")
6669 (commit (string-append "v" version))))
6670 (file-name (git-file-name name version))
6671 (sha256
6672 (base32
6673 "1rhv25yg0q1hw50c8wlfqhgwrjl4mh62zq9v14ilwgzbfgxmpiy7"))))
6674 (build-system cmake-build-system)
6675 (arguments
6676 `(#:phases
6677 (modify-phases %standard-phases
6678 (add-after 'build 'build-tests
6679 (lambda* (#:key make-flags #:allow-other-keys)
6680 (apply invoke "make" "build_tests" make-flags))))))
6681 (inputs
6682 `(("dune-common" ,dune-common)
6683 ;; Optional
6684 ("openblas" ,openblas)
6685 ("python" ,python)
6686 ("metis" ,metis)
6687 ("superlu" ,superlu)
6688 ("gmp" ,gmp)))
6689 (native-inputs
6690 `(("gfortran" ,gfortran)
6691 ("pkg-config" ,pkg-config)))
6692 (home-page "https://dune-project.org/")
6693 (synopsis "Distributed and Unified Numerics Environment")
6694 (description "TypeTree is a template library for constructing and
6695 operating on statically typed trees of objects.")
6696 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
6697 (license (list license:lgpl3+ license:gpl2))))
6698
6699 (define-public dune-functions
6700 (package
6701 (name "dune-functions")
6702 (version "2.7.0")
6703 (source
6704 (origin
6705 (method git-fetch)
6706 (uri (git-reference
6707 (url "https://gitlab.dune-project.org/staging/dune-functions.git")
6708 (commit (string-append "v" version))))
6709 (file-name (git-file-name name version))
6710 (sha256
6711 (base32
6712 "1na4gcih0kin37ksj2xj07ds04v7zx53pjdhm1hzy55jjfqdjk8h"))))
6713 (build-system cmake-build-system)
6714 (arguments
6715 `(#:phases
6716 (modify-phases %standard-phases
6717 (add-after 'unpack 'disable-failing-tests
6718 (lambda _
6719 (setenv "ARGS"
6720 ;; unable to load GMSH file in this test
6721 "--exclude-regex gridviewfunctionspacebasistest")
6722 #t))
6723 (add-after 'build 'build-tests
6724 (lambda* (#:key make-flags #:allow-other-keys)
6725 (apply invoke "make" "build_tests" make-flags))))))
6726 (inputs
6727 `(("dune-common" ,dune-common)
6728 ("dune-istl" ,dune-istl)
6729 ("dune-localfunctions" ,dune-localfunctions)
6730 ("dune-grid" ,dune-grid)
6731 ("dune-geometry" ,dune-geometry)
6732 ("dune-typetree" ,dune-typetree)
6733 ("openblas" ,openblas)
6734 ("metis" ,metis)
6735 ("python" ,python)
6736 ("superlu" ,superlu)
6737 ("gmp" ,gmp)))
6738 (native-inputs
6739 `(("gfortran" ,gfortran)
6740 ("pkg-config" ,pkg-config)))
6741 (home-page "https://dune-project.org/")
6742 (synopsis "Distributed and Unified Numerics Environment")
6743 (description "The dune-functions module provides an abstraction layer for
6744 global finite element functions. Its two main concepts are functions
6745 implemented as callable objects, and bases of finite element spaces.")
6746 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
6747 (license (list license:lgpl3+ license:gpl2))))
6748
6749 (define-public dune-pdelab
6750 (package
6751 (name "dune-pdelab")
6752 (version "2.7.0-git-476fe437")
6753 (source
6754 (origin
6755 (method git-fetch)
6756 (uri (git-reference
6757 (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
6758 (commit "476fe43763fa6f459c5e4658e2a2b4b5582db834")))
6759 (file-name (git-file-name name version))
6760 (sha256
6761 (base32
6762 "0cs36piqzn6rq0j2ih3ab3q3q9yg199wk72k5qi86pkzh7i7fdn1"))))
6763 (build-system cmake-build-system)
6764 (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
6765 (inputs
6766 `(("dune-common" ,dune-common)
6767 ("dune-istl" ,dune-istl)
6768 ("dune-localfunctions" ,dune-localfunctions)
6769 ("dune-geometry" ,dune-geometry)
6770 ("dune-grid" ,dune-grid)
6771 ("dune-typetree" ,dune-typetree)
6772 ("dune-functions" ,dune-functions)
6773 ;; Optional
6774 ("openblas" ,openblas)
6775 ("eigen" ,eigen)
6776 ("metis" ,metis)
6777 ("python" ,python)
6778 ("superlu" ,superlu)
6779 ("gmp" ,gmp)))
6780 (native-inputs
6781 `(("gfortran" ,gfortran)
6782 ("pkg-config" ,pkg-config)))
6783 (home-page "https://dune-project.org/")
6784 (synopsis "Differential equations solver toolbox")
6785 (description "PDELab is a partial differential equations solver toolbox
6786 built on top of DUNE, the Distributed and Unified Numerics Environment.")
6787 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
6788 (license (list license:lgpl3+ license:gpl2))))
6789
6790 (define add-openmpi-to-dune-package
6791 (let ((dune-package?
6792 (lambda (p) (string-prefix? "dune-" (package-name p)))))
6793 (package-mapping
6794 (lambda (p)
6795 (if (dune-package? p)
6796 (package (inherit p)
6797 (name (string-append (package-name p) "-openmpi"))
6798 (inputs `(,@(package-inputs p)
6799 ("openmpi" ,openmpi)))
6800 (arguments
6801 (substitute-keyword-arguments (package-arguments p)
6802 ((#:phases phases '%standard-phases)
6803 `(modify-phases ,phases
6804 (add-before 'check 'mpi-setup
6805 ,%openmpi-setup)))))
6806 (synopsis (string-append (package-synopsis p) " (with MPI support)")))
6807 p))
6808 (negate dune-package?))))
6809
6810 (define-public dune-common-openmpi
6811 (add-openmpi-to-dune-package dune-common))
6812
6813 (define-public dune-geometry-openmpi
6814 (add-openmpi-to-dune-package dune-geometry))
6815
6816 (define-public dune-istl-openmpi
6817 (add-openmpi-to-dune-package dune-istl))
6818
6819 (define-public dune-typetree-openmpi
6820 (add-openmpi-to-dune-package dune-typetree))
6821
6822 (define-public dune-uggrid-openmpi
6823 (add-openmpi-to-dune-package dune-uggrid))
6824
6825 (define-public dune-grid-openmpi
6826 (add-openmpi-to-dune-package dune-grid))
6827
6828 (define-public dune-alugrid-openmpi
6829 (add-openmpi-to-dune-package dune-alugrid))
6830
6831 (define-public dune-subgrid-openmpi
6832 (add-openmpi-to-dune-package dune-subgrid))
6833
6834 (define-public dune-localfunctions-openmpi
6835 (add-openmpi-to-dune-package dune-localfunctions))
6836
6837 (define-public dune-functions-openmpi
6838 (add-openmpi-to-dune-package dune-functions))
6839
6840 (define-public dune-pdelab-openmpi
6841 (add-openmpi-to-dune-package dune-pdelab))
6842
6843 (define-public mlucas
6844 (package
6845 (name "mlucas")
6846 (version "18")
6847 (source
6848 (origin
6849 (method url-fetch)
6850 (uri (string-append
6851 "https://mersenneforum.org/mayer/src/C/mlucas_v" version ".txz"))
6852 (sha256
6853 (base32 "0h4xj6pyyac79ka5ibqjilfa3s9j3yxnzgpwc57b54kfh2bj3447"))))
6854 (build-system gnu-build-system)
6855 (inputs
6856 `(("python2" ,python-2)))
6857 (arguments
6858 `(#:tests? #f ; no tests
6859 #:phases
6860 (modify-phases %standard-phases
6861 (replace 'configure
6862 (lambda _
6863 (chdir "src")
6864 (call-with-output-file "Makefile"
6865 (lambda (port)
6866 (format port "CC = gcc
6867 CFLAGS = -O3 ~a -DUSE_THREADS
6868 LDLIBS = -lm -lpthread -lrt
6869 Mlucas: $(addsuffix .o,$(basename $(wildcard *.c)))
6870 "
6871 ,(let ((system (or (%current-target-system)
6872 (%current-system))))
6873 (cond
6874 ((string-prefix? "x86_64" system) "-DUSE_SSE2")
6875 (else ""))))))
6876 #t))
6877 (replace 'install
6878 (lambda* (#:key outputs #:allow-other-keys)
6879 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
6880 (install-file "Mlucas" bin)
6881 (install-file "primenet.py" bin))
6882 #t)))))
6883 (home-page "https://www.mersenne.org")
6884 (synopsis "Great Internet Mersenne Prime Search (GIMPS) distributed computing client")
6885 (description "Mlucas performs Lucas-Lehmer primality testing of Mersenne
6886 numbers in search of a world-record prime. You may use it to test any
6887 suitable number as you wish, but it is preferable that you do so in a
6888 coordinated fashion, as part of the Great Internet Mersenne Prime
6889 Search (GIMPS). Mlucas also includes a simple Python script for assignment
6890 management via the GIMPS project's Primenet server.")
6891 (license license:gpl2+)))
6892
6893 (define-public nauty
6894 (package
6895 (name "nauty")
6896 (version "2.7r3")
6897 (source
6898 (origin
6899 (method url-fetch)
6900 (uri (string-append
6901 "https://pallini.di.uniroma1.it/"
6902 "nauty" (string-join (string-split version #\.) "") ".tar.gz"))
6903 (sha256
6904 (base32 "1hl81gpf3xjf809w04jczvilq1ixy9ch1qrax8a7lgx52svna1jg"))))
6905 (build-system gnu-build-system)
6906 (outputs '("out" "lib"))
6907 (arguments
6908 `(#:test-target "checks"
6909 #:configure-flags '("--enable-generic") ;prevent -march-native
6910 #:phases
6911 (modify-phases %standard-phases
6912 ;; Default make target does not build all available
6913 ;; executables. Create them now.
6914 (add-after 'build 'build-extra-programs
6915 (lambda _
6916 (for-each (lambda (target) (invoke "make" target))
6917 '("blisstog" "bliss2dre" "checks6" "sumlines"))
6918 #t))
6919 ;; Upstream does not provide any install target.
6920 (replace 'install
6921 (lambda* (#:key outputs #:allow-other-keys)
6922 (let* ((out (assoc-ref outputs "out"))
6923 (lib-output (assoc-ref outputs "lib"))
6924 (bin (string-append out "/bin"))
6925 (doc (string-append out "/share/doc/nauty/"))
6926 (include (string-append lib-output "/include/nauty"))
6927 (lib (string-append lib-output "/lib/nauty")))
6928 (for-each (lambda (f) (install-file f bin))
6929 '("addedgeg" "amtog" "assembleg" "biplabg" "blisstog"
6930 "bliss2dre" "catg" "checks6" "complg" "converseg"
6931 "copyg" "countg" "cubhamg" "deledgeg" "delptg"
6932 "directg" "dreadnaut" "dretodot" "dretog" "genbg"
6933 "genbgL" "geng" "genquarticg" "genrang" "genspecialg"
6934 "gentourng" "gentreeg" "hamheuristic" "labelg"
6935 "linegraphg" "listg" "multig" "newedgeg" "pickg"
6936 "planarg" "ranlabg" "shortg" "showg" "subdivideg"
6937 "sumlines" "twohamg" "underlyingg" "vcolg"
6938 "watercluster2" "NRswitchg"))
6939 (for-each (lambda (f) (install-file f include))
6940 (find-files "." "\\.h$"))
6941 (for-each (lambda (f) (install-file f lib))
6942 (find-files "." "\\.a$"))
6943 (for-each (lambda (f) (install-file f doc))
6944 (append '("formats.txt" "README" "schreier.txt")
6945 (find-files "." "\\.pdf$")))))))))
6946 (inputs
6947 `(("gmp" ,gmp))) ;for sumlines
6948 (home-page "https://pallini.di.uniroma1.it/")
6949 (synopsis "Library for graph automorphisms")
6950 (description "@code{nauty} (No AUTomorphisms, Yes?) is a set of
6951 procedures for computing automorphism groups of graphs and digraphs.
6952
6953 @code{nauty} computes graph information in the form of a set of
6954 generators, the size of the group, and the orbits of the group; it can
6955 also produce a canonical label. The @code{nauty} suite is written in
6956 C and comes with a command-line interface, a collection of
6957 command-line tools, and an Application Programming Interface (API).
6958
6959 This package provides the static libraries required to run programs
6960 compiled against the nauty library.")
6961 (license license:asl2.0)))
6962
6963 (define-public ppl
6964 (package
6965 (name "ppl")
6966 (version "1.2")
6967 (source
6968 (origin
6969 (method url-fetch)
6970 (uri (string-append "https://www.bugseng.com/products/ppl/download/"
6971 "ftp/releases/" version
6972 "/ppl-" version ".tar.gz"))
6973 (sha256
6974 (base32
6975 "1j5aji1g2vmdvc0gqz45n2ll2l2f6czca04wiyfl5g3sm3a6vhvb"))))
6976 (build-system gnu-build-system)
6977 (native-inputs
6978 `(("m4" ,m4)))
6979 (inputs
6980 `(("glpk" ,glpk)
6981 ("gmp" ,gmp)))
6982 (home-page "https://www.bugseng.com/parma-polyhedra-library")
6983 (synopsis
6984 "Parma Polyhedra Library for computations with polyhedra")
6985 (description
6986 "The Parma Polyhedra Library (PPL) provides numerical abstractions
6987 especially targeted at applications in the field of analysis and
6988 verification of complex systems. These abstractions include convex
6989 polyhedra, defined as the intersection of a finite number of (open or
6990 closed) halfspaces, each described by a linear inequality (strict or
6991 non-strict) with rational coefficients; some special classes of polyhedra
6992 shapes that offer interesting complexity/precision tradeoffs; and grids
6993 which represent regularly spaced points that satisfy a set of linear
6994 congruence relations. The library also supports finite powersets and
6995 products of (any kind of) polyhedra and grids, a mixed integer linear
6996 programming problem solver using an exact-arithmetic version of the simplex
6997 algorithm, a parametric integer programming solver, and primitives for
6998 termination analysis via the automatic synthesis of linear ranking
6999 functions.")
7000 (license license:gpl3+)))
7001
7002 (define-public speedcrunch
7003 (package
7004 (name "speedcrunch")
7005 (version "0.12.0")
7006 (source
7007 (origin
7008 (method git-fetch)
7009 (uri (git-reference
7010 (url "https://bitbucket.org/heldercorreia/speedcrunch.git")
7011 (commit (string-append "release-" version))))
7012 (file-name (git-file-name name version))
7013 (sha256
7014 (base32
7015 "0vh7cd1915bjqzkdp3sk25ngy8cq624mkh8c53c5bnzk357kb0fk"))))
7016 (build-system cmake-build-system)
7017 (inputs `(("qtbase" ,qtbase-5)))
7018 (native-inputs `(("qttools" ,qttools)))
7019 (arguments
7020 `(#:phases
7021 (modify-phases %standard-phases
7022 (add-after 'unpack 'chdir-to-src
7023 (lambda _ (chdir "src") #t)))))
7024 (synopsis "High-precision scientific calculator")
7025 (description
7026 "SpeedCrunch is a high-precision scientific calculator. It features a
7027 syntax-highlighted scrollable display and is designed to be fully used via
7028 keyboard. Some distinctive features are auto-completion of functions and
7029 variables, a formula book, and quick insertion of constants from various
7030 fields of knowledge.")
7031 (home-page "https://speedcrunch.org/")
7032 (license license:gpl2+)))
7033
7034 (define-public minisat
7035 ;; This is the last commit which is available upstream, no
7036 ;; release happened since 2010.
7037 (let ((commit "37dc6c67e2af26379d88ce349eb9c4c6160e8543")
7038 (revision "1"))
7039 (package
7040 (name "minisat")
7041 (version (string-append "2.2.0-" revision "." (string-take commit 7)))
7042 (source
7043 (origin
7044 (method git-fetch)
7045 (uri (git-reference
7046 (url "https://github.com/niklasso/minisat")
7047 (commit commit)))
7048 (file-name (string-append name "-" version "-checkout"))
7049 (sha256
7050 (base32
7051 "091hf3qkm197s5r7xcr3m07xsdwyz2rqk1hc9kj0hn13imz09irq"))
7052 (patches
7053 (search-patches "minisat-friend-declaration.patch"
7054 "minisat-install.patch"))))
7055 (build-system gnu-build-system)
7056 (arguments
7057 '(#:make-flags (list (string-append "prefix=" %output))
7058 #:tests? #f ;no check target
7059 #:phases
7060 (modify-phases %standard-phases
7061 (delete 'configure))))
7062 (inputs
7063 `(("zlib:static" ,zlib "static")
7064 ("zlib" ,zlib)))
7065 (synopsis
7066 "Small, yet efficient, SAT solver")
7067 (description
7068 "MiniSat is a minimalistic, open-source SAT solver, developed to help
7069 researchers and developers alike to get started on SAT.")
7070 (home-page
7071 "http://minisat.se/MiniSat.html")
7072 (license license:expat))))
7073
7074 (define-public libqalculate
7075 (package
7076 (name "libqalculate")
7077 (version "3.19.0")
7078 (source
7079 (origin
7080 (method git-fetch)
7081 (uri (git-reference
7082 (url "https://github.com/Qalculate/libqalculate/")
7083 (commit (string-append "v" version))))
7084 (file-name (git-file-name name version))
7085 (sha256
7086 (base32 "1w44407wb552q21dz4m2nwwdi8b9hzjb2w1l3ffsikzqckc7wbyj"))
7087 (patches
7088 (search-patches "libqalculate-3.8.0-libcurl-ssl-fix.patch"))))
7089 (build-system gnu-build-system)
7090 (native-inputs
7091 `(("pkg-config" ,pkg-config)
7092 ("gettext" ,gettext-minimal)
7093 ("intltool" ,intltool)
7094 ("automake" ,automake)
7095 ("autoconf" ,autoconf)
7096 ("libtool" ,libtool)
7097 ("doxygen" ,doxygen)
7098 ("file" ,file)))
7099 (inputs
7100 `(("gmp" ,gmp)
7101 ("mpfr" ,mpfr)
7102 ("libxml2" ,libxml2)
7103 ("curl" ,curl)
7104 ("icu4c" ,icu4c)
7105 ("gnuplot" ,gnuplot)
7106 ("readline" ,readline)
7107 ("libiconv" ,libiconv)))
7108 (arguments
7109 `(#:phases
7110 (modify-phases %standard-phases
7111 (add-before 'bootstrap 'setenv
7112 ;; Prevent the autogen.sh script to carry out the configure
7113 ;; script, which has not yet been patched to replace /bin/sh.
7114 (lambda _
7115 (setenv "NOCONFIGURE" "TRUE")
7116 #t)))))
7117 (home-page "https://qalculate.github.io/")
7118 (synopsis "Multi-purpose cli desktop calculator and library")
7119 (description
7120 "Libqalculate is a multi-purpose cli desktop calculator and library.
7121 It provides basic and advanced functionality. Features include customizable
7122 functions, unit calculations, and conversions, physical constants, symbolic
7123 calculations (including integrals and equations), arbitrary precision,
7124 uncertainty propagation, interval arithmetic, plotting and a user-friendly
7125 cli.")
7126 (license license:gpl2+)))
7127
7128 (define-public qalculate-gtk
7129 (package
7130 (name "qalculate-gtk")
7131 (version "3.19.0")
7132 (source
7133 (origin
7134 (method git-fetch)
7135 (uri (git-reference
7136 (url "https://github.com/Qalculate/qalculate-gtk/")
7137 (commit (string-append "v" version))))
7138 (file-name (git-file-name name version))
7139 (sha256
7140 (base32 "1nrx7gp6f1yalbdda1gb97azhbr4xclq2xf08vvbvsk8jfd6fd2v"))))
7141 (build-system glib-or-gtk-build-system)
7142 (native-inputs
7143 `(("pkg-config" ,pkg-config)
7144 ("intltool" ,intltool)
7145 ("automake" ,automake)
7146 ("autoconf" ,autoconf)
7147 ("libtool" ,libtool)
7148 ("file" ,file)))
7149 (inputs
7150 `(("gmp" ,gmp)
7151 ("mpfr" ,mpfr)
7152 ("libqalculate" ,libqalculate)
7153 ("libxml2" ,libxml2)
7154 ("glib" ,glib)
7155 ("gtk+" ,gtk+)))
7156 (arguments
7157 `(#:phases
7158 (modify-phases %standard-phases
7159 (add-before 'bootstrap 'setenv
7160 ;; Prevent the autogen.sh script to carry out the configure
7161 ;; script, which has not yet been patched to replace /bin/sh.
7162 (lambda _
7163 (setenv "NOCONFIGURE" "TRUE")
7164 #t)))))
7165 (home-page "https://qalculate.github.io/")
7166 (synopsis "Multi-purpose graphical desktop calculator")
7167 (description
7168 "Qalculate-gtk is the GTK frontend for libqalculate. It is a
7169 multi-purpose GUI desktop calculator. It provides basic and advanced
7170 functionality. Features include customizable functions, unit calculations,
7171 and conversions, physical constants, symbolic calculations (including
7172 integrals and equations), arbitrary precision, uncertainty propagation,
7173 interval arithmetic, plotting.")
7174 (license license:gpl2+)))
7175
7176 (define-public numdiff
7177 (package
7178 (name "numdiff")
7179 (version "5.9.0")
7180 (source
7181 (origin
7182 (method url-fetch)
7183 (uri (string-append "mirror://savannah/numdiff/numdiff-"
7184 version ".tar.gz"))
7185 (sha256
7186 (base32
7187 "1vzmjh8mhwwysn4x4m2vif7q2k8i19x8azq7pzmkwwj4g48lla47"))))
7188 (build-system gnu-build-system)
7189 (arguments
7190 '(#:tests? #f ; There are no tests.
7191 #:phases
7192 (modify-phases %standard-phases
7193 (add-before 'compress-documentation 'delete-precompressed-info-file
7194 (lambda _
7195 (delete-file (string-append (assoc-ref %outputs "out")
7196 "/share/info/numdiff.info.gz"))
7197 #t)))))
7198 (home-page "https://nongnu.org/numdiff/")
7199 (synopsis "Compare files with numeric fields")
7200 (description
7201 "Numdiff compares files line by line and field by field, ignoring small
7202 numeric differences and differences in numeric formats.")
7203 (license license:gpl3+)))
7204
7205 (define-public why3
7206 (package
7207 (name "why3")
7208 (version "1.4.0")
7209 (source (origin
7210 (method git-fetch)
7211 (uri (git-reference
7212 (url "https://gitlab.inria.fr/why3/why3")
7213 (commit version)))
7214 (file-name (git-file-name name version))
7215 (sha256
7216 (base32
7217 "0pfsiddnk26f384wbazfpgzh1n1ibf3xq101q74mxvczi7z0a791"))))
7218 (build-system ocaml-build-system)
7219 (native-inputs
7220 `(("autoconf" ,autoconf)
7221 ("automake" ,automake)
7222 ("coq" ,coq)
7223 ("ocaml" ,ocaml)
7224 ("which" ,which)))
7225 (propagated-inputs
7226 `(("camlzip" ,camlzip)
7227 ("ocaml-graph" ,ocaml-graph)
7228 ("ocaml-menhir" ,ocaml-menhir)
7229 ("ocaml-num" ,ocaml-num)
7230 ("ocaml-zarith" ,ocaml-zarith)))
7231 (inputs
7232 `(("coq-flocq" ,coq-flocq)
7233 ("emacs-minimal" ,emacs-minimal)
7234 ("zlib" ,zlib)))
7235 (arguments
7236 `(#:phases
7237 (modify-phases %standard-phases
7238 (add-before 'configure 'bootstrap
7239 (lambda _
7240 (invoke "./autogen.sh")
7241 (setenv "CONFIG_SHELL" (which "sh"))
7242 (substitute* "configure"
7243 (("#! /bin/sh") (string-append "#!" (which "sh")))
7244 ;; find ocaml-num in the correct directory
7245 (("\\$DIR/nums.cma") "$DIR/num.cma")
7246 (("\\$DIR/num.cmi") "$DIR/core/num.cmi"))
7247 #t))
7248 (add-after 'configure 'fix-makefile
7249 (lambda _
7250 (substitute* "Makefile"
7251 ;; find ocaml-num in the correct directory
7252 (("site-lib/num") "site-lib"))
7253 #t))
7254 (add-after 'install 'install-lib
7255 (lambda _
7256 (invoke "make" "byte")
7257 (invoke "make" "install-lib")
7258 #t)))))
7259 (home-page "http://why3.lri.fr")
7260 (synopsis "Deductive program verification")
7261 (description "Why3 provides a language for specification and programming,
7262 called WhyML, and relies on external theorem provers, both automated and
7263 interactive, to discharge verification conditions. Why3 comes with a standard
7264 library of logical theories (integer and real arithmetic, Boolean operations,
7265 sets and maps, etc.) and basic programming data structures (arrays, queues,
7266 hash tables, etc.). A user can write WhyML programs directly and get
7267 correct-by-construction OCaml programs through an automated extraction
7268 mechanism. WhyML is also used as an intermediate language for the verification
7269 of C, Java, or Ada programs.")
7270 (license license:lgpl2.1)))
7271
7272 (define-public frama-c
7273 (package
7274 (name "frama-c")
7275 (version "23.1")
7276 (source (origin
7277 (method url-fetch)
7278 (uri (string-append "http://frama-c.com/download/frama-c-"
7279 version "-Vanadium.tar.gz"))
7280 (sha256
7281 (base32
7282 "1rgkq9sg436smw005ag0j6y3xryhjn18a07m5wjfrfp0s1438nnj"))))
7283 (build-system ocaml-build-system)
7284 (arguments
7285 `(#:tests? #f; no test target in Makefile
7286 #:phases
7287 (modify-phases %standard-phases
7288 (add-before 'configure 'export-shell
7289 (lambda* (#:key inputs #:allow-other-keys)
7290 (setenv "CONFIG_SHELL"
7291 (search-input-file inputs "/bin/sh")))))))
7292 (inputs
7293 `(("gmp" ,gmp)))
7294 (propagated-inputs
7295 `(("ocaml-biniou" ,ocaml-biniou)
7296 ("ocaml-easy-format" ,ocaml-easy-format)
7297 ("ocaml-graph" ,ocaml-graph)
7298 ("ocaml-yojson" ,ocaml-yojson)
7299 ("ocaml-zarith" ,ocaml-zarith)
7300 ("why3" ,why3)))
7301 (native-search-paths
7302 (list (search-path-specification
7303 (variable "FRAMAC_SHARE")
7304 (files '("share/frama-c"))
7305 (separator #f))
7306 (search-path-specification
7307 (variable "FRAMAC_LIB")
7308 (files '("lib/frama-c"))
7309 (separator #f))))
7310 (home-page "http://frama-c.com")
7311 (synopsis "C source code analysis platform")
7312 (description "Frama-C is an extensible and collaborative platform dedicated
7313 to source-code analysis of C software. The Frama-C analyzers assist you in
7314 various source-code-related activities, from the navigation through unfamiliar
7315 projects up to the certification of critical software.")
7316 (license license:lgpl2.1+)))
7317
7318 (define-public blitz
7319 (package
7320 (name "blitz")
7321 (version "1.0.2")
7322 (source
7323 (origin
7324 (method git-fetch)
7325 (uri (git-reference
7326 (url "https://github.com/blitzpp/blitz")
7327 (commit version)))
7328 (file-name (git-file-name name version))
7329 (sha256
7330 (base32 "0c88gc72j3zggyk4yrrip6i0v7xkx97l140vpy3xhxs2i7xy1461"))))
7331 (build-system cmake-build-system)
7332 (arguments
7333 `(#:configure-flags '("-DBUILD_DOC=ON"
7334 "-DBUILD_TESTING=ON")
7335 ;; The default "check" target also includes examples and benchmarks.
7336 #:test-target "check-testsuite"
7337 #:phases
7338 (modify-phases %standard-phases
7339 (add-after 'build 'build-doc
7340 (lambda _
7341 (invoke "make" "-j" (number->string (parallel-job-count))
7342 "blitz-doc"))))))
7343 (native-inputs
7344 `(("python" ,python)
7345 ("texinfo" ,texinfo)))
7346 (synopsis "C++ template class library for multidimensional arrays")
7347 (description "Blitz++ is a C++ template class library that provides
7348 high-performance multidimensional array containers for scientific computing.")
7349 (home-page "https://github.com/blitzpp/blitz")
7350 (license (list license:artistic2.0
7351 license:bsd-3
7352 license:lgpl3+))))
7353
7354 (define-public fxdiv
7355 ;; There is currently no tag in this repo.
7356 (let ((commit "63058eff77e11aa15bf531df5dd34395ec3017c8")
7357 (version "0.0")
7358 (revision "1"))
7359 (package
7360 (name "fxdiv")
7361 (version (git-version version revision commit))
7362 (home-page "https://github.com/Maratyszcza/FXdiv")
7363 (source (origin
7364 (method git-fetch)
7365 (uri (git-reference (url home-page) (commit commit)))
7366 (file-name (git-file-name name version))
7367 (sha256
7368 (base32
7369 "0zwzh8gmbx4m6b18s5nf13b0dk5yjkd1fs8f421bl7fz5f9gjd9f"))
7370 (patches (search-patches "fxdiv-system-libraries.patch"))))
7371 (build-system cmake-build-system)
7372 (inputs
7373 `(("googletest" ,googletest)
7374 ("googlebenchmark" ,googlebenchmark)))
7375 (synopsis
7376 "C++ library for division via fixed-point multiplication by inverse")
7377 (description
7378 "On modern CPUs and GPUs, integer division is several times slower than
7379 multiplication. FXdiv implements an algorithm to replace an integer division
7380 with a multiplication and two shifts. This algorithm improves performance
7381 when an application performs repeated divisions by the same divisor.")
7382 (license license:expat))))
7383
7384 (define-public fp16
7385 ;; There is currently no tag in this repo.
7386 (let ((commit "0a92994d729ff76a58f692d3028ca1b64b145d91")
7387 (version "0.0")
7388 (revision "1"))
7389 (package
7390 (name "fp16")
7391 (version (git-version version revision commit))
7392 (home-page "https://github.com/Maratyszcza/FP16")
7393 (source (origin
7394 (method git-fetch)
7395 (uri (git-reference (url home-page) (commit commit)))
7396 (file-name (git-file-name name version))
7397 (sha256
7398 (base32
7399 "05mm4vrxsac35hjf5djif9r6rdxj9ippg97ia3p6q6b8lrp7srwv"))
7400 (patches (search-patches "fp16-system-libraries.patch"))))
7401 (build-system cmake-build-system)
7402 (arguments
7403 `(#:imported-modules ((guix build python-build-system)
7404 ,@%cmake-build-system-modules)
7405 #:modules (((guix build python-build-system)
7406 #:select (site-packages))
7407 (guix build cmake-build-system)
7408 (guix build utils))
7409 #:phases (modify-phases %standard-phases
7410 (add-after 'install 'move-python-files
7411 (lambda* (#:key inputs outputs #:allow-other-keys)
7412 ;; Python files get installed to $includedir (!).
7413 ;; Move them to the usual Python site directory.
7414 (let* ((out (assoc-ref outputs "out"))
7415 (include (string-append out "/include"))
7416 (site (site-packages inputs outputs))
7417 (target (string-append site "/fp16")))
7418 (mkdir-p target)
7419 (for-each (lambda (file)
7420 (rename-file file
7421 (string-append target "/"
7422 (basename
7423 file))))
7424 (find-files include "\\.py$"))))))))
7425 (native-inputs
7426 `(("python-wrapper" ,python-wrapper)))
7427 (inputs
7428 `(("psimd" ,psimd)
7429 ("googletest" ,googletest)
7430 ("googlebenchmark" ,googlebenchmark)))
7431 (synopsis "C++ library for half-precision floating point formats")
7432 (description
7433 "This header-only C++ library implements conversion to and from
7434 half-precision floating point formats.")
7435 (license license:expat))))
7436
7437 (define-public optizelle
7438 (let ((commit "ed4160b5287518448caeb34789d92dc6a0b7e2cc"))
7439 (package
7440 (name "optizelle")
7441 (version (git-version "1.3.0" "0" commit))
7442 (source
7443 (origin
7444 (method git-fetch)
7445 (uri (git-reference
7446 (url "https://github.com/OptimoJoe/Optizelle")
7447 (commit commit)))
7448 (file-name (git-file-name "optizelle" commit))
7449 (sha256
7450 (base32
7451 "0rjrs5sdmd33a9f4xm8an7p0953aa0bxsmr4hs3ss1aad9k181vq"))
7452 (modules '((guix build utils)))
7453 (snippet
7454 '(begin
7455 ;; Reduce the stopping tolerance in one test so that the
7456 ;; convergence check returns the correct stopping
7457 ;; condition.
7458 (substitute*
7459 "src/unit/linear_algebra/tcg_loss_of_orthogonality.cpp"
7460 (("1e-13") "5e-14"))
7461 ;; Skip one set of python tests. See
7462 ;; https://github.com/OptimoJoe/Optizelle/issues/2.
7463 (substitute*
7464 "src/examples/inequality_scaling/CMakeLists.txt"
7465 (("add_unit(.*)\\$\\{interfaces\\}(.*)$" all middle end)
7466 (string-append "add_unit" middle "\"cpp\"" end)))
7467 ;; Install the licence for Optizelle, without also
7468 ;; including the licences for the dependencies.
7469 (substitute* "licenses/CMakeLists.txt"
7470 (("file.*package.*$" all)
7471 (string-append "# " all))
7472 ((".*[^l].[.]txt\\)\n") "")
7473 (("add_license.*\"\n") ""))
7474 #t))))
7475 (build-system cmake-build-system)
7476 (arguments
7477 `(#:imported-modules ((guix build python-build-system)
7478 ,@%cmake-build-system-modules)
7479 #:modules (((guix build python-build-system) #:select
7480 (python-version))
7481 (guix build cmake-build-system)
7482 (guix build utils))
7483 #:configure-flags `("-DCMAKE_CXX_FLAGS:STRING=-pthread"
7484 "-DENABLE_CPP_UNIT:BOOL=ON"
7485 "-DENABLE_CPP_EXAMPLES:BOOL=ON"
7486 "-DENABLE_PYTHON:BOOL=ON"
7487 "-DENABLE_PYTHON_UNIT:BOOL=ON"
7488 "-DENABLE_PYTHON_EXAMPLES:BOOL=ON"
7489 ,(string-append "-DBLAS_LIBRARY:FILEPATH="
7490 (assoc-ref %build-inputs
7491 "blas/lapack")
7492 "/lib/libopenblas.so")
7493 ,(string-append "-DLAPACK_LIBRARY:FILEPATH="
7494 (assoc-ref %build-inputs
7495 "fortran:lib")
7496 "/lib/libgfortran.so;"
7497 (assoc-ref %build-inputs
7498 "fortran:lib")
7499 "/lib/libquadmath.so"))
7500 #:phases
7501 (modify-phases %standard-phases
7502 (add-after 'unpack 'set-numpy-path ; Needed for the unit tests.
7503 (lambda* (#:key inputs #:allow-other-keys)
7504 (let* ((pyver (python-version (assoc-ref inputs "python")))
7505 (npdir (string-append (assoc-ref inputs "numpy")
7506 "/lib/python" pyver
7507 "/site-packages")))
7508 (substitute* "src/cmake/Modules/Optizelle.cmake"
7509 (("PYTHONPATH=")
7510 (string-append "LD_LIBRARY_PATH=$ENV{LIBRARY_PATH};"
7511 "PYTHONPATH=" npdir ":"))))))
7512 (delete 'install-license-files)))) ; LICENSE.txt is installed.
7513 (inputs
7514 `(("blas/lapack" ,openblas)
7515 ("fortran:lib" ,gfortran "lib")
7516 ("jsoncpp" ,jsoncpp)
7517 ("numpy" ,python-numpy)
7518 ("python" ,python)))
7519 (native-inputs
7520 `(("fortran" ,gfortran)
7521 ("pkg-config" ,pkg-config)))
7522 (home-page "https://www.optimojoe.com/products/optizelle/")
7523 (synopsis "Mathematical optimization library")
7524 (description "@code{optizelle} is a software library designed to
7525 solve nonlinear optimization problems. Four types of problem are
7526 considered: unconstrained, equality constrained, inequality
7527 constrained and constrained. Constraints may be applied as values of
7528 functions or sets of partial differential equations (PDEs).
7529
7530 Solution algorithms such as the preconditioned nonlinear conjugate
7531 gradient method, sequential quadratic programming (SQP) and the
7532 primal-dual interior-point method are made available. Interfaces are
7533 provided for applications written in C++ and Python. Parallel
7534 computation is supported via MPI.")
7535 (license license:bsd-2))))