Changeset 34 for trunk/solve-minimize-fit
- Timestamp:
- 03/11/08 01:34:13 (8 months ago)
- Location:
- trunk/solve-minimize-fit
- Files:
-
- 4 modified
-
linear-least-squares.lisp (modified) (3 diffs)
-
minimization-multi.lisp (modified) (4 diffs)
-
nonlinear-least-squares.lisp (modified) (2 diffs)
-
roots-multi.lisp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/solve-minimize-fit/linear-least-squares.lisp
r26 r34 1 1 ;; Linear least squares, or linear regression 2 2 ;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp> 3 ;; Time-stamp: <2008-0 2-23 19:43:59EST linear-least-squares.lisp>3 ;; Time-stamp: <2008-03-09 19:30:56EDT linear-least-squares.lisp> 4 4 ;; $Id$ 5 5 … … 259 259 "First example in Section 36.5 of the GSL manual." 260 260 ;; Results not given in manual so not verified yet. 261 (letm ((x (vector-double #(1970.0d0 1980.0d0 1990.0d0 2000.0d0)))262 (y (vector-double #(12.0d0 11.0d0 14.0d0 13.0d0)))263 (w (vector-double #(0.1d0 0.2d0 0.3d0 0.4d0))))261 (letm ((x (vector-double-float #(1970.0d0 1980.0d0 1990.0d0 2000.0d0))) 262 (y (vector-double-float #(12.0d0 11.0d0 14.0d0 13.0d0))) 263 (w (vector-double-float #(0.1d0 0.2d0 0.3d0 0.4d0)))) 264 264 (multiple-value-bind (c0 c1 cov00 cov01 cov11 chisq) 265 265 (weighted-linear-fit x w y) … … 302 302 "Second example in Section 36.5 of the GSL manual." 303 303 (letm ((n (length data)) chisq 304 (x (matrix-double n 3))305 (cov (matrix-double 3 3))306 (y (vector-double n))307 (w (vector-double n))308 (c (vector-double 3)))304 (x (matrix-double-float n 3)) 305 (cov (matrix-double-float 3 3)) 306 (y (vector-double-float n)) 307 (w (vector-double-float n)) 308 (c (vector-double-float 3))) 309 309 (loop for i from 0 310 310 for row in data do -
trunk/solve-minimize-fit/minimization-multi.lisp
r26 r34 1 1 ;; Multivariate minimization. 2 2 ;; Liam Healy <Tue Jan 8 2008 - 21:28> 3 ;; Time-stamp: <2008-0 2-23 18:49:17EST minimization-multi.lisp>3 ;; Time-stamp: <2008-03-09 19:29:20EDT minimization-multi.lisp> 4 4 ;; $Id$ 5 5 … … 8 8 ;; In the parabaloid example, I notice that the consruct 9 9 ;; (min-test-gradient (mfdfminimizer-gradient minimizer) 1.0d-3) 10 ;; is constructing a CL vector-double (in mfdfminimizer-gradient) and10 ;; is constructing a CL vector-double-float (in mfdfminimizer-gradient) and 11 11 ;; then immediately pulling out the pointer (in min-test-gradient). It 12 12 ;; is easy enough to eliminate this, but then mfdfminimizer-gradient … … 349 349 (mfdfminimizer *conjugate-fletcher-reeves* 2 parabaloid 350 350 initial 0.01d0 1.0d-4)) 351 (initial (vector-double #(5.0d0 7.0d0))))351 (initial (vector-double-float #(5.0d0 7.0d0)))) 352 352 (loop with status = T 353 353 for iter from 0 below 100 … … 376 376 377 377 (defun multimin-example-nelder-mead () 378 (letm ((initial (vector-double #(5.0d0 7.0d0)))379 (step-size (vector-double 2)))378 (letm ((initial (vector-double-float #(5.0d0 7.0d0))) 379 (step-size (vector-double-float 2))) 380 380 (set-all step-size 1.0d0) 381 381 (letm ((minimizer -
trunk/solve-minimize-fit/nonlinear-least-squares.lisp
r26 r34 1 1 ;; Nonlinear least squares fitting. 2 2 ;; Liam Healy, 2008-02-09 12:59:16EST nonlinear-least-squares.lisp 3 ;; Time-stamp: <2008-0 2-23 18:49:18EST nonlinear-least-squares.lisp>3 ;; Time-stamp: <2008-03-09 19:30:55EDT nonlinear-least-squares.lisp> 4 4 ;; $Id$ 5 5 … … 384 384 385 385 (defun solve-nonlinear-least-squares-example () 386 (letm ((init (vector-double #(1.0d0 0.0d0 0.0d0)))386 (letm ((init (vector-double-float #(1.0d0 0.0d0 0.0d0))) 387 387 (covariance 388 (matrix-double *number-of-parameters* *number-of-parameters*))388 (matrix-double-float *number-of-parameters* *number-of-parameters*)) 389 389 (fit (nonlinear-fdffit 390 390 *levenberg-marquardt* -
trunk/solve-minimize-fit/roots-multi.lisp
r26 r34 1 1 ;;; Multivariate roots. 2 2 ;;; Liam Healy 2008-01-12 12:49:08 3 ;;; Time-stamp: <2008-0 2-23 18:49:17EST roots-multi.lisp>3 ;;; Time-stamp: <2008-03-09 19:29:20EDT roots-multi.lisp> 4 4 ;;; $Id$ 5 5 … … 407 407 (defparameter *rosenbrock-b* 10.0d0) 408 408 409 (defparameter *gsl-vector*410 (make-instance 'gsl-vector-double :pointer nil :storage-size nil))411 412 409 #| 413 410 ;;; One alternative way of writing the function, not recommended. … … 433 430 "Solving Rosenbrock, the example given in Sec. 34.8 of the GSL manual." 434 431 (let ((max-iter 1000)) 435 (letm ((vect (vector-double #(-10.0d0 -5.0d0))))432 (letm ((vect (vector-double-float #(-10.0d0 -5.0d0)))) 436 433 (letm ((solver (mfsolver *hybrid-scaled* rosenbrock vect))) 437 434 (let ((fnval (mfsolver-f solver)) … … 485 482 (maref fnval 1)))) 486 483 (let ((max-iter 1000)) 487 (letm ((vect (vector-double #(-10.0d0 -5.0d0))))484 (letm ((vect (vector-double-float #(-10.0d0 -5.0d0)))) 488 485 (letm 489 486 ((solver (mfdfsolver *gnewton-mfdfsolver* rosenbrock-f vect)))
