Skip to content
Snippets Groups Projects
Commit 352210f5 authored by Liam Healy's avatar Liam Healy
Browse files

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.
parent ed9a001e
No related branches found
No related tags found
No related merge requests found
;; Basis splines. ;; Basis splines.
;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
(dotimes (j ncoeffs) (dotimes (j ncoeffs)
(setf (maref Xmatrix i j) (maref B j)))) (setf (maref Xmatrix i j) (maref B j))))
;; Do the fit ;; 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 ;; Return the smoothed curve
(loop for xi from 0.0d0 to 15.0d0 by 0.1d0 (loop for xi from 0.0d0 to 15.0d0 by 0.1d0
with yval and yerr with yval and yerr
......
...@@ -359,8 +359,7 @@ GSL doesn't have them. ...@@ -359,8 +359,7 @@ GSL doesn't have them.
<a name="status"/> <a name="status"/>
<p> <p>
GSLL is largely complete and usable, with functioning interfaces to GSLL is largely complete and usable, with functioning interfaces to
most of GSL. Some functionality is not yet ported, particularly those most of GSL. Some functionality is not yet ported; see
introduced in the more recent versions of GSL; see
<a href="missing-features.text">missing-features.text</a> <a href="missing-features.text">missing-features.text</a>
for more details. Known bugs are documented in for more details. Known bugs are documented in
<a href="status.text">status.text</a>. Work is ongoing to both <a href="status.text">status.text</a>. Work is ongoing to both
...@@ -384,7 +383,7 @@ and arrays used internally or for function return. ...@@ -384,7 +383,7 @@ and arrays used internally or for function return.
<!-- Created: Feb 25 2005 --> <!-- Created: Feb 25 2005 -->
<!-- hhmts start --> <!-- hhmts start -->
<small> <small>
Time-stamp: <2009-02-16 14:41:41EST index.html> Time-stamp: <2009-02-21 16:47:23EST index.html>
</small> </small>
<!-- hhmts end --> <!-- hhmts end -->
</div> </div>
......
...@@ -10,3 +10,7 @@ Stride is always set to 1 in GSL functions that take a stride. ...@@ -10,3 +10,7 @@ Stride is always set to 1 in GSL functions that take a stride.
Wishlist Wishlist
Be able to set the real and imaginary parts of an array to a real Be able to set the real and imaginary parts of an array to a real
array. array.
Unify names for sampling Sat Feb 21 2009
Polynomial coefficients solver vs. evaluator Sat Feb 21 2009
;; Histogram probability distribution. ;; Histogram probability distribution.
;; Liam Healy, Mon Jan 1 2007 - 17:51 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
'pdf. The algorithm used to compute the sample s is given by 'pdf. The algorithm used to compute the sample s is given by
s = range[i] + delta * (range[i+1] - range[i]) s = range[i] + delta * (range[i+1] - range[i])
where i is the index which satisfies where i is the index which satisfies
sum[i] <= r < sum[i+1] and delta is sum[i] <= value < sum[i+1] and delta is
(r - sum[i])/(sum[i+1] - sum[i]).")) (value - sum[i])/(sum[i+1] - sum[i])."))
(defmfun sample ((pdf histogram-pdf) value) (defmfun sample ((pdf histogram-pdf) value)
"gsl_histogram_pdf_sample" "gsl_histogram_pdf_sample"
......
;; Generators of random numbers. ;; Generators of random numbers.
;; Liam Healy, Sat Jul 15 2006 - 14:43 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
"A double precision floating point number uniformly "A double precision floating point number uniformly
distributed in the range [0,1). The range includes 0.0 but excludes 1.0. 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 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 precision. Some generators compute this ratio internally so that they
can provide floating point numbers with more than 32 bits of randomness 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 (the maximum number of bits that can be portably represented in a single
......
;; Generic functions for optimization ;; Generic functions for optimization
;; Liam Healy 2009-01-03 12:59:07EST generic.lisp ;; 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: $ ;; $Id: $
(in-package :gsl) (in-package :gsl)
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
;;;; Generic functions for solve-minimize-fit objects ;;;; Generic functions for solve-minimize-fit objects
;;;;**************************************************************************** ;;;;****************************************************************************
(export '(iterate solution function-value last-step))
(defgeneric iterate (object) (defgeneric iterate (object)
(:documentation "Take the next iteration step for this object.")) (:documentation "Take the next iteration step for this object."))
......
;; Linear least squares, or linear regression ;; Linear least squares, or linear regression
;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp> ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
(export 'linear-mfit) (export 'linear-mfit)
(defun linear-mfit (defun linear-mfit
(model observations parameters-or-size (model observations parameters-or-size
&optional tolerance weight &optional weight tolerance
(covariance (default-covariance parameters-or-size)) (covariance (default-covariance parameters-or-size))
(workspace (default-lls-workspace observations parameters-or-size))) (workspace (default-lls-workspace observations parameters-or-size)))
"Compute the best-fit parameters c of the weighted or unweighted "Compute the best-fit parameters c of the weighted or unweighted
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
(maref y i) (second row) (maref y i) (second row)
(maref w i) (/ (expt (third row) 2)))) (maref w i) (/ (expt (third row) 2))))
(multiple-value-bind (parameters cov chisq) (multiple-value-bind (parameters cov chisq)
(linear-mfit X y 3 nil w) (linear-mfit X y 3 w)
(when print-details (when print-details
(format t "Best fit: Y = ~10,8f + ~10,8f X + ~10,8f X^2~&" (format t "Best fit: Y = ~10,8f + ~10,8f X + ~10,8f X^2~&"
(maref parameters 0) (maref parameters 1) (maref parameters 2)) (maref parameters 0) (maref parameters 1) (maref parameters 2))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment