fixed loading issues related to configuration and packaging.
[CommonLispStat.git] / src / packages.lisp
bloba9d362a760f46b812dbb6e593380c2544e6b1c46
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2008-11-16 20:38:56 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
8 ;;; on how it arrives.
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
16 ;;; version.
18 (in-package :cl-user)
20 ;;; LispStat Basics
22 (in-package :cl-user)
24 (defpackage :lisp-stat-object-system
25 (:nicknames :ls-objects :lsos)
26 (:use :common-lisp)
27 (:shadow :call-method :call-next-method :slot-value)
28 (:export ls-object objectp *object* kind-of-p make-object
29 *message-hook*
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
40 a bit incomplete.")
41 (:use :common-lisp)
42 (:export fixnump
43 check-nonneg-fixnum check-one-nonneg-fixnum
44 check-one-fixnum check-one-real check-one-number))
47 ;;; Package Setup
49 (in-package :cl-user)
51 (defpackage :lisp-stat-float
52 (:use :common-lisp)
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
66 (:use :common-lisp
67 :lisp-stat-object-system
68 :lisp-stat-types)
69 (:shadowing-import-from :lisp-stat-object-system
70 slot-value
71 call-next-method call-method)
72 (:export compound-data-p *compound-data-proto*
73 compound-object-p
74 compound-data-seq compound-data-length
75 element-list element-seq
76 sort-data order rank
77 recursive-map-elements map-elements repeat
78 check-sequence
79 get-next-element make-next-element set-next-element
80 ;; sequencep
81 iseq ordered-nneg-seq
82 select split-list which
83 difference rseq
84 flatten-list ))
86 (defpackage :lisp-stat-macros
87 (:use :common-lisp
88 :lisp-stat-compound-data)
89 (:export make-rv-function make-rv-function-1))
91 (defpackage :lisp-stat-basics
92 (:use :common-lisp
93 :lisp-stat-object-system
94 :lisp-stat-types
95 :lisp-stat-float
96 :lisp-stat-macros
97 :lisp-stat-compound-data)
98 (:shadowing-import-from :lisp-stat-object-system
99 slot-value call-method call-next-method)
100 (:export permute-array sum prod count-elements mean
101 if-else sample))
105 (defpackage :lisp-stat-float
106 (:use :common-lisp)
107 (:export +stat-float-typing+ +stat-cfloat-typing+ +stat-float-template+
108 machine-epsilon base-float makedouble
110 make-base-trans-fun-2 make-base-trans-fun
112 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
113 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
114 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
115 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
116 BASE-FROUND BASE-SIGNUM BASE-CIS))
118 ;;;
120 (defpackage :lisp-stat-macros
121 (:use :common-lisp
122 :lisp-stat-compound-data)
123 (:export make-rv-function make-rv-function-1))
125 ;;; NEW CLOS STRUCTURE
127 (defpackage :lisp-stat-data-clos
128 (:use :common-lisp
129 :lisp-matrix)
130 (:export get-variable-matrix get-variable-vector
131 ;; generic container class for data -- if small enough
132 ;; could be value, otherwise might be reference.
133 data-pointer))
135 (defpackage :lisp-stat-regression-linear-clos
136 (:use :common-lisp
137 :lisp-matrix
138 :lisp-stat-data-clos)
139 (:export regression-model))
143 ;;; USER PACKAGES
145 (defpackage :lisp-stat-ffi-int
146 (:use :common-lisp
147 :cffi)
148 (:export ccl-store-integer ccl-store-double ccl-store-ptr
149 get-buf ))
151 (defpackage :lisp-stat-probability
152 (:use :common-lisp
153 :cffi
154 :lisp-stat-ffi-int
155 :lisp-stat-macros)
156 (:export log-gamma set-seed
157 uniform-rand
158 normal-cdf normal-quant normal-dens normal-rand
159 bivnorm-cdf
160 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
161 gamma-cdf gamma-quant gamma-dens gamma-rand
162 chisq-cdf chisq-quant chisq-dens chisq-rand
163 beta-cdf beta-quant beta-dens beta-rand
164 t-cdf t-quant t-dens t-rand
165 f-cdf f-quant f-dens f-rand
166 poisson-cdf poisson-quant poisson-pmf poisson-rand
167 binomial-cdf binomial-quant binomial-pmf binomial-rand))
171 (defpackage :lisp-stat-matrix
172 (:use :common-lisp
173 :cffi
174 :lisp-stat-compound-data)
175 (:export matrixp ;; matrix -- conflicts!
176 num-rows num-cols matmult identity-matrix diagonal
177 row-list column-list inner-product outer-product
178 cross-product transpose bind-columns bind-rows
179 array-data-vector vector-to-array
181 check-matrix check-square-matrix
183 copy-array copy-vector
186 (defpackage :lisp-stat-linalg-data
187 (:use :common-lisp
188 :cffi
189 :lisp-stat-ffi-int
190 :lisp-stat-types
191 :lisp-stat-compound-data
192 :lisp-stat-matrix)
193 (:export ;; more to add
194 +mode-in+ +mode-re+ +mode-cx+ mode-of
196 la-data-mode la-allocate la-free
198 la-get-double la-put-double
199 la-put-integer
201 la-matrix la-free-matrix la-matrix-to-data la-data-to-matrix
202 la-vector la-free-vector la-vector-to-data la-data-to-vector ))
205 (defpackage :lisp-stat-math
206 (:use :common-lisp
207 :lisp-stat-object-system
208 :lisp-stat-macros
209 :lisp-stat-compound-data
210 :lisp-stat-float)
211 (:shadowing-import-from :lisp-stat-object-system
212 slot-value call-method call-next-method)
213 (:shadow expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
214 asin acos atan sinh cosh tanh asinh acosh atanh float random
215 truncate floor ceiling round minusp zerop plusp evenp oddp
216 < <= = /= >= > ;; complex
217 conjugate realpart imagpart phase
218 min max logand logior logxor lognot ffloor fceiling
219 ftruncate fround signum cis)
220 (:export ^ ** expt + - * / mod rem pmin pmax abs 1+ 1- log exp sqrt sin cos
221 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
222 truncate floor ceiling round minusp zerop plusp evenp oddp < <= =
223 /= >= > ;; complex
224 conjugate realpart imagpart phase min max
225 logand logior logxor lognot ffloor fceiling ftruncate fround
226 signum cis)
227 (:documentation "Vectorization of numerical functions"))
230 (defpackage :lisp-stat-linalg
231 (:use :common-lisp
232 :cffi
233 :lisp-stat-ffi-int
234 :lisp-stat-math
235 :lisp-stat-types
236 :lisp-stat-float
237 :lisp-stat-compound-data
238 :lisp-stat-linalg-data
239 :lisp-stat-matrix)
240 (:shadowing-import-from :lisp-stat-math
241 expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
242 asin acos atan sinh cosh tanh asinh acosh atanh float random
243 truncate floor ceiling round minusp zerop plusp evenp oddp
244 < <= = /= >= > complex conjugate realpart imagpart phase
245 min max logand logior logxor lognot ffloor fceiling
246 ftruncate fround signum cis)
247 (:export chol-decomp lu-decomp lu-solve determinant inverse
248 sv-decomp qr-decomp rcondest make-rotation spline
249 kernel-dens kernel-smooth
250 fft make-sweep-matrix sweep-operator ax+y eigen
252 check-real ;; for optimize
254 covariance-matrix matrix print-matrix solve
255 backsolve eigenvalues eigenvectors accumulate cumsum combine
256 lowess))
261 (defpackage :lisp-stat-data
262 (:documentation "Data management, integration, I/O, and other data technologies.")
263 (:nicknames :ls-data)
264 (:use :common-lisp
265 :lisp-stat-object-system
266 :lisp-stat-config
267 :lisp-stat-types
268 :lisp-stat-compound-data)
269 (:shadowing-import-from :lisp-stat-object-system
270 slot-value call-method call-next-method)
271 (:export open-file-dialog read-data-file read-data-columns load-data
272 load-example *variables* *ask-on-redefine*
273 def variables savevar undef))
275 (defpackage :lisp-stat-descriptive-statistics
276 (:use :common-lisp
277 :lisp-stat-data
278 :lisp-stat-math
279 :lisp-stat-compound-data
280 :lisp-stat-matrix
281 :lisp-stat-linalg-data
282 :lisp-stat-linalg
283 :lisp-stat-basics)
284 (:shadowing-import-from :lisp-stat-math ;; life is a vector!
285 expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
286 asin acos atan sinh cosh tanh asinh acosh atanh float random
287 truncate floor ceiling round minusp zerop plusp evenp oddp
288 < <= = /= >= > ;; complex
289 conjugate realpart imagpart phase
290 min max logand logior logxor lognot ffloor fceiling
291 ftruncate fround signum cis)
292 (:export standard-deviation quantile median interquartile-range
293 fivnum sample))
296 (defpackage :lisp-stat-regression-linear
297 (:use :common-lisp
298 :lisp-stat-object-system
299 :lisp-stat-basics
300 :lisp-stat-compound-data
301 :lisp-stat-math
302 :lisp-stat-matrix
303 :lisp-stat-linalg
304 :lisp-stat-descriptive-statistics)
305 (:shadowing-import-from :lisp-stat-object-system
306 slot-value call-method call-next-method)
307 (:shadowing-import-from :lisp-stat-math
308 expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
309 asin acos atan sinh cosh tanh asinh acosh atanh float random
310 truncate floor ceiling round minusp zerop plusp evenp oddp
311 < <= = /= >= > ;; complex
312 conjugate realpart imagpart phase
313 min max logand logior logxor lognot ffloor fceiling
314 ftruncate fround signum cis)
315 (:export regression-model regression-model-proto x y intercept sweep-matrix
316 basis weights included total-sum-of-squares residual-sum-of-squares
317 predictor-names response-name case-labels))
319 (defpackage :lisp-stat
320 (:documentation "Experimentation package for LispStat. Serious
321 work should be packaged up elsewhere for reproducibility. By this
322 I mean, creating a data/analytics/analysis package with the
323 minimal set of objects required.")
324 (:use :common-lisp
325 :lisp-stat-object-system
326 :lisp-stat-compound-data
327 :lisp-stat-probability
328 :lisp-stat-types
329 :lisp-stat-float
330 :lisp-stat-basics
331 :lisp-stat-data
332 :lisp-stat-math
333 :lisp-stat-matrix
334 :lisp-stat-linalg
335 :lisp-stat-descriptive-statistics
336 :lisp-stat-regression-linear)
337 (:shadowing-import-from :lisp-stat-object-system
338 slot-value call-method call-next-method)
339 (:shadowing-import-from :lisp-stat-math
340 expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
341 asin acos atan sinh cosh tanh asinh acosh atanh float random
342 truncate floor ceiling round minusp zerop plusp evenp oddp
343 < <= = /= >= > ;;complex
344 conjugate realpart imagpart phase
345 min max logand logior logxor lognot ffloor fceiling
346 ftruncate fround signum cis)
347 (:export
348 ;; lsobjects :
349 defproto defproto2
350 defmeth send
352 ;; lstypes :
353 fixnump check-nonneg-fixnum check-one-fixnum
354 check-one-real check-one-number
356 ;; lsmacros:
358 ;; lsfloat :
359 machine-epsilon
361 ;; compound :
362 compound-data-p *compound-data-proto* compound-object-p
363 compound-data-seq compound-data-length
364 element-list element-seq
365 sort-data order rank
366 recursive-map-elements map-elements
367 repeat
368 check-sequence
369 get-next-element make-next-element set-next-element
370 ;; sequencep
371 iseq
372 ordered-nneg-seq
373 select which
374 difference rseq
376 ;; lsmath.lsp
377 ^ ** expt + - * / mod rem pmin pmax abs 1+ 1- log exp sqrt sin cos
378 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
379 truncate floor ceiling round minusp zerop plusp evenp oddp < <= =
380 /= >= > ;; complex
381 conjugate realpart imagpart phase min max
382 logand logior logxor lognot ffloor fceiling ftruncate fround
383 signum cis
385 ;; matrices.lisp
386 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
387 column-list inner-product outer-product cross-product transpose
388 bind-columns bind-rows
390 ;; linalg.lisp
391 chol-decomp lu-decomp lu-solve determinant inverse
392 sv-decomp qr-decomp rcondest make-rotation spline
393 kernel-dens kernel-smooth
394 fft make-sweep-matrix sweep-operator ax+y eigen
395 check-real
396 covariance-matrix matrix print-matrix solve
397 backsolve eigenvalues eigenvectors accumulate cumsum combine
398 lowess
400 ;; in linalg.lisp, possibly not supported by matlisp
401 spline kernel-dens kernel-smooth
403 ;; optimize.lsp
404 newtonmax nelmeadmax
406 ;; lispstat-macros
407 make-rv-function make-rv-function-1
409 ;; data.lisp
410 open-file-dialog read-data-file read-data-columns load-data
411 load-example *variables* *ask-on-redefine*
412 def variables savevar undef
414 ;; statistics.lsp
415 standard-deviation quantile median interquartile-range
416 fivnum sample
418 ;; dists
419 log-gamma set-seed
420 uniform-rand normal-cdf normal-quant normal-dens
421 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
422 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
423 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
424 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
425 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
426 binomial-cdf binomial-quant binomial-pmf binomial-rand
428 ;;; Here is where we have a problem -- lispstat core should be core
429 ;;; data management and config problems, with packages providing
430 ;;; specialized extensions to LispStat, i.e. regression, nonlin
431 ;;; regression, bayesian regression via laplace approximation, etc.
433 ;;; The following could be considered "recommended packages", similar
434 ;;; to the idea of the recommended packages in R.
436 ;; regression.lsp
437 regression-model regression-model-proto x y intercept sweep-matrix
438 basis weights included total-sum-of-squares residual-sum-of-squares
439 predictor-names response-name case-labels
441 ;; nonlin.lsp
442 nreg-model nreg-model-proto mean-function theta-hat epsilon
443 count-limit verbose
445 ;; bayes.lsp
446 bayes-model bayes-model-proto bayes-internals))
449 ;;;; PACKAGES FOR USEABILITY
451 (defpackage :lisp-stat-data-examples
452 (:documentation "Example data for unittests, examples, illustrations,")
453 (:use :common-lisp
454 :lisp-stat)
455 (:shadowing-import-from :lisp-stat
456 slot-value call-method call-next-method
458 expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
459 asin acos atan sinh cosh tanh asinh acosh atanh float random
460 truncate floor ceiling round minusp zerop plusp evenp oddp
461 < <= = /= >= > > ;; complex
462 conjugate realpart imagpart phase
463 min max logand logior logxor lognot ffloor fceiling
464 ftruncate fround signum cis
466 <= float imagpart)
467 (:export iron aluminum absorbtion
468 diabetes dlabs))
471 (defpackage :lisp-stat-user
472 (:documentation "Experimentation package for LispStat.
473 Serious work should be placed in a similar package elsewhere for
474 reproducibility. But this should hint as to what needs to be
475 done for a user- or analysis-package.")
476 (:nicknames :ls-user)
477 (:use :common-lisp
478 :lisp-stat
479 :lisp-stat-data-examples) ;; this last is to have 'things to play with'
480 (:shadowing-import-from :lisp-stat
481 slot-value call-method call-next-method
483 expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
484 asin acos atan sinh cosh tanh asinh acosh atanh float random
485 truncate floor ceiling round minusp zerop plusp evenp oddp
486 < <= = /= >= > > ;; complex
487 conjugate realpart imagpart phase
488 min max logand logior logxor lognot ffloor fceiling
489 ftruncate fround signum cis
491 <= float imagpart))
493 (defpackage :lisp-stat-unittests
494 (:use :common-lisp :lift :lisp-stat :lisp-stat-data-examples)
495 (:shadowing-import-from :lisp-stat
496 slot-value call-method call-next-method ;; objects
497 expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan ;; lsmath
498 asin acos atan sinh cosh tanh asinh acosh atanh float random
499 truncate floor ceiling round minusp zerop plusp evenp oddp
500 < <= = /= >= > ;; complex
501 conjugate realpart imagpart phase
502 min max logand logior logxor lognot ffloor fceiling
503 ftruncate fround signum cis)
504 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard ; exec
505 almost= almost=lists numerical=)) ; compare
507 (defpackage :lisp-stat-data-clos-example
508 (:use :common-lisp
509 :lift :lisp-stat-unittests
510 :lisp-stat-data-examples
511 :lisp-stat-data-clos)
512 (:export absorbtion aluminum iron))