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