3 ;;; Time-stamp: <2009-04-29 08:35:29 tony>
4 ;;; Creation: <2008-09-08 08:06:30 tony>
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c) 2007-2008, AJ Rossini <blindglobe@gmail.com>. BSD.
8 ;;; Purpose: Stuff that needs to be made working sits inside the
9 ;;; progns... This file contains the current challenges to
10 ;;; solve, including a description of the setup and the work
13 ;;; What is this talk of 'release'? Klingons do not make software
14 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
15 ;;; designers and quality assurance people in its wake.
20 ;;(asdf:oos 'asdf:load-op 'lisp-matrix)
21 ;;(asdf:oos 'asdf:compile-op 'lispstat :force t)
22 ;;(asdf:oos 'asdf:load-op 'lispstat)
24 (in-package :lisp-stat-unittests
)
26 ;; tests = 80, failures = 8, errors = 15
27 (run-tests :suite
'lisp-stat-ut
)
28 (describe (run-tests :suite
'lisp-stat-ut
))
30 ;; FIXME: Example: currently not relevant, yet
31 ;; (describe (lift::run-test :test-case 'lisp-stat-unittests::create-proto
32 ;; :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
34 (describe (lift::run-tests
:suite
'lisp-stat-ut-dataframe
))
35 (lift::run-tests
:suite
'lisp-stat-ut-dataframe
)
39 :test-case
'lisp-stat-unittests
::create-proto
40 :suite
'lisp-stat-unittests
::lisp-stat-ut-proto
))
42 (describe 'lisp-stat-ut
)
48 ;; Plotting -- need to figure out the core-dump, or change libraries.
49 ;; (asdf:oos 'asdf:load-op 'cl-plplot)
51 ;; (defparameter *gdev* "xwin")
52 (defparameter *gdev
* "xcairo")
53 ;; (cl-plplot::plsdev *gdev*) ; -- usually handled within call.
56 ;; Boom! -- there is currently a loose pointer floating around that
57 ;; causes errors the 3rd time that we create a plot (and crashes
58 ;; SBCL the 4th time). Order independent.
68 ;; REVIEW: general Lisp use guidance
70 (fdefinition 'make-matrix
)
71 (documentation 'make-matrix
'function
)
73 #| Examples from CLHS
, a bit of guidance.
75 ;; This function assumes its callers have checked the types of the
76 ;; arguments, and authorizes the compiler to build in that assumption.
77 (defun discriminant (a b c
)
78 (declare (number a b c
))
79 "Compute the discriminant for a quadratic equation."
80 (- (* b b
) (* 4 a c
))) => DISCRIMINANT
81 (discriminant 1 2/3 -
2) => 76/9
83 ;; This function assumes its callers have not checked the types of the
84 ;; arguments, and performs explicit type checks before making any assumptions.
85 (defun careful-discriminant (a b c
)
86 "Compute the discriminant for a quadratic equation."
90 (locally (declare (number a b c
))
91 (- (* b b
) (* 4 a c
)))) => CAREFUL-DISCRIMINANT
92 (careful-discriminant 1 2/3 -
2) => 76/9
98 (progn ;; experiments with GSL and the Lisp interface.
99 (asdf:oos
'asdf
:load-op
'gsll
)
100 (asdf:oos
'asdf
:load-op
'gsll-tests
) ; requires lisp-unit
102 ;; the following should be equivalent
103 (defparameter *t1
* (LIST 6.18d0
6.647777777777779d0
6.18d0
))
104 (defparameter *t2
* (MULTIPLE-VALUE-LIST
106 (gsll:make-marray
'DOUBLE-FLOAT
107 :INITIAL-CONTENTS
'(-3.21d0
1.0d0
12.8d0
)))
109 (gsll:MAKE-MARRAY
'DOUBLE-FLOAT
110 :INITIAL-CONTENTS
'(3.0d0
1.0d0
2.0d0
))))
111 (LET ((MEAN (gsll:MEAN VEC
)))
112 (LIST (gsll:ABSOLUTE-DEVIATION VEC
)
113 (gsll:WEIGHTED-ABSOLUTE-DEVIATION VEC WEIGHTS
)
114 (gsll:ABSOLUTE-DEVIATION VEC MEAN
))))))
118 ;; from (gsll:examples 'gsll::numerical-integration) ...
119 (gsll:integration-qng gsll
::one-sine
0.0d0 PI
)
121 (gsll:defun-single axpb
(x) (+ (* 2 x
) 3)) ;; a<-2, b<-3
122 (gsll:integration-qng axpb
1d0
2d0
)
126 (defun-single axpb2
(x) (+ (* a x
) b
)))
127 (gsll:integration-qng axpb2
1d0
2d0
)
130 ;; (gsll:integration-qng
133 ;; (defun-single axpb2 (x) (+ (* a x) b)))
136 ;; right, but weird expansion...
137 (gsll:integration-qng
140 (defun axpb2 (x) (+ (* a x
) b
))
141 (gsll:def-single-function axpb2
)
145 ;; Linear least squares
147 (gsll:gsl-lookup
"gsl_linalg_LU_decomp") ; => gsll:lu-decomposition
148 (gsll:gsl-lookup
"gsl_linalg_LU_solve") ; => gsll:lu-solve