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