Show
Ignore:
Timestamp:
03/11/08 01:34:13 (8 months ago)
Author:
lhealy
Message:

The classes/types in the different contexts are now gathered together
in one place, in *type-names* for the types and in *data-class-name*
for data classes, populated by #'add-data-class. Both defdata and
defmfun-all use the table and so mapping between various names is
consistent. The data class names are now different, *-double-float
and *-single-float replaces *-double and *-single. The regression
tests give the same results as before.

Location:
trunk/solve-minimize-fit
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/solve-minimize-fit/linear-least-squares.lisp

    r26 r34  
    11;; Linear least squares, or linear regression 
    22;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp> 
    3 ;; Time-stamp: <2008-02-23 19:43:59EST linear-least-squares.lisp> 
     3;; Time-stamp: <2008-03-09 19:30:56EDT linear-least-squares.lisp> 
    44;; $Id$ 
    55 
     
    259259  "First example in Section 36.5 of the GSL manual." 
    260260  ;; 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)))) 
    264264        (multiple-value-bind (c0 c1 cov00 cov01 cov11 chisq) 
    265265            (weighted-linear-fit x w y) 
     
    302302  "Second example in Section 36.5 of the GSL manual." 
    303303  (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))) 
    309309    (loop for i from 0 
    310310          for row in data do 
  • trunk/solve-minimize-fit/minimization-multi.lisp

    r26 r34  
    11;; Multivariate minimization. 
    22;; Liam Healy  <Tue Jan  8 2008 - 21:28> 
    3 ;; Time-stamp: <2008-02-23 18:49:17EST minimization-multi.lisp> 
     3;; Time-stamp: <2008-03-09 19:29:20EDT minimization-multi.lisp> 
    44;; $Id$ 
    55 
     
    88;; In the parabaloid example, I notice that the consruct  
    99;; (min-test-gradient (mfdfminimizer-gradient minimizer) 1.0d-3) 
    10 ;; is constructing a CL vector-double (in mfdfminimizer-gradient) and 
     10;; is constructing a CL vector-double-float (in mfdfminimizer-gradient) and 
    1111;; then immediately pulling out the pointer (in min-test-gradient).  It 
    1212;; is easy enough to eliminate this, but then mfdfminimizer-gradient 
     
    349349          (mfdfminimizer *conjugate-fletcher-reeves* 2 parabaloid 
    350350                         initial 0.01d0 1.0d-4)) 
    351          (initial (vector-double #(5.0d0 7.0d0)))) 
     351         (initial (vector-double-float #(5.0d0 7.0d0)))) 
    352352    (loop with status = T 
    353353          for iter from 0 below 100 
     
    376376 
    377377(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))) 
    380380    (set-all step-size 1.0d0) 
    381381    (letm ((minimizer 
  • trunk/solve-minimize-fit/nonlinear-least-squares.lisp

    r26 r34  
    11;; Nonlinear least squares fitting. 
    22;; Liam Healy, 2008-02-09 12:59:16EST nonlinear-least-squares.lisp 
    3 ;; Time-stamp: <2008-02-23 18:49:18EST nonlinear-least-squares.lisp> 
     3;; Time-stamp: <2008-03-09 19:30:55EDT nonlinear-least-squares.lisp> 
    44;; $Id$ 
    55 
     
    384384 
    385385(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))) 
    387387         (covariance 
    388           (matrix-double *number-of-parameters* *number-of-parameters*)) 
     388          (matrix-double-float *number-of-parameters* *number-of-parameters*)) 
    389389         (fit (nonlinear-fdffit 
    390390               *levenberg-marquardt* 
  • trunk/solve-minimize-fit/roots-multi.lisp

    r26 r34  
    11;;; Multivariate roots.                 
    22;;; Liam Healy 2008-01-12 12:49:08 
    3 ;;; Time-stamp: <2008-02-23 18:49:17EST roots-multi.lisp> 
     3;;; Time-stamp: <2008-03-09 19:29:20EDT roots-multi.lisp> 
    44;;; $Id$ 
    55 
     
    407407(defparameter *rosenbrock-b* 10.0d0) 
    408408 
    409 (defparameter *gsl-vector* 
    410   (make-instance 'gsl-vector-double :pointer nil :storage-size nil)) 
    411  
    412409#| 
    413410;;; One alternative way of writing the function, not recommended. 
     
    433430  "Solving Rosenbrock, the example given in Sec. 34.8 of the GSL manual." 
    434431  (let ((max-iter 1000)) 
    435     (letm ((vect (vector-double #(-10.0d0 -5.0d0)))) 
     432    (letm ((vect (vector-double-float #(-10.0d0 -5.0d0)))) 
    436433      (letm ((solver (mfsolver *hybrid-scaled* rosenbrock vect))) 
    437434        (let ((fnval (mfsolver-f solver)) 
     
    485482                   (maref fnval 1)))) 
    486483    (let ((max-iter 1000)) 
    487       (letm ((vect (vector-double #(-10.0d0 -5.0d0)))) 
     484      (letm ((vect (vector-double-float #(-10.0d0 -5.0d0)))) 
    488485        (letm 
    489486            ((solver (mfdfsolver *gnewton-mfdfsolver* rosenbrock-f vect)))