Commit 9848c6ad authored by Liam Healy's avatar Liam Healy

Redeclare foreign-allocated variables called by reference

Variables called using with-foreign-objects that are passed to GSL for
the purposes of returning computed values (i.e., are not mentioned in
the CL arglist) need to be declared (:pointer type) because they are
calls by reference.  Everything now compiles though there are
execution errors in the tests.
parent 0b3847ba
;; Monte Carlo Integration
;; Liam Healy Sat Feb 3 2007 - 17:42
;; Time-stamp: <2009-04-04 22:34:29EDT monte-carlo.lisp>
;; Time-stamp: <2009-04-26 23:21:18EDT monte-carlo.lisp>
;; $Id$
(in-package :gsl)
......@@ -44,7 +44,7 @@
((dim0 lower-limits) sizet) (number-of-samples sizet)
((mpointer generator) :pointer)
((mpointer state) :pointer)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:inputs (lower-limits upper-limits)
:callbacks
(callback fnstruct-dimension (dimension)
......@@ -130,7 +130,7 @@
((dim0 lower-limits) sizet) (number-of-samples sizet)
((mpointer generator) :pointer)
((mpointer state) :pointer)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:inputs (lower-limits upper-limits)
:callbacks
(callback fnstruct-dimension (dimension)
......@@ -226,7 +226,7 @@
((dim0 lower-limits) sizet) (number-of-samples sizet)
((mpointer generator) :pointer)
((mpointer state) :pointer)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:inputs (lower-limits upper-limits)
:callbacks
(callback fnstruct-dimension (dimension)
......
;; Numerical differentiation.
;; Liam Healy Mon Nov 12 2007 - 22:07
;; Time-stamp: <2009-04-04 22:24:31EDT numerical-differentiation.lisp>
;; Time-stamp: <2009-04-26 23:23:53EDT numerical-differentiation.lisp>
;; $Id$
(in-package :gsl)
;;; The example at the end needs to be made into a regression test.
;;; GSL function "callback" passing is identical to
;;; numerical-integration, so those definitions have been used.
;;; Some improvement could be made in naming/organization.
;;; /usr/include/gsl/gsl_diff.h
(defmfun central-derivative (function x step)
"gsl_deriv_central"
((callback :pointer) (x :double) (step :double)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -36,7 +33,7 @@
(defmfun forward-derivative (function x step)
"gsl_deriv_forward"
((callback :pointer) (x :double) (step :double)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -61,7 +58,7 @@
(defmfun backward-derivative (function x step)
"gsl_deriv_backward"
((callback :pointer) (x :double) (step :double)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......
;; Numerical integration techniques that require tables
;; Liam Healy 2009-04-04 15:24:05EDT
;; Time-stamp: <2009-04-04 22:27:18EDT numerical-integration-with-tables.lisp>
;; Time-stamp: <2009-04-26 23:20:16EDT numerical-integration-with-tables.lisp>
;; $Id: $
(in-package :gsl)
......@@ -48,7 +48,7 @@
((mpointer table) :pointer)
(absolute-error :double) (relative-error :double)
(limit sizet) ((mpointer workspace) :pointer)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -109,7 +109,7 @@
(absolute-error :double) (relative-error :double)
(limit sizet) ((mpointer workspace) :pointer)
((mpointer table) :pointer)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -153,7 +153,7 @@
(limit sizet)
((mpointer workspace) :pointer) ((mpointer cycle-workspace) :pointer)
((mpointer table) :pointer)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......
;; Numerical integration
;; Liam Healy, Wed Jul 5 2006 - 23:14
;; Time-stamp: <2009-04-04 22:25:57EDT numerical-integration.lisp>
;; Time-stamp: <2009-04-26 23:19:49EDT numerical-integration.lisp>
;; $Id$
(in-package :gsl)
......@@ -34,7 +34,8 @@
((callback :pointer)
(a :double) (b :double)
(absolute-error :double) (relative-error :double)
(result :double) (abserr :double) (neval sizet))
(result (:pointer :double)) (abserr (:pointer :double))
(neval (:pointer sizet)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -78,7 +79,7 @@
(a :double) (b :double)
(absolute-error :double) (relative-error :double)
(limit sizet) (method integrate-method) ((mpointer workspace) :pointer)
(result :double) (abserr :double))
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -114,7 +115,8 @@
((callback :pointer)
(a :double) (b :double)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer) (result :double) (abserr :double))
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -146,7 +148,8 @@
((callback :pointer)
((c-pointer points) :pointer) ((dim0 points) sizet)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer) (result :double) (abserr :double))
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
:inputs (points)
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
......@@ -176,7 +179,8 @@
"gsl_integration_qagi"
((callback :pointer)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer) (result :double) (abserr :double))
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -200,7 +204,8 @@
"gsl_integration_qagiu"
((callback :pointer) (a :double)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer) (result :double) (abserr :double))
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -220,7 +225,8 @@
"gsl_integration_qagil"
((callback :pointer) (b :double)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer) (result :double) (abserr :double))
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......@@ -245,7 +251,8 @@
((callback :pointer)
(a :double) (b :double) (c :double)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer) (result :double) (abserr :double))
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
:callbacks
(callback fnstruct nil (function :double (:input :double) :slug))
:callback-dynamic (nil (function))
......
;; Chebyshev Approximations
;; Liam Healy Sat Nov 17 2007 - 20:36
;; Time-stamp: <2009-04-04 22:27:16EDT chebyshev.lisp>
;; Time-stamp: <2009-04-26 23:25:30EDT chebyshev.lisp>
;; $Id$
(in-package :gsl)
......@@ -63,10 +63,10 @@
(defmfun evaluate-chebyshev-error (chebyshev x &optional order)
("gsl_cheb_eval_err" "gsl_cheb_eval_n_err")
((((mpointer chebyshev) :pointer) (x :double) (result :double)
(abserr :double))
((((mpointer chebyshev) :pointer) (x :double)
(result (:pointer :double)) (abserr (:pointer :double)))
(((mpointer chebyshev) :pointer) (order sizet) (x :double)
(result :double) (abserr :double)))
(result (:pointer :double)) (abserr (:pointer :double))))
:documentation ; FDL
"Evaluate the Chebyshev series at a point x, returning result and
an estimate of its absolute error. If order is supplied,
......
;; Tests of array functions
;; Liam Healy 2008-10-20 22:41:48EDT array-tests.lisp
;; Time-stamp: <2009-01-11 22:19:58EST array-tests.lisp>
;; Time-stamp: <2009-04-11 22:33:59EDT array-tests.lisp>
;; $Id: $
;;; Generate each file with #'write-test-to-file, e.g.
......@@ -15,13 +15,13 @@
;;;; Bulk operations
;;;;****************************************************************************
(generate-all-array-tests vector-set-all-add :no-complex
(generate-all-array-tests vector-set-all-add t
(let ((v1 (array-default 3 t))
(v2 (array-default 3)))
(set-all v1 (scalar-default))
(cl-array (elt+ v1 v2))))
(generate-all-array-tests matrix-set-all-add :no-complex
(generate-all-array-tests matrix-set-all-add t
(let ((m1 (array-default '(3 3) t))
(m2 (array-default '(3 3))))
(set-all m1 (scalar-default))
......
;; Functions for both vectors and matrices.
;; Liam Healy 2008-04-26 20:48:44EDT both.lisp
;; Time-stamp: <2009-04-25 18:29:10EDT both.lisp>
;; Time-stamp: <2009-04-26 22:29:34EDT both.lisp>
;; $Id$
(in-package :gsl)
......@@ -270,7 +270,7 @@
(defmfun min-index ((a matrix))
("gsl_" :category :type "_min_index")
(((mpointer a) :pointer) (imin sizet) (jmin sizet))
(((mpointer a) :pointer) (imin (:pointer sizet)) (jmin (:pointer sizet)))
:definition :methods
:element-types :no-complex
:inputs (a)
......@@ -289,7 +289,7 @@
(defmfun max-index ((a matrix))
("gsl_" :category :type "_max_index")
(((mpointer a) :pointer) (imax sizet) (jmax sizet))
(((mpointer a) :pointer) (imin (:pointer sizet)) (jmin (:pointer sizet)))
:definition :methods
:element-types :no-complex
:inputs (a)
......@@ -297,7 +297,7 @@
(defmfun minmax-index ((a vector))
("gsl_" :category :type "_minmax_index")
(((mpointer a) :pointer) (imin sizet) (imax sizet))
(((mpointer a) :pointer) (imin (:pointer sizet)) (jmin (:pointer sizet)))
:definition :generic
:element-types :no-complex
:inputs (a)
......@@ -310,7 +310,9 @@
(defmfun minmax-index ((a matrix))
("gsl_" :category :type "_minmax_index")
(((mpointer a) :pointer) (imin sizet) (jmin sizet) (imax sizet) (jmax sizet))
(((mpointer a) :pointer)
(imin (:pointer sizet)) (jmin (:pointer sizet))
(imax (:pointer sizet)) (jmax (:pointer sizet)))
:definition :methods
:element-types :no-complex
:inputs (a)
......
;; Permutations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2009-03-17 20:27:01EDT permutation.lisp>
;; Time-stamp: <2009-04-26 22:47:28EDT permutation.lisp>
;; $Id$
(in-package :gsl)
......@@ -223,7 +223,7 @@
(defmfun permute-inverse
(p (data #.+foreign-pointer-class+) &optional (size 1) (stride 1))
"gsl_permute_inverse"
(((mpointer p) :pointer) (data :pointer) (stride sizet) (n sizet))
(((mpointer p) :pointer) (data :pointer) (stride sizet) (stride sizet))
:definition :method
:inputs (p data)
:outputs (data)
......
;; Statistics of histograms.
;; Liam Healy, Mon Jan 1 2007 - 16:13
;; Time-stamp: <2008-12-26 14:46:23EST statistics.lisp>
;; Time-stamp: <2009-04-26 23:15:55EDT statistics.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_histogram.h
;;; /usr/include/gsl/gsl_histogram2d.h
(defmfun mmax ((histogram histogram))
"gsl_histogram_max_val"
(((mpointer histogram) :pointer))
......@@ -50,7 +53,7 @@
(defmfun max-index ((histogram histogram2d))
"gsl_histogram2d_max_bin"
(((mpointer histogram) :pointer)
(xindex sizet) (yindex sizet))
(xindex (:pointer sizet)) (yindex (:pointer sizet)))
:definition :method
:c-return :void
:documentation ; FDL
......@@ -71,7 +74,7 @@
(defmfun min-index ((histogram histogram2d))
"gsl_histogram2d_min_bin"
(((mpointer histogram) :pointer)
(xindex sizet) (yindex sizet))
(xindex (:pointer sizet)) (yindex (:pointer sizet)))
:definition :method
:c-return :void
:documentation ; FDL
......
;; Updating and accessing histogram elements.
;; Liam Healy, Mon Jan 1 2007 - 14:43
;; Time-stamp: <2008-12-26 11:58:11EST updating-accessing.lisp>
;; Time-stamp: <2009-04-26 23:13:17EDT updating-accessing.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_histogram.h
;;; /usr/include/gsl/gsl_histogram2d.h
(defmfun increment (histogram value &optional weight)
("gsl_histogram_increment" "gsl_histogram_accumulate")
((((mpointer histogram) :pointer) (value :double))
......@@ -37,7 +40,7 @@
(defmfun range (histogram i)
"gsl_histogram_get_range"
(((mpointer histogram) :pointer) (i sizet)
(lower :double) (upper :double))
(lower (:pointer :double)) (upper (:pointer :double)))
:documentation ; FDL
"Find the upper and lower range limits of the i-th
bin of the histogram. If the index i is valid then the
......@@ -79,9 +82,9 @@
(defmfun histogram-find (histogram x-value &optional y-value)
("gsl_histogram_find" "gsl_histogram2d_find")
((((mpointer histogram) :pointer) (x-value :double) (bin sizet))
((((mpointer histogram) :pointer) (x-value :double) (bin (:pointer sizet)))
(((mpointer histogram) :pointer) (x-value :double) (y-value :double)
(xbin sizet) (ybin sizet)))
(xbin (:pointer sizet)) (ybin (:pointer sizet))))
:documentation ; FDL
"Finds the bin number which covers the coordinate value in
the histogram. The bin is located using a binary search. The
......
;; Helpers for defining GSL functions on arrays
;; Liam Healy 2009-01-07 22:01:16EST defmfun-array.lisp
;; Time-stamp: <2009-04-25 23:27:05EDT defmfun-array.lisp>
;; Time-stamp: <2009-04-26 22:27:10EDT defmfun-array.lisp>
;; $Id: $
(in-package :gsl)
......@@ -200,7 +200,7 @@
(lambda (v)
(subst (cl-cffi element-type) :element-c-type
(subst (component-type element-type) :component-float-type v)))
c-arguments)))
c-arguments))
;;; (actual-class-arglist '((v1 vector) (v2 vector) (m matrix) x) '(unsigned-byte 16))
;;; ((V1 VECTOR-UNSIGNED-BYTE-16) (V2 VECTOR-UNSIGNED-BYTE-16)
......
;; BLAS level 1, Vector operations
;; Liam Healy, Wed Apr 26 2006 - 15:23
;; Time-stamp: <2009-01-15 21:28:41EST blas1.lisp>
;; Time-stamp: <2009-04-26 23:01:57EDT blas1.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_blas.h
(defmfun dot ((vec1 vector) (vec2 vector))
("gsl_blas_" :type "dot" :suffix)
(((mpointer vec1) :pointer) ((mpointer vec2) :pointer)
(result :element-c-type))
(result (:pointer :element-c-type)))
:definition :generic
:element-types :float-complex
:inputs (vec1 vec2)
......
;; LU decomposition
;; Liam Healy, Thu Apr 27 2006 - 12:42
;; Time-stamp: <2009-03-17 20:42:37EDT lu.lisp>
;; Time-stamp: <2009-04-26 23:04:02EDT lu.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_linalg.h
(defmfun LU-decomposition
((A matrix) &optional (permutation (make-permutation (dim0 A))))
("gsl_linalg" :complex "_LU_decomp")
(((mpointer A) :pointer) ((mpointer permutation) :pointer) (signum :int))
(((mpointer A) :pointer) ((mpointer permutation) :pointer)
(signum (:pointer :int)))
:definition :generic
:inputs (A)
:outputs (A permutation)
......@@ -94,7 +97,7 @@
(defmfun LU-determinant ((LU matrix) signum)
("gsl_linalg" :complex "_LU_det")
(((mpointer LU) :pointer) (signum :int))
(((mpointer LU) :pointer) (signum (:pointer :int)))
:definition :generic
:inputs (LU)
:element-types :doubles
......@@ -119,7 +122,7 @@
(defmfun LU-sgndet ((LU matrix) signum)
("gsl_linalg" :complex "_LU_sgndet")
(((mpointer LU) :pointer) (signum :int))
(((mpointer LU) :pointer) (signum (:pointer :int)))
:definition :generic
:inputs (LU)
:element-types :doubles
......
;; QR with column pivoting
;; Liam Healy, Fri Apr 28 2006 - 16:53
;; Time-stamp: <2009-02-23 22:11:10EST qrpt.lisp>
;; Time-stamp: <2009-04-26 23:05:14EDT qrpt.lisp>
;; $Id$
(in-package :gsl)
;;; /usr/include/gsl/gsl_linalg.h
(defmfun QRPT-decomposition
(A tau p &optional (norm (make-marray 'double-float :dimensions (dim1 A))))
"gsl_linalg_QRPT_decomp"
(((mpointer A) :pointer) ((mpointer tau) :pointer)
((mpointer p) :pointer)
(signum :int) ((mpointer norm) :pointer))
(signum (:pointer :int)) ((mpointer norm) :pointer))
:inputs (A)
:outputs (A tau p norm)
:return (A tau signum p)
......@@ -40,7 +42,7 @@
"gsl_linalg_QRPT_decomp2"
(((mpointer A) :pointer) ((mpointer q) :pointer)
((mpointer r) :pointer) ((mpointer tau) :pointer)
((mpointer p) :pointer) (signum :int)
((mpointer p) :pointer) (signum (:pointer :int))
((mpointer norm) :pointer))
:inputs (A)
:outputs (q r norm)
......
;; Polynomials
;; Liam Healy, Tue Mar 21 2006 - 18:33
;; Time-stamp: <2009-04-02 21:58:22EDT polynomial.lisp>
;; Time-stamp: <2009-04-26 22:49:47EDT polynomial.lisp>
;; $Id$
(in-package :gsl)
......@@ -103,7 +103,8 @@
(defmfun solve-quadratic (a b c)
"gsl_poly_solve_quadratic"
((a :double) (b :double) (c :double) (root1 :double) (root2 :double))
((a :double) (b :double) (c :double)
(root1 (:pointer :double)) (root2 (:pointer :double)))
:c-return :number-of-answers
:documentation ; FDL
"The real roots of the quadratic equation a x^2 + b x + c = 0.
......@@ -127,7 +128,8 @@
(defmfun solve-cubic (a b c)
"gsl_poly_solve_cubic"
((a :double) (b :double) (c :double)
(root1 :double) (root2 :double) (root3 :double))
(root1 (:pointer :double))
(root2 (:pointer :double)) (root3 (:pointer :double)))
:c-return :number-of-answers
:documentation ; FDL
"Find the real roots of the cubic equation, x^3 + a x^2 + b x + c = 0
......
;; Gaussian bivariate distribution
;; Liam Healy, Sat Sep 2 2006 - 16:32
;; Time-stamp: <2009-02-16 10:10:33EST gaussian-bivariate.lisp>
;; Time-stamp: <2009-04-26 23:06:34EDT gaussian-bivariate.lisp>
;; $Id$
(in-package :gsl)
......@@ -10,7 +10,7 @@
(defmfun bivariate-gaussian (generator sigma-x sigma-y rho)
"gsl_ran_bivariate_gaussian"
(((mpointer generator) :pointer) (sigma-x :double) (sigma-y :double) (rho :double)
(x :double) (y :double))
(x (:pointer :double)) (y (:pointer :double)))
:c-return :void
:documentation ; FDL
"Generate a pair of correlated Gaussian variates, with
......
;; Spherical Vector distribution
;; Liam Healy, Sun Oct 22 2006
;; Time-stamp: <2009-02-16 10:10:32EST spherical-vector.lisp>
;; Time-stamp: <2009-04-26 23:08:37EDT spherical-vector.lisp>
;; $Id$
(in-package :gsl)
......@@ -11,7 +11,8 @@
(defmfun direction-2d (generator)
"gsl_ran_dir_2d"
(((mpointer generator) :pointer) (x :double) (y :double))
(((mpointer generator) :pointer)
(x (:pointer :double)) (y (:pointer :double)))
:c-return :void
:documentation ; FDL
"A random direction vector v = (x,y) in
......@@ -20,7 +21,8 @@
(defmfun direction-2d-trig-method (generator)
"gsl_ran_dir_2d_trig_method"
(((mpointer generator) :pointer) (x :double) (y :double))
(((mpointer generator) :pointer)
(x (:pointer :double)) (y (:pointer :double)))
:c-return :void
:documentation ; FDL
"A random direction vector v = (x,y) in
......@@ -29,7 +31,8 @@
(defmfun direction-3d (generator)
"gsl_ran_dir_3d"
(((mpointer generator) :pointer) (x :double) (y :double) (z :double))
(((mpointer generator) :pointer)
(x (:pointer :double)) (y (:pointer :double)) (z (:pointer :double)))
:c-return :void
:documentation ; FDL
"A random direction vector v =
......
;; Series acceleration.
;; Liam Healy, Wed Nov 21 2007 - 18:41
;; Time-stamp: <2009-01-26 21:31:38EST series-acceleration.lisp>
;; Time-stamp: <2009-04-26 23:27:40EDT series-acceleration.lisp>
;; $Id$
(in-package :gsl)
......@@ -36,7 +36,7 @@
(defmfun accelerate (array levin)
"gsl_sum_levin_u_accel"
(((c-pointer array) :pointer) ((dim0 array) sizet) ((mpointer levin) :pointer)
(accelerated-sum :double) (absolute-error :double))
(accelerated-sum (:pointer :double)) (abserr (:pointer :double)))
:inputs (array)
:documentation ; FDL
"From the terms of a series in array, compute the extrapolated
......@@ -64,7 +64,7 @@
(defmfun accelerate-truncated (array levin)
"gsl_sum_levin_utrunc_accel"
(((c-pointer array) :pointer) ((dim0 array) sizet) ((mpointer levin) :pointer)
(accelerated-sum :double) (absolute-error :double))
(accelerated-sum (:pointer :double)) (abserr (:pointer :double)))
:inputs (array)
:documentation ; FDL
"From the terms of a series in array, compute the extrapolated
......
;; Linear least squares, or linear regression
;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp>
;; Time-stamp: <2009-03-20 14:58:52EDT linear-least-squares.lisp>
;; Time-stamp: <2009-04-26 23:36:23EDT linear-least-squares.lisp>
;; $Id$
(in-package :gsl)
......@@ -22,16 +22,18 @@
(x y &optional weight (x-stride 1) (y-stride 1) (weight-stride 1))
("gsl_fit_linear" "gsl_fit_wlinear")
((((c-pointer x) :pointer) (x-stride sizet)
((c-pointer y) :pointer) (y-stride sizet)
((dim0 x) sizet) (c0 :double) (c1 :double)
(cov00 :double) (cov01 :double) (cov11 :double)
(sumsq :double))
((c-pointer y) :pointer) (y-stride sizet)
((dim0 x) sizet)
(c0 (:pointer :double)) (c1 (:pointer :double))
(cov00 (:pointer :double)) (cov01 (:pointer :double))
(cov11 (:pointer :double)) (sumsq (:pointer :double)))
(((c-pointer x) :pointer) (x-stride sizet)
((c-pointer weight) :pointer) (weight-stride sizet)
((c-pointer y) :pointer) (y-stride sizet)
((dim0 x) sizet) (c0 :double) (c1 :double)
(cov00 :double) (cov01 :double) (cov11 :double)
(chisq :double)))
((c-pointer weight) :pointer) (weight-stride sizet)
((c-pointer y) :pointer) (y-stride sizet)
((dim0 x) sizet)
(c0 (:pointer :double)) (c1 (:pointer :double))
(cov00 (:pointer :double)) (cov01 (:pointer :double))
(cov11 (:pointer :double)) (sumsq (:pointer :double))))
:inputs (x weight y)
:switch (weight weight-stride)
:documentation ; FDL
......@@ -53,7 +55,7 @@
"gsl_fit_linear_est"
((x :double) (c0 :double) (c1 :double)
(cov00 :double) (cov01 :double) (cov11 :double)
(y :double) (y-error :double))
(y (:pointer :double)) (y-error (:pointer :double)))
:documentation ; FDL
"Use the best-fit linear regression coefficients
c0, c1 and their covariance
......@@ -70,13 +72,15 @@
("gsl_fit_mul" "gsl_fit_wmul")
((((c-pointer x) :pointer) (x-stride sizet)
((c-pointer y) :pointer) (y-stride sizet)
((dim0 x) sizet) (c1 :double) (cov11 :double)
(sumsq :double))
((dim0 x) sizet)
(c1 (:pointer :double)) (cov11 (:pointer :double))
(sumsq (:pointer :double)))
(((c-pointer x) :pointer) (x-stride sizet)
((c-pointer weight) :pointer) (weight-stride sizet)
((c-pointer y) :pointer) (y-stride sizet)
((dim0 x) sizet) (c1 :double) (cov11 :double)
(chisq :double)))
((dim0 x) sizet)
(c1 (:pointer :double)) (cov11 (:pointer :double))
(sumsq (:pointer :double))))
:inputs (x y weight)
:switch (weight weight-stride)
:documentation ; FDL
......@@ -95,7 +99,7 @@
(defmfun multiplier-estimate (x c1 cov11)
"gsl_fit_mul_est"
((x :double) (c1 :double) (cov11 :double)
(y :double) (y-error :double))
(y (:pointer :double)) (y-error (:pointer :double)))
:documentation ; FDL
"Use the best-fit linear regression coefficient
c1 and its covariance cov11 to compute the fitted function
......@@ -171,14 +175,14 @@
((mpointer observations) :pointer)
((mpointer parameters) :pointer)
((mpointer covariance) :pointer)
(chisq :double)
(chisq (:pointer :double))
((mpointer workspace) :pointer))
(((mpointer model) :pointer)
((mpointer weight) :pointer)
((mpointer observations) :pointer)
((mpointer parameters) :pointer)
((mpointer covariance) :pointer)
(chisq :double)
(chisq (:pointer :double))
((mpointer workspace) :pointer)))
:inputs (model weight observations)
:outputs (parameters covariance)
......@@ -211,19 +215,19 @@
((((mpointer model) :pointer)
((mpointer observations