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