(module blas-lapack mzscheme
(require (lib "foreign.ss")
(lib "list.ss" "srfi" "1"))
(provide *blas* *lapack*
_cblas-order _cblas-transpose)
(define accelerate-path
"/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current")
(define vecLib-path
"/System/Library/Frameworks/vecLib.framework/Versions/Current")
(define default-path "")
(define (string-empty? s)
(= (string-length s) 0))
(define base-path
(ormap (lambda (path) (and (directory-exists? path) path))
(list accelerate-path vecLib-path default-path)))
(define (build-path* . paths-or-empty)
(apply build-path (filter (lambda (p-or-e) (not (string-empty? p-or-e))) paths-or-empty)))
(define *blas* (ffi-lib (build-path* base-path "libBLAS")))
(define *lapack* (ffi-lib (build-path* base-path "libLAPACK")))
(define _cblas-order (_enum '(row-major = 101 col-major = 102)))
(define _cblas-transpose (_enum '(no-trans = 111 trans = 112 conj-trans = 113 atlas-conj = 114))))