Commit 80875db6 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Added definitions in GSL 1.13

Added definitions to GSLL for new definitions in GSL 1.13:
 #'greville-abscissa
 #'evaluate-with-derivatives
 +simplex-nelder-mead-random+
 +quad-golden-fminimizer+
These additions compile cleanly, only evaluate-with-derivatives has been
tested.

This completes the port to GSLL of new definitions in GSL 1.13
as given in the GSL changelog.
parent 9223686a
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
;; Basis splines.
;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp
;; Time-stamp: <2012-01-13 12:01:11EST basis-splines.lisp>
;; Time-stamp: <2016-06-15 23:07:19EDT basis-splines.lisp>
;;
;; Copyright 2008, 2009, 2011 Liam M. Healy
;; Copyright 2008, 2009, 2011, 2012, 2016 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
@@ -103,6 +103,13 @@
  :gsl-version (1 9)
  :documentation "The ith breakpoint of the basis spline bspline.")

(defmfun greville-abscissa (i bspline)
  "gsl_bspline_greville_abscissa"
  ((i :sizet) ((mpointer bspline) :pointer))
  :c-return :double
  :gsl-version (1 13)
  :documentation "Returns the location of the @math{i}-th Greville abscissa for the given B-spline basis.  For the ill-defined case when @math{k=1}, the implementation chooses to return breakpoint interval midpoints.")

;;; Examples and unit test

(defun bspline-example (&optional (ncoeffs 8))
+17 −2
Original line number Diff line number Diff line
;; Polynomials
;; Liam Healy, Tue Mar 21 2006 - 18:33
;; Time-stamp: <2014-12-26 13:18:34EST polynomial.lisp>
;; Time-stamp: <2016-06-15 22:31:17EDT polynomial.lisp>
;;
;; Copyright 2009, 2011, 2012, 2014 Liam M. Healy
;; Copyright 2009, 2011, 2012, 2014, 2016 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
@@ -42,6 +42,21 @@
  :documentation			; FDL
  "Evaluate the polyonomial with coefficients at the point x.")

(defmfun evaluate-with-derivatives
    (coefficients x &optional (derivatives 2)
		  &aux (result (grid:ensure-foreign-array derivatives derivatives 'double-float)))
  "gsl_poly_eval_derivs"
  (((grid:foreign-pointer coefficients) :pointer)
   ((grid:dim0 coefficients) :sizet)
   (x :double)
   ((grid:foreign-pointer result) :pointer)
   ((grid:dim0 result) :sizet))
  :gsl-version (1 13)
  :inputs (coefficients x)
  :return (result)
  :documentation
  "Evaluates a polynomial and its derivatives and stores the results in the array @var{res} of size @var{lenres}.  The output array contains the values of @math{d^k P/d x^k} for the specified value of @var{x} starting with @math{k = 0}. The optional argument 'derivatives may be either a vector-double-float, or a non-negative integer. If the former, the function value and derivatives are put in the vector supplied; if the latter, a new vector-double-float is created with the specified length.")

#+fsbv
(defmfun evaluate
    ((coefficients grid:vector-double-float) (x complex)
+7 −3
Original line number Diff line number Diff line
;; Multivariate minimization.
;; Liam Healy  <Tue Jan  8 2008 - 21:28>
;; Time-stamp: <2012-01-13 12:01:18EST minimization-multi.lisp>
;; Time-stamp: <2016-06-15 23:07:48EDT minimization-multi.lisp>
;;
;; Copyright 2008, 2009, 2011 Liam M. Healy
;; Copyright 2008, 2009, 2011, 2012, 2016 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
@@ -313,7 +313,6 @@

(defmpar +simplex-nelder-mead+
    "gsl_multimin_fminimizer_nmsimplex2"
  ;; FDL
  "The Simplex algorithm of Nelder and Mead. It constructs 
   n vectors p_i from the
   starting vector initial and the vector step-size as follows:
@@ -345,6 +344,11 @@
   distance, which has the advantage of allowing a linear update."
  :gsl-version (1 12))

(defmpar +simplex-nelder-mead-random+
  "gsl_multimin_fminimizer_nmsimplex2rand"
  "This method is a variant of @code{nmsimplex2} which initialises the simplex around the starting point @var{x} using a randomly-oriented set of basis vectors instead of the fixed coordinate axes. The final dimensions of the simplex are scaled along the coordinate axes by the vector @var{step_size}.  The randomisation uses a simple deterministic generator so that repeated calls to @code{gsl_multimin_fminimizer_set} for a given solver object will vary the orientation in a well-defined way.")


;;;;****************************************************************************
;;;; Examples
;;;;****************************************************************************
+6 −2
Original line number Diff line number Diff line
;; Univariate minimization
;; Liam Healy Tue Jan  8 2008 - 21:02
;; Time-stamp: <2011-10-30 10:31:55EDT minimization-one.lisp>
;; Time-stamp: <2016-06-15 23:04:31EDT minimization-one.lisp>
;;
;; Copyright 2008, 2009, 2011 Liam M. Healy
;; Copyright 2008, 2009, 2011, 2016 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
@@ -192,6 +192,10 @@
   step.  The full details of Brent's method include some additional checks
   to improve convergence.")

(defmpar +quad-golden-fminimizer+ "gsl_min_fminimizer_quad_golden"
  "A variant of Brent's algorithm which uses the safeguarded step-length algorithm of Gill and Murray."
  :gsl-version (1 13))

;;;;****************************************************************************
;;;; Example
;;;;****************************************************************************