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