From jivestgarden at common-lisp.net Mon Jun 1 08:24:28 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Mon, 01 Jun 2009 04:24:28 -0400 Subject: [lisplab-cvs] r46 - src/fft src/matlisp system Message-ID: Author: jivestgarden Date: Mon Jun 1 04:24:28 2009 New Revision: 46 Log: clean up buildin system and bugfixes Added: system/libs.lisp system/lisplab-base.asd system/lisplab-fftw.asd system/lisplab-matlisp.asd Modified: src/fft/level3-fft-fftw.lisp src/matlisp/geev.lisp start.lisp system/lisplab.asd Modified: src/fft/level3-fft-fftw.lisp ============================================================================== --- src/fft/level3-fft-fftw.lisp (original) +++ src/fft/level3-fft-fftw.lisp Mon Jun 1 04:24:28 2009 @@ -47,13 +47,15 @@ (matrix-store x) (matrix-store x) fftw-ffi:+fftw-forward+ - fftw-ffi:+FFTW-ESTIMATE+)) + fftw-ffi:+FFTW-ESTIMATE+) + x) -(defmethod fft2! ((x matrix-blas-zge)) +(defmethod ifft2! ((x matrix-blas-zge)) (fftw-ffi:fftw-fft2 (rows x) (cols x) (matrix-store x) (matrix-store x) fftw-ffi:+fftw-backward+ - fftw-ffi:+FFTW-ESTIMATE+)) + fftw-ffi:+FFTW-ESTIMATE+) + x) Modified: src/matlisp/geev.lisp ============================================================================== --- src/matlisp/geev.lisp (original) +++ src/matlisp/geev.lisp Mon Jun 1 04:24:28 2009 @@ -34,7 +34,7 @@ (defmethod eigenvectors ((a matrix-blas-dge)) (destructuring-bind (evals vl-mat vr-mat) - (dgeev (copy a) nil (create a 0)) + (dgeev (copy a) nil (mcreate a 0)) (list evals vr-mat))) (defmethod eigenvalues ((a matrix-blas-dge)) @@ -130,7 +130,7 @@ (defmethod eigenvectors ((a matrix-zge)) (destructuring-bind (evals vl-mat vr-mat) - (zgeev (copy a) nil (create a 0)) + (zgeev (copy a) nil (mcreate a 0)) (list evals vr-mat))) (defmethod eigenvalues ((a matrix-zge)) Modified: start.lisp ============================================================================== --- start.lisp (original) +++ start.lisp Mon Jun 1 04:24:28 2009 @@ -1,18 +1,32 @@ +;; The connection between asdf and your machine settings. +;; Please hack this file to fit your settings. -(in-package :asdf) +(defvar *lisplab-home* + *default-pathname-defaults* + "The lisplab directory.") -(push (merge-pathnames #P"system/" - *default-pathname-defaults*) - *central-registry*) +(defun load-lisplab () + (assert *lisplab-home*) -(defparameter *lisplab-external-libraries* - '("/usr/lib/atlas/libblas.so.3.0" - "/usr/lib/atlas/liblapack.so.3.0")) + (let ((asdf:*central-registry* + (cons + (merge-pathnames #P"system/" cl-user::*lisplab-home*) + asdf:*central-registry*))) + (let ((asdf:*compile-file-failure-behaviour* :ignore)) + ;; There seems to bee some compilation trouble in SBCL + ;; due to type interference. Should be fixed, not just skipped. + (asdf:oos 'asdf:load-op 'slatec)) + (asdf:oos 'asdf:load-op 'quadpack) + (asdf:oos 'asdf:load-op 'lisplab) + (asdf:oos 'asdf:load-op 'lisplab-base) + (asdf:oos 'asdf:load-op 'lisplab-matlisp) + (asdf:oos 'asdf:load-op 'lisplab-fftw) + + ;; The lisplab system will load all the above systems. + ;; They are listed only to expose their names to the hacker. + (asdf:oos 'asdf:load-op 'lisplab))) -(let ((*compile-file-failure-behaviour* :ignore)) - ;; There seems to bee some compilation trouble in SBCL - ;; due to type interference. Should be fixed, not just skipped. - (asdf:operate 'asdf:load-op 'slatec)) -(asdf:operate 'asdf:load-op 'quadpack) -(asdf:operate 'asdf:load-op 'lisplab) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(load-lisplab) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \ No newline at end of file Added: system/libs.lisp ============================================================================== --- (empty file) +++ system/libs.lisp Mon Jun 1 04:24:28 2009 @@ -0,0 +1,6 @@ +;; Containes the forign libraries to be loaded +;; by the asdf systems + +((:libblas . "/usr/lib/atlas/libblas.so.3.0") + (:liblapack . "/usr/lib/atlas/liblapack.so.3.0") + (:libfftw . "/usr/lib/libfftw3.so.3")) \ No newline at end of file Added: system/lisplab-base.asd ============================================================================== --- (empty file) +++ system/lisplab-base.asd Mon Jun 1 04:24:28 2009 @@ -0,0 +1,130 @@ + +(in-package :asdf) + +(defsystem :lisplab-base + :depends-on (:slatec :quadpack) + :components + ( + (:file "package") + + ;; + ;; All core none-matrix stuff (level 0) + ;; + (:module :core + :depends-on ("package") + :pathname "../src/core/" + :serial t + :components + ( + (:file "level0-basic") + (:file "level0-const") + (:file "level0-interface") + (:file "level0-functions") + (:file "level0-permutation") + (:file "level0-infpre"))) + + ;; + ;; Special functions + ;; + (:module :specfunc + :depends-on (:core) + :pathname "../src/specfunc/" + :serial t + :components + ( + (:file "level0-specfunc"))) + + ;; + ;; All core matrix stuff (level 1 and 2) + ;; + (:module :matrix + :depends-on (:core :specfunc) + :pathname "../src/matrix/" + :serial t + :components + ( + (:file "level1-interface") + (:file "level1-util") + (:file "level1-classes") + (:file "level1-constructors") + (:file "level1-matrix") + (:file "level1-array") + + (:file "level2-interface") + (:file "level2-constructors") + (:file "level2-generic") + (:file "level2-matrix-dge") + (:file "level2-matrix-zge") + (:file "level2-array-functions"))) + + ;; + ;; IO (level 3) + ;; + (:module :io + :depends-on (:matrix) + :pathname "../src/io/" + :serial t + :components + ( + (:file "level3-io"))) + + ;; + ;; Linear algebra interface(Level 3) + ;; + (:module :linalg-interface + :depends-on (:matrix) + :pathname "../src/linalg/" + :serial t + :components + ( + (:file "level3-linalg-interface"))) + + ;; + ;; Linear algebra lisp implementation (Level 3) + ;; + (:module :linalg-native + :depends-on (:matrix :linalg-interface) + :pathname "../src/linalg/" + :serial t + :components + ( + (:file "level3-linalg-generic") + (:file "level3-linalg-blas-real"))) + + ;; + ;; Fast Fourier transform (Level 3) + ;; + (:module :fft + :depends-on (:matrix) + :pathname "../src/fft/" + :serial t + :components + ( + (:file "level3-fft-interface") + (:file "level3-fft-blas"))) + + ;; + ;; Euler and Runge-Kutt solvers (Level 3) + ;; + (:module :diffsolve + :depends-on (:matrix) + :pathname "../src/util/" + :serial t + :components + ( + (:file "level3-rk4") + (:file "level3-euler"))) + + + ;; + ;; Quadpack + ;; + (:module :integrate + :depends-on () ; quadpack + :pathname "../src/integrate/" + :serial t + :components + ( + (:file "quadpack"))) +)) + Added: system/lisplab-fftw.asd ============================================================================== --- (empty file) +++ system/lisplab-fftw.asd Mon Jun 1 04:24:28 2009 @@ -0,0 +1,34 @@ +(in-package :asdf) + +(defun get-lisplab-lib (name) + (let ((libs (merge-pathnames #P"system/libs.lisp" + cl-user::*lisplab-home*))) + (cdr (assoc name (with-open-file (out libs) + (read out)))))) + +(defsystem :lisplab-fftw + :depends-on (:lisplab-base) + :pathname (merge-pathnames #P"src/fft/" cl-user::*lisplab-home*) + :serial t + :components + ( + (:file "fftw-ffi-package") + + (:module :fftw-libs + :perform (asdf:load-op :after (op c) + (sb-alien:load-shared-object + (get-lisplab-lib :libfftw))) + :explain (asdf:load-op :after (op c) + (format t "Loads alien object <~A>" + (get-lisplab-lib :libfftw)))) + + ;; + ;; Blas and Lapack implmentations (Level 3) + ;; + (:module :fftw + :depends-on (:fftw-libs) + :pathname "" + :serial t + :components + ((:file "fftw-ffi") + (:file "level3-fft-fftw"))))) \ No newline at end of file Added: system/lisplab-matlisp.asd ============================================================================== --- (empty file) +++ system/lisplab-matlisp.asd Mon Jun 1 04:24:28 2009 @@ -0,0 +1,47 @@ +(in-package :asdf) + +(defun get-lisplab-lib (name) + (let ((libs (merge-pathnames #P"system/libs.lisp" + cl-user::*lisplab-home*))) + (cdr (assoc name (with-open-file (out libs) + (read out)))))) + +(defsystem :lisplab-matlisp + :depends-on (:lisplab-base) + :pathname (merge-pathnames #P"src/matlisp/" cl-user::*lisplab-home*) + :serial t + :components + ( + (:file "f77-package") + (:file "f77-mangling") + (:file "ffi-sbcl") + + (:module :blas-libs + :perform (asdf:load-op :after (op c) + (sb-alien:load-shared-object + (get-lisplab-lib :libblas))) + :explain (asdf:load-op :after (op c) + (format t "Loads alien object <~A>" + (get-lisplab-lib :libblas)))) + (:module :lapack-libs + :perform (asdf:load-op :after (op c) + (sb-alien:load-shared-object + (get-lisplab-lib :liblapack))) + :explain (asdf:load-op :after (op c) + (format t "Loads alien object <~A>" + (get-lisplab-lib :liblapack)))) + + ;; + ;; Blas and Lapack implmentations (Level 3) + ;; + (:module :matlisp + :depends-on (:lapack-libs) + :pathname "" + :serial t + :components + ((:file "blas") + (:file "lapack") + (:file "mul") + (:file "inv") + (:file "geev"))))) + Modified: system/lisplab.asd ============================================================================== --- system/lisplab.asd (original) +++ system/lisplab.asd Mon Jun 1 04:24:28 2009 @@ -1,167 +1,4 @@ +(in-package :asdf) (defsystem :lisplab - :depends-on (:slatec :quadpack) - :components - ( - (:file "package") - - ;; - ;; All core none-matrix stuff (level 0) - ;; - (:module :core - :depends-on ("package") - :pathname "../src/core/" - :serial t - :components - ( - (:file "level0-basic") - (:file "level0-const") - (:file "level0-interface") - (:file "level0-functions") - (:file "level0-permutation") - (:file "level0-infpre"))) - - ;; - ;; Special functions - ;; - (:module :specfunc - :depends-on (:core) - :pathname "../src/specfunc/" - :serial t - :components - ( - (:file "level0-specfunc"))) - - ;; - ;; All core matrix stuff (level 1 and 2) - ;; - (:module :matrix - :depends-on (:core :specfunc) - :pathname "../src/matrix/" - :serial t - :components - ( - (:file "level1-interface") - (:file "level1-util") - (:file "level1-classes") - (:file "level1-constructors") - (:file "level1-matrix") - (:file "level1-array") - - (:file "level2-interface") - (:file "level2-constructors") - (:file "level2-generic") - (:file "level2-matrix-dge") - (:file "level2-matrix-zge") - (:file "level2-array-functions"))) - - ;; - ;; IO (level 3) - ;; - (:module :io - :depends-on (:matrix) - :pathname "../src/io/" - :serial t - :components - ( - (:file "level3-io"))) - - ;; - ;; Linear algebra interface(Level 3) - ;; - (:module :linalg-interface - :depends-on (:matrix) - :pathname "../src/linalg/" - :serial t - :components - ( - (:file "level3-linalg-interface"))) - - ;; - ;; Linear algebra lisp implementation (Level 3) - ;; - (:module :linalg-native - :depends-on (:matrix :linalg-interface) - :pathname "../src/linalg/" - :serial t - :components - ( - (:file "level3-linalg-generic") - (:file "level3-linalg-blas-real"))) - - ;; - ;; Fast Fourier transform (Level 3) - ;; - (:module :fft - :depends-on (:matrix) - :pathname "../src/fft/" - :serial t - :components - ( - (:file "level3-fft-interface") - (:file "level3-fft-blas"))) - - ;; - ;; Euler and Runge-Kutt solvers (Level 3) - ;; - (:module :diffsolve - :depends-on (:matrix) - :pathname "../src/util/" - :serial t - :components - ( - (:file "level3-rk4") - (:file "level3-euler"))) - - ;; - ;; Blas and Lapack implmentations (Level 3) - ;; - (:module :matlisp - :depends-on (:matrix :linalg-interface) - :pathname "../src/matlisp/" - :serial t - :components - ((:file "f77-package") - (:file "f77-mangling") - (:file "ffi-sbcl") - (:file "blas") - (:file "lapack") - (:file "mul") - (:file "inv") - (:file "geev")) - - :perform (asdf:load-op :after (op c) - (dolist (lib asdf::*lisplab-external-libraries*) - (sb-alien:load-shared-object lib))) - - :explain (asdf:load-op :after (op c) - (dolist (lib asdf::*lisplab-external-libraries*) - (format t "Loads alien object <~A>" lib)))) - - - ;; - ;; Blas and Lapack implmentations (Level 3) - ;; - (:module :fftw - :depends-on (:matrix :fft) - :pathname "../src/fft/" - :serial t - :components - ((:file "fftw-ffi-package") - (:file "fftw-ffi") - (:file "level3-fft-fftw")) - :perform (asdf:load-op :after (op c) - (sb-alien:load-shared-object "/usr/lib/libfftw3.so.3"))) - - ;; - ;; Euler and Runge-Kutt solvers (Level 3) - ;; - (:module :integrate - :depends-on () ; quadpack - :pathname "../src/integrate/" - :serial t - :components - ( - (:file "quadpack"))) -)) - + :depends-on (:lisplab-base :lisplab-matlisp :lisplab-fftw)) From jivestgarden at common-lisp.net Mon Jun 1 17:47:00 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Mon, 01 Jun 2009 13:47:00 -0400 Subject: [lisplab-cvs] r47 - doc/manual Message-ID: Author: jivestgarden Date: Mon Jun 1 13:46:57 2009 New Revision: 47 Log: Manaual. Unfinished but started Added: doc/manual/ doc/manual/lisplab.texi Added: doc/manual/lisplab.texi ============================================================================== --- (empty file) +++ doc/manual/lisplab.texi Mon Jun 1 13:46:57 2009 @@ -0,0 +1,147 @@ +\input texinfo @c -*-texinfo-*- + at setfilename lisplab.info + at settitle Lisplab manual + + at copying +GPL + +Copyright @copyright{} 2009 Jorn Inge Vestgaarden + at end copying + + at titlepage + at title Lisplab manual + + at page + at vskip 0pt plus 1filll + at insertcopying + at end titlepage + + at contents + + at ifnottex + at node Top + at top Lisplab manual + +This is a short sample Texinfo file. + at end ifnottex + + at menu +* Introduction:: +* Dependencies:: +* Installing:: +* Tutorial:: +* Structure:: +* Index:: + at end menu + + at c The body + + at node Introduction + at chapter Introduction +Lisplab is a mathematics library in Common Lisp. Common Lisp +is a general purpose programming. The purpose +of Lisplab is to specialize Common Lisp towards mathematics. + + + at node Dependencies + at chapter Dependencies +Lisplab has been developed with SBCL, SLIME and ASDF on Linux, +and there are yet unnecessary bindings to these platforms. + at enumerate + at item +Some of the optimized lisp code uses the SBCL macro + at code{truly-the}. This must be dealt with. + + at item +The FFTW FFI is only for SBCL. + + at item +The Matlisp FFI should be portable to other lisps and +Windows, but it has not been tested. + + at end enumerate + +In order to enjoy the full power of Lisplab you +must install some foreign libraries. These are + at enumerate + at item +BLAS -- Basic Linear Algebra Subprograms. Preferably the Atlas build + + at item +LAPACK -- Matrix library. Preferably the Atlas build + + + at item +FFTW -- The fastest Fast Fourier Transform available. + + at end enumerate + + + + at node Installing + at chapter Installing +Lisplab is ASDF installable, but the installations is +more complicated than most Common Lisp libraries because of +the external dependencies. Lisplab has of the following +ASDF systems + at enumerate + at item @emph{Lisplab} -- +the full Lisplab installation. + + at item @emph{Lisplab-base} -- +the part of Lisplab without external dependencies. It should run +on all platforms. + + at item @emph{Lisplab-matlisp} -- +FFIs to BLAS and LAPACK. These are modified version from Matlisp. + + at item @emph{Lisplab-fftw} -- +FFI to FFTW for Fast Fourier Transform. + + at item Slatec -- +special functions, generated from Fortran by f2cl. +Originally made for Maxima. + + at item Quadpack -- +integration routines, generated from Fortran by f2cl. + at end enumerate + +The simplest way to install Lisplab is to load @code{start.lisp}. +If you have problems loading, first look at @code{start.lisp} +and see if you can hack it. +The foreign libraries are also loaded by ASDF and it takes +the file pathnames from the file @code{libs.lisp}. + + at node Tutorial + at chapter Tutorial + + + + at section Matrix construction + + at section Matrix manipulation + + at section Ordinary functions + + at section Special functions + + + at node Structure + at chapter Structure + + at section Package structure + + at section Class structure + + + + + at c End stuff + + at node Index + at unnumbered Index + + at printindex cp + + + at bye From jivestgarden at common-lisp.net Mon Jun 1 18:41:36 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Mon, 01 Jun 2009 14:41:36 -0400 Subject: [lisplab-cvs] r48 - doc/manual Message-ID: Author: jivestgarden Date: Mon Jun 1 14:41:36 2009 New Revision: 48 Log: backup Modified: doc/manual/lisplab.texi Modified: doc/manual/lisplab.texi ============================================================================== --- doc/manual/lisplab.texi (original) +++ doc/manual/lisplab.texi Mon Jun 1 14:41:36 2009 @@ -41,6 +41,20 @@ Lisplab is a mathematics library in Common Lisp. Common Lisp is a general purpose programming. The purpose of Lisplab is to specialize Common Lisp towards mathematics. +The name Lisplab is inspired by Matlab and Lisplab offers +much of the same kind of programming style as Matlab, with high level +manipulation of matrices. Contrary to Matlab, Lisplab can do a +lot other than just matrix manipulation because Lisplab is +based on Common Lisp. Hence, you get all +the benefits of programming in a lexically scoped, dynamic, and fast +general purpose programming language, not bound to the idiom +of @i{everything's a matrix}. + +Note that Lisplab is not unique in building Matlab-like +syntax on top of Common Lisp. Lisplab contains much code from +Matlisp, but has also a lot of new code, refactored +code and rewritten code. Other libraries of similar nature +are FEMLLISP and NLISP. @node Dependencies @@ -77,7 +91,6 @@ @end enumerate - @node Installing @chapter Installing Lisplab is ASDF installable, but the installations is @@ -114,10 +127,32 @@ @node Tutorial @chapter Tutorial +The main package of Lisplab is @i{lisplab}, with nickname @i{ll}. +The tutorial assues that you are in the @i{lisplab} package or +use it. + + at section Naming conventions +The matrix classes and constructors follow the naming convention +from BLAS where you give names based on element type and +matrix structure. + +The most used types are @i{f - float}, @i{d - double}, + at i{c - complex float}, @i{z - complex double float}, +while for matrix structure @i{ge - general}, @i{di - diagonal}, +and many more. So @i{matrix-dge} is a general matrix +with double float elements, while @i{matrix-zge} is a +general matrix with complex double float elements. + + at xref{Structure}, for more about the naming conventions +of matrix structure. There you also see the naming conventions for +files. + at section Basic algebra - + at section Matrix classes @section Matrix construction +Lisplab offers a very many ways to create a matrix. + @section Matrix manipulation @@ -131,6 +166,8 @@ @section Package structure + at section The four levels, 0 -- 3. + @section Class structure From jivestgarden at common-lisp.net Wed Jun 3 19:00:51 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Wed, 03 Jun 2009 15:00:51 -0400 Subject: [lisplab-cvs] r49 - Message-ID: Author: jivestgarden Date: Wed Jun 3 15:00:51 2009 New Revision: 49 Log: untested but promising asdf Added: lisplab.asd Added: lisplab.asd ============================================================================== --- (empty file) +++ lisplab.asd Wed Jun 3 15:00:51 2009 @@ -0,0 +1,420 @@ + +(defun get-lisplab-lib (name) + (let ((libs #P"system/libs.lisp" #+nil (merge-pathnames #P"system/libs.lisp" + cl-user::*lisplab-home*))) + (cdr (assoc name (with-open-file (out libs) + (read out)))))) + +(defsystem :lisplab + :depends-on (:lisplab-base :lisplab-matlisp :lisplab-fftw)) + +(defsystem :lisplab-base + :depends-on (:slatec :quadpack) + :components + ( + (:file "system/package") + + ;; + ;; All core none-matrix stuff (level 0) + ;; + (:module :src/core + :depends-on ("system/package") + :serial t + :components + ( + (:file "level0-basic") + (:file "level0-const") + (:file "level0-interface") + (:file "level0-functions") + (:file "level0-permutation") + (:file "level0-infpre"))) + + ;; + ;; Special functions + ;; + (:module :src/specfunc + :depends-on (:src/core) ; and slatec + :components + ( + (:file "level0-specfunc"))) + + ;; + ;; All core matrix stuff (level 1 and 2) + ;; + (:module :src/matrix + :depends-on (:src/core :src/specfunc) + :serial t + :components + ( + (:file "level1-interface") + (:file "level1-util") + (:file "level1-classes") + (:file "level1-constructors") + (:file "level1-matrix") + (:file "level1-array") + + (:file "level2-interface") + (:file "level2-constructors") + (:file "level2-generic") + (:file "level2-matrix-dge") + (:file "level2-matrix-zge") + (:file "level2-array-functions"))) + + ;; + ;; IO (level 3) + ;; + (:module :src/io + :depends-on (:src/matrix) + :components + ( + (:file "level3-io"))) + + ;; + ;; Linear algebra lisp implementation (Level 3) + ;; + (:module :src/linalg + :depends-on (:src/matrix) + :serial t + :components + ((:file "level3-linalg-interface") + (:file "level3-linalg-generic") + (:file "level3-linalg-blas-real"))) + + ;; + ;; Fast Fourier transform (Level 3) + ;; + (:module :src/fft + :depends-on (:src/matrix) + :serial t + :components + ( + (:file "level3-fft-interface") + (:file "level3-fft-blas"))) + + ;; + ;; Euler and Runge-Kutt solvers (Level 3) + ;; + (:module :src/util + :depends-on (:src/matrix) + :serial t + :components + ( + (:file "level3-rk4") + (:file "level3-euler"))) + + + ;; + ;; Quadpack + ;; + (:module :src/integrate + :depends-on (:src/core) ; and quadpack + :serial t + :components + ( + (:file "quadpack"))) + )) + + + +(defsystem :lisplab-matlisp + :depends-on (:lisplab-base) + :serial t + :components + ( + ;; + ;; Blas and Lapack implmentations (Level 3) + ;; + (:module :src/matlisp + :serial t + :components + ( + (:file "f77-mangling") + (:module :blas-libs + :perform (asdf:load-op :after (op c) + (sb-alien:load-shared-object + (get-lisplab-lib :libblas))) + :explain (asdf:load-op :after (op c) + (format t "Loads alien object <~A>" + (get-lisplab-lib :libblas)))) + (:module :lapack-libs + :perform (asdf:load-op :after (op c) + (sb-alien:load-shared-object + (get-lisplab-lib :liblapack))) + :explain (asdf:load-op :after (op c) + (format t "Loads alien object <~A>" + (get-lisplab-lib :liblapack)))) + (:file "f77-package") + (:file "ffi-sbcl") + (:file "blas") + (:file "lapack") + (:file "mul") + (:file "inv") + (:file "geev"))))) + + +(defsystem :lisplab-fftw + :depends-on (:lisplab-base) + :serial t + :components + ( + ;; + ;; Blas and Lapack implmentations (Level 3) + ;; + (:module :src/fft + :depends-on (:fftw-libs) + :serial t + :components + ((:file "fftw-ffi-package") + (:module :fftw-libs + :perform (asdf:load-op :after (op c) + (sb-alien:load-shared-object + (get-lisplab-lib :libfftw))) + :explain (asdf:load-op :after (op c) + (format t "Loads alien object <~A>" + (get-lisplab-lib :libfftw)))) + + (:file "fftw-ffi") + (:file "level3-fft-fftw"))))) + + +(defsystem :quadpack + :components + ( + ;; + ;; Quadpack. Generated with f2cl. + ;; + (:module :/shared/quadpack/ + :serial t + :components + ( + (:file "f2cl-package") + (:file "f2cl-macros") + + (:file "quadpack-package") + (:file "d1mach") + (:file "dgtsl") + (:file "dqage") + (:file "dqagie") + (:file "dqagi") + (:file "dqag") + (:file "dqagpe") + (:file "dqagse") + (:file "dqags") + (:file "dqawce") + (:file "dqawc") + (:file "dqawfe") + (:file "dqawf") + (:file "dqawoe") + (:file "dqawo") + (:file "dqawse") + (:file "dqaws") + (:file "dqc25c") + (:file "dqc25f") + (:file "dqc25s") + (:file "dqcheb") + (:file "dqelg") + (:file "dqk15i") + (:file "dqk15") + (:file "dqk15w") + (:file "dqk21") + (:file "dqk31") + (:file "dqk41") + (:file "dqk51") + (:file "dqk61") + (:file "dqmomo") + (:file "dqng") + (:file "dqpsrt") + (:file "dqwgtc") + (:file "dqwgtf") + (:file "dqwgts") + (:file "i1mach") + )))) + + +(defsystem :slatec + :components + ( + (:module :shared/slatec + :components + ( + (:file "f2cl-package") + (:file "f2cl-lib") + ;; The package + (:file "slatec") + + (:file "fdump") + (:file "j4save") + (:file "initds" + :depends-on ("xermsg")) + (:file "xgetua") + (:file "xermsg" + :depends-on ("fdump" "j4save" "xercnt" "xerhlt" "xerprn" "xersve")) + (:file "xercnt") + (:file "xerhlt") + (:file "xerprn" + :depends-on ("xgetua")) + (:file "xersve" + :depends-on ("j4save")) + (:file "dcsevl" + :depends-on ("xermsg")) + + ;; Gamma function + (:file "d9lgmc" + :depends-on ("dcsevl" "initds" "xermsg")) + (:file "dgamlm" + :depends-on ("xermsg")) + (:file "dgamma" + :depends-on ("d9lgmc" "dcsevl" "dgamlm" "initds" "xermsg")) + (:file "dgamln") + (:file "dlngam" + :depends-on ("d9lgmc" "dgamma" "xermsg")) + + ;; Bessel J functions + (:file "d9b0mp" + :depends-on ("dcsevl" "initds" "xermsg")) + (:file "d9b1mp" + :depends-on ("dcsevl" "initds" "xermsg")) + (:file "dbesj0" + :depends-on ("d9b0mp" "dcsevl" "initds")) + (:file "dbesj1" + :depends-on ("d9b1mp" "dcsevl" "initds" "xermsg")) + (:file "djairy") + (:file "dasyjy") + (:file "dbesj" + :depends-on ("dasyjy" "djairy" "dlngam" "xermsg")) + + ;; Bessel I functions + (:file "dbsi0e" + :depends-on ("dcsevl" "initds")) + (:file "dbsi1e" + :depends-on ("dcsevl" "initds" "xermsg")) + (:file "dbesi0" + :depends-on ("dbsi0e" "dcsevl" "initds" "xermsg")) + (:file "dbesi1" + :depends-on ("dbsi1e" "dcsevl" "initds" "xermsg")) + (:file "dasyik") + (:file "dbesi" + :depends-on ("dasyik" "dlngam" "xermsg")) + (:file "zbesi" + :depends-on ("zabs" "zbinu")) + + ;; Bessel J function for complex + ;; arg and real order. + + (:file "zabs") + (:file "zacai" + :depends-on ("zabs" "zasyi" "zbknu" "zmlri" "zs1s2" "zseri")) + (:file "zairy" + :depends-on ("zabs" "zacai" "zbknu" "zexp" "zsqrt")) + (:file "zasyi" + :depends-on ("zabs" "zdiv" "zexp" "zmlt" "zsqrt")) + (:file "zbesj" + :depends-on ("zabs" "zbinu")) + (:file "zbinu" + :depends-on ("zabs" "zasyi" "zbuni" "zmlri" "zseri" "zuoik" "zwrsk")) + (:file "zbknu" + :depends-on ("dgamln" "zabs" "zdiv" "zexp" "zkscl" + "zlog" "zmlt" "zshch" "zsqrt" "zuchk")) + (:file "zbuni" + :depends-on ("zabs" "zuni1" "zuni2")) + (:file "zdiv") + (:file "zexp") + (:file "zkscl" + :depends-on ("zabs" "zlog" "zuchk")) + (:file "zlog" + :depends-on ("zabs")) + (:file "zmlri" + :depends-on ("dgamln" "zabs" "zexp" "zlog" "zmlt")) + (:file "zmlt") + (:file "zrati" + :depends-on ("zabs" "zdiv")) + (:file "zs1s2" + :depends-on ("zabs" "zexp" "zlog")) + (:file "zseri" + :depends-on ("dgamln" "zabs" "zdiv" "zlog" "zmlt" "zuchk")) + (:file "zshch") + (:file "zsqrt" :depends-on ("zabs")) + (:file "zuchk") + (:file "zunhj" + :depends-on ("zabs" "zdiv" "zlog" "zsqrt")) + (:file "zuni1" + :depends-on ("zabs" "zuchk" "zunik" "zuoik")) + (:file "zuni2" + :depends-on ("zabs" "zairy" "zuchk" "zunhj" "zuoik")) + (:file "zunik" + :depends-on ("zdiv" "zlog" "zsqrt")) + (:file "zuoik" + :depends-on ("zabs" "zlog" "zuchk" "zunhj" "zunik")) + (:file "zwrsk" + :depends-on ("zabs" "zbknu" "zrati")) + + ;; Bessel Y functions + (:file "dbesy0" + :depends-on ("d9b0mp" "dbesj0" "dcsevl" "initds" "xermsg")) + (:file "dbesy1" + :depends-on ("d9b1mp" "dbesj1" "dcsevl" "initds" "xermsg")) + (:file "dbesy" + :depends-on ("dasyjy" "dbesy0" "dbesy1" "dbsynu" "dyairy" "xermsg")) + (:file "dbsynu" + :depends-on ("dgamma" "xermsg")) + (:file "dyairy") + + (:file "zbesy" + :depends-on ("zbesh")) + (:file "zbesh" + :depends-on ("zabs" "zacon" "zbknu" "zbunk" "zuoik")) + (:file "zacon" + :depends-on ("zabs" "zbinu" "zbknu" "zmlt" "zs1s2")) + (:file "zbunk" + :depends-on ("zunk1" "zunk2")) + (:file "zunk1" + :depends-on ("zabs" "zs1s2" "zuchk" "zunik")) + (:file "zunk2" + :depends-on ("zabs" "zairy" "zs1s2" "zuchk" "zunhj")) + + ;; Bessel K functions + (:file "dbesk0" + :depends-on ("dbesi0" "dbsk0e" "dcsevl" "initds" "xermsg")) + (:file "dbsk0e" + :depends-on ("dbesi0" "dcsevl" "initds" "xermsg")) + (:file "dbesk1" + :depends-on ("dbesi1" "dbsk1e" "dcsevl" "initds" "xermsg")) + (:file "dbsk1e" + :depends-on ("dbesi1" "dcsevl" "initds" "xermsg")) + (:file "dbesk" + :depends-on ("dasyik" "dbesk0" "dbesk1" "dbsk0e" "dbsk1e" "dbsknu" "xermsg")) + (:file "dbsknu" + :depends-on ("dgamma" "xermsg")) + (:file "zbesk" + :depends-on ("zabs" "zacon" "zbknu" "zbunk" "zuoik")) + + ;; Airy functions + (:file "d9aimp" + :depends-on ("dcsevl" "initds" "xermsg")) + (:file "daie" + :depends-on ("d9aimp" "dcsevl" "initds")) + (:file "dai" + :depends-on ("d9aimp" "daie" "dcsevl" "initds" "xermsg")) + (:file "dbie" + :depends-on ("d9aimp" "dcsevl" "initds")) + (:file "dbi" + :depends-on ("d9aimp" "dbie" "dcsevl" "initds" "xermsg")) + (:file "zbiry" + :depends-on ("zabs" "zbinu" "zdiv" "zsqrt")) + + ;; Error functions + (:file "derf" + :depends-on ("dcsevl" "derfc" "initds")) + (:file "derfc" + :depends-on ("dcsevl" "initds" "xermsg")) + + ;; Exponential integrals + (:file "de1" + :depends-on ("dcsevl" "initds" "xermsg")) + (:file "dei" + :depends-on ("de1")) + (:file "dspenc" + :depends-on ("d9upak")) + (:file "d9upak"))) + )) + From jivestgarden at common-lisp.net Sat Jun 6 12:01:26 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Sat, 06 Jun 2009 08:01:26 -0400 Subject: [lisplab-cvs] r50 - system Message-ID: Author: jivestgarden Date: Sat Jun 6 08:01:19 2009 New Revision: 50 Log: ready to delete system directory Added: libs.lisp (props changed) - copied unchanged from r48, /system/libs.lisp package.lisp (props changed) - copied unchanged from r48, /system/package.lisp Removed: system/libs.lisp system/package.lisp Modified: lisplab.asd start.lisp Modified: lisplab.asd ============================================================================== --- lisplab.asd (original) +++ lisplab.asd Sat Jun 6 08:01:19 2009 @@ -1,24 +1,31 @@ -(defun get-lisplab-lib (name) - (let ((libs #P"system/libs.lisp" #+nil (merge-pathnames #P"system/libs.lisp" - cl-user::*lisplab-home*))) - (cdr (assoc name (with-open-file (out libs) - (read out)))))) +(in-package :cl-user) +(defpackage :asdf-lisplab (:use :asdf :cl)) +(in-package :asdf-lisplab) + +(defun get-lisplab-lib (name &optional (libs #P"libs.lisp")) + (cdr (assoc name (with-open-file (out libs) + (read out))))) (defsystem :lisplab - :depends-on (:lisplab-base :lisplab-matlisp :lisplab-fftw)) + :depends-on + (:lisplab-base + :lisplab-matlisp + :lisplab-fftw + ; :slatec Slatec not in system becuase of compilation problems + :quadpack)) (defsystem :lisplab-base - :depends-on (:slatec :quadpack) + :depends-on () :components ( - (:file "system/package") + (:file "package") ;; ;; All core none-matrix stuff (level 0) ;; (:module :src/core - :depends-on ("system/package") + :depends-on ("package") :serial t :components ( @@ -30,19 +37,10 @@ (:file "level0-infpre"))) ;; - ;; Special functions - ;; - (:module :src/specfunc - :depends-on (:src/core) ; and slatec - :components - ( - (:file "level0-specfunc"))) - - ;; ;; All core matrix stuff (level 1 and 2) ;; (:module :src/matrix - :depends-on (:src/core :src/specfunc) + :depends-on (:src/core) :serial t :components ( @@ -102,20 +100,8 @@ (:file "level3-rk4") (:file "level3-euler"))) - - ;; - ;; Quadpack - ;; - (:module :src/integrate - :depends-on (:src/core) ; and quadpack - :serial t - :components - ( - (:file "quadpack"))) )) - - (defsystem :lisplab-matlisp :depends-on (:lisplab-base) :serial t @@ -151,7 +137,6 @@ (:file "inv") (:file "geev"))))) - (defsystem :lisplab-fftw :depends-on (:lisplab-base) :serial t @@ -161,7 +146,7 @@ ;; Blas and Lapack implmentations (Level 3) ;; (:module :src/fft - :depends-on (:fftw-libs) + :depends-on () :serial t :components ((:file "fftw-ffi-package") @@ -176,10 +161,17 @@ (:file "fftw-ffi") (:file "level3-fft-fftw"))))) - (defsystem :quadpack + :depends-on (:lisplab-base) :components - ( + ( + ;; + ;; Quadpack in lisplab + ;; + (:module :src/integrate + :depends-on (:/shared/quadpack/) + :components ((:file "quadpack"))) + ;; ;; Quadpack. Generated with f2cl. ;; @@ -230,10 +222,18 @@ (:file "i1mach") )))) - (defsystem :slatec + :depends-on (:lisplab-base) :components ( + + ;; + ;; Slatec in lisplab + ;; + (:module :src/specfunc + :depends-on (:shared/slatec) + :components ((:file "level0-specfunc"))) + (:module :shared/slatec :components ( Modified: start.lisp ============================================================================== --- start.lisp (original) +++ start.lisp Sat Jun 6 08:01:19 2009 @@ -1,32 +1,14 @@ -;; The connection between asdf and your machine settings. -;; Please hack this file to fit your settings. -(defvar *lisplab-home* - *default-pathname-defaults* - "The lisplab directory.") +(in-package :cl-user) (defun load-lisplab () - (assert *lisplab-home*) - - (let ((asdf:*central-registry* - (cons - (merge-pathnames #P"system/" cl-user::*lisplab-home*) - asdf:*central-registry*))) - (let ((asdf:*compile-file-failure-behaviour* :ignore)) - ;; There seems to bee some compilation trouble in SBCL - ;; due to type interference. Should be fixed, not just skipped. - (asdf:oos 'asdf:load-op 'slatec)) - (asdf:oos 'asdf:load-op 'quadpack) - (asdf:oos 'asdf:load-op 'lisplab) - (asdf:oos 'asdf:load-op 'lisplab-base) - (asdf:oos 'asdf:load-op 'lisplab-matlisp) - (asdf:oos 'asdf:load-op 'lisplab-fftw) - - ;; The lisplab system will load all the above systems. - ;; They are listed only to expose their names to the hacker. - (asdf:oos 'asdf:load-op 'lisplab))) - + (asdf:oos 'asdf:load-op 'lisplab) + (let ((asdf:*compile-file-failure-behaviour* :ignore)) + ;; There seems to bee some compilation trouble in SBCL + ;; due to type interference. Should be fixed, not just skipped. + (asdf:oos 'asdf:load-op 'slatec))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (load-lisplab) +(format t "Lisplab is loaded~%") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \ No newline at end of file From jivestgarden at common-lisp.net Sat Jun 6 12:06:51 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Sat, 06 Jun 2009 08:06:51 -0400 Subject: [lisplab-cvs] r51 - system Message-ID: Author: jivestgarden Date: Sat Jun 6 08:06:50 2009 New Revision: 51 Log: deleted system directory Removed: system/ Modified: start.lisp Modified: start.lisp ============================================================================== --- start.lisp (original) +++ start.lisp Sat Jun 6 08:06:50 2009 @@ -1,6 +1,8 @@ (in-package :cl-user) +(setf *READ-DEFAULT-FLOAT-FORMAT* 'double-float) + (defun load-lisplab () (asdf:oos 'asdf:load-op 'lisplab) (let ((asdf:*compile-file-failure-behaviour* :ignore)) From jivestgarden at common-lisp.net Sat Jun 6 12:07:26 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Sat, 06 Jun 2009 08:07:26 -0400 Subject: [lisplab-cvs] r52 - Message-ID: Author: jivestgarden Date: Sat Jun 6 08:07:23 2009 New Revision: 52 Log: Doc Modified: README Modified: README ============================================================================== --- README (original) +++ README Sat Jun 6 08:07:23 2009 @@ -6,7 +6,7 @@ src/matliap From the Matlisp project. Rewritten for Lisplab matrices. shared/ Unmodified code from other projects. doc/ Documentation. - system/ Package and asdf-system definitions. + STATUS The project is not in finished state and names will change without warning. From jivestgarden at common-lisp.net Tue Jun 9 19:24:32 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Tue, 09 Jun 2009 15:24:32 -0400 Subject: [lisplab-cvs] r53 - src/fft Message-ID: Author: jivestgarden Date: Tue Jun 9 15:24:26 2009 New Revision: 53 Log: renamed file Added: src/fft/level3-fft-zge.lisp - copied unchanged from r50, /src/fft/level3-fft-blas.lisp Removed: src/fft/level3-fft-blas.lisp Modified: lisplab.asd Modified: lisplab.asd ============================================================================== --- lisplab.asd (original) +++ lisplab.asd Tue Jun 9 15:24:26 2009 @@ -87,7 +87,7 @@ :components ( (:file "level3-fft-interface") - (:file "level3-fft-blas"))) + (:file "level3-fft-zge"))) ;; ;; Euler and Runge-Kutt solvers (Level 3) From jivestgarden at common-lisp.net Tue Jun 9 19:49:15 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Tue, 09 Jun 2009 15:49:15 -0400 Subject: [lisplab-cvs] r54 - src/fft src/io src/matrix Message-ID: Author: jivestgarden Date: Tue Jun 9 15:49:13 2009 New Revision: 54 Log: fixes on matrix types Added: src/fft/level3-fft-generic.lisp Modified: lisplab.asd src/fft/level3-fft-zge.lisp src/io/level3-io.lisp src/matrix/level2-matrix-dge.lisp src/matrix/level2-matrix-zge.lisp Modified: lisplab.asd ============================================================================== --- lisplab.asd (original) +++ lisplab.asd Tue Jun 9 15:49:13 2009 @@ -87,6 +87,7 @@ :components ( (:file "level3-fft-interface") + (:file "level3-fft-generic") (:file "level3-fft-zge"))) ;; Added: src/fft/level3-fft-generic.lisp ============================================================================== --- (empty file) +++ src/fft/level3-fft-generic.lisp Tue Jun 9 15:49:13 2009 @@ -0,0 +1,55 @@ +;;; Lisplab, level3-fft-generic.lisp +;;; Simple converters is the to the methods that do calculations + +;;; Copyright (C) 2009 Joern Inge Vestgaarden +;;; +;;; This program is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 2 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License along +;;; with this program; if not, write to the Free Software Foundation, Inc., +;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +(in-package :lisplab) + +(defun convert-to-matrix-zge (m) + (let ((m-copy (make-matrix-instance (create-matrix-description m :et :z) + (dim m) + 0))) + (copy-contents m m-copy) + m-copy)) + +;;;; Real matrices + +(defmethod fft1 ((x matrix-base-dge)) + (fft1! (convert-to-matrix-zge x))) + +(defmethod ifft1 ((x matrix-base-dge)) + (ifft1! (convert-to-matrix-zge x))) + +(defmethod ifft2 ((x matrix-base-dge)) + (ifft2! (convert-to-matrix-zge x))) + +(defmethod fft2 ((x matrix-base-dge)) + (fft2! (convert-to-matrix-zge x))) + +;;; Complex matrices + +(defmethod fft1 ((x matrix-base-zge)) + (fft1! (copy x))) + +(defmethod ifft1 ((x matrix-base-zge)) + (ifft1! (copy x))) + +(defmethod ifft2 ((x matrix-base-zge)) + (ifft2! (copy x))) + +(defmethod fft2 ((x matrix-base-zge)) + (fft2! (copy x))) Modified: src/fft/level3-fft-zge.lisp ============================================================================== --- src/fft/level3-fft-zge.lisp (original) +++ src/fft/level3-fft-zge.lisp Tue Jun 9 15:49:13 2009 @@ -1,4 +1,4 @@ -;;; Lisplab, level3-fft-blas.lisp +;;; Lisplab, level3-fft-zge.lisp ;;; Methods for fast Fourier transforms specialized on blas matrices. ;;; Copyright (C) 2009 Joern Inge Vestgaarden @@ -17,41 +17,10 @@ ;;; with this program; if not, write to the Free Software Foundation, Inc., ;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -;;; TODO should use the normal ref-blas-complex-store - -;;; TODO fix the methods so that they use the actual input matrix type, not just -;;; the eql spezializer. +;;; TODO should use the normal ref-blas-complex-store ? (in-package :lisplab) -;;;; Real matrices - -(defmethod fft1 ((x matrix-lisp-dge)) - (fft1! (convert x 'matrix-zge))) - -(defmethod ifft1 ((x matrix-lisp-dge)) - (ifft1! (convert x 'matrix-zge))) - -(defmethod ifft2 ((x matrix-lisp-dge)) - (ifft2! (convert x 'matrix-zge))) - -(defmethod fft2 ((x matrix-lisp-dge)) - (fft2! (convert x 'matrix-zge))) - -;;; Complex matrices - -(defmethod fft1 ((x matrix-lisp-zge)) - (fft1! (copy x))) - -(defmethod ifft1 ((x matrix-lisp-zge)) - (ifft1! (copy x))) - -(defmethod ifft2 ((x matrix-lisp-zge)) - (ifft2! (copy x))) - -(defmethod fft2 ((x matrix-lisp-zge)) - (fft2! (copy x))) - ;;;; The implementing methods (defmethod fft1! ((x matrix-lisp-zge)) Modified: src/io/level3-io.lisp ============================================================================== --- src/io/level3-io.lisp (original) +++ src/io/level3-io.lisp Tue Jun 9 15:49:13 2009 @@ -25,7 +25,7 @@ (in-package :lisplab) -(export '(pgmwrite dlmread dlmwrite)) +(export '(pgmwrite dlmread dlmwrite pswrite)) (defun dlmwrite (a &optional (out t) &key @@ -87,8 +87,8 @@ (let* ((rows (rows m)) (cols (cols m)) (scale (- max min))) - (if (<= (- max min) 0.0) - (setf max 1.0 min 0.0 scale 1.0)) + (when (<= (- max min) 0.0) + (setf max 1.0 min 0.0 scale 1.0)) (with-open-file (out filename :direction :output :if-exists :supersede) (format out "P5~%") (format out "~A ~A~%" cols rows) @@ -114,6 +114,9 @@ "Writes matrix as postsrcipt bitmap. Port of a2ps.c by Eric Weeks." ;; TODO: clean up and some more lispifying. ;; TODO: more testing. + ;; TOOD: change name to epswrite. + (when (<= (- max min) 0.0) + (setf max 1.0 min 0.0 )) (let* ((DTXSCALE 1.0787) (DTYSCALE 1.0) (DTHRES 513) Modified: src/matrix/level2-matrix-dge.lisp ============================================================================== --- src/matrix/level2-matrix-dge.lisp (original) +++ src/matrix/level2-matrix-dge.lisp Tue Jun 9 15:49:13 2009 @@ -19,19 +19,19 @@ (in-package :lisplab) -(defmethod fill! ((a matrix-lisp-dge) value) +(defmethod fill! ((a matrix-base-dge) value) (let ((x (coerce value 'double-float)) (store (matrix-store a))) (declare (type type-blas-store store)) (fill store x))) -(defmethod copy ((matrix matrix-lisp-dge)) +(defmethod copy ((matrix matrix-base-dge)) (make-instance (class-name (class-of matrix)) :store (copy-seq (the type-blas-store (matrix-store matrix))) :rows (rows matrix) :cols (cols matrix))) -(defmethod .map (f (a matrix-lisp-dge) &rest args) +(defmethod .map (f (a matrix-base-dge) &rest args) (let ((b (copy a))) (apply #'map-into (matrix-store b) @@ -40,29 +40,29 @@ (matrix-store a) (mapcar #'matrix-store args)) b)) -(defmethod .imagpart ((a matrix-lisp-dge)) +(defmethod .imagpart ((a matrix-base-dge)) (mcreate a 0)) -(defmethod .realpart ((a matrix-lisp-dge)) +(defmethod .realpart ((a matrix-base-dge)) (copy a)) -(defmethod .abs ((a matrix-lisp-dge)) +(defmethod .abs ((a matrix-base-dge)) (let ((b (mcreate a))) (copy-contents a b #'abs) b)) -(defmethod .conj ((a matrix-lisp-dge)) +(defmethod .conj ((a matrix-base-dge)) (copy a)) -(defmethod .some (pred (a matrix-lisp-dge) &rest args) +(defmethod .some (pred (a matrix-base-dge) &rest args) (let ((stores (mapcar #'matrix-store (cons a args)))) (apply #'some pred stores))) -(defmethod .every (pred (a matrix-lisp-dge) &rest args) +(defmethod .every (pred (a matrix-base-dge) &rest args) (let ((stores (mapcar #'matrix-store (cons a args)))) (apply #'every pred stores))) -(defmacro def-binary-op-matrix-lisp-dge (new old) +(defmacro def-binary-op-matrix-base-dge (new old) (let ((a (gensym "a")) (b (gensym "b")) (len (gensym "len")) @@ -70,7 +70,7 @@ (store2 (gensym "store2")) (i (gensym "i"))) `(progn - (defmethod ,new ((,a matrix-lisp-dge) (,b real)) + (defmethod ,new ((,a matrix-base-dge) (,b real)) (let* ((,a (copy ,a)) (,store (matrix-store ,a)) (,b (coerce ,b 'double-float)) @@ -81,7 +81,7 @@ (dotimes (,i ,len) (setf (aref ,store ,i) (,old (aref ,store ,i) ,b))) ,a)) - (defmethod ,new ((,a real) (,b matrix-lisp-dge)) + (defmethod ,new ((,a real) (,b matrix-base-dge)) (let* ((,b (copy ,b)) (,store (matrix-store ,b)) (,a (coerce ,a 'double-float)) @@ -92,7 +92,7 @@ (dotimes (,i ,len) (setf (aref ,store ,i) (,old ,a (aref ,store ,i)))) ,b)) - (defmethod ,new ((,a matrix-lisp-dge) (,b matrix-lisp-dge)) + (defmethod ,new ((,a matrix-base-dge) (,b matrix-base-dge)) (let* ((,a (copy ,a)) (,store (matrix-store ,a)) (,store2 (matrix-store ,b)) @@ -104,15 +104,15 @@ (setf (aref ,store ,i) (,old (aref ,store ,i) (aref ,store2 ,i)))) ,a))))) -(def-binary-op-matrix-lisp-dge .add +) +(def-binary-op-matrix-base-dge .add +) -(def-binary-op-matrix-lisp-dge .mul *) +(def-binary-op-matrix-base-dge .mul *) -(def-binary-op-matrix-lisp-dge .sub -) +(def-binary-op-matrix-base-dge .sub -) -(def-binary-op-matrix-lisp-dge .div /) +(def-binary-op-matrix-base-dge .div /) -(def-binary-op-matrix-lisp-dge .expt expt) +(def-binary-op-matrix-base-dge .expt expt) (defmacro each-matrix-element-df-to-df (x form) "Applies a form on each element of an matrix-dge. The form must @@ -146,50 +146,50 @@ ;;; Trignometric functions -(defmethod .sin ((x matrix-lisp-dge)) +(defmethod .sin ((x matrix-base-dge)) (each-matrix-element-df-to-df x (sin x))) -(defmethod .cos ((x matrix-lisp-dge)) +(defmethod .cos ((x matrix-base-dge)) (each-matrix-element-df-to-df x (cos x))) -(defmethod .tan ((x matrix-lisp-dge)) +(defmethod .tan ((x matrix-base-dge)) (each-matrix-element-df-to-df x (tan x))) ;;; Hyperbolic functions -(defmethod .sinh ((x matrix-lisp-dge)) +(defmethod .sinh ((x matrix-base-dge)) (each-matrix-element-df-to-df x (sinh x))) -(defmethod .cosh ((x matrix-lisp-dge)) +(defmethod .cosh ((x matrix-base-dge)) (each-matrix-element-df-to-df x (cosh x))) -(defmethod .tanh ((x matrix-lisp-dge)) +(defmethod .tanh ((x matrix-base-dge)) (each-matrix-element-df-to-df x (tanh x))) -(defmethod .log ((x matrix-lisp-dge) &optional base) +(defmethod .log ((x matrix-base-dge) &optional base) (if base (each-matrix-element-df-to-df x (log x base)) (each-matrix-element-df-to-df x (log x)))) -(defmethod .exp ((x matrix-lisp-dge)) +(defmethod .exp ((x matrix-base-dge)) (each-matrix-element-df-to-df x (exp x))) ;;; Bessel functions -(defmethod .besj (n (x matrix-lisp-dge)) +(defmethod .besj (n (x matrix-base-dge)) (each-matrix-element-df-to-df x (.besj n x))) -(defmethod .besy (n (x matrix-lisp-dge)) +(defmethod .besy (n (x matrix-base-dge)) (each-matrix-element-df-to-df x (.besy n x))) -(defmethod .besi (n (x matrix-lisp-dge)) +(defmethod .besi (n (x matrix-base-dge)) (each-matrix-element-df-to-df x (.besi n x))) -(defmethod .besk (n (x matrix-lisp-dge)) +(defmethod .besk (n (x matrix-base-dge)) (each-matrix-element-df-to-df x (.besk n x))) -(defmethod .besh1 (n (x matrix-lisp-dge)) +(defmethod .besh1 (n (x matrix-base-dge)) (each-matrix-element-df-to-complex-df x (.besh1 n x))) -(defmethod .besh2 (n (x matrix-lisp-dge)) +(defmethod .besh2 (n (x matrix-base-dge)) (each-matrix-element-df-to-complex-df x (.besh2 n x))) \ No newline at end of file Modified: src/matrix/level2-matrix-zge.lisp ============================================================================== --- src/matrix/level2-matrix-zge.lisp (original) +++ src/matrix/level2-matrix-zge.lisp Tue Jun 9 15:49:13 2009 @@ -18,7 +18,7 @@ (in-package :lisplab) -(defmethod fill! ((a matrix-zge) value) +(defmethod fill! ((a matrix-base-zge) value) (let ((rx (coerce (realpart value) 'double-float)) (cx (coerce (imagpart value) 'double-float)) (store (matrix-store a))) @@ -26,25 +26,25 @@ (setf (aref store i) rx (aref store (1+ i)) cx)))) -(defmethod copy ((matrix matrix-lisp-zge)) +(defmethod copy ((matrix matrix-base-zge)) (make-instance (class-name (class-of matrix)) :store (copy-seq (the type-blas-store (matrix-store matrix))) :rows (rows matrix) :cols (cols matrix))) -(defmethod .imagpart ((a matrix-lisp-zge)) +(defmethod .imagpart ((a matrix-base-zge)) (let* ((description (create-matrix-description a :et :d)) (b (make-matrix-instance description (dim a) 0))) (copy-contents a b #'imagpart) b)) -(defmethod .realpart ((a matrix-lisp-zge)) +(defmethod .realpart ((a matrix-base-zge)) (let* ((description (create-matrix-description a :et :d)) (b (make-matrix-instance description (dim a) 0))) (copy-contents a b #'realpart) b)) -(defmethod .abs ((a matrix-lisp-zge)) +(defmethod .abs ((a matrix-base-zge)) (let* ((description (create-matrix-description a :et :d)) (b (make-matrix-instance description (dim a) 0))) (copy-contents a b #'abs) @@ -59,7 +59,7 @@ (store2 (gensym "store2")) (i (gensym "i"))) `(progn - (defmethod ,new ((,a matrix-zge) (,b number)) + (defmethod ,new ((,a matrix-base-zge) (,b number)) (let* ((,a (copy ,a)) (,store (matrix-store ,a)) (,b (coerce ,b '(complex double-float))) @@ -71,7 +71,7 @@ (setf (ref-blas-complex-store ,store ,i 0 ,len) (,old (ref-blas-complex-store ,store ,i 0 ,len) ,b))) ,a)) - (defmethod ,new ((,a number) (,b matrix-zge)) + (defmethod ,new ((,a number) (,b matrix-base-zge)) (let* ((,b (copy ,b)) (,store (matrix-store ,b)) (,a (coerce ,a '(complex double-float))) @@ -83,7 +83,7 @@ (setf (ref-blas-complex-store ,store ,i 0 ,len) (,old ,a (ref-blas-complex-store ,store ,i 0 ,len)))) ,b)) - (defmethod ,new ((,a matrix-zge) (,b matrix-zge)) + (defmethod ,new ((,a matrix-base-zge) (,b matrix-base-zge)) (let* ((,a (copy ,a)) (,store (matrix-store ,a)) (,store2 (matrix-store ,b)) @@ -97,7 +97,7 @@ (,old (ref-blas-complex-store ,store ,i 0 ,len) (ref-blas-complex-store ,store2 ,i 0 ,len)))) ,a)) - (defmethod ,new ((,a matrix-zge) (,b matrix-dge)) + (defmethod ,new ((,a matrix-base-zge) (,b matrix-base-dge)) (let* ((,a (copy ,a)) (,store (matrix-store ,a)) (,store2 (matrix-store ,b)) @@ -110,7 +110,7 @@ (,old (ref-blas-complex-store ,store ,i 0 ,len) (aref ,store2 ,i)))) ,a)) - (defmethod ,new ((,a matrix-dge) (,b matrix-zge)) + (defmethod ,new ((,a matrix-base-dge) (,b matrix-base-zge)) (let* ((,b (copy ,b)) (,store (matrix-store ,a)) (,store2 (matrix-store ,b)) @@ -134,12 +134,12 @@ (def-binary-op-blas-complex .expt expt) -(defmacro each-element-function-matrix-zge (x form) - "Applies a form on each element of an matrix-zge." +(defmacro each-element-function-matrix-base-zge (x form) + "Applies a form on each element of an matrix-base-zge." (let ((i (gensym)) (y (gensym))) `(let* ((,y (copy ,x))) - (declare (type matrix-zge ,y)) + (declare (type matrix-base-zge ,y)) (dotimes (,i (size ,y)) (let ((,x (vref ,y ,i))) (declare (type (complex double-float) ,x)) @@ -147,55 +147,55 @@ ,form))) ,y))) -(defmethod .conj ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (conjugate x))) +(defmethod .conj ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (conjugate x))) ;;; Trignometric functions -(defmethod .sin ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (sin x))) +(defmethod .sin ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (sin x))) -(defmethod .cos ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (cos x))) +(defmethod .cos ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (cos x))) -(defmethod .tan ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (tan x))) +(defmethod .tan ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (tan x))) ;;; Hyperbolic functions -(defmethod .sinh ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (sinh x))) +(defmethod .sinh ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (sinh x))) -(defmethod .cosh ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (cosh x))) +(defmethod .cosh ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (cosh x))) -(defmethod .tanh ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (tanh x))) +(defmethod .tanh ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (tanh x))) -(defmethod .log ((x matrix-lisp-zge) &optional base) +(defmethod .log ((x matrix-base-zge) &optional base) (if base - (each-element-function-matrix-zge x (log x base)) - (each-element-function-matrix-zge x (log x)))) + (each-element-function-matrix-base-zge x (log x base)) + (each-element-function-matrix-base-zge x (log x)))) -(defmethod .exp ((x matrix-lisp-zge)) - (each-element-function-matrix-zge x (exp x))) +(defmethod .exp ((x matrix-base-zge)) + (each-element-function-matrix-base-zge x (exp x))) ;;; Bessel functions -(defmethod .besj (n (x matrix-lisp-zge)) - (each-element-function-matrix-zge x (.besj n x))) +(defmethod .besj (n (x matrix-base-zge)) + (each-element-function-matrix-base-zge x (.besj n x))) -(defmethod .besy (n (x matrix-lisp-zge)) - (each-element-function-matrix-zge x (.besy n x))) +(defmethod .besy (n (x matrix-base-zge)) + (each-element-function-matrix-base-zge x (.besy n x))) -(defmethod .besi (n (x matrix-lisp-zge)) - (each-element-function-matrix-zge x (.besi n x))) +(defmethod .besi (n (x matrix-base-zge)) + (each-element-function-matrix-base-zge x (.besi n x))) -(defmethod .besk (n (x matrix-lisp-zge)) - (each-element-function-matrix-zge x (.besk n x))) +(defmethod .besk (n (x matrix-base-zge)) + (each-element-function-matrix-base-zge x (.besk n x))) -(defmethod .besh1 (n (x matrix-lisp-zge)) - (each-element-function-matrix-zge x (.besh1 n x))) +(defmethod .besh1 (n (x matrix-base-zge)) + (each-element-function-matrix-base-zge x (.besh1 n x))) -(defmethod .besh2 (n (x matrix-lisp-zge)) - (each-element-function-matrix-zge x (.besh2 n x))) +(defmethod .besh2 (n (x matrix-base-zge)) + (each-element-function-matrix-base-zge x (.besh2 n x))) From jivestgarden at common-lisp.net Thu Jun 11 18:55:22 2009 From: jivestgarden at common-lisp.net (=?UTF-8?Q?J=C3=B8rn_Inge_Vestg=C3=A5rden?=) Date: Thu, 11 Jun 2009 14:55:22 -0400 Subject: [lisplab-cvs] r55 - Message-ID: Author: jivestgarden Date: Thu Jun 11 14:55:21 2009 New Revision: 55 Log: fixed default loading and builing of ffi libs Removed: libs.lisp Modified: lisplab.asd start.lisp Modified: lisplab.asd ============================================================================== --- lisplab.asd (original) +++ lisplab.asd Thu Jun 11 14:55:21 2009 @@ -1,13 +1,25 @@ + (in-package :cl-user) + +(defvar *lisplab-libblas-path* nil "Path to blas shared object file") +(defvar *lisplab-liblapack-path* nil "Path to lapack shared object file") +(defvar *lisplab-fftw-path* nil "Path to fftw shared object file") + (defpackage :asdf-lisplab (:use :asdf :cl)) (in-package :asdf-lisplab) -(defun get-lisplab-lib (name &optional (libs #P"libs.lisp")) - (cdr (assoc name (with-open-file (out libs) - (read out))))) +(defun load-lisplab-lib (name) + (sb-alien:load-shared-object name)) (defsystem :lisplab + ;; Default system, without external libs + :depends-on + (:lisplab-base + :quadpack)) + +(defsystem :lisplab-all + ;; Default system, without all libs :depends-on (:lisplab-base :lisplab-matlisp @@ -118,18 +130,18 @@ (:file "f77-mangling") (:module :blas-libs :perform (asdf:load-op :after (op c) - (sb-alien:load-shared-object - (get-lisplab-lib :libblas))) + (load-lisplab-lib + cl-user::*lisplab-libblas-path*)) :explain (asdf:load-op :after (op c) (format t "Loads alien object <~A>" - (get-lisplab-lib :libblas)))) - (:module :lapack-libs + cl-user::*lisplab-libblas-path*))) + (:module :lapack-libs :perform (asdf:load-op :after (op c) - (sb-alien:load-shared-object - (get-lisplab-lib :liblapack))) + (load-lisplab-lib + cl-user::*lisplab-liblapack-path*)) :explain (asdf:load-op :after (op c) (format t "Loads alien object <~A>" - (get-lisplab-lib :liblapack)))) + cl-user::*lisplab-liblapack-path*))) (:file "f77-package") (:file "ffi-sbcl") (:file "blas") @@ -153,12 +165,11 @@ ((:file "fftw-ffi-package") (:module :fftw-libs :perform (asdf:load-op :after (op c) - (sb-alien:load-shared-object - (get-lisplab-lib :libfftw))) + (load-lisplab-lib + cl-user::*lisplab-libfftw-path*)) :explain (asdf:load-op :after (op c) (format t "Loads alien object <~A>" - (get-lisplab-lib :libfftw)))) - + cl-user::*lisplab-libfftw-path*))) (:file "fftw-ffi") (:file "level3-fft-fftw"))))) Modified: start.lisp ============================================================================== --- start.lisp (original) +++ start.lisp Thu Jun 11 14:55:21 2009 @@ -1,14 +1,28 @@ +;; Loads lisplab. Hack this file to fit your setup +;; and your shared libraries. (in-package :cl-user) +;; TODO make this part of the package (setf *READ-DEFAULT-FLOAT-FORMAT* 'double-float) +;; (defvar *lisplab-libblas-path* #P"/usr/lib/atlas/libblas.so.3.0") +;; (defvar *lisplab-liblapack-path* #P"/usr/lib/atlas/liblapack.so.3.0") +;; (defvar *lisplab-libfftw-path* #P"/usr/lib/libfftw3.so.3") + (defun load-lisplab () (asdf:oos 'asdf:load-op 'lisplab) (let ((asdf:*compile-file-failure-behaviour* :ignore)) ;; There seems to bee some compilation trouble in SBCL ;; due to type interference. Should be fixed, not just skipped. - (asdf:oos 'asdf:load-op 'slatec))) + (asdf:oos 'asdf:load-op 'slatec)) + + ;; The system lisplab-matlisp depends on libblas.so and liblapack.so + ;; (asdf:oos 'asdf:load-op 'lisplab-matlisp) + + ;; The system lisplab-fftw depends on libfftw.so + ;; (asdf:oos 'asdf:load-op 'lisplab-fftw) + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (load-lisplab)