Commit 8a8148f8 authored by Liam Healy's avatar Liam Healy

Define duplicate functions with defun

The duplicate example functions for solving and minimizing are defined
with defun now instead of setf fdefinition in the hopes of minimizing
warnings and messages from some compilers.  Eliminated obsolete
comments.
parent 03e76278
;; Multivariate minimization.
;; Liam Healy <Tue Jan 8 2008 - 21:28>
;; Time-stamp: <2008-12-28 18:14:04EST minimization-multi.lisp>
;; Time-stamp: <2008-12-30 10:17:15EST minimization-multi.lisp>
;; $Id$
(in-package :gsl)
......@@ -332,8 +332,8 @@
;;; Because def-minimization-functions bind a symbol
;;; of the same name as the first function, and we want both to run,
;;; we'll make an alias function so we can use both.
(eval-when (:load-toplevel :execute)
(setf (fdefinition 'parabaloid-f) #'parabaloid))
(defun parabaloid-f (gsl-vector-pointer)
(parabaloid gsl-vector-pointer))
(def-minimization-functions parabaloid-f 2)
......
;;; Multivariate roots.
;;; Liam Healy 2008-01-12 12:49:08
;;; Time-stamp: <2008-12-28 18:25:31EST roots-multi.lisp>
;;; Time-stamp: <2008-12-30 09:57:11EST roots-multi.lisp>
;;; $Id$
(in-package :gsl)
......@@ -367,17 +367,6 @@
(defparameter *rosenbrock-a* 1.0d0)
(defparameter *rosenbrock-b* 10.0d0)
#|
;;; One alternative way of writing the function, not recommended.
(defun rosenbrock (argument return)
"Rosenbrock test function."
(with-c-doubles (((vector-data argument) x0 x1)
((vector-data return) f0 f1))
(setf f0 (* *rosenbrock-a* (- 1 x0))
f1 (* *rosenbrock-b* (- x1 (expt x0 2))))))
|#
;;; The recommended alternative
(defun rosenbrock (argument return)
"Rosenbrock test function."
(setf (maref return 0)
......@@ -428,8 +417,8 @@
;;; Because def-solver-functions and def-single-function bind a symbol
;;; of the same name as the first function, and we want both to run,
;;; we'll make an alias function so we can use both.
(eval-when (:load-toplevel :execute)
(setf (fdefinition 'rosenbrock-f) #'rosenbrock))
(defun rosenbrock-f (argument return)
(rosenbrock argument return))
(def-solver-functions rosenbrock-f rosenbrock-df rosenbrock-fdf 2)
......
;; One-dimensional root solver.
;; Liam Healy
;; Time-stamp: <2008-12-29 19:16:52EST roots-one.lisp>
;; Time-stamp: <2008-12-30 10:17:14EST roots-one.lisp>
;; $Id$
(in-package :gsl)
......@@ -339,8 +339,7 @@
;;; Because def-solver-functions and def-single-function bind a symbol
;;; of the same name as the first function, and we want both to run,
;;; we'll make an alias function so we can use both.
(eval-when (:load-toplevel :execute)
(setf (fdefinition 'quadratic-df) #'quadratic))
(defun quadratic-df (x) (quadratic x))
(def-solver-functions
quadratic-df quadratic-derivative quadratic-and-derivative)
......
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