Common Lisp Package: CL-NUM-UTILS-TESTS

README:

FUNCTION

Public

RUN (&OPTIONAL INTERACTIVE?)

Run all tests in the test suite.

Private

APPROXIMATION-ERROR (F F-APPROX INTERVAL &OPTIONAL (N-GRID 1000))

Approximation error, using MAXIMUM-ON-GRID.

ASSERT-DISTRIBUTIVE-CONVERT-OP (A B CONVERT OP)

Check that OP distributes over CONVERT.

ASSERT-NOT-RELATION (RELATION &REST ARGUMENT-LISTS)

Assert that RELATION does not hold, called with each set of arguments.

ASSERT-RELATION (RELATION &REST ARGUMENT-LISTS)

Assert RELATION called with each set of arguments.

DO-MATRIX-CONVERT-OPS (TEST CONVERTS &KEY (OPS (LIST #'E+ #'E- #'E*)))

Funcall TEST with CONVERT and each operation in OPs.

MAXIMUM-ON-GRID (F INTERVAL &OPTIONAL (N-GRID 1000))

Maximum of F on a grid of N-GRID equidistand points in INTERVAL.

NUM=-TEST-STRUCT-A (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

NUM=-TEST-STRUCT-B (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PRECISE-CENTRAL-MOMENTS (SEQUENCE)

First 4 central moments, calculated using rationals, returned as four values, normalized by the length of the sequence. Slow, but useful for testing as it does not suffer from approximation error.

PRECISE-WEIGHTED-CENTRAL-MOMENTS (SEQUENCE WEIGHTS)

First 4 weighted central moments, calculated using rationals, returned as four values, normalized by the length of the sequence. Slow, but useful for testing as it does not suffer from approximation error.

RANDOM-FLOATS (N MEAN &OPTIONAL (ELEMENT-TYPE 'DOUBLE-FLOAT))

Return a N-element vector of random floats (with given ELEMENT-TYPE). A uniform random number from either [-1,0] or [0,3] (with equal probability) is added to MEAN, which ensures nonzero third and fourth central moments. Higher abolute value of MEAN makes the calculation of higher central moments more ill-conditioned when using floats.

RANDOM-WEIGHTS (N RANGE &OPTIONAL (ELEMENT-TYPE 'DOUBLE-FLOAT))

Random weights between (exp 1) and (exp (1+ range)), with given element-type.

TEST-MOMENTS (N MEAN &OPTIONAL (ELEMENT-TYPE 'DOUBLE-FLOAT))

Test that moments calculated precisely and with accumulators are equal.

TEST-WEIGHTED-MOMENTS (N MEAN &KEY (WEIGHT-RANGE 4) (ELEMENT-TYPE 'DOUBLE-FLOAT))

Test that moments calculated precisely and with accumulators are equal.

Undocumented

ASSERT-NOT-PAIRED-RELATION (RELATION1 RELATION2 &REST ARGUMENT-LISTS)

ASSERT-PAIRED-RELATION (RELATION1 RELATION2 &REST ARGUMENT-LISTS)

ASSERT-RELATION-CORNER-CASES (&REST RELATIONS)

COPY-NUM=-TEST-STRUCT (INSTANCE)

MAKE-NUM=-TEST-STRUCT (&KEY ((A DUM339) NIL) ((B DUM340) NIL))

SETFNUM=-TEST-STRUCT-A (NEW-VALUE INSTANCE)

SETFNUM=-TEST-STRUCT-B (NEW-VALUE INSTANCE)

NUM=-TEST-STRUCT-P (OBJECT)

TEST-CHEBYSHEV-APPROXIMATE (F INTERVAL N-POLYNOMIALS TEST-INTERVAL &REST REST)

TEST-POOLED-MOMENTS (N MEAN &OPTIONAL (ELEMENT-TYPE 'DOUBLE-FLOAT))

GENERIC-FUNCTION

Private

MEAN (OBJECT &KEY WEIGHTS)

The mean of elements in OBJECT.

MEDIAN (OBJECT)

Median of OBJECT.

VARIANCE (OBJECT &KEY WEIGHTS)

Variance of OBJECT. For samples, normalized by the weight-1 (and thus unbiased if certain assumptions hold, eg weights that count frequencies).

CLASS

Private

NUM=-TEST-STRUCT

Structure for testing DEFINE-STRUCTURE-num=.