Commit 360080b1 authored by Liam Healy's avatar Liam Healy

Export symbols, eliminate dead code, add tridiagonal example

A few overlooked function symbols have been exported and some unused
function definitions eliminated.  Added an example
solve-tridiagonal-example thanks to Mirko Vukovic.
parent a6225f09
;; Permutations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2009-06-06 09:49:18EDT permutation.lisp>
;; Time-stamp: <2009-11-14 10:52:43EST permutation.lisp>
;; $Id$
(in-package :gsl)
......@@ -106,6 +106,7 @@
"A pointer to the array of elements in the
permutation p.")
(export 'validp)
(defgeneric validp (object)
(:documentation ; FDL
"Check that the object p is valid."))
......
;; Expand the body of a defmfun
;; Liam Healy 2009-04-13 22:07:13EDT body-expand.lisp
;; Time-stamp: <2009-05-03 22:18:13EDT body-expand.lisp>
;; Time-stamp: <2009-11-14 10:19:46EST body-expand.lisp>
;; $Id: $
(in-package :gsl)
......@@ -27,19 +27,6 @@
(make-symbol (string (st-symbol sd)))
(st-type sd))))))
(defun substitute-symbols (substlist st-list)
"Substitute in the new symbols for the old in the st list."
(loop for pair in substlist
with answer = st-list
do
(setf answer
(subst
(st-symbol (second pair))
(first pair)
answer
:test 'st-symbol))
finally (return answer)))
;;; This function should never be called even when FSBV is absent,
;;; because the potential callers should all have #-fsbv
;;; conditionalization. It is here just so that body-expand can
......
;; Define examples.
;; Liam Healy 2008-09-07 21:00:48EDT generate-tests.lisp
;; Time-stamp: <2009-02-11 22:44:32EST generate-examples.lisp>
;; Time-stamp: <2009-11-14 10:22:05EST generate-examples.lisp>
;; $Id: $
;;; Define examples that can be displayed by users with the function
......@@ -75,15 +75,6 @@
-82 75 -30 -71 44 48 88 121 106)
"A sequence of random integers ranging between -255 and 255.")
(defun make-vector-from-pool (type length &optional (starting 0))
"Make a vector of the specified element type and length using the
pool data for the type and starting at the specified point in the pool."
(make-marray
type
:dimensions length
:initial-contents
(make-list-from-pool type length starting)))
(defun make-list-from-pool (type length &optional (starting 0))
"Make a list for :initial-contents of the specified element type and
length using the pool data for the type and starting at the
......
;; Number types used by GSL functions, and specification conversion
;; Liam Healy 2008-12-31 21:06:34EST types.lisp
;; Time-stamp: <2009-05-25 16:34:12EDT types.lisp>
;; Time-stamp: <2009-11-14 10:54:53EST types.lisp>
;; $Id: $
(in-package :gsl)
......@@ -207,16 +207,3 @@
"The CL type from the CFFI element type."
(unless (eq cffi-type :pointer)
(lookup-type cffi-type *cstd-cl-type-mapping*)))
(defun splice-name (base-name type keyword)
"Make a new C name for a data function from a base name."
(let ((pos (search keyword base-name)))
(when pos
(let ((insert (+ pos (length keyword)))
(gsltype (cl-gsl type)))
(concatenate 'string
(subseq base-name 0 insert)
(if (zerop (length gsltype)) "" "_")
(cl-gsl type)
(subseq base-name insert))))))
;; Tridiagonal and Bidiagonal matrices
;; Liam Healy, Thu May 4 2006 - 15:43
;; Time-stamp: <2008-12-07 18:31:38EST diagonal.lisp>
;; Time-stamp: <2009-11-14 09:22:50EST diagonal.lisp>
;; $Id$
(in-package :gsl)
......@@ -211,3 +211,40 @@
( e_0 d_1 e_1 0 )
( 0 e_1 d_2 e_2 )
( e_3 0 e_2 d_3 )")
;;;;****************************************************************************
;;;; Example
;;;;****************************************************************************
(defun solve-tridiagonal-example (&optional (n 6))
"Solution differential equation
y=1 with boundary conditions y(0)=(n-1)^2, y(n-1)=0.
The solution is the sequence: (n-1)^2, (n-2)^2, ... 9, 4, 2, 1, 0
Desicretization of y leads to a tridiagonal system of equations
(y_(i-1)-2_i+y_(i+1))/2 = 1 for 1 < i < (n - 2)
The boundary conditions are implemented as
y(0)=(n-1)^2
y(n-1)=0"
(labels ((mvec (dimension &key initial-element)
"Shorthand for initializing gsll vectors"
(if initial-element
(make-marray 'double-float :dimensions dimension :initial-element initial-element)
(make-marray 'double-float :dimensions dimension))))
(let ((x (mvec n))
(b (mvec n :initial-element 1d0))
(diag (mvec n :initial-element -1d0))
(superdiag (mvec (1- n) :initial-element 0.5d0))
(subdiag (mvec (1- n) :initial-element 0.5d0)))
(setf
;; i=0 matrix elements
(maref diag 0) 1d0
(maref superdiag 0) 0d0
(maref b 0) (coerce (expt (1- n) 2) 'double-float)
;; i=n-1 matrix elements
(maref diag (1- n)) 1d0
(maref subdiag (- n 2)) 0d0
(maref b (1- n)) 0d0)
(solve-tridiagonal diag superdiag subdiag b x))))
;; Dilogarithm
;; Liam Healy, Fri Mar 17 2006 - 18:44
;; Time-stamp: <2008-10-21 22:57:50EDT dilogarithm.lisp>
;; $Id$
;; Time-stamp: <2009-11-14 10:27:52EST dilogarithm.lisp>
(in-package :gsl)
;;; dilog merge complex and real
(export 'dilogarithm)
(defgeneric dilogarithm (x)
(:documentation ; FDL
"The dilogarithm."))
......
;; Psi (digamma) functions
;; Liam Healy, Mon May 1 2006 - 22:11
;; Time-stamp: <2008-10-25 11:27:13EDT psi.lisp>
;; Time-stamp: <2009-11-14 10:56:27EST psi.lisp>
;; $Id$
(in-package :gsl)
......@@ -36,6 +36,7 @@
;;;; Trigamma Function
;;;;****************************************************************************
(export 'psi-1)
(defgeneric psi-1 (x)
;; FDL
(:documentation "The Trigamma function."))
......
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