From 352210f54acc9f11c948a0d22f796e9addff2f09 Mon Sep 17 00:00:00 2001 From: Liam Healy <liam@thinkpad.local> Date: Sat, 21 Feb 2009 17:41:32 -0500 Subject: [PATCH] Order of arguments in linear-mfit, export symbols, documentation update Swapped the optional arguments 'weight, 'tolerance to linear-mfit on the assumption that weighted fits are used more often than SVD. Exported symbols for the generic functions defined in generic.lisp (note: this will require shadowing when importing both the :gsl package and the :iterate package). Various minor improvements/updates to documentation. --- basis-splines.lisp | 4 ++-- documentation/index.html | 5 ++--- documentation/missing-features.text | 4 ++++ histogram/probability-distribution.lisp | 6 +++--- random/generators.lisp | 4 ++-- solve-minimize-fit/generic.lisp | 4 +++- solve-minimize-fit/linear-least-squares.lisp | 6 +++--- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/basis-splines.lisp b/basis-splines.lisp index e40f04f6..e93a2fb8 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: <2009-02-19 21:59:54EST basis-splines.lisp> +;; Time-stamp: <2009-02-21 16:46:31EST basis-splines.lisp> ;; $Id$ (in-package :gsl) @@ -123,7 +123,7 @@ (dotimes (j ncoeffs) (setf (maref Xmatrix i j) (maref B j)))) ;; Do the fit - (linear-mfit Xmatrix y c nil w cov mw) + (linear-mfit Xmatrix y c w nil cov mw) ;; Return the smoothed curve (loop for xi from 0.0d0 to 15.0d0 by 0.1d0 with yval and yerr diff --git a/documentation/index.html b/documentation/index.html index 5fbc4963..2aab04b9 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -359,8 +359,7 @@ GSL doesn't have them. <a name="status"/> <p> GSLL is largely complete and usable, with functioning interfaces to -most of GSL. Some functionality is not yet ported, particularly those -introduced in the more recent versions of GSL; see +most of GSL. Some functionality is not yet ported; see <a href="missing-features.text">missing-features.text</a> for more details. Known bugs are documented in <a href="status.text">status.text</a>. Work is ongoing to both @@ -384,7 +383,7 @@ and arrays used internally or for function return. <!-- Created: Feb 25 2005 --> <!-- hhmts start --> <small> -Time-stamp: <2009-02-16 14:41:41EST index.html> +Time-stamp: <2009-02-21 16:47:23EST index.html> </small> <!-- hhmts end --> </div> diff --git a/documentation/missing-features.text b/documentation/missing-features.text index 24a405ea..2afc5c10 100644 --- a/documentation/missing-features.text +++ b/documentation/missing-features.text @@ -10,3 +10,7 @@ Stride is always set to 1 in GSL functions that take a stride. Wishlist Be able to set the real and imaginary parts of an array to a real array. + + +Unify names for sampling Sat Feb 21 2009 +Polynomial coefficients solver vs. evaluator Sat Feb 21 2009 diff --git a/histogram/probability-distribution.lisp b/histogram/probability-distribution.lisp index a831fa7f..cf5eba9e 100644 --- a/histogram/probability-distribution.lisp +++ b/histogram/probability-distribution.lisp @@ -1,6 +1,6 @@ ;; Histogram probability distribution. ;; Liam Healy, Mon Jan 1 2007 - 17:51 -;; Time-stamp: <2009-01-25 10:04:23EST probability-distribution.lisp> +;; Time-stamp: <2009-02-21 17:12:56EST probability-distribution.lisp> ;; $Id$ (in-package :gsl) @@ -40,8 +40,8 @@ 'pdf. The algorithm used to compute the sample s is given by s = range[i] + delta * (range[i+1] - range[i]) where i is the index which satisfies - sum[i] <= r < sum[i+1] and delta is - (r - sum[i])/(sum[i+1] - sum[i]).")) + sum[i] <= value < sum[i+1] and delta is + (value - sum[i])/(sum[i+1] - sum[i]).")) (defmfun sample ((pdf histogram-pdf) value) "gsl_histogram_pdf_sample" diff --git a/random/generators.lisp b/random/generators.lisp index cbcc3fc3..6343edd7 100644 --- a/random/generators.lisp +++ b/random/generators.lisp @@ -1,6 +1,6 @@ ;; Generators of random numbers. ;; Liam Healy, Sat Jul 15 2006 - 14:43 -;; Time-stamp: <2009-02-16 18:43:36EST generators.lisp> +;; Time-stamp: <2009-02-21 17:23:26EST generators.lisp> ;; $Id$ (in-package :gsl) @@ -59,7 +59,7 @@ "A double precision floating point number uniformly distributed in the range [0,1). The range includes 0.0 but excludes 1.0. The value is typically obtained by dividing the result of - #'rng-get by (+ (rng-max generator) 1.0) in double + #'get-random-number by (+ (rng-max generator) 1.0) in double precision. Some generators compute this ratio internally so that they can provide floating point numbers with more than 32 bits of randomness (the maximum number of bits that can be portably represented in a single diff --git a/solve-minimize-fit/generic.lisp b/solve-minimize-fit/generic.lisp index f231583a..882422c7 100644 --- a/solve-minimize-fit/generic.lisp +++ b/solve-minimize-fit/generic.lisp @@ -1,6 +1,6 @@ ;; Generic functions for optimization ;; Liam Healy 2009-01-03 12:59:07EST generic.lisp -;; Time-stamp: <2009-02-14 12:25:14EST generic.lisp> +;; Time-stamp: <2009-02-21 16:47:51EST generic.lisp> ;; $Id: $ (in-package :gsl) @@ -9,6 +9,8 @@ ;;;; Generic functions for solve-minimize-fit objects ;;;;**************************************************************************** +(export '(iterate solution function-value last-step)) + (defgeneric iterate (object) (:documentation "Take the next iteration step for this object.")) diff --git a/solve-minimize-fit/linear-least-squares.lisp b/solve-minimize-fit/linear-least-squares.lisp index 34d94762..6543c5fe 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: <2009-02-19 21:58:24EST linear-least-squares.lisp> +;; Time-stamp: <2009-02-21 16:46:32EST linear-least-squares.lisp> ;; $Id$ (in-package :gsl) @@ -130,7 +130,7 @@ (export 'linear-mfit) (defun linear-mfit (model observations parameters-or-size - &optional tolerance weight + &optional weight tolerance (covariance (default-covariance parameters-or-size)) (workspace (default-lls-workspace observations parameters-or-size))) "Compute the best-fit parameters c of the weighted or unweighted @@ -330,7 +330,7 @@ (maref y i) (second row) (maref w i) (/ (expt (third row) 2)))) (multiple-value-bind (parameters cov chisq) - (linear-mfit X y 3 nil w) + (linear-mfit X y 3 w) (when print-details (format t "Best fit: Y = ~10,8f + ~10,8f X + ~10,8f X^2~&" (maref parameters 0) (maref parameters 1) (maref parameters 2)) -- GitLab