3 ;;; Time-stamp: <2008-11-10 14:52:43 tony>
4 ;;; Creation: <2008-03-11 19:18:34 user>
5 ;;; File: packages.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2007--2008, AJ Rossini. BSD, LLGPL, or GPLv2, depending
9 ;;; Purpose: package structure description for lispstat
11 ;;; What is this talk of 'release'? Klingons do not make software
12 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
13 ;;; designers and quality assurance people in its wake.
15 ;;; This organization and structure is new to the 21st Century
24 (defpackage :lisp-stat-object-system
25 (:nicknames
:ls-objects
:lsos
)
27 (:shadow
:call-method
:call-next-method
:slot-value
)
28 (:export ls-object objectp
*object
* kind-of-p make-object
30 *set-slot-hook
* slot-value self
31 send call-next-method call-method
32 defmeth defproto instance-slots proto-name
))
38 (defpackage :lisp-stat-types
39 (:documentation
"Provides some typeing for LispStat, but is clearly
43 check-nonneg-fixnum check-one-nonneg-fixnum
44 check-one-fixnum check-one-real check-one-number
))
51 (defpackage :lisp-stat-float
53 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
54 machine-epsilon base-float makedouble
56 make-base-trans-fun-2 make-base-trans-fun
58 base-log base-exp base-expt base-sqrt base-sin base-cos
59 base-tan base-asin base-acos base-atan base-sinh
60 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
61 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
62 BASE-FROUND BASE-SIGNUM BASE-CIS
))
65 (defpackage :lisp-stat-compound-data
67 :lisp-stat-object-system
69 (:shadowing-import-from
:lisp-stat-object-system
71 call-next-method call-method
)
72 (:export compound-data-p
*compound-data-proto
*
74 compound-data-seq compound-data-length
75 element-list element-seq
77 recursive-map-elements map-elements repeat
79 get-next-element make-next-element set-next-element
80 sequencep iseq ordered-nneg-seq
81 select split-list which
85 (defpackage :lisp-stat-macros
87 :lisp-stat-compound-data
)
88 (:export make-rv-function make-rv-function-1
))
90 (defpackage :lisp-stat-basics
92 :lisp-stat-object-system
96 :lisp-stat-compound-data
)
97 (:shadowing-import-from
:lisp-stat-object-system
98 slot-value call-method call-next-method
)
99 (:export permute-array sum prod count-elements mean
104 (defpackage :lisp-stat-float
106 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
107 machine-epsilon base-float makedouble
109 make-base-trans-fun-2 make-base-trans-fun
111 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
112 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
113 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
114 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
115 BASE-FROUND BASE-SIGNUM BASE-CIS
))
119 (defpackage :lisp-stat-macros
121 :lisp-stat-compound-data
)
122 (:export make-rv-function make-rv-function-1
))
124 ;;; NEW CLOS STRUCTURE
126 (defpackage :lisp-stat-data-clos
129 (:export get-variable-matrix get-variable-vector
130 ;; generic container class for data -- if small enough
131 ;; could be value, otherwise might be reference.
134 (defpackage :lisp-stat-regression-linear-clos
137 :lisp-stat-data-clos
)
138 (:export regression-model
))
144 (defpackage :lisp-stat-ffi-int
147 (:export ccl-store-integer ccl-store-double ccl-store-ptr
150 (defpackage :lisp-stat-probability
155 (:export log-gamma set-seed
157 normal-cdf normal-quant normal-dens normal-rand
159 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
160 gamma-cdf gamma-quant gamma-dens gamma-rand
161 chisq-cdf chisq-quant chisq-dens chisq-rand
162 beta-cdf beta-quant beta-dens beta-rand
163 t-cdf t-quant t-dens t-rand
164 f-cdf f-quant f-dens f-rand
165 poisson-cdf poisson-quant poisson-pmf poisson-rand
166 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
170 (defpackage :lisp-stat-matrix
173 :lisp-stat-compound-data
)
174 (:export matrixp
;; matrix -- conflicts!
175 num-rows num-cols matmult identity-matrix diagonal
176 row-list column-list inner-product outer-product
177 cross-product transpose bind-columns bind-rows
178 array-data-vector vector-to-array
180 check-matrix check-square-matrix
182 copy-array copy-vector
185 (defpackage :lisp-stat-linalg-data
190 :lisp-stat-compound-data
192 (:export
;; more to add
193 +mode-in
+ +mode-re
+ +mode-cx
+ mode-of
195 la-data-mode la-allocate la-free
197 la-get-double la-put-double
200 la-matrix la-free-matrix la-matrix-to-data la-data-to-matrix
201 la-vector la-free-vector la-vector-to-data la-data-to-vector
))
204 (defpackage :lisp-stat-math
206 :lisp-stat-object-system
208 :lisp-stat-compound-data
210 (:shadowing-import-from
:lisp-stat-object-system
211 slot-value call-method call-next-method
)
212 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
213 asin acos atan sinh cosh tanh asinh acosh atanh float random
214 truncate floor ceiling round minusp zerop plusp evenp oddp
215 < <= = /= >= > ;; complex
216 conjugate realpart imagpart phase
217 min max logand logior logxor lognot ffloor fceiling
218 ftruncate fround signum cis
)
219 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
220 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
221 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
223 conjugate realpart imagpart phase min max
224 logand logior logxor lognot ffloor fceiling ftruncate fround
226 (:documentation
"Vectorization of numerical functions"))
229 (defpackage :lisp-stat-linalg
236 :lisp-stat-compound-data
237 :lisp-stat-linalg-data
239 (:shadowing-import-from
:lisp-stat-math
240 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
241 asin acos atan sinh cosh tanh asinh acosh atanh float random
242 truncate floor ceiling round minusp zerop plusp evenp oddp
243 < <= = /= >= > complex conjugate realpart imagpart phase
244 min max logand logior logxor lognot ffloor fceiling
245 ftruncate fround signum cis
)
246 (:export chol-decomp lu-decomp lu-solve determinant inverse
247 sv-decomp qr-decomp rcondest make-rotation spline
248 kernel-dens kernel-smooth
249 fft make-sweep-matrix sweep-operator ax
+y eigen
251 check-real
;; for optimize
253 covariance-matrix matrix print-matrix solve
254 backsolve eigenvalues eigenvectors accumulate cumsum combine
258 (defpackage :lisp-stat-config
260 (:export
*default-path
*
261 *lsos-files
* *basic-files
* *ls-files
*
262 *lispstat-data-dir
* *lispstat-examples-dir
*))
265 (defpackage :lisp-stat-data
266 (:documentation
"Data management, integration, I/O, and other data technologies.")
267 (:nicknames
:ls-data
)
269 :lisp-stat-object-system
272 :lisp-stat-compound-data
)
273 (:shadowing-import-from
:lisp-stat-object-system
274 slot-value call-method call-next-method
)
275 (:export open-file-dialog read-data-file read-data-columns load-data
276 load-example
*variables
* *ask-on-redefine
*
277 def variables savevar undef
))
279 (defpackage :lisp-stat-descriptive-statistics
283 :lisp-stat-compound-data
285 :lisp-stat-linalg-data
288 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
289 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
290 asin acos atan sinh cosh tanh asinh acosh atanh float random
291 truncate floor ceiling round minusp zerop plusp evenp oddp
292 < <= = /= >= > ;; complex
293 conjugate realpart imagpart phase
294 min max logand logior logxor lognot ffloor fceiling
295 ftruncate fround signum cis
)
296 (:export standard-deviation quantile median interquartile-range
300 (defpackage :lisp-stat-regression-linear
302 :lisp-stat-object-system
304 :lisp-stat-compound-data
308 :lisp-stat-descriptive-statistics
)
309 (:shadowing-import-from
:lisp-stat-object-system
310 slot-value call-method call-next-method
)
311 (:shadowing-import-from
:lisp-stat-math
312 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
313 asin acos atan sinh cosh tanh asinh acosh atanh float random
314 truncate floor ceiling round minusp zerop plusp evenp oddp
315 < <= = /= >= > ;; complex
316 conjugate realpart imagpart phase
317 min max logand logior logxor lognot ffloor fceiling
318 ftruncate fround signum cis
)
319 (:export regression-model regression-model-proto x y intercept sweep-matrix
320 basis weights included total-sum-of-squares residual-sum-of-squares
321 predictor-names response-name case-labels
))
323 (defpackage :lisp-stat
324 (:documentation
"Experimentation package for LispStat. Serious
325 work should be packaged up elsewhere for reproducibility. By this
326 I mean, creating a data/analytics/analysis package with the
327 minimal set of objects required.")
329 :lisp-stat-object-system
330 :lisp-stat-compound-data
331 :lisp-stat-probability
339 :lisp-stat-descriptive-statistics
340 :lisp-stat-regression-linear
)
341 (:shadowing-import-from
:lisp-stat-object-system
342 slot-value call-method call-next-method
)
343 (:shadowing-import-from
:lisp-stat-math
344 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
345 asin acos atan sinh cosh tanh asinh acosh atanh float random
346 truncate floor ceiling round minusp zerop plusp evenp oddp
347 < <= = /= >= > ;;complex
348 conjugate realpart imagpart phase
349 min max logand logior logxor lognot ffloor fceiling
350 ftruncate fround signum cis
)
357 fixnump check-nonneg-fixnum check-one-fixnum
358 check-one-real check-one-number
366 compound-data-p
*compound-data-proto
* compound-object-p
367 compound-data-seq compound-data-length
368 element-list element-seq
370 recursive-map-elements map-elements
373 get-next-element make-next-element set-next-element
380 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
381 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
382 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
384 conjugate realpart imagpart phase min max
385 logand logior logxor lognot ffloor fceiling ftruncate fround
389 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
390 column-list inner-product outer-product cross-product transpose
391 bind-columns bind-rows
394 chol-decomp lu-decomp lu-solve determinant inverse
395 sv-decomp qr-decomp rcondest make-rotation spline
396 kernel-dens kernel-smooth
397 fft make-sweep-matrix sweep-operator ax
+y eigen
399 covariance-matrix matrix print-matrix solve
400 backsolve eigenvalues eigenvectors accumulate cumsum combine
403 ;; in linalg.lisp, possibly not supported by matlisp
404 spline kernel-dens kernel-smooth
410 make-rv-function make-rv-function-1
413 open-file-dialog read-data-file read-data-columns load-data
414 load-example
*variables
* *ask-on-redefine
*
415 def variables savevar undef
418 standard-deviation quantile median interquartile-range
423 uniform-rand normal-cdf normal-quant normal-dens
424 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
425 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
426 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
427 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
428 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
429 binomial-cdf binomial-quant binomial-pmf binomial-rand
431 ;;; Here is where we have a problem -- lispstat core should be core
432 ;;; data management and config problems, with packages providing
433 ;;; specialized extensions to LispStat, i.e. regression, nonlin
434 ;;; regression, bayesian regression via laplace approximation, etc.
436 ;;; The following could be considered "recommended packages", similar
437 ;;; to the idea of the recommended packages in R.
440 regression-model regression-model-proto x y intercept sweep-matrix
441 basis weights included total-sum-of-squares residual-sum-of-squares
442 predictor-names response-name case-labels
445 nreg-model nreg-model-proto mean-function theta-hat epsilon
449 bayes-model bayes-model-proto bayes-internals
))
452 ;;;; PACKAGES FOR USEABILITY
454 (defpackage :lisp-stat-data-examples
455 (:documentation
"Example data for unittests, examples, illustrations,")
458 (:shadowing-import-from
:lisp-stat
459 slot-value call-method call-next-method
461 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
462 asin acos atan sinh cosh tanh asinh acosh atanh float random
463 truncate floor ceiling round minusp zerop plusp evenp oddp
464 < <= = /= >= > > ;; complex
465 conjugate realpart imagpart phase
466 min max logand logior logxor lognot ffloor fceiling
467 ftruncate fround signum cis
470 (:export iron aluminum absorbtion
474 (defpackage :lisp-stat-user
475 (:documentation
"Experimentation package for LispStat.
476 Serious work should be placed in a similar package elsewhere for
477 reproducibility. But this should hint as to what needs to be
478 done for a user- or analysis-package.")
479 (:nicknames
:ls-user
)
482 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
483 (:shadowing-import-from
:lisp-stat
484 slot-value call-method call-next-method
486 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
487 asin acos atan sinh cosh tanh asinh acosh atanh float random
488 truncate floor ceiling round minusp zerop plusp evenp oddp
489 < <= = /= >= > > ;; complex
490 conjugate realpart imagpart phase
491 min max logand logior logxor lognot ffloor fceiling
492 ftruncate fround signum cis
496 (defpackage :lisp-stat-unittests
497 (:use
:common-lisp
:lift
:lisp-stat
:lisp-stat-data-examples
)
498 (:shadowing-import-from
:lisp-stat
499 slot-value call-method call-next-method
;; objects
500 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
501 asin acos atan sinh cosh tanh asinh acosh atanh float random
502 truncate floor ceiling round minusp zerop plusp evenp oddp
503 < <= = /= >= > ;; complex
504 conjugate realpart imagpart phase
505 min max logand logior logxor lognot ffloor fceiling
506 ftruncate fround signum cis
)
507 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
508 almost
= almost
=lists numerical
=)) ; compare
510 (defpackage :lisp-stat-data-clos-example
512 :lift
:lisp-stat-unittests
513 :lisp-stat-data-examples
514 :lisp-stat-data-clos
)
515 (:export absorbtion aluminum iron
))