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