API Reference

No packages.

No packages.

# clml.blas

CLML BLAS (Complex)

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

No packages.

# clml.statistics

Statistics Library

## CLML.STATISTICS.UTILITIES

• Function SQR (x)
• Function BINOMIAL (n k)
• Function LINEAR-COMBINATION (a x b)
Gives A when X = 0 and B when X = 1.
• Function POLYNOMIAL (coefficients x)
Evaluates a polynomial at X.
• Function REAL-INTEGER-P (object)
• Function CONCATENATED-SYMBOL (&rest lst)
• Macro DEF-ON-SORTED (name (sequence &rest args) &body body)
• Function BINARY-SEARCH (x fn from to)
Searches for K in the integer interval [FROM, TO] where FN(K) is closest to X.
• Function REAL-BINARY-SEARCH (fn from to &optional (tolerance 1.d-8))
Searches for the zero position of FN in the interval [FROM, TO].
• Macro CONDITIONAL-SWAP-LET (pred fn var-lists &body body)
If PRED is true, swap the values of every pair in VAR-LISTS, and execute BODY in this environment. Call FN on the result, if PRED was true. E.g. (CONDITIONAL-SWAP-LET T #'1+ ((A B) (C D)) ..BODY..) would swap the values of A and B, and C and D, and return the result of the body + 1. Uses SETF.
• Macro CONDITIONAL-LET* (pred fn var-val-lists &body body)
If PRED is true, bind the first, otherwise the second value of every value pair in VAR-VAL-LISTS, and execute BODY in this environment. Call FN on the result, if PRED was true.
• Function COUNT-VALUES (seq &key (test #'equal))

## CLML.STATISTICS.MATH

• Function CHEBYSHEV-TERMS (coefficients tolerance)
The maximum number of Chebyshev terms that the error is within tolerance.
• Function CHEBYSHEV (x coefficients n)
N-term shifted Chebyshev series at X.
• Function LOG-GAMMA-CORRECTION (x)
• Function LOG-GAMMA-CORRECTION (x)
• Function LOG-GAMMA (x)
• Function LOG-GAMMA (x)
• Function STIRLING-ERROR (n)
• Function STIRLING-ERROR (n)
• Function GAMMA (x)
• Function GAMMA (x)
• Function GAMMA-HALF (n)
The gamma function for N/2 (where N is an integer).
• Function DIGAMMA (x)
TODO: This is a kind of Chebyshev series, should be implemented with CHEBYSHEV and CHEBYSHEV-TERMS.
• Function DIGAMMA (x)
TODO: This is a kind of Chebyshev series, should be implemented with CHEBYSHEV and CHEBYSHEV-TERMS.
• Function ERF (x)
• Function ERF (x)
• Function ERF-INVERSE (x)
• Function ERF-INVERSE (x)
• Variable *MAX-SERIES-ITERATIONS*
100
• Function SUM-SERIES (fn bits)
FN generates the series, the error will be less than sum/2^BITS.
• Function LOWER-INCOMPLETE-GAMMA (a x)
• Function LOWER-INCOMPLETE-GAMMA-HALF (n x)
The lower incomplete gamma function for N/2 (where N is an integer).
• Function REGULARIZED-GAMMA (a x)
• Function BETA (a b)
• Function BETA-HALF (a b)
Beta function for A/2, B/2.
• Function INCOMPLETE-BETA (a b x)
• Function GENERALIZED-CONTINUED-FRACTION (a b &key (a1 (funcall a 1)) (b0 (funcall b 0)) (tolerance double-float-epsilon) (pred (lambda (new old) (> (abs (- new old)) (* tolerance new)))))
Calculates the infinite continued fraction with coefficients given by the functions A and B, with relative tolerance TOLERANCE. Initial values (for the n=0 case) can b given as keys. If PRED is given, it should be a function of two arguments, the new and old value in the iteration, that returns NIL when the iterations should stop.
• Function SIMPLE-CONTINUED-FRACTION (a &key (a0 (funcall a 0)) (tolerance double-float-epsilon) (pred (lambda (new old) (> (abs (- new old)) (* tolerance new)))))
• Function REGULARIZED-INCOMPLETE-BETA (a b x)
• Function INCOMPLETE-BETA-INVERSE (a b x)
TODO: a much better guess should be computed. A very detailed treatise of all the cases can be found in the Boost library documentation.
• Variable *INV-LIN-INTERP-PRECISION*
1.d-12
• Variable *INV-LIN-INTERP-MAX-ITERATION*
1000
• Function INVERSE-LINEAR-INTERPOLATION (fn range)
• Variable *NEWTON-RAPHSON-PRECISION*
1.d-12
• Variable *NEWTON-RAPHSON-INITIAL-DIVISIONS*
100
• Function NEWTON-RAPHSON (fn derivative &key range initial-guess)
• Function NUMERICAL-DERIVATIVE (fn x &key range)
• Function GAMMP (a x)

## CLML.STATISTICS

** Notes
- Numbers are not converted to (double) floats, for better accuracy with
whole number data. This should be OK, since double data will generate
double results (the number type is preserved).
- Places marked with TODO are not optimal or not finished (see the TODO
file for more details).

*** Distributions
Distributions are CLOS objects, and they are created by the constructor
of the same name. The objects support the methods CDF (cumulative
distribution function), DENSITY (MASS for discrete distributions),
QUANTILE, RAND (gives a random number according to the given distribution),
RAND-N (convenience function that gives n random numbers), MEAN and
VARIANCE (giving the distribution's mean and variance, respectively).
These take the distribution as their first parameter.

Most distributions can also be created with an estimator constructor.
The estimator function has the form <distribution>-ESTIMATE, unless noted.
• Generic-Function MEAN (obj)
Returns the mean of SEQ.
• Method MEAN ((sequence sequence))
• Function MEDIAN-ON-SORTED (sequence)
Returns the median of SEQ. (Variant: median-on-sorted (sorted-seq))
• Function MEDIAN (sequence)
• Function DISCRETE-QUANTILE-ON-SORTED (sequence cuts)
Returns the quantile(s) of SEQ at the given cut point(s). CUTS can be a single value or a list. (Variant: discrete-quantile-on-sorted (sorted-seq cuts)) The function gives the mean of the two numbers closest to the given ratio if the ratio does not give an exact (whole) position. This is what LISP-STAT does, but returning (LINEAR-COMBINATION (ELT SEQUENCE Q) R (ELT SEQUENCE (1+ Q))) may be better. More on this at http://mathworld.wolfram.com/Quantile.html. CUTS is a single number or a list of numbers, each in the interval [0,1].
• Function DISCRETE-QUANTILE (sequence cuts)
• Function FIVE-NUMBER-SUMMARY-ON-SORTED (sequence)
Returns the "five number summary" of SEQ, ie. the discrete quantiles at the cut points 0, 1/4, 1/2, 3/4 and 1. (Variant: five-number-summary-on-sorted (sorted-seq))
• Function FIVE-NUMBER-SUMMARY (sequence)
• Function RANGE (sequence)
Returns the interquartile range of SEQ, ie. the difference of the discrete quantiles at 3/4 and 1/4. (Variant: interquartile-range-on-sorted (sorted-seq))
• Function INTERQUARTILE-RANGE-ON-SORTED (sequence)
• Function INTERQUARTILE-RANGE (sequence)
• Function MEAN-DEVIATION (sequence)
Returns the mean deviation of SEQ.
• Function SPEARMAN-RANK-CORRELATION (seq1 seq2)
Gives the correlation coefficient based on just the relative size of the given values.
• Function KENDALL-RANK-CORRELATION (seq1 seq2)
Returns the Kendall "tau" rank correlation coefficient.
• Function PARSE-DIST-SLOTS (distribution-slots class)
• Macro DEFDISTRIBUTION (name direct-supers direct-slots &rest options)
• Class LOG-NORMAL-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
• Class UNIFORM-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
SKEWNESS
KURTOSIS
• Class GAMMA-DISTRIBUTION  (GAMMA-LIKE-DISTRIBUTION)
SHAPE-INV
D
C
• Class ERLANG-DISTRIBUTION  (GAMMA-LIKE-DISTRIBUTION)
• Class EXPONENTIAL-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
SKEWNESS
KURTOSIS
MODE
• Class NORMAL-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
MODE
SKEWNESS
KURTOSIS
• Class CHI-SQUARE-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
• Class T-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
R
B
C
A
D
K
W
S
P
Q
T1
T2
V1
V2
• Class BETA-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
ALPHA-GAMMA
BETA-GAMMA
• Class F-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
CHI1
CHI2
F
• Class BINOMIAL-DISTRIBUTION  (BERNOULLI-RELATED-DISTRIBUTION)
TABLE
KI
VI
B
K
W
NSQ
• Class GEOMETRIC-DISTRIBUTION  (BERNOULLI-RELATED-DISTRIBUTION)
TABLE
KI
VI
B
K
W
NSQ
PSQ
Q
R
C
• Class HYPERGEOMETRIC-DISTRIBUTION  (DISCRETE-DISTRIBUTION)
TABLE
KI
VI
B
K
W
NSQ
A1
• Class CAUCHY-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
• Class LOGISTIC-DISTRIBUTION  (CONTINUOUS-DISTRIBUTION)
SKEWNESS
KURTOSIS
• Class NEGATIVE-BINOMIAL-DISTRIBUTION  (BERNOULLI-RELATED-DISTRIBUTION)
TABLE
KI
VI
B
K
W
NSQ
PSQ
Q
R
XL
XU
PL
PU
QUE
S
TEE
• Class POISSON-DISTRIBUTION  (DISCRETE-DISTRIBUTION)
TABLE
KI
VI
B
K
W
NSQ
PSQ
Q
R
XL
XU
PL
PU
C
• Class WEIBULL-DISTRIBUTION  (GAMMA-LIKE-DISTRIBUTION)
R-INV
• Generic-Function UPDATE-DISTRIBUTION (distribution)
• Generic-Function CDF (distribution x)
Cumulative distribution function of DISTRIBUTION at X.
• Generic-Function DENSITY (continuous-distribution x)
Density function of DISTRIBUTION at X.
• Generic-Function QUANTILE (distribution p)
Quantile of P according to DISTRIBUTION.
• Generic-Function RAND (distribution)
Gives a random number according to DISTRIBUTION.
• Generic-Function MODE (distribution &optional test)
Gives a mode according to DISTRIBUTION.
• Method MODE ((distribution distribution) &optional test)
• Method CDF ((distribution discrete-distribution) x)
The CDF of a discrete distribution is (CDF (FLOOR X)).
• Function RAND-N (distribution n)
N random numbers according to DISTRIBUTION.
• Method MEAN ((distribution distribution))
• Generic-Function VARIANCE (obj)
• Method VARIANCE ((sequence sequence))
• Method VARIANCE ((distribution distribution))
• Function STANDARD-DEVIATION (sequence &key populationp)
Sample standard deviation; or population standard deviation if POPULATIONP.
• Method MODE ((seq sequence) &optional (test #'eql))
• Method CDF ((distribution normal-distribution) x)
• Method DENSITY ((distribution normal-distribution) x)
• Method QUANTILE ((distribution normal-distribution) p)
• Method RAND ((distribution normal-distribution))
• Function NORMAL-DISTRIBUTION-ESTIMATE-UNBIASED (sequence)
• Function NORMAL-DISTRIBUTION-ESTIMATE-MAXIMUM-LIKELIHOOD (sequence)
• Function NORMAL-DISTRIBUTION (average std)
- Parameters: expected-value, deviation - Estimators: normal-distribution-estimate-unbiased, normal-distribution-estimate-maximum-likelihood - (Variant: standard-normal-distribution)
• Function STANDARD-NORMAL-DISTRIBUTION
• Function STANDARD-NORMAL-DISTRIBUTION
• Function LOG-NORMAL-DISTRIBUTION (average std)
- Parameters: expected-value, deviation - Estimators: log-normal-distribution-estimate-unbiased, log-normal-distribution-estimate-maximum-likelihood
• Method CDF ((distribution log-normal-distribution) x)
• Method DENSITY ((distribution log-normal-distribution) x)
• Method QUANTILE ((distribution log-normal-distribution) p)
• Method RAND ((distribution log-normal-distribution))
• Function LOG-NORMAL-DISTRIBUTION-ESTIMATE-UNBIASED (lst)
• Function LOG-NORMAL-DISTRIBUTION-ESTIMATE-MAXIMUM-LIKELIHOOD (lst)
• Function UNIFORM-DISTRIBUTION (from to)
- Parameters: from, to - Estimators: uniform-distribution-estimate-moments, uniform-distribution-estimate-maximum-likelihood - (Variant: standard-uniform-distribution)
• Function STANDARD-UNIFORM-DISTRIBUTION
• Method CDF ((distribution uniform-distribution) x)
• Method DENSITY ((distribution uniform-distribution) x)
• Method QUANTILE ((distribution uniform-distribution) p)
• Method RAND ((distribution uniform-distribution))
• Function UNIFORM-DISTRIBUTION-ESTIMATE-MOMENTS (sequence)
• Function UNIFORM-DISTRIBUTION-ESTIMATE-MAXIMUM-LIKELIHOOD (sequence)
• Function ERLANG-DISTRIBUTION (scale shape)
• Method CDF ((distribution erlang-distribution) x)
• Method RAND ((distribution erlang-distribution))
• Function ERLANG-DISTRIBUTION-ESTIMATE (sequence)
Estimates by matching moments.
• Function EXPONENTIAL-DISTRIBUTION (scale-or-hazard &optional (hazardp t))
(EXPONENTIAL-DISTRIBUTION SCALE T) or (EXPONENTIAL-DISTRIBUTION HAZARD).
• Method CDF ((distribution exponential-distribution) x)
• Method DENSITY ((distribution exponential-distribution) x)
• Method QUANTILE ((distribution exponential-distribution) p)
• Method RAND ((distribution exponential-distribution))
• Function EXPONENTIAL-DISTRIBUTION-ESTIMATE (sequence)
Unbiased maximum likelihood estimate.
• Function GAMMA-DISTRIBUTION (scale shape)
- Parameters: scale, shape - (Variant: erlang-distribution [shape is an integer]) - Numerical calculation: If there is a numerical problem with QUANTILE, QUANTILE-ILI would be solve it.\ ILI is abbreviation of the numerical calculation method of Inverse-Linear-Interpolation.\ However this is slower than Newton-Raphson(for QUANTILE).
• Method CDF ((distribution gamma-distribution) x)
• Method DENSITY ((distribution gamma-distribution) x)
• Method QUANTILE ((distribution gamma-like-distribution) p)
Uses the Wilson-Hilferty guess and Newton-Raphson approximation. TODO: For small numbers the WH estimate doesn't really work. WH: KT = 2/G * (((ZT - G/6) * G/6 + 1)^3 - 1) Kite: KT = ZT + (ZT^2 - 1) * G/6 + 1/3 * (ZT^3 - 6 * ZT) * (G/6)^2 - (ZT^2 - 1) * (G/6)^3 + ZT * (G/6)^4 + 1/3 * (G/6)^5.
• Generic-Function QUANTILE-ILI (distribution p)
• Method QUANTILE-ILI ((distribution gamma-like-distribution) p)
Use the method of inverse-linear-interpolation for numerical calculation. If there is a numerical problem with quantile of gamma-like-distribution, this method would be solve it. However this is slower than Newton-Raphson.
• Method RAND ((distribution gamma-distribution))
• Function GAMMA-DISTRIBUTION-ESTIMATE (sequence)
Estimates by matching moments.
• Function CHI-SQUARE-DISTRIBUTION (freedom)
- Parameters: degree - Estimators: [none]
• Method CDF ((distribution chi-square-distribution) x)
• Method DENSITY ((distribution chi-square-distribution) x)
• Method QUANTILE ((distribution chi-square-distribution) p)
• Method RAND ((distribution chi-square-distribution))
• Method UPDATE-DISTRIBUTION ((distribution t-distribution))
TODO: This can be done once in a global variable that contains an adjustable vector, that is adjusted if the new distribution has a larger freedom than the one precalculated.
• Function T-DISTRIBUTION (freedom)
- Parameters: degree - Estimators: [none]
• Method CDF ((distribution t-distribution) x)
• Method DENSITY ((distribution t-distribution) x)
• Method QUANTILE ((distribution t-distribution) p)
This implementation is quite expensive: it uses Newton-Raphson numerical integration twice, since the inverse of the incomplete beta function also uses it.
• Method RAND ((distribution t-distribution))
• Method VARIANCE ((distribution t-distribution))
• Function BETA-DISTRIBUTION (shape1 shape2)
- Parameters: shape1 shape2
• Method CDF ((distribution beta-distribution) x)
• Method DENSITY ((distribution beta-distribution) x)
• Method QUANTILE ((distribution beta-distribution) p)
• Method RAND ((distribution beta-distribution))
• Method MEAN ((distribution beta-distribution))
• Method VARIANCE ((distribution beta-distribution))
• Function BETA-DISTRIBUTION-ESTIMATE (sequence)
Estimates by matching moments.
• Function F-DISTRIBUTION (freedom1 freedom2)
- Parameters: degree1 degree2 - Estimators: [none]
• Method CDF ((distribution f-distribution) x)
• Method DENSITY ((distribution f-distribution) x)
• Method QUANTILE ((distribution f-distribution) p)
If one freedom is large, it uses the chi-square quantile, otherwise it uses the beta distribution quantile.
• Method RAND ((distribution f-distribution))
• Method MEAN ((distribution f-distribution))
• Method VARIANCE ((distribution f-distribution))
• Method UPDATE-DISTRIBUTION ((distribution bernoulli-related-distribution))
• Function BINOMIAL-DISTRIBUTION (size probability)
- Parameters: size, probability
• Method CDF ((distribution binomial-distribution) k)
• Method QUANTILE ((distribution binomial-distribution) p)
TODO: The search part could be more efficient.
• Method RAND ((distribution binomial-distribution))
• Method MEAN ((distribution binomial-distribution))
• Method VARIANCE ((distribution binomial-distribution))
• Function BINOMIAL-DISTRIBUTION-ESTIMATE (size successes)
Maximum likelihood estimate.
• Function GEOMETRIC-DISTRIBUTION (probability)
- Parameters: probability - (Supported on k = 1, 2, ... (the # of trials until a success, inclusive))
• Method CDF ((distribution geometric-distribution) k)
• Method QUANTILE ((distribution geometric-distribution) p)
• Method RAND ((distribution geometric-distribution))
• Method MEAN ((distribution geometric-distribution))
• Method VARIANCE ((distribution geometric-distribution))
• Function GEOMETRIC-DISTRIBUTION-ESTIMATE (trials)
Maximum likelihood estimate.
• Function HYPERGEOMETRIC-DISTRIBUTION (elements successes samples)
• Method CDF ((distribution hypergeometric-distribution) k)
TODO: Trivial implementation - ineffective and there may be cancellation.
• Method QUANTILE ((distribution hypergeometric-distribution) p)
TODO: Trivial implementation - ineffective.
• Method RAND ((distribution hypergeometric-distribution))
• Method MEAN ((distribution hypergeometric-distribution))
• Method VARIANCE ((distribution hypergeometric-distribution))
• Function HYPERGEOMETRIC-DISTRIBUTION-ESTIMATE-SUCCESSES-UNBIASED (elements samples sample-successes)
• Function HYPERGEOMETRIC-DISTRIBUTION-ESTIMATE-SUCCESSES-MAXIMUM-LIKELIHOOD (elements samples sample-successes)
• Function HYPERGEOMETRIC-DISTRIBUTION-ESTIMATE-ELEMENTS (successes samples sample-successes)
Maximum likelihood estimation.
• Function CAUCHY-DISTRIBUTION (location scale)
- Parameters: location, scale
• Method CDF ((distribution cauchy-distribution) x)
• Method DENSITY ((distribution cauchy-distribution) x)
• Method QUANTILE ((distribution cauchy-distribution) p)
• Method RAND ((distribution cauchy-distribution))
• Function CAUCHY-DISTRIBUTION-ESTIMATE (lst &optional (iterations 100))
• Function LOGISTIC-DISTRIBUTION (location scale)
- Parameters: location, scale
• Method CDF ((distribution logistic-distribution) x)
• Method DENSITY ((distribution logistic-distribution) x)
• Method QUANTILE ((distribution logistic-distribution) p)
• Method RAND ((distribution logistic-distribution))
• Method MEAN ((distribution logistic-distribution))
• Method VARIANCE ((distribution logistic-distribution))
• Function LOGISTIC-DISTRIBUTION-ESTIMATE (sequence &optional (iteration 100) (tolerance 1.d-10))
Maximal likelihood estimate.
• Function NEGATIVE-BINOMIAL-DISTRIBUTION (successes probability)
- Parameters: successes, probability, failuresp - Estimators: negative-binomial-distribution-estimate-unbiased, negative-binomial-distribution-estimate-maximum-likelihood - When failuresp is NIL, the distribution is supported on k = s, s+1, ... (the # of trials until a given number of successes, inclusive)) - When failuresp is T (the default), it is supported on k = 0, 1, ... (the # of failures until a given number of successes, inclusive) - Estimators also have the failuresp parameter - (Variant: geometric-distribution [successes = 1, failuresp = nil]) Number of failures until a given number of successes, extended to real numbers. If FAILURESP is NIL, we look at the number of all trials, not just the failures.
• Method CDF ((distribution negative-binomial-distribution) k)
• Method QUANTILE ((distribution negative-binomial-distribution) p)
• Method RAND ((distribution negative-binomial-distribution))
• Method MEAN ((distribution negative-binomial-distribution))
• Method VARIANCE ((distribution negative-binomial-distribution))
• Function NEGATIVE-BINOMIAL-DISTRIBUTION-ESTIMATE-MAXIMUM-LIKELIHOOD (successes trials)
Estimate based on the number of successes in a given number of trials. FAILURESP works as in NEGATIVE-BINOMIAL-DISTRIBUTION.
• Function NEGATIVE-BINOMIAL-DISTRIBUTION-ESTIMATE-UNBIASED (successes trials)
Estimate based on the number of successes in a given number of trials. FAILURESP works as in NEGATIVE-BINOMIAL-DISTRIBUTION.
• Function POISSON-DISTRIBUTION (rate)
- Parameters: rate
• Method CDF ((distribution poisson-distribution) k)
• Method QUANTILE ((distribution poisson-distribution) p)
• Method RAND ((distribution poisson-distribution))
• Method MEAN ((distribution poisson-distribution))
• Method VARIANCE ((distribution poisson-distribution))
• Function POISSON-DISTRIBUTION-ESTIMATE (sequence)
Maximum likelihood estimate, also unbiased and minimum variance.
• Function WEIBULL-DISTRIBUTION (scale shape)
- Parameters: scale, shape
• Method CDF ((distribution weibull-distribution) x)
• Method DENSITY ((distribution weibull-distribution) x)
• Method QUANTILE ((distribution weibull-distribution) p)
• Method RAND ((distribution weibull-distribution))
• Method MEAN ((distribution weibull-distribution))
• Method VARIANCE ((distribution weibull-distribution))
• Function WEIBULL-DISTRIBUTION-ESTIMATE (sequence)
Maximum likelihood estimate.
• Function SMIRNOV-GRUBBS (seq alpha &key (type :max) (recursive nil) (sig-p-hash nil))
**** smirnov-grubbs (seq alpha &key (type :max) (recursive nil)) Smirnov-Grubbs method for outlier verification. - return: nil | sequence - arguments: - seq : <sequence of number> - alpha : <number> , significance level - type : :min | :max, which side of outlier value - recursive : nil | t - reference: http://aoki2.si.gunma-u.ac.jp/lecture/Grubbs/Grubbs.html length of seq must be more than 4
• Function SMIRNOV-GRUBBS-P (seq position alpha &key (sig-p-hash nil))
• Function GET-SIG-P (n alpha)
• Function MAKE-SIG-P-HASH (n alpha)
• Function COVARIANCE (seq1 seq2)
Returns the covariance of SEQ1 and SEQ2.
• Function LINEAR-REGRESSION (seq1 seq2)
Fits a line y = A + Bx on the data points from SEQ1 x SEQ2. Returns (A B).
• Function CORRELATION-COEFFICIENT (seq1 seq2)
Returns the correlation coefficient of SEQ1 and SEQ2, ie. covariance / (standard-deviation1 * standard-deviation2).
• Function NORMAL-DIST-TEST (freq-seq inf width precision)
- Input: frequation sequence, infimum of the first class, class width, precision - Output( 3 values of property-list ) - result (:TOTAL total-frequency :MEAN mean :VARIANCE variance :SD standard-deviation) - table (:MID mid-value-of-each-class :FREQ frequency-of-each-class :Z standard-score :CDF cummulative-distribution-frequency :EXPECTATION expectation) - result2 (:CHI-SQ Chi-square-statistics :D.F. Degree-of-freedom :P-VALUE p-value)
• Function POISSON-DIST-TEST (d)
- Input: sequence of frequency - Output( 3 values of p-list ) - result (:N total-frequency :MEAN mean) - table (:C-ID assumed-class-value :FREQ frequency :P probability :E expectation) - result2 (:CHI-SQ Chi-square-statistics :D.F. Degree-of-freedom :P-VALUE p-value)
• Function BINOM-DIST-TEST (d x size)
- Input: sequence of frequency, sequence of class-value, size of Bernoulli trials - Output( 3 values of p-list ) - result (:D-SIZE total-frequency :PROBABILITY population-rate) - table (:FREQ frequency :P probability :E expectation) - result2 (:CHI-SQ Chi-square-statistics :D.F. Degree-of-freedom :P-VALUE p-value)

### Also exports

• CLML.STATISTICS.UTILITIES:COUNT-VALUES

# clml.statistics.rand

CLML Probability distribution random number generation method Library

## CLML.STATISTICS.RAND

• Macro DFLOAT (x)
• Function UNIT-RANDOM (&optional mode)
A random number in the range [0, 1), (0, 1], [0, 1] or (0, 1).
• Variable +BIT-OPERATION-M+
(floor (log most-positive-fixnum 2))
• Function BERNOULLI (base-p)
• Function INT-POWER (double integer_a)
• Function HALF-INTEGER-POWER (double half-integer)
• Function COMBINATION (bag choice)
• Function TEST-RANDOM-MOMENT (fn &optional (times 10000000))
• Function BOX-MULLER
• Function GAUSS-POLAR
• Function GAUSS-MONTY-PYTHON
• Function GAUSS-MONTY-PYTHON-BIT
• Function GAUSS-ZIGGURAT
• Function GAUSS-ZIGGURAT-BIT
• Function NORMAL-RANDOM (average std)
• Function GAUSS-HALF-ZIGGURAT-BIT
• Function HALF-NORMAL-RANDOM (std)
• Function CAUCHY-INVERSE
• Function CAUCHY-POLAR
• Function CAUCHY-POLAR-GAUSS
• Function CAUCHY-MONTY-PYTHON
• Function CAUCHY-MONTY-PYTHON
• Function CAUCHY-MONTY-PYTHON-BIT
• Function CAUCHY-MONTY-PYTHON-BIT
• Function CAUCHY-ZIGGURAT-BIT
• Function CAUCHY-RANDOM (location scale)
• Function EXP-INVERSE
• Function EXP-INVERSE-INCLUDE-ZERO
• Function EXP-ZIGGURAT-BIT
• Function EXP-ZIGGURAT-BIT-INCLUDE-ZERO
• Function EXP-ZIGGURAT-BIT
• Function EXP-ZIGGURAT-BIT-INCLUDE-ZERO
• Function EXP-RANDOM (scale &optional include-zero)
• Function LAPLACE-INVERSE
• Function LAPLACE-ZIGGURAT-BIT
• Function LAPLACE-ZIGGURAT-BIT
• Function WEIBULL-INVERSE-CACHED (shape rinv &optional include-zero)
• Function WEIBULL-INVERSE (shape &optional include-zero)
• Function WEIBULL-RANDOM (shape scale &optional include-zero)
• Function GAMMA-INVERSE-SHAPE-BIG-CACHED (shape d c)
• Function GAMMA-INVERSE-SHAPE-BIG (shape)
• Function GAMMA-INVERSE-SHAPE-SMALL-CACHED (shape shape-inv d c)
• Function GAMMA-INVERSE-SHAPE-SMALL (shape)
• Function GAMMA-INVERSE (shape)
• Function GAMMA-COMPRESSION-SHAPE-BIG-CACHED (shape d c)
• Function GAMMA-COMPRESSION-SHAPE-BIG (shape)
• Function GAMMA-COMPRESSION-SHAPE-SMALL-CACHED (shape shape-inv d c)
• Function GAMMA-COMPRESSION-SHAPE-SMALL (shape)
• Function GAMMA-COMPRESSION (shape)
• Function GAMMA-RANDOM (shape scale)
• Function RIGHT-TRIANGULAR-INVERSE-CACHED (a b s)
• Function RIGHT-TRIANGULAR-INVERSE (a b)
• Function RIGHT-TRIANGULAR-COMPARE-CACHED (a b s)
• Function RIGHT-TRIANGULAR-COMPARE (a b)
• Function LEFT-TRIANGULAR-INVERSE-CACHED (a b s)
• Function LEFT-TRIANGULAR-INVERSE (a b)
• Function LEFT-TRIANGULAR-COMPARE-CACHED (a b s)
• Function LEFT-TRIANGULAR-COMPARE (a b)
• Function RIGHT-TRIANGULAR-RANDOM (a b)
• Function LEFT-TRIANGULAR-RANDOM (a b)
• Function POWER-FUNCTION-INVERSE-CACHED (shape lower-boundary upper-boundary shape-inv s)
• Function POWER-FUNCTION-INVERSE (shape lower-boundary upper-boundary)
• Function POWER-FUNCTION-WITH-GAMMA-CACHED (shape lower-boundary upper-boundary s)
• Function POWER-FUNCTION-WITH-GAMMA (shape lower-boundary upper-boundary)
• Function POWER-FUNCTION-RANDOM (shape lower-boundary upper-boundary)
• Function ARCSINE-INVERSE
• Function ARCSINE-POLAR
• Function ARCSINE-RANDOM
• Function BETA-RANDOM (alpha beta)
• Function ERLANG-CONVOLUTION (shape scale)
• Function ERLANG-CONVOLUTION-INCLUDE-ZERO (shape scale)
• Function ERLANG-RANDOM (shape scale &optional include-zero)
• Function CHI-SQUARE-CONVOLUTION (freedom)
• Function CHI-SQUARE-RANDOM (freedom)
• Function F-RANDOM-CACHED (freedom1 freedom2 f)
• Function F-RANDOM (freedom1 freedom2)
• Function T-WITH-GAMMA-CACHED (freedom rdiv2 d)
• Function T-WITH-GAMMA (freedom)
• Function T-MONTY-PYTHON-CACHED (freedom r b c a d s p q t1 t2 v1 v2)
• Function T-MONTY-PYTHON (freedom)
• Function T-MONTY-PYTHON-BIT-CACHED (freedom r b c a d k w s p q t1 t2 v1 v2)
• Function T-MONTY-PYTHON-BIT (freedom)
• Function T-COMPRESSION-CACHED (freedom r p q xf fxf x2 fx2 x1 fx1 d1 d2 r4 d3 s3 d4 s4 d5 r5 t5 c6 d6 aarray a)
• Function T-COMPRESSION (freedom)
• Function T-RANDOM (freedom)
• Function LOGISTIC-INVERSE
• Function LOGISTIC-ZIGGURAT-BIT
• Function LOGISTIC-ZIGGURAT-BIT
• Function LOGISTIC-RANDOM (location scale)
• Function BINOMIAL-INVERSE-CACHED (size probability s a d)
• Function BINOMIAL-INVERSE (size probability)
• Function BINOMIAL-INVERSE-MODE-CACHED (size probability s a tee b m d)
• Function BINOMIAL-INVERSE-MODE (size probability)
• Function BINOMIAL-CONVOLUTION (size probability)
• Function BINOMIAL-CONVOLUTION-RECYCLE-CACHED (size probability p q)
• Function BINOMIAL-CONVOLUTION-RECYCLE (size probability)
• Function BINOMIAL-CONVOLUTION-COINFLIP (size)
• Function BINOMIAL-TABLE (size probability)
• Function BINOMIAL-TABLE-LOOKUP (tix si)
• Function BINOMIAL-TABLE-HISTOGRAM (size probability)
• Function BINOMIAL-TABLE-HISTOGRAM-LOOKUP (table ki vi b k w nsq)
• Function BINOMIAL-RANDOM (size probability)
• Function GEOMETRIC-BERNOULLI (probability)
• Function GEOMETRIC-BERNOULLI-RECYCLE-CACHED (probability q)
• Function GEOMETRIC-BERNOULLI-RECYCLE (probability)
• Function GEOMETRIC-BERNOULLI-COINFLIP
• Function GEOMETRIC-INVERSE-CACHED (probability q)
• Function GEOMETRIC-INVERSE (probability)
• Function GEOMETRIC-INVERSE-EXP-CACHED (probability d)
• Function GEOMETRIC-INVERSE-EXP (probability)
• Function GEOMETRIC-TABLE-HISTOGRAM (probability)
• Function GEOMETRIC-TABLE-HISTOGRAM-LOOKUP (table ki vi b k w nsq psq q r c)
• Function GEOMETRIC-RANDOM (probability)
• Function POISSON-SIMULATE-CACHED (rate d)
• Function POISSON-SIMULATE (rate)
• Function POISSON-SIMULATE-EXP (rate)
• Function POISSON-INVERSE-CACHED (rate d)
• Function POISSON-INVERSE (rate)
• Function POISSON-INVERSE-MODE-CACHED (rate c m d)
• Function POISSON-INVERSE-MODE (rate)
• Function POISSON-TABLE-HISTOGRAM (rate)
• Function POISSON-TABLE-HISTOGRAM-LOOKUP (table ki vi b k w nsq psq q r xl xu pl pu c rate)
• Function POISSON-RANDOM (rate)
• Function HYPERGEOMETRIC-SIMULATE (elements successes samples)
• Function HYPERGEOMETRIC-INVERSE-CACHED (elements successes samples a d b1 b2 b3)
• Function HYPERGEOMETRIC-INVERSE (elements successes samples)
• Function HYPERGEOMETRIC-INVERSE-MODE-CACHED (elements successes samples a1 a2 b1 b2 b3 m d)
• Function HYPERGEOMETRIC-INVERSE-MODE (elements successes samples)
• Function HYPERGEOMETRIC-TABLE-HISTOGRAM (elements successes samples)
• Function HYPERGEOMETRIC-TABLE-HISTOGRAM-LOOKUP (table ki vi b k w nsq a1)
• Function HYPERGEOMETRIC-RANDOM (elements successes samples)
• Function NEGATIVE-BINOMIAL-COMPOSE-CACHED (successes probability beta)
• Function NEGATIVE-BINOMIAL-COMPOSE (successes probability)
• Function NEGATIVE-BINOMIAL-CONVOLUTION-INTEGER (successes probability)
• Function NEGATIVE-BINOMIAL-INVERSE-CACHED (successes probability d q s)
• Function NEGATIVE-BINOMIAL-INVERSE (successes probability)
• Function NEGATIVE-BINOMIAL-INVERSE-MODE-CACHED (successes probability q s tee m d)
• Function NEGATIVE-BINOMIAL-INVERSE-MODE (successes probability)
• Function NEGATIVE-BINOMIAL-TABLE-HISTOGRAM (successes probability)
• Function NEGATIVE-BINOMIAL-TABLE-HISTOGRAM-LOOKUP (table ki vi b k w nsq psq q r xl xu pl pu que s tee)
• Function NEGATIVE-BINOMIAL-RANDOM (successes probability)

No packages.

No packages.

No packages.

No packages.

# clml.utility

CLML Utility Library

## CLML.UTILITY.CSV

• Function WRITE-CSV-STREAM (stream table)
Accept a stream and a table and output the table as csv form to the stream. A table is a sequence of lines. A line is a sequence of elements. Elements can be any types
• Function WRITE-CSV-FILE (filename table &key (external-format *csv-default-external-format*))
Accept a filename and a table and output the table as csv form to the file. A table is a sequence of lines. A line is a sequence of elements. Elements can be any types
• Function PARSE-CSV-STRING (str)
• Function READ-CSV-STREAM (stream &key (header t) type-spec map-fns (start 0) end)
Read from stream until eof and return a csv table. A csv table is a vector of csv records. A csv record is a vector of elements. Type spec should be a list of type specifier (symbols). If the type specifier is nil or t, it will be treated as string. If type-spec is nil (the default case), then all will be treated as string. map-fns is a list of functions of one argument and output one result. each function in it will be applied to the parsed element. If any function in the list is nil or t, it equals to #'identity. If map-fns is nil, then nothing will be applied. start and end specifies how many elements per record will be included. If start or end is negative, it counts from the end. -1 is the last element.
• Function READ-CSV-FILE (filename &key (header t) type-spec map-fns (external-format *csv-default-external-format*) (os :anynl-dos) (start 0) end)
Read from stream until eof and return a csv table. A csv table is a vector of csv records. A csv record is a vector of elements. Type spec should be a list of type specifier (symbols). If the type specifier is nil or t, it will be treated as string. If type-spec is nil (the default case), then all will be treated as string. map-fns is a list of functions of one argument and output one result. each function in it will be applied to the parsed element. If any function in the list is nil or t, it equals to #'identity. If map-fns is nil, then nothing will be applied. https://cgit.gentoo.org/proj/lisp.git/tree/dev-lisp/cl-rsm-finance/cl-rsm-finance-1.1.ebuild?h=old-portage&id=e9b71910b0d4f22aeb66f14e158a2451f9955b0d external-format (default is shift-jis) is a valid AllegroCL external-format type. OS is a set to eol-convention of the file stream. start and end specifies how many elements per record will be included. If start or end is negative, it counts from the end. -1 is the last element.
• Function READ-CSV-FILE-AND-SORT (filename sort-order &key (header t) (order :ascend) type-spec map-fns (external-format *csv-default-external-format*))

## CLML.UTILITY.PRIORITY-QUE

• Function MAKE-PRIQUE (implementation &key (maxcount nil) (lessp #'<) (key #'identity))
• Generic-Function PRIQUE-EMPTY-P (q)
• Method PRIQUE-EMPTY-P ((q lheap))
• Method PRIQUE-EMPTY-P ((q biheap))
• Method PRIQUE-EMPTY-P ((q bnheap))
• Method PRIQUE-EMPTY-P ((q fheap))
• Generic-Function PRIQUE-BOX-ITEM (q)
• Method PRIQUE-BOX-ITEM ((q lheap-box))
• Method PRIQUE-BOX-ITEM ((q biheap-box))
• Method PRIQUE-BOX-ITEM ((q bnheap-box))
• Method PRIQUE-BOX-ITEM ((q fheap-box))
• Generic-Function INSERT-PRIQUE (q item)
• Method INSERT-PRIQUE ((q lheap) item)
• Method INSERT-PRIQUE ((q biheap) item)
• Method INSERT-PRIQUE ((q bnheap) item)
• Method INSERT-PRIQUE ((q fheap) item)
• Generic-Function FIND-MIN-PRIQUE (q)
• Method FIND-MIN-PRIQUE ((q lheap))
• Method FIND-MIN-PRIQUE ((q biheap))
• Method FIND-MIN-PRIQUE ((q bnheap))
• Method FIND-MIN-PRIQUE ((q fheap))
• Generic-Function DELETE-MIN-PRIQUE (q)
• Method DELETE-MIN-PRIQUE ((q lheap))
• Method DELETE-MIN-PRIQUE ((q biheap))
• Method DELETE-MIN-PRIQUE ((q bnheap))
• Method DELETE-MIN-PRIQUE ((q fheap))
• Generic-Function UNION-PRIQUE (q1 q2)
• Method UNION-PRIQUE ((q1 lheap) (q2 lheap))
• Method UNION-PRIQUE ((q1 biheap) (q2 biheap))
• Method UNION-PRIQUE ((q1 bnheap) (q2 biheap))
• Method UNION-PRIQUE ((q1 fheap) (q2 biheap))
• Generic-Function AFTER-DECREASE-KEY-PRIQUE (q ib)
• Method AFTER-DECREASE-KEY-PRIQUE ((q lheap) (ib lheap-box))
• Method AFTER-DECREASE-KEY-PRIQUE ((q biheap) (ib biheap-box))
• Method AFTER-DECREASE-KEY-PRIQUE ((q bnheap) (ib bnheap-box))
• Method AFTER-DECREASE-KEY-PRIQUE ((q fheap) (ib fheap-box))

## CLML.UTILITY.DATA

• Function FETCH (url-or-path &key (dir (namestring (asdf/system:system-relative-pathname 'clml "sample/"))) (external-format :utf-8) (cache t) (stream nil) (flush nil))
Fetch file from ~url-or-location~ if not cached in ~dir~ stores the file in the location specified by dir if url or file is url the file is stored in ~dir~/~uri-host~/~uri-path~. Note that it is important to ensure that dir and subdir if used end in a / -return: path to file or stream if :stream parameter is passed -arguments: - url-or-path: <string> pathname or url string identifying file to be fetched. - stream: resuests that fetch returns a stream - cache: <T|NIL> if T looks for file in -dir and uses that as source if NIL then the a fresh copy of the file is fetched - dir: location to store fetched file, default location is in the sample directory in the top level of the clml source tree. - flush: if T fetch does not download the file it deletes the existing file.
• Function PROCESS-FINANCE-HEADER (stream &key (seperator "=") (column-key "columns") (len 6))

# f2cl-lib

Macro library autogenerated by f2cl

## F2CL-LIB

The package holding all symbols used by the Fortran to Lisp library
• Variable *CHECK-ARRAY-BOUNDS*
nil
If non-NIL, generated code checks for array bounds. If NIL, checking is not included
• Type LOGICAL
• Type INTEGER4 (&optional (low -2147483648) (high 2147483647))
• Type INTEGER2
• Type INTEGER1
• Type REAL8
• Type REAL4
• Type COMPLEX8
• Type COMPLEX16
• Type ARRAY-DOUBLE-FLOAT
• Type ARRAY-INTEGER4
• Type ARRAY-SINGLE-FLOAT
• Type ARRAY-STRINGS
• Variable %FALSE%
nil
• Variable %TRUE%
t
• Macro FREF (arr indices bounds &optional offset)
• Macro FSET (a b)
• Macro FREF-STRING (s range)
• Macro FSET-STRING (a b)
• Macro F2CL-// (a b)
• Macro WITH-ARRAY-DATA ((data-var offset-var array) &rest body)
• Macro WITH-MULTI-ARRAY-DATA (array-info &rest body)
• Macro ARRAY-SLICE (vname type indices bounds)
• Macro ARRAY-INITIALIZE (type dims data)
• Macro FORTRAN_COMMENT (&rest args)
• Macro FDO (do_vble_clause predicate_clause &rest body)
• Macro F2CL/ (x y)
• Macro INT-ADD (arg &rest more-args)
• Macro INT-SUB (&rest args)
• Macro INT-MUL (arg &rest more-args)
• Macro ARITHMETIC-IF (pred s1 s2 s3)
• Macro COMPUTED-GOTO (tag-lst i)
• Macro ASSIGNED-GOTO (var tag-list)
• Function INT (x)
• Function IFIX (x)
• Function AINT (x)
• Function DINT (x)
• Function ANINT (x)
• Function DNINT (x)
• Function NINT (x)
• Function IDNINT (x)
• Function FREAL (x)
• Function SNGL (x)
• Function DBLE (x)
• Function CMPLX (x &optional y)
• Function DCMPLX (x &optional y)
• Function ICHAR (c)
• Function FCHAR (i)
• Function IABS (x)
• Function DABS (x)
• Function CABS (x)
• Function CDABS (x)
• Function AMOD (x y)
• Function DMOD (x y)
• Function ISIGN (x y)
• Function SIGN (x y)
• Function DSIGN (x y)
• Function IDIM (x y)
• Function DIM (x y)
• Function DPROD (x y)
• Function MAX0 (x y &rest z)
• Function AMAX1 (x y &rest z)
• Function DMAX1 (x y &rest z)
• Function MAX1 (x y &rest z)
• Function AMAX0 (x y &rest z)
• Function MIN0 (x y &rest z)
• Function AMIN1 (x y &rest z)
• Function DMIN1 (x y &rest z)
• Function MIN1 (x y &rest z)
• Function LEN (s)
• Function INDEX (s1 s2)
• Function LGE (s1 s2)
• Function LGT (s1 s2)
• Function FSTRING-/= (s1 s2)
• Function FSTRING-= (s1 s2)
• Function FSTRING-> (s1 s2)
• Function FSTRING->= (s1 s2)
• Function FSTRING-< (s1 s2)
• Function FSTRING-<= (s1 s2)
• Function AIMAG (c)
• Function DIMAG (c)
• Function CONJG (c)
• Function DCONJG (c)
• Function FSQRT (x)
• Function FLOG (x)
• Function DSQRT (x)
• Function CSQRT (x)
• Function ZSQRT (x)
• Function ALOG (x)
• Function DLOG (x)
• Function CLOG (x)
• Function ALOG10 (x)
• Function DLOG10 (x)
• Function LOG10 (x)
• Function DEXP (x)
• Function CEXP (x)
• Function DSIN (x)
• Function CSIN (x)
• Function DCOS (x)
• Function CCOS (x)
• Function DTAN (x)
• Function DASIN (x)
• Function DACOS (x)
• Function DATAN (x)
• Function ATAN2 (x y)
• Function DATAN2 (x y)
• Function DSINH (x)
• Function DCOSH (x)
• Function DTANH (x)
• Function FFLOAT (x)
• Macro DATA-IMPLIED-DO (implied-do low-bnds var-types vals)
• Macro FFORMAT (dest-lun format-cilist &rest args)
• Macro F2CL-INIT-STRING (dims len &optional inits)
• Macro F2CL-SET-STRING (lhs rhs (string len))
• Function D1MACH (i)
• Function R1MACH (i)
• Function I1MACH (i)

### Also exports

• COMMON-LISP:ACOS
• COMMON-LISP:MAX
• COMMON-LISP:ABS
• COMMON-LISP:ASIN
• COMMON-LISP:ATAN

# fork-future

Fork-future is a posix fork() based future parallel library

## FORK-FUTURE

• Variable *FUTURE-RESULT-FILE-TEMPLATE*
"/tmp/future-result.~d.tmp~~"
• Variable *FORK-FUTURE-MAX-PROCESSES*
4
• Variable *AFTER-FORK-HOOKS*
nil
• Variable *BEFORE-FORK-HOOKS*
nil
• Class FUTURE
PID   Accessor: PID-OF
• Function INITIALIZE-ENVIRONMENT (&key kill-current-futures-p force-p)
• Macro WITH-NEW-ENVIRONMENT (nil &body body)
• Method WAIT-FOR-FUTURE ((future future))
• Function WAIT-FOR-ANY-FUTURE (&optional error-p (warn-p t))
• Function WAIT-FOR-ALL-FUTURES
• Method KILL-FUTURE ((future future) &optional force)
• Function KILL-ALL-FUTURES (&optional force)
• Macro FUTURE (&body body)
Evaluate expr in parallel using a forked child process. Returns a 'future' object whose value can be retrieved using touch. No side-effects made in <expr> will be visible from the calling process.
• Method TOUCH ((future future))
walk the list structure 'future', replacing any futures with their evaluated values. Blocks if a future is still running.

# future

Fork-future is a thread based future parallel library

## FUTURE

• Struct FUTURE
No slots.
• Variable *AFTER-FINISH-HOOKS*
nil
• Variable *BEFORE-START-HOOKS*
nil
• Function INITIALIZE-ENVIRONMENT (&key kill-current-futures-p)
• Macro WITH-NEW-ENVIRONMENT (nil &body body)
• Function WAIT-FOR-FUTURE (future)
• Function WAIT-FOR-ANY-FUTURE
• Function WAIT-FOR-ALL-FUTURES (futures)
• Function KILL-FUTURE (future)
• Function KILL-ALL-FUTURES
• Macro FUTURE (&body body)
• Function FUTURE-FUNCALL (function &optional args future)
• Function TOUCH (future)