Download Manual
Transcript
Chapter 5: Scientific Repository
27
_lapack_solve(A, B, listlist_to_f32matrix,
f32matrix_to_listlist, LAPACK_sgesv);
}
obj lapack_solvef64(obj A, obj B) {
_lapack_solve(A, B, listlist_to_f64matrix,
f64matrix_to_listlist, LAPACK_dgesv);
}
obj lapack_solvec32(obj A, obj B) {
_lapack_solve(A, B, listlist_to_c32matrix,
c32matrix_to_listlist, LAPACK_cgesv);
}
obj lapack_solvec64(obj A, obj B) {
_lapack_solve(A, B, listlist_to_c64matrix,
c64matrix_to_listlist, LAPACK_zgesv);
}
> (load "~~/examples/sci-lapack2.six")
> (lapack_solvef32 ’((3. 1. 3.)(1. 5. 9.)(2. 6.
((-1.) (-.9999999403953552) (1.))
> (lapack_solvef64 ’((3. 1. 3.)(1. 5. 9.)(2. 6.
((-1.) (-1.0000000000000002) (1.))
> (lapack_solvec32 ’((3. 1. 3.)(1. 5. 9.)(2. 6.
((-1.+0.i) (-.9999999403953552+0.i) (1.+0.i))
> (lapack_solvec64 ’((3. 1. 3.)(1. 5. 9.)(2. 6.
((-1.+0.i) (-1.0000000000000002+0.i) (1.+0.i))
5.)) ’((-1.)(3.)(-3.)))
5.)) ’((-1.)(3.)(-3.)))
5.)) ’((-1.)(3.)(-3.)))
5.)) ’((-1.)(3.)(-3.)))
5.3 SLATEC examples
SLATEC is a comprehensive scientific software library containing over 1400 general purpose
mathematical and statistical routines.
This is a simple example of accessing this library from within SENSAWAVE:
;; examples/sci-slatec.scm
;; simple SLATEC examples
(module-require ’SLATEC)
;; cube root - single precision
(display (format "---\nSLATEC_cbrt: ~F\n" (SLATEC_cbrt 10.) ))
(display (format "Expecting: ~F\n---\n" (expt 10. (/ 1. 3.))))
;; cube root - double precision
(display (format "SLATEC_dcbrt: ~F\n" (SLATEC_dcbrt 10.) ))
(display (format "Expecting: ~F\n---\n" (expt 10. (/ 1. 3.))))
;; cube root - complex single precision
(display (format "SLATEC_ccbrt: ~F\n" (real-part (SLATEC_ccbrt 10.)) ))
(display (format "Expecting: ~F\n---\n" (expt 10. (/ 1. 3.))))