Commit e803849a authored by liam's avatar liam

Add linear least squares fitting. Define generic functions so that

warnings are suppressed.


git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3274 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent 0a78898d
This diff is collapsed.
This diff is collapsed.
;********************************************************
; file: eigensystems.lisp
; description: Eigenvectors and eigenvalues
; date: Sun May 21 2006 - 19:52
; author: Liam M. Healy
; modified: Tue Jul 4 2006 - 23:09
;********************************************************
;;; $Id: $
;; Eigenvectors and eigenvalues
;; Liam Healy, Sun May 21 2006 - 19:52
;; Time-stamp: <2008-01-21 11:30:57EST eigensystems.lisp>
;; $Id: $
(in-package :gsl)
......@@ -45,33 +41,38 @@
(defun-gsl eigen-symm-alloc (n)
"gsl_eigen_symm_alloc" ((n :size))
:documentation "Allocate a workspace for computing eigenvalues of
@var{n}-by-@var{n} real symmetric matrices. The size of the workspace
is @math{O(2n)}."
:documentation ; FDL
"Allocate a workspace for computing eigenvalues of
n-by-n real symmetric matrices. The size of the workspace
is O(2n)."
:c-return :pointer)
(defun-gsl eigen-symm-free (w)
"gsl_eigen_symm_free" ((w :pointer))
:c-return :void
:documentation "Free the memory associated with the workspace @var{w}.")
:documentation ; FDL
"Free the memory associated with the workspace w.")
(defun-gsl eigen-symmv-alloc (n)
"gsl_eigen_symmv_alloc" ((n :size))
:documentation "Allocate a workspace for computing eigenvalues and
eigenvectors of @var{n}-by-@var{n} real symmetric matrices. The size of
the workspace is @math{O(4n)}."
:documentation ; FDL
"Allocate a workspace for computing eigenvalues and
eigenvectors of n-by-n real symmetric matrices. The size of
the workspace is O(4n)."
:c-return :pointer)
(defun-gsl eigen-symmv-free (w)
"gsl_eigen_symmv_free" ((w :pointer))
:c-return :void
:documentation "Free the memory associated with the workspace @var{w}.")
:documentation ; FDL
"Free the memory associated with the workspace w.")
(defun-gsl eigenvalues-symmetric (A eval ws)
"gsl_eigen_symm" ((A gsl-matrix-c) (eval gsl-vector-c) (ws :pointer))
:documentation "Eigenvalues of the real symmetric matrix
@var{A}. Additional workspace of the appropriate size must be provided
in @var{w}. The diagonal and lower triangular part of @var{A} are
:documentation ; FDL
"Eigenvalues of the real symmetric matrix
A. Additional workspace of the appropriate size must be provided
in w. The diagonal and lower triangular part of A are
destroyed during the computation, but the strict upper triangular part
is not referenced. The eigenvalues are stored in the vector @var{eval}
and are unordered."
......@@ -81,13 +82,14 @@
(defun-gsl eigenvalues-eigenvectors-symmetric (A eval evec ws)
"gsl_eigen_symmv"
((A gsl-matrix-c) (eval gsl-vector-c) (evec gsl-matrix-c) (ws :pointer))
:documentation "The eigenvalues and eigenvectors of the real
symmetric matrix @var{A}. Additional workspace of the appropriate size
must be provided in @var{w}. The diagonal and lower triangular part of
@var{A} are destroyed during the computation, but the strict upper
:documentation ; FDL
"The eigenvalues and eigenvectors of the real
symmetric matrix A. Additional workspace of the appropriate size
must be provided in w. The diagonal and lower triangular part of
A are destroyed during the computation, but the strict upper
triangular part is not referenced. The eigenvalues are stored in the
vector @var{eval} and are unordered. The corresponding eigenvectors are
stored in the columns of the matrix @var{evec}. For example, the
vector eval and are unordered. The corresponding eigenvectors are
stored in the columns of the matrix evec. For example, the
eigenvector in the first column corresponds to the first eigenvalue.
The eigenvectors are guaranteed to be mutually orthogonal and normalised
to unit magnitude."
......@@ -100,23 +102,25 @@
(defun-gsl eigen-herm-alloc (n)
"gsl_eigen_herm_alloc" ((n :size))
:documentation "Allocate a workspace for computing eigenvalues of
@var{n}-by-@var{n} complex hermitian matrices. The size of the workspace
is @math{O(3n)}."
:documentation ; FDL
"Allocate a workspace for computing eigenvalues of
n-by-n complex hermitian matrices. The size of the workspace
is O(3n)."
:c-return :pointer)
(defun-gsl eigen-herm-free (w)
"gsl_eigen_herm_free" ((w :pointer))
:c-return :void
:documentation "Free the memory associated with the workspace @var{w}.")
:documentation ; FDL
"Free the memory associated with the workspace w.")
(defun-gsl eigenvalues-hermitian (A eval w)
"gsl_eigen_herm"
(((pointer A) gsl-matrix-c) ((pointer eval) gsl-vector-c) (w :pointer))
:documentation
:documentation ; FDL
"Compute the eigenvalues of the complex hermitian matrix
@var{A}. Additional workspace of the appropriate size must be provided
in @var{w}. The diagonal and lower triangular part of @var{A} are
A. Additional workspace of the appropriate size must be provided
in w. The diagonal and lower triangular part of A are
destroyed during the computation, but the strict upper triangular part
is not referenced. The imaginary parts of the diagonal are assumed to be
zero and are not referenced. The eigenvalues are stored in the vector
......@@ -126,29 +130,31 @@
(defun-gsl eigen-hermv-alloc (n)
"gsl_eigen_hermv_alloc" ((n :size))
:documentation "Allocate a workspace for computing eigenvalues and
eigenvectors of @var{n}-by-@var{n} complex hermitian matrices. The size of
the workspace is @math{O(5n)}."
:documentation ; FDL
"Allocate a workspace for computing eigenvalues and
eigenvectors of n-by-n complex hermitian matrices. The size of
the workspace is O(5n)."
:c-return :pointer)
(defun-gsl eigen-hermv-free (w)
"gsl_eigen_hermv_free" ((w :pointer))
:c-return :void
:documentation "Free the memory associated with the workspace @var{w}.")
:documentation ; FDL
"Free the memory associated with the workspace w.")
(defun-gsl eigenvalues-eigenvectors-hermitian (A eval evec w)
"gsl_eigen_hermv"
(((pointer A) gsl-matrix-c) ((pointer eval) gsl-vector-c)
((pointer evec) gsl-matrix-c) (w :pointer))
:documentation
:documentation ; FDL
"Compute the eigenvalues and eigenvectors of the complex
hermitian matrix @var{A}. Additional workspace of the appropriate size
must be provided in @var{w}. The diagonal and lower triangular part of
@var{A} are destroyed during the computation, but the strict upper
hermitian matrix A. Additional workspace of the appropriate size
must be provided in w. The diagonal and lower triangular part of
A are destroyed during the computation, but the strict upper
triangular part is not referenced. The imaginary parts of the diagonal
are assumed to be zero and are not referenced. The eigenvalues are
stored in the vector @var{eval} and are unordered. The corresponding
complex eigenvectors are stored in the columns of the matrix @var{evec}.
stored in the vector eval and are unordered. The corresponding
complex eigenvectors are stored in the columns of the matrix evec.
For example, the eigenvector in the first column corresponds to the
first eigenvalue. The eigenvectors are guaranteed to be mutually
orthogonal and normalised to unit magnitude."
......@@ -163,15 +169,19 @@
"gsl_eigen_sort_t from /usr/include/gsl/gsl_eigen.h."
:value-ascending :value-descending :absolute-ascending :absolute-descending)
(export 'sort-eigenvalues-eigenvectors)
(defgeneric sort-eigenvalues-eigenvectors (eval evec sort-type)
(:documentation ; FDL
"Simultaneously sort the eigenvalues stored in the vector
eval and the corresponding real eigenvectors stored in the columns
of the matrix evec into ascending or descending order according to
the value of the parameter sort-type: :value-ascending,
:value-descending, :absolute-ascending, :absolute-descending."))
(defun-gsl sort-eigenvalues-eigenvectors
((eval gsl-vector-double) evec sort-type)
"gsl_eigen_symmv_sort"
((eval gsl-vector-c) (evec gsl-matrix-c) (sort-type eigen-sort-type))
:documentation "Simultaneously sort the eigenvalues stored in the vector
@var{eval} and the corresponding real eigenvectors stored in the columns
of the matrix @var{evec} into ascending or descending order according to
the value of the parameter @var{sort_type}, :value-ascending,
:value-descending, :absolute-ascending, :absolute-descending."
:type :method
:invalidate (eval evec))
......@@ -179,10 +189,6 @@
((eval gsl-vector-complex) evec sort-type)
"gsl_eigen_hermv_sort"
((eval gsl-vector-c) (evec gsl-matrix-c) (sort-type eigen-sort-type))
:documentation "Simultaneously sort the eigenvalues stored in the vector
@var{eval} and the corresponding complex eigenvectors stored in the
columns of the matrix @var{evec} into ascending or descending order
according to the value of the parameter @var{sort_type}."
:type :method
:invalidate (eval evec))
......
;********************************************************
; file: mathematical.lisp
; description: Mathematical functions
; date: Wed Mar 8 2006 - 22:09
; author: Liam M. Healy
; modified: Mon May 29 2006 - 23:06
;********************************************************
;; Mathematical functions
;; Liam Healy, Wed Mar 8 2006 - 22:09
;; Time-stamp: <2008-01-21 18:01:09EST mathematical.lisp>
;; $Id: $
(in-package :gsl)
......@@ -83,11 +80,13 @@
:documentation
"exp(x)-1, computed in a way that is accurate for small x.")
(defun-gsl hypotenuse (x y)
(defun-gsl hypotenuse* (x y)
;; This is redundant; there is "gsl_sf_hypot_e" defined as
;; #'hyptoenuse.
"gsl_hypot" ((x :double) (y :double))
:c-return :double
:documentation
"sqrt{x^2 + y^2} computed in a way that avoids overflow.")
"The hypotenuse sqrt{x^2 + y^2} computed in a way that avoids overflow.")
;; Not clear why this function exists
(defun-gsl gsl-asinh (x)
......
;; Definition of GSLL system
;; Liam Healy
;; Time-stamp: <2008-01-20 23:18:16EST gsll.asd>
;; Time-stamp: <2008-01-21 17:58:44EST gsll.asd>
;; $Id: $
(asdf:defsystem "gsll"
......@@ -92,7 +92,7 @@
:components
((:file "rng-types")
(:file "generators" :depends-on (rng-types))
(:file "quasi" :depends-on (rng-types))
(:file "quasi" :depends-on (rng-types generators))
(:file "gaussian" :depends-on (rng-types))
(:file "gaussian-tail" :depends-on (rng-types))
(:file "gaussian-bivariate" :depends-on (rng-types))
......@@ -172,4 +172,5 @@
(:file "roots-one" :depends-on (init general))
(:file "minimization-one" :depends-on (init general))
(:file "roots-multi" :depends-on (init general data))
(:file "minimization-multi" :depends-on (init general data))))
(:file "minimization-multi" :depends-on (init general data))
(:file "linear-least-squares" :depends-on (init general data))))
;********************************************************
; file: probability-distribution.lisp
; description: Histogram probability distribution.
; date: Mon Jan 1 2007 - 17:51
; author: Liam M. Healy
; modified: Mon Jan 1 2007 - 22:22
;********************************************************
;;; $Id: $
;; Histogram probability distribution.
;; Liam Healy, Mon Jan 1 2007 - 17:51
;; Time-stamp: <2008-01-21 18:02:00EST probability-distribution.lisp>
;; $Id: $
(in-package :gsl)
......@@ -116,6 +112,3 @@
@math{sum[i] <= r < sum[i+1]} and @math{delta} is
@math{(r - sum[i])/(sum[i+1] - sum[i])}.")
(export 'sample)
(defun sample (pdf value)
(histo-1d2d pdf sample (value)))
......@@ -324,7 +324,7 @@ svn checkout svn://common-lisp.net/project/gsll/subversion/trunk</pre>.</p>
<tr>
<td><a href="Least_002dSquares-Fitting.html">
Least Squares Fitting</a></td>
<td>Not started</td>
<td>Done</td>
</tr>
<tr>
<td><a href="Nonlinear-Least_002dSquares-Fitting.html">
......@@ -374,7 +374,7 @@ and expect a few failures on amd64 (four), none? on i386. Often, the
<!-- Created: Feb 25 2005 -->
<!-- hhmts start -->
<small>
Time-stamp: <2008-01-20 21:29:20EST index.html>
Time-stamp: <2008-01-21 17:58:20EST index.html>
</small>
<!-- hhmts end -->
</div>
......
;; Load GSL
;; Liam Healy Sat Mar 4 2006 - 18:53
;; Time-stamp: <2008-01-16 18:50:15 liam init.lisp>
;; Time-stamp: <2008-01-21 12:33:11EST init.lisp>
;; $Id: $
(defpackage gsll
......@@ -21,7 +21,9 @@
;;; The following define :size, from cffi-unix which became cffi-net,
;;; which is apparently turning into something even bigger and more
;;; irrelevant.
;;; irrelevant. All we need is the definition of :size. This should
;;; be changed to something outside the keyword package to suppress
;;; warnings from CFFI.
(cffi:defctype :uint32 :unsigned-int)
(cffi:defctype :uint64 :unsigned-long)
......
This diff is collapsed.
;; Numerical integration
;; Liam Healy, Wed Jul 5 2006 - 23:14
;; Time-stamp: <2008-01-20 22:39:09EST numerical-integration.lisp>
;; Time-stamp: <2008-01-21 12:34:03EST numerical-integration.lisp>
;; $Id: $
;;; To do: QAWS, QAWO, QAWF, more tests
......@@ -217,9 +217,11 @@
(defun-single one-sine (x) (sin x))
#|
;;; Parameters may be defined through the lexical environment:
(let ((mult 2.0d0))
(defun-single two-sine (x) (sin (* mult x))))
|#
(lisp-unit:define-test numerical-integration
(lisp-unit:assert-first-fp-equal
......
;********************************************************
; file: generators.lisp
; description: Generators of random numbers.
; date: Sat Jul 15 2006 - 14:43
; author: Liam M. Healy
; modified: Sat Feb 17 2007 - 21:56
;********************************************************
;;; $Id: $
;; Generators of random numbers.
;; Liam Healy, Sat Jul 15 2006 - 14:43
;; Time-stamp: <2008-01-21 11:47:49EST generators.lisp>
;; $Id: $
(in-package :gsl)
......@@ -143,11 +139,15 @@
;;;; Information functions about instances
;;;;****************************************************************************
(export 'rng-name)
(defgeneric rng-name (rng-instance)
(:documentation ; FDL
"The name of the random number generator."))
(defun-gsl rng-name ((rng-instance random-number-generator))
"gsl_rng_name" (((generator rng-instance) :pointer))
:type :method
:c-return :string
:documentation "The name of the random number generator.")
:c-return :string)
(defun-gsl rng-max (rng-instance)
"gsl_rng_max" (((generator rng-instance) :pointer))
......@@ -163,21 +163,27 @@
algorithms that cannot return zero, and for these generators the minimum
value is 1.")
(export 'rng-state)
(defgeneric rng-state (rng-instance)
(:documentation ; FDL
"A pointer to the state of generator."))
(defun-gsl rng-state ((rng-instance random-number-generator))
"gsl_rng_state" (((generator rng-instance) :pointer))
:c-return :pointer
:type :method
:export nil
:index gsl-random-state
:documentation "A pointer to the state of generator.")
:index gsl-random-state)
(export 'rng-size)
(defgeneric rng-size (rng-instance)
(:documentation ; FDL
"The size of the generator."))
(defun-gsl rng-size ((rng-instance random-number-generator))
"gsl_rng_size" (((generator rng-instance) :pointer))
:c-return :size
:type :method
:export nil
:index gsl-random-state
:documentation "The size of the generator.")
:index gsl-random-state)
(export 'gsl-random-state)
(defun gsl-random-state (rng-instance)
......@@ -202,19 +208,22 @@
"gsl_rng_memcpy"
(((generator destination) :pointer) ((generator source) :pointer))
:type :method
:documentation
"Copy the random number generator @var{source} into the
pre-existing generator @var{destination},
making @var{destination} into an exact copy
of @var{source}. The two generators must be of the same type.")
:documentation ; FDL
"Copy the random number generator source into the
pre-existing generator destination,
making destination into an exact copy
of source. The two generators must be of the same type.")
(export 'clone-generator)
(defgeneric clone-generator (instance)
(:documentation ; FDL
"Create a new generator which is an exact copy of the original.
Don't use; use #'make-random-number-generator, #'copy instead."))
(defun-gsl clone-generator ((instance random-number-generator))
"gsl_rng_clone" (((generator instance) :pointer))
:c-return :pointer
:type :method
:documentation
"Create a new generator which is an exact copy of the original.
Don't use; use #'make-random-number-generator, #'copy instead.")
:type :method)
(defun-gsl write-binary
((object random-number-generator) stream)
......
;********************************************************
; file: quasi.lisp
; description: Quasi-random sequences in arbitrary dimensions.
; date: Sun Jul 16 2006 - 15:54
; author: Liam M. Healy
; modified: Sat Mar 3 2007 - 19:55
;********************************************************
;;; $Id: $
;; Quasi-random sequences in arbitrary dimensions.
;; Liam Healy, Sun Jul 16 2006 - 15:54
;; Time-stamp: <2008-01-21 11:39:10EST quasi.lisp>
;; $Id: $
(in-package :gsl)
......@@ -34,60 +30,58 @@
:type :method
:c-return (ptr :pointer)
:return ((progn (setf (generator generator) ptr) generator))
:documentation
:documentation ; FDL
"Instatiate a random number generator of specified type.
For example, create an instance of the Tausworthe
generator: (rng-alloc *taus*).
The generator is automatically initialized with the default seed,
@code{gsl_rng_default_seed}. This is zero by default but can be changed
either directly or by using the environment variable @code{GSL_RNG_SEED}")
*default-seed*. This is zero by default but can be changed
either directly or by using the environment variable GSL_RNG_SEED.")
(defun-gsl free ((generator quasi-random-number-generator))
"gsl_qrng_free" (((generator generator) :pointer))
:type :method
:c-return :void
:after ((setf (generator generator) nil))
:documentation "Free all the memory associated with the generator.")
:documentation ; FDL
"Free all the memory associated with the generator.")
(defun-gsl init (generator)
"gsl_qrng_init" (((generator generator) :pointer))
:c-return :void
:documentation
"Reinitializes the generator @var{q} to its starting point.
:documentation ; FDL
"Reinitializes the generator q to its starting point.
Note that quasi-random sequences do not use a seed and always produce
the same set of values.")
(defun-gsl qrng-get (generator return-vector)
"gsl_qrng_get"
(((generator generator) :pointer) ((gsl-array return-vector) :pointer))
:documentation
"Store the next point from the sequence generator @var{q}
in the array @var{x}. The space available for @var{x} must match the
dimension of the generator. The point @var{x} will lie in the range
@math{0 < x_i < 1} for each @math{x_i}."
:documentation ; FDL
"Store the next point from the sequence generator q
in the array x. The space available for x must match the
dimension of the generator. The point x will lie in the range
0 < x_i < 1 for each x_i."
:invalidate (return-vector))
(defun-gsl rng-name ((instance quasi-random-number-generator))
"gsl_qrng_name" (((generator instance) :pointer))
:type :method
:c-return :string
:documentation "The name of the random number generator.")
:c-return :string)
(defun-gsl rng-state ((instance quasi-random-number-generator))
"gsl_qrng_state" (((generator instance) :pointer))
:c-return :pointer
:type :method
:export nil
:index gsl-random-state
:documentation "A pointer to the state of generator.")
:index gsl-random-state)
(defun-gsl rng-size ((instance quasi-random-number-generator))
"gsl_qrng_size" (((generator instance) :pointer))
:c-return :size
:type :method
:export nil
:index gsl-random-state
:documentation "The size of the generator.")
:index gsl-random-state)
(defun-gsl copy
((destination quasi-random-number-generator)
......@@ -95,22 +89,23 @@
"gsl_qrng_memcpy"
(((generator destination) :pointer) ((generator source) :pointer))
:type :method
:documentation
"Copy the quasi-random sequence generator @var{src} into the
pre-existing generator @var{dest}, making @var{dest} into an exact copy
of @var{src}. The two generators must be of the same type.")
:documentation ; FDL
"Copy the quasi-random sequence generator src into the
pre-existing generator dest, making dest into an exact copy
of src. The two generators must be of the same type.")
(defun-gsl clone-generator ((instance quasi-random-number-generator))
"gsl_qrng_clone" (((generator instance) :pointer))
:c-return :pointer
:type :method
:documentation
:documentation ; FDL
"Create a new generator which is an exact copy of the original.
Don't use; use #'make-random-number-generator, #'copy instead.")
(def-rng-type *niederreiter2*
;; FDL
"Described in Bratley, Fox, Niederreiter,
@cite{ACM Trans. Model. Comp. Sim.} 2, 195 (1992). It is
ACM Trans. Model. Comp. Sim. 2, 195 (1992). It is
valid up to 12 dimensions."
"gsl_qrng_niederreiter_2")
......@@ -119,6 +114,7 @@
(make-quasi-random-number-generator 2 *niederreiter2*)))
(def-rng-type *sobol*
;; FDL
"This generator uses the Sobol sequence described in Antonov, Saleev,
@cite{USSR Comput. Maths. Math. Phys.} 19, 252 (1980). It is valid up to
40 dimensions."
......
;********************************************************
; file: sorting.lisp
; description: Sorting
; date: Fri Apr 14 2006 - 20:20
; author: Liam M. Healy
; modified: Sun Mar 4 2007 - 10:06
;********************************************************
;;; $Id: $
;; Sorting
;; Liam Healy, Fri Apr 14 2006 - 20:20
;; Time-stamp: <2008-01-21 11:22:27EST sorting.lisp>
;; $Id: $
(in-package :gsl)
......@@ -26,14 +22,14 @@
,body))
(defun-gsl heapsort (array count size function)
"gsl_heapsort"
"gsl_heapsort" ; FDL
((array :pointer) (count :size) (size :size) (function :pointer))
:documentation
"Sort the @var{count} elements of the array @var{array},
each of size @var{size}, into ascending order using the comparison
function @var{compare}. The type of the comparison function is defined by,
"Sort the count elements of the array of size specified
into ascending order using the comparison
function. The type of the comparison function is defined by,
A comparison function should return a negative integer if the first
argument is less than the second argument, @code{0} if the two arguments
argument is less than the second argument, zero if the two arguments
are equal and a positive integer if the first argument is greater than
the second argument."
:c-return :void)
......@@ -41,16 +37,16 @@
(defun-gsl heapsort-index (p array count size function)
"gsl_heapsort_index"
((p :size) (array :pointer) (count :size) (size :size) (function :pointer))
:documentation
"Indirectly sort the @var{count} elements of the array
@var{array}, each of size @var{size}, into ascending order using the
comparison function @var{compare}. The resulting permutation is stored
in @var{p}, an array of length @var{n}. The elements of @var{p} give the
:documentation ; FDL
"Indirectly sort the count elements of the array
array, each of size given, into ascending order using the
comparison function. The resulting permutation is stored
in p, an array of length n. The elements of p give the
index of the array element which would have been stored in that position
if the array had been sorted in place. The first element of @var{p}
gives the index of the least element in @var{array}, and the last
element of @var{p} gives the index of the greatest element in
@var{array}. The array itself is not changed.")
if the array had been sorted in place. The first element of p
gives the index of the least element in array, and the last
element of p gives the index of the greatest element in
array. The array itself is not changed.")
;;;;****************************************************************************
;;;; Vector sort
......@@ -58,68 +54,86 @@
;;; Port only _vector_ sort functions?
(export 'sort-vector)
(defgeneric sort-vector (vector)
(:documentation ; FDL
"Sort the elements of the vector into ascending numerical order."))
(defun-gsl-vdsf sort-vector ((vector gsl-vector))
"gsl_sort_vector" (((pointer vector) gsl-vector-c))
:documentation
"Sort the elements of the vector into ascending numerical order."
:c-return :void)
(export 'sort-vector-index)
(defgeneric sort-vector-index (permutation vector)
(:documentation ; FDL
"Indirectly sort the elements of the vector v into
ascending order, storing the resulting permutation in p. The
elements of p give the index of the vector element which would
have been stored in that position if the vector had been sorted in
place. The first element of p gives the index of the least element
in v and the last element of p gives the index of the
greatest element in v. The vector v is not changed."))
(defun-gsl-vdsf sort-vector-index (permutation (vector gsl-vector))
"gsl_sort_vector_index"
(((pointer permutation) gsl-permutation-c)
((pointer vector) gsl-vector-c))
:documentation
"Indirectly sort the elements of the vector @var{v} into
ascending order, storing the resulting permutation in @var{p}. The
elements of @var{p} give the index of the vector element which would
have been stored in that position if the vector had been sorted in
place. The first element of @var{p} gives the index of the least element
in @var{v}, and the last element of @var{p} gives the index of the
greatest element in @var{v}. The vector @var{v} is not changed.")
((pointer vector) gsl-vector-c)))
(export 'sort-vector-smallest)
(defgeneric sort-vector-smallest (destination vector)
(:documentation ; FDL
"Find the smallest elements of the vector v and put them into dest,
which must be shorter than v."))
(defun-gsl-vdsf sort-vector-smallest (dest (v gsl-vector))
"gsl_sort_vector_smallest"
(((gsl-array dest) :pointer) ((dim0 dest) :size)
((pointer v) gsl-vector-c))
:documentation
"Find the smallest elements of the vector @var{v} and put them into dest,
which must be shorter than v."
:c-return :void
:invalidate (dest))
;;; p should be gsl-vector-unsigned-fixnum, if that can be made to
;;; work (see vector.lisp).
(export 'sort-vector-smallest-index)
(defgeneric sort-vector-smallest-index (p vector)
(:documentation ; FDL
"The indices of the smallest elements of the vector stored
in the array p."))
(defun-gsl-vdsf sort-vector-smallest-index
((p gsl-vector-fixnum) (v gsl-vector))
"gsl_sort_vector_smallest_index"
(((gsl-array p) :pointer) ((dim0 p) :size)
((pointer v) gsl-vector-c))
:documentation
"The indices of the smallest elements of the vector @var{v} stored
in the array @var{p}."
:c-return :void
:invalidate (p))
(export 'sort-vector-largest)
(defgeneric sort-vector-largest (dest vector)
(:documentation ; FDL
"Find the largest elements of the vector and put them into dest,
which must be shorter than the vector."))
(defun-gsl-vdsf sort-vector-largest (dest (v gsl-vector))
"gsl_sort_vector_largest"
(((gsl-array dest) :pointer) ((dim0 dest) :size)
((pointer v) gsl-vector-c))
:documentation
"Find the largest elements of the vector @var{v} and put them into dest,
which must be shorter than v."
:c-return :void
:invalidate (dest))
(export 'sort-vector-largest-index)
;;; p should be gsl-vector-unsigned-fixnum, if that can be made to
;;; work (see vector.lisp).
(defgeneric sort-vector-largest-index (p vector)
(:documentation ; FDL
"The indices of the largest elements of the vector stored
in the array p."))
(defun-gsl-vdsf sort-vector-largest-index
((p gsl-vector-fixnum) (v gsl-vector))
"gsl_sort_vector_largest_index"
(((gsl-array p) :pointer) ((dim0 p) :size)
((pointer v) gsl-vector-c))
:documentation
"The indices of the largest elements of the vector @var{v} stored
in the array @var{p}."
:c-return :void
:invalidate (p))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment