gnu: scotch, pt-scotch: Use modify-phases.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
CommitLineData
8f8b2451 1;;; GNU Guix --- Functional package management for GNU
12ed1216 2;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
da95c817 3;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
668c06ac 4;;; Copyright © 2014 John Darrington <jmd@gnu.org>
6c798540 5;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
df354a77 6;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
182d6311 7;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
865a69dd 8;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
32158110 9;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
9aafbc0c 10;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
8f8b2451
AE
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages maths)
ec322be2 28 #:use-module (ice-9 regex)
8f8b2451 29 #:use-module (gnu packages)
b5b73a82 30 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
31 #:use-module (guix packages)
32 #:use-module (guix download)
279663ef 33 #:use-module (guix svn-download)
0e2672ae 34 #:use-module (guix utils)
da95c817 35 #:use-module (guix build-system cmake)
c9dfa3c7 36 #:use-module (guix build-system gnu)
3de01d3f
EB
37 #:use-module (gnu packages algebra)
38 #:use-module (gnu packages bison)
e73b49fb 39 #:use-module (gnu packages check)
3de01d3f 40 #:use-module (gnu packages cmake)
c9dfa3c7 41 #:use-module (gnu packages compression)
668c06ac 42 #:use-module (gnu packages curl)
57e544e8 43 #:use-module (gnu packages elf)
3de01d3f 44 #:use-module (gnu packages flex)
668c06ac 45 #:use-module (gnu packages fltk)
f3929800 46 #:use-module (gnu packages fontutils)
1dba6407 47 #:use-module (gnu packages gettext)
da95c817 48 #:use-module (gnu packages gcc)
73fed4f8 49 #:use-module (gnu packages gd)
668c06ac 50 #:use-module (gnu packages ghostscript)
221ed17a 51 #:use-module (gnu packages glib)
f3929800 52 #:use-module (gnu packages gtk)
668c06ac 53 #:use-module (gnu packages less)
8731e527 54 #:use-module (gnu packages lisp)
5698b8b8 55 #:use-module (gnu packages gnome)
668c06ac
JD
56 #:use-module (gnu packages xorg)
57 #:use-module (gnu packages gl)
8731e527 58 #:use-module (gnu packages m4)
d8c7eeb9 59 #:use-module (gnu packages mpi)
b92eee75 60 #:use-module (gnu packages multiprecision)
668c06ac 61 #:use-module (gnu packages pcre)
5698b8b8 62 #:use-module (gnu packages popt)
c9dfa3c7
AE
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
da95c817 65 #:use-module (gnu packages python)
c9dfa3c7 66 #:use-module (gnu packages readline)
2742f87e 67 #:use-module (gnu packages tbb)
183e44ae 68 #:use-module (gnu packages tcsh)
df354a77 69 #:use-module (gnu packages tcl)
668c06ac 70 #:use-module (gnu packages texinfo)
73fed4f8 71 #:use-module (gnu packages texlive)
9aafbc0c 72 #:use-module (gnu packages wxwidgets)
c12efc72
AE
73 #:use-module (gnu packages xml)
74 #:use-module (gnu packages zip))
8f8b2451
AE
75
76(define-public units
77 (package
78 (name "units")
983815c8 79 (version "2.11")
8f8b2451
AE
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "mirror://gnu/units/units-" version
83 ".tar.gz"))
84 (sha256 (base32
983815c8 85 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
8f8b2451
AE
86 (build-system gnu-build-system)
87 (synopsis "Conversion between thousands of scales")
88 (description
574e86f9
LC
89 "GNU Units converts numeric quantities between units of measure. It
90can handle scale changes through adaptive usage of standard scale prefixes
91(micro-, kilo-, etc.). It can also handle nonlinear conversions such as
92Fahrenheit to Celsius. Its interpreter is powerful enough to be used
93effectively as a scientific calculator.")
8f8b2451
AE
94 (license license:gpl3+)
95 (home-page "http://www.gnu.org/software/units/")))
c9dfa3c7 96
61a529b4
RW
97(define-public double-conversion
98 (package
99 (name "double-conversion")
100 (version "1.1.5")
101 (source (origin
102 (method url-fetch)
103 (uri (string-append
104 "https://github.com/floitsch/double-conversion/archive/v"
105 version ".tar.gz"))
106 (file-name (string-append name "-" version ".tar.gz"))
107 (sha256
108 (base32
109 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
110 (build-system cmake-build-system)
111 (arguments
112 '(#:test-target "test"
113 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
114 "-DBUILD_TESTING=ON")))
115 (home-page "https://github.com/floitsch/double-conversion")
116 (synopsis "Conversion routines for IEEE doubles")
117 (description
118 "The double-conversion library provides binary-decimal and decimal-binary
119routines for IEEE doubles. The library consists of efficient conversion
120routines that have been extracted from the V8 JavaScript engine.")
121 (license license:bsd-3)))
122
182d6311
ML
123(define-public dionysus
124 (package
125 (name "dionysus")
126 (version "1.3.0")
127 (source (origin
128 (method url-fetch)
129 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
130 ".tar.gz"))
131 (sha256
132 (base32
133 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
134 (build-system gnu-build-system)
135 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
136 (synopsis "Local search for universal constants and scientific values")
137 (description
138 "GNU Dionysus is a convenient system for quickly retrieving the values of
139mathematical constants used in science and engineering. Values can be
140searched using a simple command-line tool, choosing from three databases:
141universal constants, atomic numbers, and constants related to
142semiconductors.")
143 (license license:gpl3+)
144 (home-page "http://www.gnu.org/software/dionysus/")))
145
88bd1804
AE
146(define-public gsl
147 (package
148 (name "gsl")
487da565 149 (version "1.16")
88bd1804
AE
150 (source
151 (origin
152 (method url-fetch)
153 (uri (string-append "mirror://gnu/gsl/gsl-"
154 version ".tar.gz"))
155 (sha256
156 (base32
180a93c7
MW
157 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))
158 (patches (map search-patch '("gsl-poly-test-fix-pt1.patch"
159 "gsl-poly-test-fix-pt2.patch")))))
88bd1804 160 (build-system gnu-build-system)
71e0f288 161 (arguments
487da565
AE
162 `(#:parallel-tests? #f
163 #:phases
71e0f288
AE
164 (alist-replace
165 'configure
166 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
167 (let ((configure (assoc-ref %standard-phases 'configure)))
168 ;; disable numerically unstable test on i686, see thread at
169 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
170 (if (string=? (or target system) "i686-linux")
171 (substitute* "ode-initval2/Makefile.in"
172 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
173 (apply configure args)))
174 %standard-phases)))
88bd1804
AE
175 (home-page "http://www.gnu.org/software/gsl/")
176 (synopsis "Numerical library for C and C++")
177 (description
a22dc0c4
LC
178 "The GNU Scientific Library is a library for numerical analysis in C
179and C++. It includes a wide range of mathematical routines, with over 1000
180functions in total. Subject areas covered by the library include:
181differential equations, linear algebra, Fast Fourier Transforms and random
182numbers.")
88bd1804
AE
183 (license license:gpl3+)))
184
b92eee75
AE
185(define-public glpk
186 (package
187 (name "glpk")
66fdf545 188 (version "4.55")
b92eee75
AE
189 (source
190 (origin
191 (method url-fetch)
192 (uri (string-append "mirror://gnu/glpk/glpk-"
193 version ".tar.gz"))
194 (sha256
195 (base32
66fdf545 196 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
b92eee75
AE
197 (build-system gnu-build-system)
198 (inputs
199 `(("gmp" ,gmp)))
200 (arguments
201 `(#:configure-flags '("--with-gmp")))
202 (home-page "http://www.gnu.org/software/glpk/")
79c311b8 203 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
204 (description
205 "GLPK is a C library for solving large-scale linear programming (LP),
206mixed integer programming (MIP), and other related problems. It supports the
207GNU MathProg modeling language, a subset of the AMPL language, and features a
208translator for the language. In addition to the C library, a stand-alone
209LP/MIP solver is included in the package.")
210 (license license:gpl3+)))
211
c9dfa3c7
AE
212(define-public pspp
213 (package
214 (name "pspp")
3dcd7810 215 (version "0.8.4")
c9dfa3c7
AE
216 (source
217 (origin
218 (method url-fetch)
219 (uri (string-append "mirror://gnu/pspp/pspp-"
220 version ".tar.gz"))
221 (sha256
222 (base32
3dcd7810 223 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
c9dfa3c7
AE
224 (build-system gnu-build-system)
225 (inputs
f3929800
AE
226 `(("cairo" ,cairo)
227 ("fontconfig" ,fontconfig)
1dba6407 228 ("gettext" ,gnu-gettext)
c9dfa3c7
AE
229 ("gsl" ,gsl)
230 ("libxml2" ,libxml2)
f3929800 231 ("pango" ,pango)
c9dfa3c7 232 ("readline" ,readline)
e6a5ce8e
JD
233 ("gtk" ,gtk+-2)
234 ("gtksourceview" ,gtksourceview)
c9dfa3c7
AE
235 ("zlib" ,zlib)))
236 (native-inputs
221ed17a
EB
237 `(("glib" ,glib "bin") ;for glib-genmarshal
238 ("perl" ,perl)
c9dfa3c7 239 ("pkg-config" ,pkg-config)))
c9dfa3c7
AE
240 (home-page "http://www.gnu.org/software/pspp/")
241 (synopsis "Statistical analysis")
242 (description
79c311b8 243 "GNU PSPP is a statistical analysis program. It can perform
c5779c93
LC
244descriptive statistics, T-tests, linear regression and non-parametric tests.
245It features both a graphical interface as well as command-line input. PSPP
246is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
247can be imported from spreadsheets, text files and database sources and it can
248be output in text, PostScript, PDF or HTML.")
c9dfa3c7 249 (license license:gpl3+)))
da95c817 250
865a69dd
RW
251(define-public arpack-ng
252 (package
253 (name "arpack-ng")
254 (version "3.2.0")
255 (source
256 (origin
257 (method url-fetch)
258 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
259 version ".tar.gz"))
f586c877 260 (file-name (string-append name "-" version ".tar.gz"))
865a69dd
RW
261 (sha256
262 (base32
263 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
264 (build-system gnu-build-system)
265 (home-page "https://github.com/opencollab/arpack-ng")
266 (inputs
267 `(("lapack" ,lapack)
19afbea1 268 ("fortran" ,gfortran)))
865a69dd
RW
269 (synopsis "Fortran subroutines for solving eigenvalue problems")
270 (description
271 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
272large scale eigenvalue problems.")
166191b3 273 (license (license:non-copyleft "file://COPYING"
865a69dd
RW
274 "See COPYING in the distribution."))))
275
da95c817
NK
276(define-public lapack
277 (package
278 (name "lapack")
566146ab 279 (version "3.5.0")
da95c817
NK
280 (source
281 (origin
282 (method url-fetch)
283 (uri (string-append "http://www.netlib.org/lapack/lapack-"
284 version ".tgz"))
285 (sha256
286 (base32
566146ab 287 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
da95c817
NK
288 (build-system cmake-build-system)
289 (home-page "http://www.netlib.org/lapack/")
19afbea1 290 (inputs `(("fortran" ,gfortran)
da95c817
NK
291 ("python" ,python-2)))
292 (arguments
06ed5982 293 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
da95c817 294 #:phases (alist-cons-before
6a995754
LC
295 'check 'patch-python
296 (lambda* (#:key inputs #:allow-other-keys)
297 (let ((python (assoc-ref inputs "python")))
298 (substitute* "lapack_testing.py"
299 (("/usr/bin/env python") python))))
06ed5982 300 %standard-phases)))
da95c817
NK
301 (synopsis "Library for numerical linear algebra")
302 (description
303 "LAPACK is a Fortran 90 library for solving the most commonly occurring
304problems in numerical linear algebra.")
166191b3 305 (license (license:non-copyleft "file://LICENSE"
da95c817 306 "See LICENSE in the distribution."))))
73fed4f8
JD
307
308(define-public gnuplot
309 (package
310 (name "gnuplot")
311 (version "4.6.3")
312 (source
313 (origin
314 (method url-fetch)
315 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
316 version "/gnuplot-" version ".tar.gz"))
317 (sha256
318 (base32
319 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
320 (build-system gnu-build-system)
321 (inputs `(("readline" ,readline)
322 ("cairo" ,cairo)
323 ("pango" ,pango)
324 ("gd" ,gd)))
325 (native-inputs `(("texlive" ,texlive)
326 ("pkg-config" ,pkg-config)))
327 (home-page "http://www.gnuplot.info")
328 (synopsis "Command-line driven graphing utility")
329 (description "Gnuplot is a portable command-line driven graphing
35b9e423 330utility. It was originally created to allow scientists and students to
73fed4f8 331visualize mathematical functions and data interactively, but has grown to
35b9e423 332support many non-interactive uses such as web scripting. It is also used as a
73fed4f8
JD
333plotting engine by third-party applications like Octave.")
334 ;; X11 Style with the additional restriction that derived works may only be
335 ;; distributed as patches to the original.
336 (license (license:fsf-free
668c06ac
JD
337 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
338
7ee3f1a2
JD
339(define-public hdf5
340 (package
341 (name "hdf5")
342 (version "1.8.12")
343 (source
344 (origin
345 (method url-fetch)
93c3de92
AE
346 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
347 version "/src/hdf5-"
7ee3f1a2
JD
348 version ".tar.bz2"))
349 (sha256
350 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
351 (build-system gnu-build-system)
12ed1216
AE
352 (inputs
353 `(("zlib" ,zlib)))
7ee3f1a2
JD
354 (arguments
355 `(#:phases
d4bf49b1
EB
356 (alist-cons-before
357 'configure 'patch-configure
358 (lambda _
359 (substitute* "configure"
360 (("/bin/mv") "mv")))
7ee3f1a2 361 %standard-phases)))
7ee3f1a2 362 (home-page "http://www.hdfgroup.org")
516e93f8 363 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
364 (description "HDF5 is a suite that makes possible the management of
365extremely large and complex data collections.")
d4bf49b1
EB
366 (license (license:x11-style
367 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2
JD
368
369
668c06ac
JD
370;; For a fully featured Octave, users are strongly recommended also to install
371;; the following packages: texinfo, less, ghostscript, gnuplot.
372(define-public octave
373 (package
374 (name "octave")
32158110 375 (version "3.8.2")
668c06ac
JD
376 (source
377 (origin
378 (method url-fetch)
379 (uri (string-append "mirror://gnu/octave/octave-"
380 version ".tar.gz"))
381 (sha256
382 (base32
32158110 383 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
668c06ac
JD
384 (build-system gnu-build-system)
385 (inputs
386 `(("lapack" ,lapack)
387 ("readline" ,readline)
388 ("glpk" ,glpk)
1ec78e9d
EB
389 ("fftw" ,fftw)
390 ("fftwf" ,fftwf)
391 ("arpack" ,arpack-ng)
668c06ac
JD
392 ("curl" ,curl)
393 ("pcre" ,pcre)
394 ("fltk" ,fltk)
395 ("fontconfig" ,fontconfig)
396 ("freetype" ,freetype)
40029cbe 397 ("hdf5" ,hdf5)
668c06ac
JD
398 ("libxft" ,libxft)
399 ("mesa" ,mesa)
1ec78e9d 400 ("glu" ,glu)
668c06ac
JD
401 ("zlib" ,zlib)))
402 (native-inputs
19afbea1 403 `(("gfortran" ,gfortran)
668c06ac
JD
404 ("pkg-config" ,pkg-config)
405 ("perl" ,perl)
1ec78e9d
EB
406 ;; The following inputs are not actually used in the build process.
407 ;; However, the ./configure gratuitously tests for their existence and
408 ;; assumes that programs not present at build time are also not, and
409 ;; can never be, available at run time! If these inputs are therefore
410 ;; not present, support for them will be built out. However, Octave
411 ;; will still run without them, albeit without the features they
668c06ac
JD
412 ;; provide.
413 ("less" ,less)
414 ("texinfo" ,texinfo)
415 ("ghostscript" ,ghostscript)
416 ("gnuplot" ,gnuplot)))
417 (arguments
418 `(#:configure-flags (list (string-append "--with-shell="
419 (assoc-ref %build-inputs "bash")
420 "/bin/sh"))))
421 (home-page "http://www.gnu.org/software/octave/")
422 (synopsis "High-level language for numerical computation")
1ec78e9d
EB
423 (description "GNU Octave is a high-level interpreted language that is
424specialized for numerical computations. It can be used for both linear and
425non-linear applications and it provides great support for visualizing results.
426Work may be performed both at the interactive command-line as well as via
427script files.")
668c06ac 428 (license license:gpl3+)))
3de01d3f
EB
429
430(define-public gmsh
431 (package
432 (name "gmsh")
433 (version "2.8.4")
434 (source
435 (origin
436 (method url-fetch)
437 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
438 version "-source.tgz"))
439 (sha256
440 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
441 (modules '((guix build utils)))
442 (snippet
443 ;; Remove non-free METIS code
444 '(delete-file-recursively "contrib/Metis"))))
445 (build-system cmake-build-system)
3de01d3f
EB
446 (propagated-inputs
447 `(("fltk" ,fltk)
19afbea1 448 ("gfortran" ,gfortran)
3de01d3f 449 ("gmp" ,gmp)
40029cbe 450 ("hdf5" ,hdf5)
3de01d3f
EB
451 ("lapack" ,lapack)
452 ("mesa" ,mesa)
85f41902 453 ("glu" ,glu)
3de01d3f
EB
454 ("libx11" ,libx11)
455 ("libxext" ,libxext)))
456 (arguments
457 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
458 "-DENABLE_BUILD_SHARED:BOOL=ON"
459 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
460 (home-page "http://www.geuz.org/gmsh/")
461 (synopsis "3D finite element grid generator")
edf684ef
EB
462 (description "Gmsh is a 3D finite element grid generator with a built-in
463CAD engine and post-processor. Its design goal is to provide a fast, light
464and user-friendly meshing tool with parametric input and advanced
465visualization capabilities. Gmsh is built around four modules: geometry,
466mesh, solver and post-processing. The specification of any input to these
467modules is done either interactively using the graphical user interface or in
468ASCII text files using Gmsh's own scripting language.")
3de01d3f 469 (license license:gpl2+)))
b9100e2f
EB
470
471(define-public petsc
472 (package
473 (name "petsc")
474 (version "3.4.4")
475 (source
476 (origin
477 (method url-fetch)
478 ;; The *-lite-* tarball does not contain the *large* documentation
479 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
480 "petsc-lite-" version ".tar.gz"))
481 (sha256
482 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
483 (patches
484 (list (search-patch "petsc-fix-threadcomm.patch")))))
485 (build-system gnu-build-system)
486 (native-inputs
487 `(("python" ,python-2)
488 ("perl" ,perl)))
489 (inputs
19afbea1 490 `(("gfortran" ,gfortran)
b9100e2f 491 ("lapack" ,lapack)
f258212d 492 ("superlu" ,superlu)
b9100e2f
EB
493 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
494 ;; leaving out opengl, as configuration seems to only be for mac
495 ))
496 (arguments
497 `(#:test-target "test"
498 #:parallel-build? #f
499 #:configure-flags
500 `("--with-mpi=0"
f258212d
EB
501 "--with-openmp=1"
502 "--with-superlu=1"
503 ,(string-append "--with-superlu-include="
504 (assoc-ref %build-inputs "superlu") "/include")
505 ,(string-append "--with-superlu-lib="
506 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
b9100e2f
EB
507 #:phases
508 (alist-replace
509 'configure
510 ;; PETSc's configure script is actually a python script, so we can't
511 ;; run it with bash.
512 (lambda* (#:key outputs (configure-flags '())
513 #:allow-other-keys)
514 (let* ((prefix (assoc-ref outputs "out"))
515 (flags `(,(string-append "--prefix=" prefix)
516 ,@configure-flags)))
517 (format #t "build directory: ~s~%" (getcwd))
518 (format #t "configure flags: ~s~%" flags)
519 (zero? (apply system* "./configure" flags))))
520 (alist-cons-after
10b11968
EB
521 'configure 'clean-local-references
522 ;; Try to keep build directory names from leaking into compiled code
b9100e2f 523 (lambda* (#:key inputs outputs #:allow-other-keys)
10b11968
EB
524 (let ((out (assoc-ref outputs "out")))
525 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
526 (((getcwd)) out))))
527 (alist-cons-after
528 'install 'clean-install
529 ;; Try to keep installed files from leaking build directory names.
530 (lambda* (#:key inputs outputs #:allow-other-keys)
531 (let ((out (assoc-ref outputs "out"))
532 (fortran (assoc-ref inputs "gfortran")))
533 (substitute* (map (lambda (file)
534 (string-append out "/" file))
535 '("conf/petscvariables"
536 "conf/PETScConfig.cmake"))
537 (((getcwd)) out))
538 ;; Make compiler references point to the store
539 (substitute* (string-append out "/conf/petscvariables")
540 (("= g(cc|\\+\\+|fortran)" _ suffix)
541 (string-append "= " fortran "/bin/g" suffix)))
542 ;; PETSc installs some build logs, which aren't necessary.
543 (for-each (lambda (file)
544 (let ((f (string-append out "/" file)))
545 (when (file-exists? f)
546 (delete-file f))))
547 '("conf/configure.log"
548 "conf/make.log"
549 "conf/test.log"
550 "conf/error.log"
551 "conf/RDict.db"
552 ;; Once installed, should uninstall with Guix
553 "conf/uninstall.py"))))
554 %standard-phases)))))
b9100e2f 555 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 556 (synopsis "Library to solve PDEs")
b9100e2f
EB
557 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
558data structures and routines for the scalable (parallel) solution of
559scientific applications modeled by partial differential equations.")
166191b3 560 (license (license:non-copyleft
b9100e2f
EB
561 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
562
563(define-public petsc-complex
564 (package (inherit petsc)
565 (name "petsc-complex")
566 (arguments
567 (substitute-keyword-arguments (package-arguments petsc)
568 ((#:configure-flags cf)
569 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 570 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 571
d8c7eeb9
EB
572(define-public petsc-openmpi
573 (package (inherit petsc)
574 (name "petsc-openmpi")
575 (inputs
576 `(("openmpi" ,openmpi)
577 ,@(package-inputs petsc)))
578 (arguments
579 (substitute-keyword-arguments (package-arguments petsc)
580 ((#:configure-flags cf)
581 ``("--with-mpiexec=mpirun"
582 ,(string-append "--with-mpi-dir="
583 (assoc-ref %build-inputs "openmpi"))
584 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 585 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
586
587(define-public petsc-complex-openmpi
588 (package (inherit petsc-complex)
589 (name "petsc-complex-openmpi")
590 (inputs
591 `(("openmpi" ,openmpi)
592 ,@(package-inputs petsc-complex)))
593 (arguments
594 (substitute-keyword-arguments (package-arguments petsc-complex)
595 ((#:configure-flags cf)
596 ``("--with-mpiexec=mpirun"
597 ,(string-append "--with-mpi-dir="
598 (assoc-ref %build-inputs "openmpi"))
599 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 600 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 601
183e44ae
EB
602(define-public superlu
603 (package
604 (name "superlu")
605 (version "4.3")
606 (source
607 (origin
608 (method url-fetch)
609 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
610 "superlu_" version ".tar.gz"))
611 (sha256
612 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
613 (build-system gnu-build-system)
614 (native-inputs
615 `(("tcsh" ,tcsh)))
616 (inputs
617 `(("lapack" ,lapack)
19afbea1 618 ("gfortran" ,gfortran)))
183e44ae
EB
619 (arguments
620 `(#:parallel-build? #f
621 #:tests? #f ;tests are run as part of `make all`
622 #:phases
623 (alist-replace
624 'configure
625 (lambda* (#:key inputs outputs #:allow-other-keys)
626 (call-with-output-file "make.inc"
627 (lambda (port)
628 (format port "
629PLAT =
630SuperLUroot = ~a
631SUPERLULIB = ~a/lib/libsuperlu.a
632TMGLIB = libtmglib.a
633BLASDEF = -DUSE_VENDOR_BLAS
634BLASLIB = -L~a/lib -lblas
635LIBS = $(SUPERLULIB) $(BLASLIB)
636ARCH = ar
637ARCHFLAGS = cr
638RANLIB = ranlib
639CC = gcc
640PIC = -fPIC
641CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
642NOOPTS = -O0 $(PIC)
643FORTRAN = gfortran
644FFLAGS = -O2 $(PIC)
645LOADER = $(CC)
646CDEFS = -DAdd_"
647 (getcwd)
648 (assoc-ref outputs "out")
649 (assoc-ref inputs "lapack")))))
650 (alist-cons-before
651 'build 'create-install-directories
652 (lambda* (#:key outputs #:allow-other-keys)
653 (for-each
654 (lambda (dir)
655 (mkdir-p (string-append (assoc-ref outputs "out")
656 "/" dir)))
657 '("lib" "include")))
658 (alist-replace
659 'install
660 (lambda* (#:key outputs #:allow-other-keys)
661 ;; Library is placed in lib during the build phase. Copy over
662 ;; headers to include.
663 (let* ((out (assoc-ref outputs "out"))
664 (incdir (string-append out "/include")))
665 (for-each (lambda (file)
666 (let ((base (basename file)))
667 (format #t "installing `~a' to `~a'~%"
668 base incdir)
669 (copy-file file
670 (string-append incdir "/" base))))
671 (find-files "SRC" ".*\\.h$"))))
672 %standard-phases)))))
673 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
674 (synopsis "Supernodal direct solver for sparse linear systems")
675 (description
676 "SuperLU is a general purpose library for the direct solution of large,
677sparse, nonsymmetric systems of linear equations on high performance machines.
678The library is written in C and is callable from either C or Fortran. The
679library routines perform an LU decomposition with partial pivoting and
680triangular system solves through forward and back substitution. The library
681also provides threshold-based ILU factorization preconditioners.")
682 (license license:bsd-3)))
f8ed036a 683
a54aefea
EB
684(define-public superlu-dist
685 (package
686 (name "superlu-dist")
687 (version "3.3")
688 (source
689 (origin
690 (method url-fetch)
691 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
692 "superlu_dist_" version ".tar.gz"))
693 (sha256
694 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
695 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
696 (build-system gnu-build-system)
697 (native-inputs
698 `(("tcsh" ,tcsh)))
699 (inputs
19afbea1 700 `(("gfortran" ,gfortran)))
a54aefea
EB
701 (propagated-inputs
702 `(("openmpi" ,openmpi) ;headers include MPI heades
703 ("lapack" ,lapack) ;required to link with output library
704 ("pt-scotch" ,pt-scotch))) ;same
705 (arguments
706 `(#:parallel-build? #f ;race conditions using ar
707 #:phases
708 (alist-replace
709 'configure
710 (lambda* (#:key inputs outputs #:allow-other-keys)
711 (call-with-output-file "make.inc"
712 (lambda (port)
713 (format port "
714PLAT =
715DSuperLUroot = ~a
716DSUPERLULIB = ~a/lib/libsuperlu_dist.a
717BLASDEF = -DUSE_VENDOR_BLAS
718BLASLIB = -L~a/lib -lblas
719PARMETISLIB = -L~a/lib \
720 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
721 -lscotch -lscotcherr -lscotcherrexit
722METISLIB = -L~:*~a/lib \
723 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
724LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
725ARCH = ar
726ARCHFLAGS = cr
727RANLIB = ranlib
728CC = mpicc
729PIC = -fPIC
730CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
731NOOPTS = -O0 -g $(PIC)
732FORTRAN = mpifort
733FFLAGS = -O2 -g $(PIC)
734LOADER = $(CC)
735CDEFS = -DAdd_"
736 (getcwd)
737 (assoc-ref outputs "out")
738 (assoc-ref inputs "lapack")
739 (assoc-ref inputs "pt-scotch")))))
740 (alist-cons-after
741 'unpack 'remove-broken-symlinks
742 (lambda _
743 (for-each delete-file
744 (find-files "MAKE_INC" "\\.#make\\..*")))
745 (alist-cons-before
746 'build 'create-install-directories
747 (lambda* (#:key outputs #:allow-other-keys)
748 (for-each
749 (lambda (dir)
750 (mkdir-p (string-append (assoc-ref outputs "out")
751 "/" dir)))
752 '("lib" "include")))
753 (alist-replace
754 'check
755 (lambda _
756 (with-directory-excursion "EXAMPLE"
757 (and
758 (zero? (system* "mpirun" "-n" "2"
759 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
760 (zero? (system* "mpirun" "-n" "2"
761 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
762 (alist-replace
763 'install
764 (lambda* (#:key outputs #:allow-other-keys)
765 ;; Library is placed in lib during the build phase. Copy over
766 ;; headers to include.
767 (let* ((out (assoc-ref outputs "out"))
768 (incdir (string-append out "/include")))
769 (for-each (lambda (file)
770 (let ((base (basename file)))
771 (format #t "installing `~a' to `~a'~%"
772 base incdir)
773 (copy-file file
774 (string-append incdir "/" base))))
775 (find-files "SRC" ".*\\.h$"))))
776 %standard-phases)))))))
777 (home-page (package-home-page superlu))
778 (synopsis "Parallel supernodal direct solver")
779 (description
780 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
781It is targeted for distributed memory parallel machines. SuperLU_DIST is
782implemented in ANSI C, and MPI for communications.")
783 (license license:bsd-3)))
784
f8ed036a
EB
785(define-public scotch
786 (package
787 (name "scotch")
6c798540 788 (version "6.0.4")
f8ed036a
EB
789 (source
790 (origin
791 (method url-fetch)
6c798540 792 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
f8ed036a
EB
793 "scotch_" version ".tar.gz"))
794 (sha256
6c798540
EB
795 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
796 (patches (list (search-patch "scotch-test-threading.patch")
797 (search-patch "pt-scotch-build-parallelism.patch")))))
f8ed036a
EB
798 (build-system gnu-build-system)
799 (inputs
800 `(("zlib" ,zlib)
801 ("flex" ,flex)
802 ("bison" ,bison)))
803 (arguments
804 `(#:phases
d6602ee9
EB
805 (modify-phases %standard-phases
806 (add-after
807 'unpack 'chdir-to-src
808 (lambda _ (chdir "src")))
809 (replace
810 'configure
811 (lambda _
812 (call-with-output-file "Makefile.inc"
813 (lambda (port)
814 (format port "
f8ed036a
EB
815EXE =
816LIB = .a
817OBJ = .o
818MAKE = make
819AR = ar
820ARFLAGS = -ruv
821CCS = gcc
822CCP = mpicc
823CCD = gcc
824CPPFLAGS =~{ -D~a~}
6c798540 825CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
f8ed036a
EB
826LDFLAGS = -lz -lm -lrt -lpthread
827CP = cp
828LEX = flex -Pscotchyy -olex.yy.c
829LN = ln
830MKDIR = mkdir
831MV = mv
832RANLIB = ranlib
833YACC = bison -pscotchyy -y -b y
834"
d6602ee9
EB
835 '("COMMON_FILE_COMPRESS_GZ"
836 "COMMON_PTHREAD"
837 "COMMON_RANDOM_FIXED_SEED"
838 ;; XXX: Causes invalid frees in superlu-dist tests
839 ;; "SCOTCH_PTHREAD"
840 ;; "SCOTCH_PTHREAD_NUMBER=2"
841 "restrict=__restrict"))))))
842 (replace
f8ed036a
EB
843 'install
844 (lambda* (#:key outputs #:allow-other-keys)
845 (let ((out (assoc-ref outputs "out")))
846 (mkdir out)
847 (zero? (system* "make"
848 (string-append "prefix=" out)
d6602ee9 849 "install"))))))))
f8ed036a
EB
850 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
851 (synopsis "Programs and libraries for graph algorithms")
852 (description "SCOTCH is a set of programs and libraries which implement
853the static mapping and sparse matrix reordering algorithms developed within
854the SCOTCH project. Its purpose is to apply graph theory, with a divide and
855conquer approach, to scientific computing problems such as graph and mesh
856partitioning, static mapping, and sparse matrix ordering, in application
857domains ranging from structural mechanics to operating systems or
858bio-chemistry.")
859 ;; See LICENSE_en.txt
860 (license license:cecill-c)))
6acb4adb
EB
861
862(define-public pt-scotch
863 (package (inherit scotch)
864 (name "pt-scotch")
865 (propagated-inputs
866 `(("openmpi" ,openmpi))) ;Headers include MPI headers
867 (arguments
868 (substitute-keyword-arguments (package-arguments scotch)
869 ((#:phases scotch-phases)
d6602ee9
EB
870 `(modify-phases ,scotch-phases
871 (replace
872 'build
873 ;; TODO: Would like to add parallelism here
874 (lambda _
875 (and
876 (zero? (system* "make" "ptscotch"))
877 ;; Install the serial metis compatibility library
878 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
879 (replace
880 'check
881 (lambda _ (zero? (system* "make" "ptcheck"))))))))
6acb4adb 882 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8
JD
883
884(define-public gsegrafix
885 (package
886 (name "gsegrafix")
887 (version "1.0.6")
888 (source
889 (origin
890 (method url-fetch)
891 (uri (string-append "mirror://gnu/" name "/" name "-"
892 version ".tar.gz"))
893 (sha256
894 (base32
895 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
896 (build-system gnu-build-system)
897 (arguments
898 `(#:configure-flags '("LDFLAGS=-lm")))
899 (inputs
900 `(("libgnomecanvas" ,libgnomecanvas)
901 ("libbonoboui" ,libbonoboui)
902 ("libgnomeui" ,libgnomeui)
903 ("libgnomeprintui" ,libgnomeprintui)
904 ("popt" ,popt)))
905 (native-inputs
906 `(("pkg-config" ,pkg-config)))
907 (home-page "http://www.gnu.org/software/gsegrafix/")
908 (synopsis "GNOME application to create scientific and engineering plots")
909 (description "GSEGrafix is an application which produces high-quality graphical
910plots for science and engineering. Plots are specified via simple ASCII
911parameter files and data files and are presented in an anti-aliased GNOME
912canvas. The program supports rectangular two-dimensional plots, histograms,
913polar-axis plots and three-dimensional plots. Plots can be printed or saved
914to BMP, JPEG or PNG image formats.")
915 (license license:gpl3+)))
8731e527
JD
916
917(define-public maxima
918 (package
919 (name "maxima")
77af7b24 920 (version "5.36.1")
8731e527
JD
921 (source
922 (origin
923 (method url-fetch)
924 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
925 version "-source/" name "-" version ".tar.gz"))
926 (sha256
927 (base32
77af7b24
MW
928 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
929 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
8731e527 930 (build-system gnu-build-system)
df354a77
FB
931 (inputs
932 `(("gcl" ,gcl)
933 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 934 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
935 (native-inputs
936 `(("texinfo" ,texinfo)
937 ("perl" ,perl)))
8731e527 938 (arguments
df354a77
FB
939 `(#:configure-flags
940 (list "--enable-gcl"
941 (string-append "--with-posix-shell="
942 (assoc-ref %build-inputs "bash")
943 "/bin/sh")
944 (string-append "--with-wish="
945 (assoc-ref %build-inputs "tk")
946 "/bin/wish"
947 (let ((v ,(package-version tk)))
948 (string-take v (string-index-right v #\.)))))
df354a77 949 ;; By default Maxima attempts to write temporary files to
77af7b24
MW
950 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
951 ;; Work around that.
df354a77 952 #:make-flags (list "TMPDIR=/tmp")
df354a77 953 #:phases (alist-cons-before
8731e527 954 'check 'pre-check
df354a77 955 (lambda _
8731e527 956 (chmod "src/maxima" #o555))
f36afe4d
FB
957 ;; Make sure the doc and emacs files are found in the
958 ;; standard location. Also configure maxima to find gnuplot
959 ;; without having it on the PATH.
960 (alist-cons-after
961 'install 'post-install
962 (lambda* (#:key outputs inputs #:allow-other-keys)
963 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
964 (out (assoc-ref outputs "out"))
965 (datadir (string-append out "/share/maxima/" ,version)))
966 (with-directory-excursion out
967 (mkdir-p "share/emacs")
968 (mkdir-p "share/doc")
969 (symlink
970 (string-append datadir "/emacs/")
971 (string-append out "/share/emacs/site-lisp"))
972 (symlink
973 (string-append datadir "/doc/")
974 (string-append out "/share/doc/maxima"))
975 (with-atomic-file-replacement
976 (string-append datadir "/share/maxima-init.lisp")
977 (lambda (in out)
978 (format out "~a ~s~a~%"
979 "(setf $gnuplot_command "
980 (string-append gnuplot "/bin/gnuplot") ")")
981 (dump-port in out))))))
982 %standard-phases))))
8731e527
JD
983 (home-page "http://maxima.sourceforge.net")
984 (synopsis "Numeric and symbolic expression manipulation")
985 (description "Maxima is a system for the manipulation of symbolic and
986numerical expressions. It yields high precision numeric results by using
987exact fractions, arbitrary precision integers, and variable precision floating
988point numbers")
989 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
990 ;; Others simply say "GNU General Public License" without stating a
991 ;; version (which implicitly means gpl1+).
992 ;; At least one file (src/maxima.asd) says "version 2."
993 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 994 (license license:gpl2)))
ec322be2 995
9aafbc0c
MW
996(define-public wxmaxima
997 (package
998 (name "wxmaxima")
999 (version "15.04.0")
1000 (source
1001 (origin
1002 (method url-fetch)
1003 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1004 version "/" name "-" version ".tar.gz"))
1005 (sha256
1006 (base32
1007 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1008 (build-system gnu-build-system)
1009 (inputs
1010 `(("wxwidgets" ,wxwidgets)
1011 ("maxima" ,maxima)))
1012 (arguments
1013 `(#:phases (modify-phases %standard-phases
1014 (add-after
1015 'install 'wrap-program
1016 (lambda* (#:key inputs outputs #:allow-other-keys)
1017 (wrap-program (string-append (assoc-ref outputs "out")
1018 "/bin/wxmaxima")
1019 `("PATH" ":" prefix
1020 (,(string-append (assoc-ref inputs "maxima")
1021 "/bin"))))
1022 #t)))))
1023 (home-page "https://andrejv.github.io/wxmaxima/")
1024 (synopsis "Graphical user interface for the Maxima computer algebra system")
1025 (description
1026 "wxMaxima is a graphical user interface for the Maxima computer algebra
1027system. It eases the use of Maxima by making most of its commands available
1028through a menu system and by providing input dialogs for commands that require
1029more than one argument. It also implements its own display engine that
1030outputs mathematical symbols directly instead of depicting them with ASCII
1031characters.
1032
1033wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1034text and mathematical calculations to create documents, exporting of input and
1035output to TeX, and a browser for Maxima's manual including command index and
1036full text searching.")
1037 (license license:gpl2+)))
1038
279663ef
RW
1039(define-public muparser
1040 (package
1041 (name "muparser")
1042 (version "2.2.5")
1043 (source
1044 (origin
1045 (method svn-fetch)
1046 (uri (svn-reference
1047 (url "http://muparser.googlecode.com/svn/trunk/")
1048 (revision 34)))
1049 (sha256
1050 (base32
1051 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1052 (build-system gnu-build-system)
1053 (arguments
1054 `(#:configure-flags '("--enable-samples=no")
1055 #:tests? #f)) ;no "check" target
1056 (home-page "http://muparser.beltoforion.de/")
1057 (synopsis "Fast parser library for mathematical expressions")
1058 (description
1059 "muParser is an extensible high performance math parser library. It is
1060based on transforming an expression into a bytecode and precalculating
1061constant parts of it.")
1062 (license license:expat)))
1063
e73b49fb
RW
1064(define-public openblas
1065 (package
1066 (name "openblas")
ecf28847 1067 (version "0.2.14")
e73b49fb
RW
1068 (source
1069 (origin
1070 (method url-fetch)
1071 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1072 version))
1073 (file-name (string-append name "-" version ".tar.gz"))
1074 (sha256
1075 (base32
ecf28847 1076 "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))))
e73b49fb
RW
1077 (build-system gnu-build-system)
1078 (arguments
5b5ea159
RW
1079 `(#:tests? #f ;no "check" target
1080 ;; DYNAMIC_ARCH is not supported on MIPS. When it is disabled,
1081 ;; OpenBLAS will tune itself to the build host, so we need to disable
1082 ;; substitutions.
1083 #:substitutable? ,(not (string-prefix? "mips" (%current-system)))
e73b49fb
RW
1084 #:make-flags
1085 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1086 "SHELL=bash"
af5b817e
RW
1087 "NO_LAPACK=1"
1088 ;; Build the library for all supported CPUs. This allows
1089 ;; switching CPU targets at runtime with the environment variable
1090 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
5b5ea159
RW
1091 ;; Unfortunately, this is not supported on MIPS.
1092 ,@(if (string-prefix? "mips" (%current-system))
1093 '()
1094 '("DYNAMIC_ARCH=1")))
e73b49fb
RW
1095 ;; no configure script
1096 #:phases (alist-delete 'configure %standard-phases)))
1097 (inputs
19afbea1 1098 `(("fortran" ,gfortran)))
e73b49fb
RW
1099 (native-inputs
1100 `(("cunit" ,cunit)
1101 ("perl" ,perl)))
1102 (home-page "http://www.openblas.net/")
1103 (synopsis "Optimized BLAS library based on GotoBLAS")
1104 (description
1105 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1106 (license license:bsd-3)))
1107
e1605e36
RW
1108(define-public openlibm
1109 (package
1110 (name "openlibm")
1111 (version "0.4.1")
1112 (source
1113 (origin
1114 (method url-fetch)
1115 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1116 version ".tar.gz"))
1117 (file-name (string-append name "-" version ".tar.gz"))
1118 (sha256
1119 (base32
1120 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1121 (build-system gnu-build-system)
1122 (arguments
1123 `(#:make-flags
1124 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1125 #:phases
1126 ;; no configure script
1127 (alist-delete 'configure %standard-phases)
1128 #:tests? #f)) ;the tests are part of the default target
1129 (home-page "http://openlibm.org/")
1130 (synopsis "Portable C mathematical library (libm)")
1131 (description
1132 "OpenLibm is an effort to have a high quality, portable, standalone C
1133mathematical library (libm). It can be used standalone in applications and
1134programming language implementations. The project was born out of a need to
1135have a good libm for the Julia programming langage that worked consistently
1136across compilers and operating systems, and in 32-bit and 64-bit
1137environments.")
1138 ;; See LICENSE.md for details.
1139 (license (list license:expat
1140 license:isc
1141 license:bsd-2
1142 license:public-domain
1143 license:lgpl2.1+))))
1144
e62be58f
RW
1145(define-public openspecfun
1146 (package
1147 (name "openspecfun")
1148 (version "0.4")
1149 (source
1150 (origin
1151 (method url-fetch)
1152 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1153 version ".tar.gz"))
1154 (file-name (string-append name "-" version ".tar.gz"))
1155 (sha256
1156 (base32
1157 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1158 (build-system gnu-build-system)
1159 (arguments
1160 '(#:tests? #f ;no "check" target
1161 #:make-flags
1162 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1163 ;; no configure script
1164 #:phases (alist-delete 'configure %standard-phases)))
1165 (inputs
19afbea1 1166 `(("fortran" ,gfortran)))
e62be58f
RW
1167 (home-page "https://github.com/JuliaLang/openspecfun")
1168 (synopsis "Collection of special mathematical functions")
1169 (description
1170 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1171portable package for Bessel Functions of a Complex Argument and Nonnegative
1172Order; it contains subroutines for computing Bessel functions and Airy
1173functions. Faddeeva allows computing the various error functions of arbitrary
1174complex arguments (Faddeeva function, error function, complementary error
1175function, scaled complementary error function, imaginary error function, and
1176Dawson function); given these, one can also easily compute Voigt functions,
1177Fresnel integrals, and similar related functions as well.")
1178 ;; Faddeeva is released under the Expat license; AMOS is included as
1179 ;; public domain software.
1180 (license (list license:expat license:public-domain))))
1181
2742f87e
RW
1182(define-public suitesparse
1183 (package
1184 (name "suitesparse")
1185 (version "4.4.3")
1186 (source
1187 (origin
1188 (method url-fetch)
1189 (uri (string-append
1190 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1191 version ".tar.gz"))
1192 (sha256
1193 (base32
1194 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1195 (build-system gnu-build-system)
1196 (arguments
1197 '(#:parallel-build? #f ;cholmod build fails otherwise
1198 #:tests? #f ;no "check" target
1199 #:make-flags
1200 (list "CC=gcc"
1201 "BLAS=-lblas"
1202 "TBB=-ltbb"
1203 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1204 (string-append "INSTALL_LIB="
1205 (assoc-ref %outputs "out") "/lib")
1206 (string-append "INSTALL_INCLUDE="
1207 (assoc-ref %outputs "out") "/include"))
1208 #:phases
1209 (alist-cons-before
1210 'install 'prepare-out
1211 ;; README.txt states that the target directories must exist prior to
1212 ;; running "make install".
1213 (lambda _
1214 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1215 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1216 ;; no configure script
1217 (alist-delete 'configure %standard-phases))))
1218 (inputs
1219 `(("tbb" ,tbb)
1220 ("lapack" ,lapack)))
1221 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1222 (synopsis "Suite of sparse matrix software")
1223 (description
1224 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1225multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1226multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1227simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1228CXSparse, a concise sparse Cholesky factorization package; and many other
1229packages.")
1230 ;; LGPLv2.1+:
1231 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1232 ;; GPLv2+:
1233 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1234 (license (list license:gpl2+ license:lgpl2.1+))))
1235
ec322be2
FB
1236(define-public atlas
1237 (package
1238 (name "atlas")
1239 (version "3.10.2")
1240 (source (origin
1241 (method url-fetch)
1242 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1243 version ".tar.bz2"))
1244 (sha256
1245 (base32
1246 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1247 (build-system gnu-build-system)
1248 (home-page "http://math-atlas.sourceforge.net/")
19afbea1 1249 (inputs `(("gfortran" ,gfortran)
ec322be2
FB
1250 ("lapack-tar" ,(package-source lapack))))
1251 (outputs '("out" "doc"))
01480b9e
FB
1252 ;; For the moment we drop support for MIPS at it fails to compile. See
1253 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1254 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
1255 (arguments
1256 `(#:parallel-build? #f
1257 #:parallel-tests? #f
f15615b1
LC
1258
1259 ;; ATLAS tunes itself for the machine it is built on, as explained at
1260 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1261 ;; For this reason, we want users to build it locally instead of using
1262 ;; substitutes.
1263 #:substitutable? #f
1264
ec322be2
FB
1265 #:modules ((srfi srfi-26)
1266 (srfi srfi-1)
1267 (guix build gnu-build-system)
1268 (guix build utils))
40029cbe 1269 #:configure-flags
ec322be2
FB
1270 `(;; Generate position independent code suitable for dynamic libraries
1271 ;; and use WALL timer to get more accurate timing.
1272 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1273 ;; Set word width.
1274 "-b"
1275 ,,(if (string-match "64" (%current-system))
1276 "64"
1277 "32")
1278 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1279 ;; needed to compile C files before it is generated.
1280 "-Ss" "pmake" "make -j 1"
af89a667
FB
1281 ;; Probe is failing for MIPS. We therefore define the system
1282 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1283 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1284 ,,@(if (string-prefix? "mips" (%current-system))
1285 (list "-A" "49" "-V" "1")
1286 (list))
ec322be2
FB
1287 ;; Generate shared libraries.
1288 "--shared"
1289 ;; Build a full LAPACK library.
1290 ,(string-append "--with-netlib-lapack-tarfile="
1291 (assoc-ref %build-inputs "lapack-tar")))
1292 #:phases
1293 (alist-cons-after
1294 'install 'install-doc
1295 (lambda* (#:key outputs inputs #:allow-other-keys)
40029cbe 1296 (let ((doc (string-append (assoc-ref outputs "doc")
ec322be2
FB
1297 "/share/doc/atlas")))
1298 (mkdir-p doc)
40029cbe 1299 (fold (lambda (file previous)
ec322be2
FB
1300 (and previous (zero? (system* "cp" file doc))))
1301 #t (find-files "../ATLAS/doc" ".*"))))
1302 (alist-cons-after
1303 'check 'check-pt
1304 (lambda _ (zero? (system* "make" "ptcheck")))
1305 ;; Fix files required to run configure.
1306 (alist-cons-before
1307 'configure 'fix-/bin/sh
1308 (lambda _
1309 ;; Use `sh', not `/bin/sh'.
1310 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1311 (("/bin/sh")
1312 "sh")))
1313 ;; Fix /bin/sh in generated make files.
1314 (alist-cons-after
1315 'configure 'fix-/bin/sh-in-generated-files
1316 (lambda _
1317 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1318 (("/bin/sh")
1319 "sh")))
1320 ;; ATLAS configure program does not accepts the default flags
1321 ;; passed by the 'gnu-build-system'.
1322 (alist-replace
1323 'configure
1324 (lambda* (#:key native-inputs inputs outputs
1325 (configure-flags '())
1326 #:allow-other-keys #:rest args)
1327 (let* ((prefix (assoc-ref outputs "out"))
1328 (bash (or (and=> (assoc-ref
1329 (or native-inputs inputs) "bash")
1330 (cut string-append <> "/bin/bash"))
1331 "/bin/sh"))
1332 (flags `(,(string-append "--prefix=" prefix)
1333 ,@configure-flags))
1334 (abs-srcdir (getcwd))
1335 (srcdir (string-append "../" (basename abs-srcdir))))
1336 (format #t "source directory: ~s (relative from build: ~s)~%"
1337 abs-srcdir srcdir)
1338 (mkdir "../build")
1339 (chdir "../build")
1340 (format #t "build directory: ~s~%" (getcwd))
1341 (format #t "configure flags: ~s~%" flags)
1342 (zero? (apply system* bash
1343 (string-append srcdir "/configure")
1344 flags))))
1345 %standard-phases)))))))
1346 (synopsis "Automatically Tuned Linear Algebra Software")
1347 (description
1348 "ATLAS is an automatically tuned linear algebra software library
1349providing C and Fortran77 interfaces to a portably efficient BLAS
1350implementation, as well as a few routines from LAPACK.
1351
f15615b1
LC
1352Optimization occurs at build time. For this reason, the library is built on
1353the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 1354
f15615b1
LC
1355Before building the library, CPU throttling should be disabled. This can be
1356done in the BIOS, or, on GNU/Linux, with the following commands:
ec322be2
FB
1357
1358cpufreq-selector -g performance -c 0
1359...
1360cpufreq-selector -g performance -c N-1
1361
1362where N is the number of cores of your CPU. Failure to do so will result in a
1363library with poor performance.")
1364 (license license:bsd-3)))
c12efc72
AE
1365
1366(define-public glm
1367 (package
1368 (name "glm")
1369 (version "0.9.6.3")
1370 (source
1371 (origin
1372 (method url-fetch)
1373 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1374 version ".zip"))
1375 (sha256
1376 (base32
1377 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1378 (build-system cmake-build-system)
1379 (native-inputs
1380 `(("unzip" ,unzip)))
1381 (home-page "http://glm.g-truc.net")
1382 (synopsis "OpenGL Mathematics library")
1383 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1384library for graphics software based on the OpenGL Shading Language (GLSL)
1385specifications.")
1386 (license license:expat)))
7f18257b
AE
1387
1388(define-public lpsolve
1389 (package
1390 (name "lpsolve")
1391 (version "5.5.2.0")
1392 (source
1393 (origin
1394 (method url-fetch)
1395 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1396 "/lp_solve_" version "_source.tar.gz"))
1397 (sha256
1398 (base32
1399 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1400 (modules '((guix build utils)))
1401 (snippet
1402 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1403 (("^c=cc") "c=gcc")
1404 ;; Pretend to be on a 64 bit platform to obtain a common directory
1405 ;; name for the build results on all architectures; nothing else
1406 ;; seems to depend on it.
1407 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1408 (build-system gnu-build-system)
1409 (arguments
1410 `(#:tests? #f ; no check target
1411 #:phases
1412 (modify-phases %standard-phases
1413 (delete 'configure)
1414 (replace 'build
1415 (lambda _
1416 (with-directory-excursion "lpsolve55"
1417 (system* "bash" "ccc"))
1418 (with-directory-excursion "lp_solve"
1419 (system* "bash" "ccc"))
1420 #t))
1421 (replace 'install
1422 (lambda* (#:key outputs #:allow-other-keys)
1423 (let* ((out (assoc-ref outputs "out"))
1424 (bin (string-append out "/bin"))
1425 (lib (string-append out "/lib"))
1426 ;; This is where LibreOffice expects to find the header
1427 ;; files, and where they are installed by Debian.
1428 (include (string-append out "/include/lpsolve")))
1429 (mkdir-p lib)
1430 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1431 (string-append lib "/liblpsolve55.a"))
1432 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1433 (string-append lib "/liblpsolve55.so"))
1434 (mkdir-p bin)
1435 (copy-file "lp_solve/bin/ux64/lp_solve"
1436 (string-append bin "/lp_solve"))
1437 (mkdir-p include)
1438 ;; Install a subset of the header files as on Debian
1439 ;; (plus lp_bit.h, which matches the regular expression).
1440 (for-each
1441 (lambda (name)
1442 (copy-file name (string-append include "/" name)))
1443 (find-files "." "lp_[HMSa-z].*\\.h$"))
1444 (with-directory-excursion "shared"
1445 (for-each
1446 (lambda (name)
1447 (copy-file name (string-append include "/" name)))
1448 (find-files "." "\\.h$")))
1449 #t))))))
1450 (home-page "http://lpsolve.sourceforge.net/")
1451 (synopsis "Mixed integer linear programming (MILP) solver")
1452 (description
1453 "lp_solve is a mixed integer linear programming solver based on the
1454revised simplex and the branch-and-bound methods.")
1455 (license license:lgpl2.1+)))