diff --git a/basis-splines.lisp b/basis-splines.lisp index dcc40231ac52b61f64d3b34bfd0ddaac25484de6..2bd780727dd51f5480e3aa0c119c9c470df414bf 100644 --- a/basis-splines.lisp +++ b/basis-splines.lisp @@ -1,6 +1,6 @@ ;; Basis splines. ;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp -;; Time-stamp: <2008-02-18 15:48:50EST basis-splines.lisp> +;; Time-stamp: <2008-02-23 19:36:35EST basis-splines.lisp> ;; $Id: $ (in-package :gsl) @@ -51,7 +51,7 @@ (defmfun evaluate-bspline (x B workspace) "gsl_bspline_eval" - ((x :double) (B :pointer) (workspace :pointer)) + ((x :double) ((pointer B) :pointer) (workspace :pointer)) :documentation ; FDL "Evaluate all B-spline basis functions at the position x and store them in the GSL vector B, so that the ith element of B is B_i(x). @@ -84,21 +84,21 @@ (sigma 0.1d0)) ;; The data to be fitted. (dotimes (i ndata) - (let* ((xi (* i (/ 15 (1- ndata)))) + (let* ((xi (coerce (* i (/ 15 (1- ndata))) 'double-float)) (yi (+ (* (cos xi) (exp (* -0.1d0 xi))) (gaussian rng sigma)))) - (setf (gsl-aref x i) xi - (gsl-aref y i) yi - (gsl-aref w i) (/ (expt sigma 2))))) + (setf (maref x i) xi + (maref y i) yi + (maref w i) (/ (expt sigma 2))))) ;; Uniform breakpoints [0, 15] (uniform-knots 0.0d0 15.0d0 bw) ;; Fit matrix (dotimes (i ndata) ;; Compute B_j - (evaluate-bspline (gsl-aref x i) B bw) + (evaluate-bspline (maref x i) B bw) ;; Fill in row i of X (dotimes (j ncoeffs) - (setf (gsl-aref Xmatrix i j) (gsl-aref B j)))) + (setf (maref Xmatrix i j) (maref B j)))) ;; Do the fit (weighted-linear-mfit Xmatrix w y c cov mw) ;; Return the smoothed curve diff --git a/data/combination.lisp b/data/combination.lisp index a5e43b2b99046e023b0547deccfd509394672cba..f2ed539a20c5d71ab8beb62ffe91daa202538d54 100644 --- a/data/combination.lisp +++ b/data/combination.lisp @@ -1,6 +1,6 @@ ;; Combinations ;; Liam Healy, Sun Mar 26 2006 - 11:51 -;; Time-stamp: <2008-02-17 10:01:38EST combination.lisp> +;; Time-stamp: <2008-02-23 18:49:21EST combination.lisp> ;; $Id: $ (in-package :gsl) @@ -25,7 +25,7 @@ ;;;; Getting values ;;;;**************************************************************************** -(defmfun gsl-aref ((combination gsl-combination) &rest indices) +(defmfun maref ((combination gsl-combination) &rest indices) "gsl_combination_get" (((pointer combination) :pointer) ((first indices) size)) :type :method @@ -38,7 +38,7 @@ (make-sequence 'list (combination-size object))))) (loop for i from 0 below (min (length seq) (combination-size object)) - do (setf (elt seq i) (gsl-aref object i))) + do (setf (elt seq i) (maref object i))) seq)) ;;;;**************************************************************************** diff --git a/data/data.lisp b/data/data.lisp index a513c7aaef86bec56862c249fb1983e6c887a0bc..fcd1105ccaf4f56693905419fd4a9cebd3e20c72 100644 --- a/data/data.lisp +++ b/data/data.lisp @@ -1,6 +1,6 @@ ;; Using GSL bulk data (vectors, matrices, etc.) storage. ;; Liam Healy, Sun Mar 26 2006 - 16:32 -;; Time-stamp: <2008-02-17 09:18:27EST data.lisp> +;; Time-stamp: <2008-02-23 18:57:18EST data.lisp> ;; $Id: $ (in-package :gsl) @@ -57,11 +57,11 @@ (:documentation "The CL type of an element.")) ;;; Accessing elements -(export 'gsl-aref) -(defgeneric gsl-aref (object &rest indices) +(export 'maref) +(defgeneric maref (object &rest indices) (:documentation "An element of the data.")) -(defgeneric (setf gsl-aref) (value object &rest indices) +(defgeneric (setf maref) (value object &rest indices) (:method :after (value (object gsl-data) &rest indices) (push indices (cl-invalid object))) (:documentation "Set an element of the data.")) @@ -300,13 +300,13 @@ (t sequence)))) (loop for i from 0 below (min (length seq) total-size) - do (setf (elt seq i) (gsl-aref object i))) + do (setf (elt seq i) (maref object i))) seq) ;; set selected (let ((seq (data-cache object))) (mapc (lambda (is) (let ((i (first is))) - (setf (elt seq i) (gsl-aref object i)))) + (setf (elt seq i) (maref object i)))) (cl-invalid object)) seq))) ;; Around method looks for cached value and returns it if valid; @@ -330,7 +330,7 @@ (:method (sequence (object gsl-data)) (loop for i from 0 below (min (length sequence) (apply #'* (storage-size object))) - do (setf (gsl-aref object i) (elt sequence i)))) + do (setf (maref object i) (elt sequence i)))) (:method :after (source (object gsl-data)) (setf (cl-invalid object) t))) @@ -372,24 +372,24 @@ ;;;; Arithmetic operations ;;;;**************************************************************************** -(export '(gsl+ gsl- gsl* gsl/ gsl*c gsl+c)) +(export '(m+ m- m* m/ m*c m+c)) -(defgeneric gsl+ (a b) +(defgeneric m+ (a b) (:documentation "Add.")) -(defgeneric gsl- (a b) +(defgeneric m- (a b) (:documentation "Subtract.")) -(defgeneric gsl* (a b) +(defgeneric m* (a b) (:documentation "Multiply.")) -(defgeneric gsl/ (a b) +(defgeneric m/ (a b) (:documentation "Divide.")) -(defgeneric gsl+c (a x) +(defgeneric m+c (a x) (:documentation "Add scalar.")) -(defgeneric gsl*c (a x) +(defgeneric m*c (a x) (:documentation "Multiply by scalar.")) ;;;;**************************************************************************** diff --git a/data/matrix.lisp b/data/matrix.lisp index ad7d1bb5c959fbf7290cf06979062b512536ad8d..18c8c57bfc89a3b64c3f214682ddc2edd0864c0e 100644 --- a/data/matrix.lisp +++ b/data/matrix.lisp @@ -1,6 +1,6 @@ ;; Matrices ;; Liam Healy, Sun Mar 26 2006 - 11:51 -;; Time-stamp: <2008-02-17 09:45:48EST matrix.lisp> +;; Time-stamp: <2008-02-23 18:57:17EST matrix.lisp> ;; $Id: $ (in-package :gsl) @@ -67,7 +67,7 @@ ;;;; Getting values ;;;;**************************************************************************** -(defmfun-mdsfc gsl-aref ((matrix gsl-matrix) &rest indices) +(defmfun-mdsfc maref ((matrix gsl-matrix) &rest indices) "gsl_matrix_get" (((pointer matrix) :pointer) ((first indices) size) @@ -104,14 +104,14 @@ below (min (array-dimension arr 1) (second (storage-size object))) do - (setf (aref arr i j) (gsl-aref object i j)))) + (setf (aref arr i j) (maref object i j)))) arr)) ;;;;**************************************************************************** ;;;; Setting values ;;;;**************************************************************************** -(defmfun-mdsfc (setf gsl-aref) (value (matrix gsl-matrix) &rest indices) +(defmfun-mdsfc (setf maref) (value (matrix gsl-matrix) &rest indices) "gsl_matrix_set" (((pointer matrix) :pointer) ((first indices) size) @@ -138,7 +138,7 @@ below (min (array-dimension array 1) (second (storage-size object))) do - (setf (gsl-aref object i j) (aref array i j))))) + (setf (maref object i j) (aref array i j))))) (defmfun-mdsfc set-all ((object gsl-matrix) value) "gsl_matrix_set_all" @@ -457,7 +457,7 @@ ;;;; Arithmetic operations ;;;;**************************************************************************** -(defmfun-mdsfc gsl+ ((a gsl-matrix) (b gsl-matrix)) +(defmfun-mdsfc m+ ((a gsl-matrix) (b gsl-matrix)) "gsl_matrix_add" (((pointer a) gsl-matrix-c) ((pointer b) gsl-matrix-c)) :invalidate (a) @@ -466,7 +466,7 @@ a'_i = a_i + b_i. The two matrices must have the same dimensions.") -(defmfun-mdsfc gsl- ((a gsl-matrix) (b gsl-matrix)) +(defmfun-mdsfc m- ((a gsl-matrix) (b gsl-matrix)) "gsl_matrix_sub" (((pointer a) gsl-matrix-c) ((pointer b) gsl-matrix-c)) :invalidate (a) :documentation ; FDL @@ -474,7 +474,7 @@ a, a'_i = a_i - b_i. The two matrices must have the same dimensions.") -(defmfun-mdsfc gsl* ((a gsl-matrix) (b gsl-matrix)) +(defmfun-mdsfc m* ((a gsl-matrix) (b gsl-matrix)) "gsl_matrix_mul_elements" (((pointer a) gsl-matrix-c) ((pointer b) gsl-matrix-c)) :invalidate (a) @@ -483,7 +483,7 @@ matrix b, a'(i,j) = a(i,j) * b(i,j). The two matrices must have the same dimensions.") -(defmfun-mdsfc gsl/ ((a gsl-matrix) (b gsl-matrix)) +(defmfun-mdsfc m/ ((a gsl-matrix) (b gsl-matrix)) "gsl_matrix_div_elements" (((pointer a) gsl-matrix-c) ((pointer b) gsl-matrix-c)) :invalidate (a) @@ -492,14 +492,14 @@ matrix b, a'(i,j) = a(i,j) / b(i,j). The two matrices must have the same dimensions.") -(defmfun-mdsfc gsl*c ((a gsl-matrix) x) +(defmfun-mdsfc m*c ((a gsl-matrix) x) "gsl_matrix_scale" (((pointer a) gsl-matrix-c) (x :c-base-type)) :invalidate (a) :documentation ; FDL "Multiply the elements of matrix a by the constant factor x, a'(i,j) = x a(i,j).") -(defmfun-mdsfc gsl+c ((a gsl-matrix) x) +(defmfun-mdsfc m+c ((a gsl-matrix) x) "gsl_matrix_add_constant" (((pointer a) gsl-matrix-c) (x :c-base-type)) :invalidate (a) :documentation ; FDL @@ -577,9 +577,9 @@ #| (make-tests matrix-fixnum - (letm ((intmat (matrix-fixnum 2 2))) ;(setf gsl-aref), gsl-aref - (setf (gsl-aref intmat 0 1) 77) - (gsl-aref intmat 0 1)) + (letm ((intmat (matrix-fixnum 2 2))) ;(setf maref), maref + (setf (maref intmat 0 1) 77) + (maref intmat 0 1)) (letm ((intmat (matrix-fixnum 2 2))) ;(setf data) (setf (data intmat) #2A((4 6) (8 2))) (data intmat)) @@ -637,8 +637,8 @@ (LIST 77) (MULTIPLE-VALUE-LIST (LETM ((INTMAT (MATRIX-FIXNUM 2 2))) - (SETF (GSL-AREF INTMAT 0 1) 77) - (GSL-AREF INTMAT 0 1)))) + (SETF (MAREF INTMAT 0 1) 77) + (MAREF INTMAT 0 1)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #2A((4 6) (8 2))) (MULTIPLE-VALUE-LIST @@ -741,14 +741,14 @@ (loop for i from 0 below 10 do (loop for j from 0 below 3 - do (setf (gsl-aref mat i j) (+ 0.23d0 j (* 100 i))))) + do (setf (maref mat i j) (+ 0.23d0 j (* 100 i))))) (data mat)) (letm ((mat (matrix-double #2A((1.0d0 2.0d0) (3.0d0 4.0d0)))) (ans (matrix-double 2 2))) (copy ans mat) (data ans)) (letm ((mat (matrix-double #2A((1.0d0 2.0d0) (3.0d0 4.0d0))))) - (gsl* mat mat) + (m* mat mat) (data mat))) |# @@ -769,7 +769,7 @@ (LETM ((MAT (MATRIX-DOUBLE 10 3))) (LOOP FOR I FROM 0 BELOW 10 DO (LOOP FOR J FROM 0 BELOW 3 DO - (SETF (GSL-AREF MAT I J) + (SETF (MAREF MAT I J) (+ 0.23d0 J (* 100 I))))) (DATA MAT)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL @@ -782,5 +782,5 @@ (LIST #2A((1.0d0 4.0d0) (9.0d0 16.0d0))) (MULTIPLE-VALUE-LIST (LETM ((MAT (MATRIX-DOUBLE #2A((1.0d0 2.0d0) (3.0d0 4.0d0))))) - (GSL* MAT MAT) (DATA MAT))))) + (M* MAT MAT) (DATA MAT))))) diff --git a/data/permutation.lisp b/data/permutation.lisp index a8a2e7bf24356033b0dd9af579f44aca5704c5c7..f6d253454a9faa3a7093eb248da8775978db6877 100644 --- a/data/permutation.lisp +++ b/data/permutation.lisp @@ -1,6 +1,6 @@ ;; Permutations ;; Liam Healy, Sun Mar 26 2006 - 11:51 -;; Time-stamp: <2008-02-17 09:56:49EST permutation.lisp> +;; Time-stamp: <2008-02-23 18:49:22EST permutation.lisp> ;; $Id: $ (in-package :gsl) @@ -24,7 +24,7 @@ ;;;; Getting values ;;;;**************************************************************************** -(defmfun gsl-aref ((permutation gsl-permutation) &rest indices) +(defmfun maref ((permutation gsl-permutation) &rest indices) "gsl_permutation_get" (((pointer permutation) :pointer) ((first indices) size)) :type :method @@ -250,9 +250,9 @@ #| (make-tests permutation - (letm ((perm-1 (permutation 4 t))) ;gsl-aref + (letm ((perm-1 (permutation 4 t))) ;maref (set-identity perm-1) - (gsl-aref perm-1 2)) + (maref perm-1 2)) (letm ((perm-1 (permutation 4 t))) ;data (set-identity perm-1) (data perm-1)) @@ -299,7 +299,7 @@ (MULTIPLE-VALUE-LIST (LETM ((PERM-1 (PERMUTATION 4 T))) (SET-IDENTITY PERM-1) - (GSL-AREF PERM-1 2)))) + (MAREF PERM-1 2)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(0 1 2 3)) (MULTIPLE-VALUE-LIST diff --git a/data/vector.lisp b/data/vector.lisp index 9a0453896d46221773e35c73899424157b1882d0..9df1da1c67fde47c9b4b50ddc96f9ce84f3b8178 100644 --- a/data/vector.lisp +++ b/data/vector.lisp @@ -1,6 +1,6 @@ ;; Vectors ;; Liam Healy, Sun Mar 26 2006 - 11:51 -;; Time-stamp: <2008-02-17 16:19:47EST vector.lisp> +;; Time-stamp: <2008-02-23 18:57:18EST vector.lisp> ;; $Id: $ (in-package :gsl) @@ -25,7 +25,7 @@ ;;; Need to build real vector out of view pointer. -;;; Need to #'cl-invalidate when (setf gsl-aref) called, see Mon Nov 26 2007. +;;; Need to #'cl-invalidate when (setf maref) called, see Mon Nov 26 2007. ;;;;**************************************************************************** @@ -116,7 +116,7 @@ deallocated with the vector. ;;;; Getting values ;;;;**************************************************************************** -(defmfun-vdsfc gsl-aref ((vector gsl-vector) &rest indices) +(defmfun-vdsfc maref ((vector gsl-vector) &rest indices) "gsl_vector_get" (((pointer vector) :pointer) ((first indices) size)) :c-return :c-base-type @@ -140,7 +140,7 @@ deallocated with the vector. ;;;; Setting values ;;;;**************************************************************************** -(defmfun-vdsfc (setf gsl-aref) (value (vector gsl-vector) &rest indices) +(defmfun-vdsfc (setf maref) (value (vector gsl-vector) &rest indices) "gsl_vector_set" (((pointer vector) :pointer) ((first indices) size) (value :c-base-type)) :c-return :void @@ -293,7 +293,7 @@ deallocated with the vector. ;;;; Arithmetic operations ;;;;**************************************************************************** -(defmfun-vdsf gsl+ ((a gsl-vector) (b gsl-vector)) +(defmfun-vdsf m+ ((a gsl-vector) (b gsl-vector)) "gsl_vector_add" (((pointer a) gsl-vector-c) ((pointer b) gsl-vector-c)) :invalidate (a) :documentation ; FDL @@ -301,34 +301,34 @@ deallocated with the vector. vector a, a'_i = a_i + b_i. The two vectors must have the same length.") -(defmfun-vdsf gsl- ((a gsl-vector) (b gsl-vector)) +(defmfun-vdsf m- ((a gsl-vector) (b gsl-vector)) "gsl_vector_sub" (((pointer a) gsl-vector-c) ((pointer b) gsl-vector-c)) :invalidate (a) :documentation ; FDL "Subtract the elements of vector b from the elements of vector a, a'_i = a_i - b_i. The two vectors must have the same length.") -(defmfun-vdsf gsl* ((a gsl-vector) (b gsl-vector)) +(defmfun-vdsf m* ((a gsl-vector) (b gsl-vector)) "gsl_vector_mul" (((pointer a) gsl-vector-c) ((pointer b) gsl-vector-c)) :invalidate (a) :documentation ; FDL "Multiply the elements of vector a by the elements of vector b, a'_i = a_i * b_i. The two vectors must have the same length.") -(defmfun-vdsf gsl/ ((a gsl-vector) (b gsl-vector)) +(defmfun-vdsf m/ ((a gsl-vector) (b gsl-vector)) "gsl_vector_div" (((pointer a) gsl-vector-c) ((pointer b) gsl-vector-c)) :invalidate (a) :documentation ; FDL "Divide the elements of vector a by the elements of vector b, a'_i = a_i / b_i. The two vectors must have the same length.") -(defmfun-vdsf gsl*c ((a gsl-vector) x) +(defmfun-vdsf m*c ((a gsl-vector) x) "gsl_vector_scale" (((pointer a) gsl-vector-c) (x :double)) :invalidate (a) :documentation ; FDL "Multiply the elements of vector a by the constant factor x, a'_i = x a_i.") -(defmfun-vdsf gsl+c ((a gsl-vector) x) +(defmfun-vdsf m+c ((a gsl-vector) x) "gsl_vector_add_constant" (((pointer a) gsl-vector-c) (x :double)) :invalidate (a) :documentation ; FDL @@ -398,9 +398,9 @@ deallocated with the vector. #| (make-tests vector-fixnum - (letm ((intvec (vector-fixnum 4))) ;(setf gsl-aref), gsl-aref - (setf (gsl-aref intvec 1) 77) - (gsl-aref intvec 1)) + (letm ((intvec (vector-fixnum 4))) ;(setf maref), maref + (setf (maref intvec 1) 77) + (maref intvec 1)) (letm ((intvec (vector-fixnum 4))) ;(setf data) (setf (data intvec) #(4 6 8 2)) (data intvec)) @@ -446,8 +446,8 @@ deallocated with the vector. (LIST 77) (MULTIPLE-VALUE-LIST (LETM ((INTVEC (VECTOR-FIXNUM 4))) - (SETF (GSL-AREF INTVEC 1) 77) - (GSL-AREF INTVEC 1)))) + (SETF (MAREF INTVEC 1) 77) + (MAREF INTVEC 1)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST #(4 6 8 2)) (MULTIPLE-VALUE-LIST @@ -536,9 +536,9 @@ deallocated with the vector. (make-tests vector-double (letm ((vec (vector-double 3))) - (setf (gsl-aref vec 0) -3.21d0 - (gsl-aref vec 1) 1.0d0 - (gsl-aref vec 2) 12.8d0 + (setf (maref vec 0) -3.21d0 + (maref vec 1) 1.0d0 + (maref vec 2) 12.8d0 (cl-invalid vec) t) (data vec)) (letm ((vec (vector-double 3))) @@ -560,9 +560,9 @@ deallocated with the vector. (LIST #(-3.21d0 1.0d0 12.8d0)) (MULTIPLE-VALUE-LIST (LETM ((VEC (VECTOR-DOUBLE 3))) - (SETF (GSL-AREF VEC 0) -3.21d0 - (GSL-AREF VEC 1) 1.0d0 - (GSL-AREF VEC 2) 12.8d0 + (SETF (MAREF VEC 0) -3.21d0 + (MAREF VEC 1) 1.0d0 + (MAREF VEC 2) 12.8d0 (CL-INVALID VEC) T) (DATA VEC)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL diff --git a/documentation/development.html b/documentation/development.html index d0f9e7e300f45b5e155ecf2cd444beb11d5b609f..babf101e1a0c8e7de6610eebbf10432782ada83f 100644 --- a/documentation/development.html +++ b/documentation/development.html @@ -1,7 +1,7 @@ -<!-- -*- mode: HTML; time-stamp-line-limit: -8; -*- --> +<!-- -*- mode: HTML; time-stamp-line-limit: -18; -*- --> <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<html xmlns="http://www.nw3.org/1999/xhtml"> <head> <link rel="stylesheet" href="style.css" type="text/css"/> <title>GSLL Development</title> @@ -39,6 +39,11 @@ equivalent probably won't be done, unless there is a need to have it present for some other GSL functionality that isn't present in CL. </li> + <li>Data types that are not defined in Common Lisp portably (such as + uint) may not be well supported. Others may be added but it + may be difficult to do so in a portable way. There are several + macros that should make this relatively easy. + </li> </ul> <h3>Status</h3> @@ -51,6 +56,10 @@ It is possible that the library API will change but probably not substantially; most of the remaining work involves added functions. + Although many of the file output functions have been ported, none + have been tested, and they likely will need additional C or support + from other libraries. + <p> There seem to be differences in the random number generators between amd64 and i386, so many regression tests fail as the @@ -96,16 +105,13 @@ <pre> (lisp-unit:run-tests) </pre> -and expect a two failures on amd64, none? on i386. +See <a href="documentation.html">documentation</a> regarding known failures. </p> <hr> <address><a href="mailto:">Liam Healy</a></address> <small> - Time-stamp: <2008-02-18 00:25:04EST index.html> -<!-- Liam Healy 2008-02-18 11:36:11EST development.html --> -<!-- Time-stamp: <2008-02-18 12:50:26EST development.html> --> -<!-- $Id: $ --> + Time-stamp: <2008-02-23 19:08:21EST development.html> </small> <!-- hhmts end --> </div> diff --git a/documentation/documentation.html b/documentation/documentation.html index b79c27a19fd633966d8f7da95998ca5297fd2ccd..53f779fbddb26df5d7c65e5c2ca8ad0d84284e71 100644 --- a/documentation/documentation.html +++ b/documentation/documentation.html @@ -1,4 +1,4 @@ -<!-- -*- mode: HTML; time-stamp-line-limit: -8; -*- --> +<!-- -*- mode: HTML; time-stamp-line-limit: -18; -*- --> <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> @@ -79,32 +79,47 @@ are functions whose symbols are exported so that an arglist prompt will be visible; however, the function should not be used outside a let binding. - <h3>Data</h3> + <h3>Data: vectors, matrices, etc.</h3> <div class="content"> + <p> Collectively, vectors, matrices, histograms and the like are called - <i>data</i>. There many different types supported by GSL, but GSLL - has implemented only a few of these: complex, double-float, - single-float, and fixnum, because those types are defined by - the Common Lisp standard. Others may be added but it may be - difficult to do so in a portable way. There are several macros that - should make this relatively easy. + <i>data</i>. There are many different types of vectors and matrices + supported by GSL, but GSLL has implemented only a few of these: + complex, double-float, single-float, and fixnum, because those types + are defined by the Common Lisp standard. + <p>Vectors and matrices can be converted to and from their Lisp + counterparts with <code>data</code> and <code>(setf data)</code>. + Setting the GSL value to a Lisp value at initialization + can be done within the <code>letm</code> by giving the Lisp value as + the first argument after the type, for example +<pre> +(letm ((vec (vector-double #(-3.21d0 1.0d0 12.8d0)))) + (data vec)) +</pre> + Individual elements of data may be accessed with <code>maref</code>, + either directly or in a <code>setf</code>. <h3>Status</h3> <div class="content"> Consistent with the <a href="development.html">development</a> philosophy, most of the interface to the library is done. Notes - particular chapters: + on particular chapters: <ul> <li><a href="Vectors-and-Matrices.html">Vectors and Matrices</a> are done for integer, real, double, complex. Subvectors and views don't work. Other element types may be difficult to port due to lack of CL definition. - <base href="http://www.gnu.org/software/gsl/manual/html_node/"> + <base + href="http://www.gnu.org/software/gsl/manual/html_node/"> +<li>Functions that provide file input and output to files are not tested and + likely will need other definitions (perhaps in C) to function + properly, unless CFFI and the CL platform provide C stream + compatibility. <li>Some <a href="Sorting.html">sorting</a> functions fail on amd64 platforms, perhaps because of lack of unsigned integer vectors. <li><a href="BLAS-Support.html">BLAS</a> is completed, but with only very limited testing. - <li><a href="Fast-Fourier-Transforms.html">FFTs</a> has not been done + <li><a href="Fast-Fourier-Transforms.html">FFTs</a> have not been done because GSL does not supply an example and it is not clear how it used. Contributions welcome. <li><a href="Simulated-Annealing.html">Simulated Annealing</a> has @@ -114,17 +129,30 @@ let binding. <li><a href="Discrete-Hankel-Transforms.html">Discrete Hankel Transforms</a> has been done but there is no example given in the GSL manual. -<li><a href="Basis-Splines.html">Basis splines</a> have yet to be tested. +<li><a href="Basis-Splines.html">Basis splines</a> example runs, but + the GSL documentation does not provide the result for comparison. +</ul> +<p> +There are failures observed in the regression tests +<code>(lisp-unit:run-tests)</code>: +<ul> +<li>CLISP shows three "foreign callout errors". Remedy unknown. +<li>Sorting shows two failures on amd64 platforms. This is possibly +because of the use of integer vectors to store unsigned integer +vectors. +<li>There are several regression failures that are apparently due to +changes in GSL between versions 1.8 and 1.10. These are: +beta, chi-squared, dirichlet, elliptic-functions, fdist, +gamma-randist, negative-binomial. </ul> <div class="footer"> <hr> <address><a href="mailto:">Liam Healy</a></address> -<!-- Created: Feb 25 2005 --> <!-- hhmts start --> <small> - Time-stamp: <2008-02-18 14:56:02EST documentation.html> + Time-stamp: <2008-02-23 19:45:14EST documentation.html> </small> <!-- hhmts end --> </div> diff --git a/documentation/index.html b/documentation/index.html index 6004286ca71c6b3b63fb03f27e8d229ccc7757c2..73679e5f33688690ebe3145f917e17c0c32e08f9 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -1,4 +1,4 @@ -<!-- -*- mode: HTML; time-stamp-line-limit: -8; -*- --> +<!-- -*- mode: HTML; time-stamp-line-limit: -18; -*- --> <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> @@ -28,13 +28,14 @@ getting quick answers, even for someone not intending to program in Lisp. </p> - <p>This code should be considered alpha but it is largely usable + <p>This code should be considered alpha and is still under + development, but it is largely usable now, with some GSL capability not yet available. See Development section below.</p> <p>This software is distributed under the <a href="http://www.cliki.net/LLGPL">LLGPL</a> and <a href="http://www.gnu.org/copyleft/fdl.html">FDL</a>. - See COPYING.</p> + See COPYING. There is absolutely no warranty.</p> </div> <h3>Examples</h3> @@ -85,7 +86,9 @@ debugger invoked on a GSL-ERROR in thread #<THREAD "initial thread" {10032258C1} common-lisp-controller</a>, install with <code>clc-register-user-package</code> and then within Lisp <code>(clc:clc-require :gsll)</code>. - <p>GSLL has been tested with SBCL on Debian i386 and amd64.</p> + <p>GSLL has been tested with <a + href="http://sbcl.sourceforge.net/">SBCL</a> and <a + href="http://clisp.cons.org/">CLISP</a> on Debian i386 and amd64.</p> </div> <h3>Additional information</h3> @@ -121,7 +124,7 @@ svn checkout svn://common-lisp.net/project/gsll/subversion/trunk</pre>.</p> <!-- Created: Feb 25 2005 --> <!-- hhmts start --> <small> - Time-stamp: <2008-02-18 12:51:51EST index.html> + Time-stamp: <2008-02-23 19:02:16EST index.html> </small> <!-- hhmts end --> </div> diff --git a/histogram/operations.lisp b/histogram/operations.lisp index 088ec8cf9a65f9d4805ab327444be03227f49c6b..73873e11f7f6480b2d9c071ec3ecbfa85f1cd69f 100644 --- a/histogram/operations.lisp +++ b/histogram/operations.lisp @@ -1,6 +1,6 @@ ;; Histogram operations ;; Liam Healy, Mon Jan 1 2007 - 16:47 -;; Time-stamp: <2008-02-17 17:10:53EST operations.lisp> +;; Time-stamp: <2008-02-23 18:57:17EST operations.lisp> ;; $Id: $ (in-package :gsl) @@ -30,11 +30,11 @@ ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl+-1 (histogram1 histogram2) +(defmfun m+-1 (histogram1 histogram2) "gsl_histogram_add" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl+ + :index m+ :documentation ; FDL "Add the contents of the bins in histogram2 to the corresponding bins of histogram1 i.e. h'_1(i) = @@ -43,32 +43,32 @@ ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl+-2 (histogram1 histogram2) +(defmfun m+-2 (histogram1 histogram2) "gsl_histogram2d_add" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl+ + :index m+ :documentation ; FDL "Add the contents of the bins in histogram2 to the corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) + h_2(i). The two histograms must have identical bin ranges.") -(defmethod gsl+ ((histogram1 histogram) (histogram2 histogram)) +(defmethod m+ ((histogram1 histogram) (histogram2 histogram)) ;; FDL "Add the contents of the bins in histogram2 to the corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) + h_2(i). The two histograms must have identical bin ranges." - (histo-1d2d histogram1 gsl+ (histogram2))) + (histo-1d2d histogram1 m+ (histogram2))) ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl--1 (histogram1 histogram2) +(defmfun m--1 (histogram1 histogram2) "gsl_histogram_sub" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl- + :index m- :documentation ; FDL "Subtract the contents of the bins in histogram2 from the corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) - @@ -76,17 +76,17 @@ ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl--2 (histogram1 histogram2) +(defmfun m--2 (histogram1 histogram2) "gsl_histogram2d_sub" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl- + :index m- :documentation ; FDL "Subtract the contents of the bins in histogram2 from the corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) - h_2(i). The two histograms must have identical bin ranges.") -(defmethod gsl- ((histogram1 histogram) (histogram2 histogram)) +(defmethod m- ((histogram1 histogram) (histogram2 histogram)) ;; FDL "Subtract the contents of the bins in histogram2 from the corresponding bins of histogram1 i.e. h'_1(i) = h_1(i) - @@ -95,11 +95,11 @@ ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl*-1 (histogram1 histogram2) +(defmfun m*-1 (histogram1 histogram2) "gsl_histogram_mul" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl* + :index m* :documentation ; FDL "Multiply the contents of the bins of histogram1 by the contents of the corresponding bins in histogram2 @@ -108,32 +108,32 @@ ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl*-2 (histogram1 histogram2) +(defmfun m*-2 (histogram1 histogram2) "gsl_histogram2d_mul" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl* + :index m* :documentation ; FDL "Multiply the contents of the bins of histogram1 by the contents of the corresponding bins in histogram2 i.e. h'_1(i) = h_1(i) * h_2(i). The two histograms must have identical bin ranges.") -(defmethod gsl* ((histogram1 histogram) (histogram2 histogram)) +(defmethod m* ((histogram1 histogram) (histogram2 histogram)) ;; FDL "Multiply the contents of the bins of histogram1 by the contents of the corresponding bins in histogram2 i.e. h'_1(i) = h_1(i) * h_2(i). The two histograms must have identical bin ranges." - (histo-1d2d histogram1 gsl* (histogram2))) + (histo-1d2d histogram1 m* (histogram2))) ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl/-1 (histogram1 histogram2) +(defmfun m/-1 (histogram1 histogram2) "gsl_histogram_div" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl/ + :index m/ :documentation ; FDL "Divide the contents of the bins of histogram1 by the contents of the corresponding bins in histogram2 @@ -142,24 +142,24 @@ ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. -(defmfun gsl/-2 (histogram1 histogram2) +(defmfun m/-2 (histogram1 histogram2) "gsl_histogram2d_div" (((pointer histogram1) :pointer) ((pointer histogram2) :pointer)) :export nil - :index gsl/ + :index m/ :documentation ; FDL "Divide the contents of the bins of histogram1 by the contents of the corresponding bins in histogram2 i.e. h'_1(i) = h_1(i) / h_2(i). The two histograms must have identical bin ranges.") -(defmethod gsl/ ((histogram1 histogram) (histogram2 histogram)) +(defmethod m/ ((histogram1 histogram) (histogram2 histogram)) ;; FDL "Divide the contents of the bins of histogram1 by the contents of the corresponding bins in histogram2 i.e. h'_1(i) = h_1(i) / h_2(i). The two histograms must have identical bin ranges." - (histo-1d2d histogram1 gsl/ (histogram2))) + (histo-1d2d histogram1 m/ (histogram2))) ;;; GSL documentation does not state what the return value for the ;;; C function means; assumed to be error code. diff --git a/histogram/updating-accessing.lisp b/histogram/updating-accessing.lisp index dccfa1ae888934a03ade74df9d5657549eee43fa..f83e501d46508fbd7b37395a8b3ac6107bd58ccc 100644 --- a/histogram/updating-accessing.lisp +++ b/histogram/updating-accessing.lisp @@ -1,6 +1,6 @@ ;; Updating and accessing histogram elements. ;; Liam Healy, Mon Jan 1 2007 - 14:43 -;; Time-stamp: <2008-02-17 17:04:08EST updating-accessing.lisp> +;; Time-stamp: <2008-02-23 18:49:16EST updating-accessing.lisp> ;; $Id: $ (in-package :gsl) @@ -34,7 +34,7 @@ histograms for a small range of a larger dataset, ignoring the values outside the range of interest.") -(defmfun gsl-aref ((histogram histogram) &rest i) +(defmfun maref ((histogram histogram) &rest i) "gsl_histogram_get" (((pointer histogram) :pointer) ((first i) size)) :type :method @@ -127,22 +127,22 @@ (set-ranges-uniform histo 0.0d0 10.0d0) (increment histo 2.7d0) (increment histo 6.9d0 2.0d0) - (gsl-aref histo 1)) + (maref histo 1)) (letm ((histo (histogram 10))) (set-ranges-uniform histo 0.0d0 10.0d0) (increment histo 2.7d0) (increment histo 6.9d0 2.0d0) - (gsl-aref histo 2)) + (maref histo 2)) (letm ((histo (histogram 10))) (set-ranges-uniform histo 0.0d0 10.0d0) (increment histo 2.7d0) (increment histo 6.9d0 2.0d0) - (gsl-aref histo 6)) + (maref histo 6)) (letm ((histo (histogram 10))) (set-ranges-uniform histo 0.0d0 10.0d0) (increment histo 2.7d0) (increment histo 6.9d0 2.0d0) - (gsl-aref histo 16)) + (maref histo 16)) (letm ((histo (histogram 10))) (set-ranges-uniform histo 0.0d0 10.0d0) (increment histo 2.7d0) @@ -174,7 +174,7 @@ (SET-RANGES-UNIFORM HISTO 0.0d0 10.0d0) (INCREMENT HISTO 2.7d0) (INCREMENT HISTO 6.9d0 2.0d0) - (GSL-AREF HISTO 1)))) + (MAREF HISTO 1)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 1.0d0) (MULTIPLE-VALUE-LIST @@ -182,7 +182,7 @@ (SET-RANGES-UNIFORM HISTO 0.0d0 10.0d0) (INCREMENT HISTO 2.7d0) (INCREMENT HISTO 6.9d0 2.0d0) - (GSL-AREF HISTO 2)))) + (MAREF HISTO 2)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 2.0d0) (MULTIPLE-VALUE-LIST @@ -190,14 +190,14 @@ (SET-RANGES-UNIFORM HISTO 0.0d0 10.0d0) (INCREMENT HISTO 2.7d0) (INCREMENT HISTO 6.9d0 2.0d0) - (GSL-AREF HISTO 6)))) + (MAREF HISTO 6)))) (LISP-UNIT:ASSERT-ERROR 'GSL-ERROR (LETM ((HISTO (HISTOGRAM 10))) (SET-RANGES-UNIFORM HISTO 0.0d0 10.0d0) (INCREMENT HISTO 2.7d0) (INCREMENT HISTO 6.9d0 2.0d0) - (GSL-AREF HISTO 16))) + (MAREF HISTO 16))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 0.0d0 10.0d0) (MULTIPLE-VALUE-LIST @@ -223,6 +223,3 @@ (INCREMENT HISTO 2.7d0) (INCREMENT HISTO 6.9d0 2.0d0) (HISTOGRAM-FIND HISTO 5.5d0))))) - - - diff --git a/polynomial.lisp b/polynomial.lisp index f28af3c33dae5564392909f89d23471fbe0c7012..0921d88b88226de627db572411a887a125056553 100644 --- a/polynomial.lisp +++ b/polynomial.lisp @@ -1,6 +1,6 @@ ;; Polynomials ;; Liam Healy, Tue Mar 21 2006 - 18:33 -;; Time-stamp: <2008-02-17 08:49:41EST polynomial.lisp> +;; Time-stamp: <2008-02-23 18:49:15EST polynomial.lisp> ;; $Id: $ (in-package :gsl) @@ -162,8 +162,8 @@ (workspace :pointer) ((gsl-array answer-pd) :pointer)) :return ((loop for i from 0 below (dim0 answer-pd) by 2 - collect (complex (gsl-aref answer-pd i) - (gsl-aref answer-pd (1+ i))))) + collect (complex (maref answer-pd i) + (maref answer-pd (1+ i))))) :documentation ; FDL "Arguments are: a GSL array of coefficients, a workspace, a gsl-array of doubles." diff --git a/series-acceleration.lisp b/series-acceleration.lisp index d3bbb88cc8b6cdb7b9095b7a0847effc83902b2a..7381421fefb21d50e5aed102ce6bf2753cbb4d4d 100644 --- a/series-acceleration.lisp +++ b/series-acceleration.lisp @@ -1,6 +1,6 @@ ;; Series acceleration. ;; Liam Healy, Wed Nov 21 2007 - 18:41 -;; Time-stamp: <2008-02-17 18:04:12EST series-acceleration.lisp> +;; Time-stamp: <2008-02-23 18:49:18EST series-acceleration.lisp> ;; $Id: $ (in-package :gsl) @@ -112,8 +112,8 @@ (letm ((levin (levin maxterms)) (array (vector-double maxterms))) (dotimes (n maxterms) - (setf (gsl-aref array n) (coerce (/ (expt (1+ n) 2)) 'double-float)) - (incf sum (gsl-aref array n))) + (setf (maref array n) (coerce (/ (expt (1+ n) 2)) 'double-float)) + (incf sum (maref array n))) (multiple-value-bind (accelerated-sum error) (accelerate array levin) (format t "~&term-by-term sum =~f using ~d terms" sum maxterms) diff --git a/solve-minimize-fit/linear-least-squares.lisp b/solve-minimize-fit/linear-least-squares.lisp index c6f1f5ed3d71a7469f8e6c4e3f951ea8fc6d80d7..d2303f2ada244bb026fbd2b0cb1d93b3fde9493c 100644 --- a/solve-minimize-fit/linear-least-squares.lisp +++ b/solve-minimize-fit/linear-least-squares.lisp @@ -1,6 +1,6 @@ ;; Linear least squares, or linear regression ;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp> -;; Time-stamp: <2008-02-17 18:33:16EST linear-least-squares.lisp> +;; Time-stamp: <2008-02-23 19:43:59EST linear-least-squares.lisp> ;; $Id: $ (in-package :gsl) @@ -243,8 +243,8 @@ (defmfun multi-linear-estimate (x coefficients covariance) "gsl_multifit_linear_est" - ((x :double) (coefficients :pointer) - (covariance :pointer) (y :double) (y-error :double)) + (((pointer x) :pointer) ((pointer coefficients) :pointer) + ((pointer covariance) :pointer) (y :double) (y-error :double)) :documentation ; FDL "Use the best-fit multilinear regression coefficients and their covariance matrix to compute the fitted function value @@ -270,15 +270,15 @@ (loop for i from 0 below (dim0 x) do (format t "~&data: ~12,5f ~12,5f ~12,5f" - (gsl-aref x i) - (gsl-aref y i) - (/ (gsl-aref w i)))) + (maref x i) + (maref y i) + (/ (maref w i)))) (loop for i from -30 below 130 by 10 ; don't print everything for - xf = (+ (gsl-aref x 0) + xf = (+ (maref x 0) (* (/ i 100) - (- (gsl-aref x (1- (dim0 x))) - (gsl-aref x 0)))) + (- (maref x (1- (dim0 x))) + (maref x 0)))) do (multiple-value-bind (yf yferr) (linear-estimate xf c0 c1 cov00 cov01 cov11) @@ -308,26 +308,26 @@ (c (vector-double 3))) (loop for i from 0 for row in data do - (setf (gsl-aref X i 0) 1.0d0 - (gsl-aref X i 1) (first row) - (gsl-aref X i 2) (expt (first row) 2) - (gsl-aref y i) (second row) - (gsl-aref w i) (/ (expt (third row) 2)))) + (setf (maref X i 0) 1.0d0 + (maref X i 1) (first row) + (maref X i 2) (expt (first row) 2) + (maref y i) (second row) + (maref w i) (/ (expt (third row) 2)))) (letm ((ws (fit-workspace n 3))) (setf chisq (weighted-linear-mfit X w y c cov ws))) (format t "~&Best fit: Y = ~10,8f + ~10,8f X + ~10,8f X^2" - (gsl-aref c 0) (gsl-aref c 1) (gsl-aref c 2)) + (maref c 0) (maref c 1) (maref c 2)) (format t "~&Covariance matrix:") (format t "~&~10,8f ~10,8f ~10,8f" - (gsl-aref cov 0 0) (gsl-aref cov 0 1) (gsl-aref cov 0 2)) + (maref cov 0 0) (maref cov 0 1) (maref cov 0 2)) (format t "~&~10,8f ~10,8f ~10,8f" - (gsl-aref cov 1 0) (gsl-aref cov 1 1) (gsl-aref cov 1 2)) + (maref cov 1 0) (maref cov 1 1) (maref cov 1 2)) (format t "~&~10,8f ~10,8f ~10,8f" - (gsl-aref cov 2 0) (gsl-aref cov 2 1) (gsl-aref cov 2 2)) + (maref cov 2 0) (maref cov 2 1) (maref cov 2 2)) (format t "~&Chisq = ~10,6f" chisq))) ;;; (mv-linear-least-squares-example (mv-linear-least-squares-data)) diff --git a/solve-minimize-fit/minimization-multi.lisp b/solve-minimize-fit/minimization-multi.lisp index 59082a7f31efee2c4b54be6db7075444e5a2c042..4c7d80b25c23b2715abdd47d4b8e0b485147164e 100644 --- a/solve-minimize-fit/minimization-multi.lisp +++ b/solve-minimize-fit/minimization-multi.lisp @@ -1,6 +1,6 @@ ;; Multivariate minimization. ;; Liam Healy <Tue Jan 8 2008 - 21:28> -;; Time-stamp: <2008-02-17 18:39:48EST minimization-multi.lisp> +;; Time-stamp: <2008-02-23 18:49:17EST minimization-multi.lisp> ;; $Id: $ (in-package :gsl) @@ -360,11 +360,11 @@ 1.0d-3))) (let ((x (mfdfminimizer-x minimizer))) (format t "~&~d~6t~10,6f~18t~10,6f~28t~12,9f" - iter (gsl-aref x 0) (gsl-aref x 1) + iter (maref x 0) (maref x 1) (mfdfminimizer-minimum minimizer))) finally (return (let ((x (mfdfminimizer-x minimizer))) - (values (gsl-aref x 0) (gsl-aref x 1))))))) + (values (maref x 0) (maref x 1))))))) ;;; Because def-minimization-functions bind a symbol ;;; of the same name as the first function, and we want both to run, @@ -390,9 +390,9 @@ (not (min-test-size size 1.0d-2))) (let ((x (mfminimizer-x minimizer))) (format t "~&~d~6t~10,6f~18t~10,6f~28t~12,9f~40t~8,3f" - iter (gsl-aref x 0) (gsl-aref x 1) + iter (maref x 0) (maref x 1) (mfminimizer-minimum minimizer) size)) finally (return (let ((x (mfminimizer-x minimizer))) - (values (gsl-aref x 0) (gsl-aref x 1)))))))) + (values (maref x 0) (maref x 1)))))))) diff --git a/solve-minimize-fit/nonlinear-least-squares.lisp b/solve-minimize-fit/nonlinear-least-squares.lisp index 90e4385bfbfac2c6d6bc7293608a4d686ae118a4..a11f7228bd30969720755030e33f1593f801b5c3 100644 --- a/solve-minimize-fit/nonlinear-least-squares.lisp +++ b/solve-minimize-fit/nonlinear-least-squares.lisp @@ -1,6 +1,6 @@ ;; Nonlinear least squares fitting. ;; Liam Healy, 2008-02-09 12:59:16EST nonlinear-least-squares.lisp -;; Time-stamp: <2008-02-17 18:26:44EST nonlinear-least-squares.lisp> +;; Time-stamp: <2008-02-23 18:49:18EST nonlinear-least-squares.lisp> ;; $Id: $ (in-package :gsl) @@ -393,7 +393,7 @@ exponential-residual init))) (macrolet ((fitx (i) `(vref (fdffit-slot fit 'x) ,i)) - (err (i) `(sqrt (gsl-aref covariance ,i ,i)))) + (err (i) `(sqrt (maref covariance ,i ,i)))) (format t "~&iter: ~d x = ~15,8f ~15,8f ~15,8f |f(x)|=~7,6g" 0 (fitx 0) (fitx 1) (fitx 2) (norm (make-data-from-pointer (fdffit-slot fit 'f)))) diff --git a/solve-minimize-fit/roots-multi.lisp b/solve-minimize-fit/roots-multi.lisp index 08b4474581651a36c60172590098ef9ae70d5328..51766372e19ac486917614282642bb49ac4fc1e2 100644 --- a/solve-minimize-fit/roots-multi.lisp +++ b/solve-minimize-fit/roots-multi.lisp @@ -1,6 +1,6 @@ ;;; Multivariate roots. ;;; Liam Healy 2008-01-12 12:49:08 -;;; Time-stamp: <2008-02-17 18:15:07EST roots-multi.lisp> +;;; Time-stamp: <2008-02-23 18:49:17EST roots-multi.lisp> ;;; $Id: $ (in-package :gsl) @@ -392,11 +392,11 @@ (defparameter *powell-A* 1.0d4) (defun powell (argument return) "Powell's test function." - (setf (gsl-aref return 0) - (- (* *powell-A* (gsl-aref argument 0) (gsl-aref argument 1)) + (setf (maref return 0) + (- (* *powell-A* (maref argument 0) (maref argument 1)) 1) - (gsl-aref return 1) - (+ (exp (- (gsl-aref argument 0))) (exp (- (gsl-aref argument 1))) + (maref return 1) + (+ (exp (- (maref argument 0))) (exp (- (maref argument 1))) (- (1+ (/ *powell-A*)))))) ;;; (def-mfunction powell 2) @@ -443,15 +443,15 @@ (iterate-mfsolver solver) (format t "~&iter=~d~8tx0=~12,8g~24tx1=~12,8g~38tf0=~12,8g~52tf1=~12,8g" iter - (gsl-aref argval 0) - (gsl-aref argval 1) - (gsl-aref fnval 0) - (gsl-aref fnval 1)) + (maref argval 0) + (maref argval 1) + (maref fnval 0) + (maref fnval 1)) finally (return - (values (gsl-aref argval 0) - (gsl-aref argval 1) - (gsl-aref fnval 0) - (gsl-aref fnval 1))))))))) + (values (maref argval 0) + (maref argval 1) + (maref fnval 0) + (maref fnval 1))))))))) (defun rosenbrock-df (argument jacobian) @@ -479,10 +479,10 @@ (flet ((print-state (iter argval fnval) (format t "~&iter=~d~8tx0=~12,8g~24tx1=~12,8g~38tf0=~12,8g~52tf1=~12,8g" iter - (gsl-aref argval 0) - (gsl-aref argval 1) - (gsl-aref fnval 0) - (gsl-aref fnval 1)))) + (maref argval 0) + (maref argval 1) + (maref fnval 0) + (maref fnval 1)))) (let ((max-iter 1000)) (letm ((vect (vector-double #(-10.0d0 -5.0d0)))) (letm @@ -497,7 +497,7 @@ (iterate-mfdfsolver solver) (print-state iter argval fnval) finally (return - (values (gsl-aref argval 0) - (gsl-aref argval 1) - (gsl-aref fnval 0) - (gsl-aref fnval 1)))))))))) + (values (maref argval 0) + (maref argval 1) + (maref fnval 0) + (maref fnval 1)))))))))) diff --git a/wavelet.lisp b/wavelet.lisp index 8369f9d509c21a1178c35d03a6fa0efe62697d3b..4a92bf17db32e36e6b6879c478bbb1394ed9da98 100644 --- a/wavelet.lisp +++ b/wavelet.lisp @@ -1,6 +1,6 @@ ;; Wavelet transforms. ;; Liam Healy, Mon Nov 26 2007 - 20:43 -;; Time-stamp: <2008-02-17 18:37:40EST wavelet.lisp> +;; Time-stamp: <2008-02-23 18:49:16EST wavelet.lisp> ;; $Id: $ (in-package :gsl) @@ -394,13 +394,13 @@ (letm ((absvector (vector-double n)) (permutation (permutation n))) (dotimes (i n) - (setf (gsl-aref absvector i) (abs (gsl-aref vector i)))) + (setf (maref absvector i) (abs (maref vector i)))) ;; Sort and set to 0 all but the largest 20. (sort-vector-index permutation absvector) (dotimes (i (- n 20)) - (setf (gsl-aref vector (gsl-aref permutation i)) + (setf (maref vector (maref permutation i)) 0.0d0))) ;; Transform back - (dotimes (i n) (format t "~&~a" (gsl-aref vector i))) + (dotimes (i n) (format t "~&~a" (maref vector i))) (cl-invalidate vector) (wavelet-transform-inverse wavelet vector 1 workspace) (data vector)))