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