# FUNCTION

# Public

# 1C (NUMBER)

Return 1-number. The mnemonic is "1 complement", 1- is already a CL
library function.

# ABS-DIFF (A B)

Absolute difference of A and B.

# ABSOLUTE-SQUARE (NUMBER)

Number multiplied by its complex conjugate.

# AS-INTEGER (NUMBER)

If NUMBER represents an integer (as an integer, complex, or float, etc), return it as an integer, otherwise signal an error. Floats are converted with RATIONALIZE.

# AS-SIMPLE-FIXNUM-VECTOR (SEQUENCE &OPTIONAL COPY?)

Convert SEQUENCE to a SIMPLE-FIXNUM-VECTOR. When COPY?, make sure that the they don't share structure.

# CENTRAL-SAMPLE-MOMENTS-DEGREE (CENTRAL-SAMPLE-MOMENTS)

Return the degree of CENTRAL-SAMPLE-MOMENTS.

# CHEBYSHEV-APPROXIMATE (F INTERVAL N-POLYNOMIALS &KEY (N-POINTS N-POLYNOMIALS))

Return a closure approximating F on the given INTERVAL (may be infinite on
either end) using the given number of Chebyshev polynomials.

# CHEBYSHEV-EVALUATE (COEFFICIENTS X)

Return the sum of Chebyshev polynomials, weighted by COEFFICIENTS, at X.

# CHEBYSHEV-REGRESSION (F N-POLYNOMIALS &OPTIONAL (N-POINTS N-POLYNOMIALS))

Chebyshev polynomial regression using the given number of polynomials and
points (zeroes of the corresponding Chebyshev polynomial).

# CHEBYSHEV-ROOT (M I)

Return the iTH root of the Mth Chebyshev polynomial as double-float.

# CHEBYSHEV-ROOTS (M)

Return the roots of the Mth Chebyshev polynomial as a vector of
double-floats.

# CUMULATIVE-PRODUCT (SEQUENCE &KEY (RESULT-TYPE (SIMILAR-SEQUENCE-TYPE SEQUENCE)))

Cumulative product of sequence. Return a sequence of the same kind and length; last element is the total product. The latter is also returned as the second value.

# CUMULATIVE-SUM (SEQUENCE &KEY (RESULT-TYPE (SIMILAR-SEQUENCE-TYPE SEQUENCE)))

Cumulative sum of sequence. Return a sequence of the same kind and length; last element is the total. The latter is returned as the second value.

# DIAGONAL-MATRIX-ELEMENTS (INSTANCE)

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

# DIVIDES? (NUMBER DIVISOR)

Test if DIVISOR divides NUMBER without remainder, and if so, return the
quotient. Works generally, but makes most sense for rationals.

# E* (ARGUMENT &REST MORE-ARGUMENTS)

Elementwise *.

# E+ (ARGUMENT &REST MORE-ARGUMENTS)

Elementwise +.

# E- (ARGUMENT &REST MORE-ARGUMENTS)

Elementwise -.

# E/ (ARGUMENT &REST MORE-ARGUMENTS)

Elementwise /.

# ELEMENTWISE-FLOAT-CONTAGION (&REST OBJECTS)

Return the resulting float type when objects (or their elements) are combined using arithmetic operations.

# ELOG (A &OPTIONAL (BASE NIL BASE?))

Elementwise logarithm.

# EMAX (OBJECT)

Elementwise MAX.

# EMIN (OBJECT)

Elementwise MIN.

# EMPIRICAL-QUANTILE (SORTED-VECTOR Q)

Return the empirical quantile of a vector of real numbers, sorted in ascending order (not checked). Uses a 0.5 correction.

# EMPIRICAL-QUANTILE-PROBABILITIES (N)

Probabilities that correspond to the empirical quantiles of a vector of length N. That is to say,
(== (quantiles sample (empirical-quantile-probabilities (length sample)))
sample)
for any vector SAMPLE.

# ENSURE-SORTED-VECTOR (OBJECT)

Return the elements of OBJECT as a vector (or reals) sorted in ascending order.

# FIXNUM? (OBJECT)

Check of type of OBJECT is fixnum.

# GENERATE-SEQUENCE (RESULT-TYPE SIZE FUNCTION)

Like MAKE-SEQUENCE, but using a function to fill the result.

# GRID-IN (INTERVAL SIZE &OPTIONAL (SEQUENCE-TYPE NIL SEQUENCE-TYPE?))

Return an arithmetic sequence of the given size (length) between the
endpoints of the interval. The endpoints of the sequence coincide with the
respective endpoint of the interval iff it is closed. RESULT-TYPE determines
the result type (eg list), if not given it is a simple-array (of rank 1),
narrowing to the appropriate float type or fixnum if possible.

# HERMITIAN-MATRIX (ELEMENTS)

Create a lower-triangular-matrix.

# IN-INTERVAL? (INTERVAL NUMBER)

Test if NUMBER is in INTERVAL (which can be NIL, designating the empty
set).

# INTERVAL (LEFT RIGHT &KEY OPEN-LEFT? OPEN-RIGHT?)

Create an INTERVAL.

# INTERVAL-HULL (OBJECT)

Return the smallest connected interval that contains (elements in) OBJECT.

# INTERVAL-LENGTH (INTERVAL)

Difference between left and right.

# INTERVAL-MIDPOINT (INTERVAL &OPTIONAL (ALPHA 1/2))

Convex combination of left and right, with alpha (defaults to 0.5)
weight on right.

# IVEC (END-OR-START &OPTIONAL (END 0 END?) (BY 1) STRICT-DIRECTION?)

Return a vector of fixnums.
(ivec end) => #(0 ... end-1) (or #(0 ... end+1) when end is negative).
(ivec start end) => #(start ... end-1) or to end+1 when end is negative.
When BY is given it determines the increment, adjusted to match the direction unless STRICT-DIRECTION, in which case an error is signalled.

# LOG10 (NUMBER)

Abbreviation for decimal logarithm.

# LOG2 (NUMBER)

Abbreviation for binary logarithm.

# LOWER-TRIANGULAR-MATRIX (ELEMENTS)

Create a lower-triangular-matrix.

# NUM-DELTA (A B)

|a-b|/max(1,|a|,|b|). Useful for comparing numbers.

# NUM=-FUNCTION (TOLERANCE)

Curried version of num=, with given tolerance.

# NUMSEQ (FROM TO &KEY LENGTH (BY (UNLESS LENGTH 1)) TYPE)

Return a sequence between FROM and TO, progressing by BY, of the given LENGTH. Only 3 of these a parameters should be given, the missing one (NIL) should be inferred automatically. The sign of BY is adjusted if necessary. If TYPE is LIST, the result is a list, otherwise it determines the element type of the resulting simple array. If TYPE is nil, it as autodetected from the arguments (as a FIXNUM, a RATIONAL, or some subtype of FLOAT). Note that the implementation may upgrade the element type.

# PLUSMINUS-INTERVAL (CENTER HALF-WIDTH &KEY OPEN-LEFT? (OPEN-RIGHT? OPEN-LEFT?))

A symmetric interval around CENTER.

# POOL (&REST ACCUMULATORS)

Pool ACCUMULATORS.

# SAME-SIGN? (&REST ARGUMENTS)

Test whether all arguments have the same sign (ie all are positive, negative, or zero).

# SHRINK-INTERVAL (INTERVAL LEFT &OPTIONAL (RIGHT LEFT) (CHECK-FLIP? T))

Shrink interval by given magnitudes (which may be REAL or RELATIVE). When
check-flip?, the result is checked for endpoints being in a different order
than the original. Negative LEFT and RIGHT extend the interval.

# SPLIT-INTERVAL (INTERVAL DIVISIONS)

Return a vector of subintervals (same length as DIVISIONS), splitting the
interval using the sequence DIVISIONS, which can be nonnegative real
numbers (or RELATIVE specifications) and SPACERs which divide the leftover
proportionally. If there are no spacers and the divisions don't fill up the
interval, and error is signalled.

# SQUARE (NUMBER)

Square of number.

# UPPER-TRIANGULAR-MATRIX (ELEMENTS)

Create a lower-triangular-matrix.

# WITHIN? (LEFT VALUE RIGHT)

Return non-nil iff value is in [left,right).

# WRAPPED-MATRIX-ELEMENTS (INSTANCE)

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

# Undocumented

# DIAGONAL-MATRIX (ELEMENTS)

# SETFDIAGONAL-MATRIX-ELEMENTS (NEW-VALUE INSTANCE)

# RELATIVE (FRACTION)

# SORTED-REALS-ELEMENTS (SORTED-REALS)

# SPACER (&OPTIONAL (WEIGHT 1))

# MACRO

# Public

# &INTERVAL (&WHOLE WHOLE1 LEFT RIGHT)

LET+ expansion for interval endpoints. If given a list of two values,
the second value is an indicator for whether the endpoint is open.

# CHECK-TYPES ((&REST ARGUMENTS) TYPE)

CHECK-TYPE for multiple places of the same type. Each argument is either a place, or a list of a place and a type-string.

# DEFINE-NUM=-WITH-ACCESSORS (CLASS ACCESSORS)

Define a method for NUM=, specialized to the given class, comparing values obtained with accessors.

# DEFINE-STRUCTURE-NUM= (STRUCTURE &REST SLOTS)

Define a NUM= method for the given structure, comparing the given slots.

# DEFINE-WITH-MULTIPLE-BINDINGS (MACRO &KEY (PLURAL (INTERN (FORMAT NIL ~aS MACRO))) (DOCSTRING (FORMAT NIL Multiple binding version of ~(~a~). MACRO)))

Define a version of MACRO with multiple arguments, given as a list. Application of MACRO will be nested. The new name is the plural of the old one (generated using format by default).

# EXPANDING (&BODY BODY)

Expand BODY. Useful for generating code programmatically.

# EXTENDF-INTERVAL (PLACE OBJECT &ENVIRONMENT ENVIRONMENT)

Apply EXTEND-INTERVAL on PLACE using OBJECT.

# GETHASH* (KEY HASH-TABLE &OPTIONAL (DATUM Key not found.) &REST ARGUMENTS)

Like GETHASH, but checking that KEY is present and raising the given error if not.

# SPLICE-AWHEN (TEST &BODY FORMS)

Similar to splice-when, but binds IT to test.

# SPLICE-WHEN (TEST &BODY FORMS)

Similar to when, but wraps the result in list.
Example: `(,foo ,@(splice-when add-bar? bar))

# UNLESSF (PLACE VALUE-FORM &ENVIRONMENT ENVIRONMENT)

When PLACE is NIL, evaluate VALUE-FORM and save it there.

# GENERIC-FUNCTION

# Public

# ADD (ACCUMULATOR OBJECT &OPTIONAL WEIGHT)

Add OBJECT to ACCUMULATOR with WEIGHT (defaults to 1 if not given). Return OBJECT. NILs are ignored by the accumulator, unless a specialized method decides otherwise.

# CENTRAL-M2 (OBJECT &KEY WEIGHTS)

Second central moment. For samples, normalized by the total weight (and thus not the unbiased estimator, see VARIANCE).

# CENTRAL-M3 (OBJECT &KEY WEIGHTS)

Third central moment.

# CENTRAL-M4 (OBJECT &KEY WEIGHTS)

Fourth central moment.

# CENTRAL-SAMPLE-MOMENTS (OBJECT &KEY DEGREE WEIGHTS (DEGREE *CENTRAL-SAMPLE-MOMENTS-DEFAULT-DEGREE*))

Return a CENTRAL-SAMPLE-MOMENTS object that allows the
calculation of the central sample moments of OBJECT up to the given DEGREE.
When WEIGHTS are given, they need to be a sequence of matching length.

# DIAGONAL-VECTOR (MATRIX)

Return the diagonal elements of MATRIX as a vector.

# SETFDIAGONAL-VECTOR (VECTOR MATRIX)

Set the diagonal elements of MATRIX using VECTOR.

# E1- (A)

Univariate elementwise -.

# E1/ (A)

Univariate elementwise /.

# E2* (A B)

Bivariate elementwise *.

# E2+ (A B)

Bivariate elementwise +.

# E2- (A B)

Bivariate elementwise -.

# E2/ (A B)

Bivariate elementwise /.

# ECONJUGATE (A)

Univariate elementwise CONJUGATE.

# EEXP (A)

Univariate elementwise EXP.

# EEXPT (A B)

Bivariate elementwise EXPT.

# ENSURE-SORTED-REALS (OBJECT)

Return the contents of OBJECT as a SORTED-REALS.

# EREDUCE (FUNCTION OBJECT &KEY KEY)

Elementwise reduce, traversing in row-major order.

# ESQRT (A)

Univariate elementwise SQRT.

# EXTEND-INTERVAL (INTERVAL OBJECT)

Return an interval that includes INTERVAL and OBJECT. NIL
stands for the empty set.

# KURTOSIS (OBJECT &KEY WEIGHTS)

Kurtosis FIXME talk about bias, maybe implement unbiased?

# MEAN (OBJECT &KEY WEIGHTS)

The mean of elements in OBJECT.

# MEDIAN (OBJECT)

Median of OBJECT.

# NUM= (A B &OPTIONAL TOLERANCE)

Compare A and B for approximate equality, checking corresponding elements when applicable (using TOLERANCE).
Two numbers A and B are NUM= iff |a-b|/max(1,|a|,|b|) <= tolerance.
Unless a method is defined for them, two objects are compared with EQUALP.
Generally, methods should be defined so that two objects are NUM= if they the same class, same dimensions, and all their elements are NUM=.

# PRODUCT (OBJECT)

Product of elements in object.

# QUANTILE (OBJECT Q)

Return an element at quantile Q. May be an interpolation or an approximation, depending on OBJECT and Q. NOTE: Extensions should define methods for QUANTILES, not QUANTILE.

# QUANTILES (OBJECT QS)

Multiple quantiles (see QUANTILE). NOTE: Extensions should define methods for QUANTILES, not QUANTILE.

# SD (OBJECT &KEY WEIGHTS)

Standard deviation. For samples, the square root of the unbiased estimator (see VARIANCE).

# SKEWNESS (OBJECT &KEY WEIGHTS)

Skewness FIXME talk about bias, maybe implement unbiased?

# SUM (OBJECT &KEY KEY (KEY #'IDENTITY))

Sum of elements in object. KEY is applied to each
element.

# TALLY (ACCUMULATOR)

The total weight of elements in ACCUMULATOR.

# TRANSPOSE (ARRAY)

Transpose.

# 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).

# Undocumented

# SHIFT-INTERVAL (INTERVAL OFFSET)

# SLOT-ACCESSOR

# Public

# LEFT (INTERVAL)

The Left endpoint of interval.

# OPEN-LEFT? (INTERVAL)

The True iff the left endpoint of the interval is open.

# OPEN-RIGHT? (INTERVAL)

The True iff the right endpoint of the interval is open.

# RIGHT (INTERVAL)

The Right endpoint of interval.

# VARIABLE

# Public

# *CENTRAL-SAMPLE-MOMENTS-DEFAULT-DEGREE*

Default degree for (weighted) central sample moments.

# *NUM=-TOLERANCE*

Default tolerance for NUM=.

# CLASS

# Public

# CENTRAL-SAMPLE-MOMENTS (OBJECT &KEY DEGREE WEIGHTS (DEGREE *CENTRAL-SAMPLE-MOMENTS-DEFAULT-DEGREE*))

Central sample moments calculated on-line/single-pass.
M weighted mean
S2 weighted sum of squared deviations from the mean, not calculated when NIL
S3 weighted sum of cubed deviations from the mean, not calculated when NIL
S4 weighted sum of 4th power deviations from the mean, not calculated when NIL
Allows on-line, numerically stable calculation of moments. See
cite{bennett2009numerically} and cite{pebay2008formulas} for the description
of the algorithm. M_2, ..., M_4 in the paper are s2, ..., s4 in the code.

# DIAGONAL-MATRIX (ELEMENTS)

Diagonal matrix. The elements in the diagonal are stored in a vector.

# FINITE-INTERVAL

Interval with finite endpoints.

# HERMITIAN-MATRIX (ELEMENTS)

Hermitian/symmetric matrix, with elements stored in the _lower_ triangle.
Implements _both_ real symmetric and complex Hermitian matrices --- as technically, real symmetric matrices are also Hermitian. Complex symmetric matrices are _not_ implemented as a special matrix type, as they don't have any special properties (eg real eigenvalues, etc).

# INTERVAL (LEFT RIGHT &KEY OPEN-LEFT? OPEN-RIGHT?)

Abstract superclass for all intervals.

# LOWER-TRIANGULAR-MATRIX (ELEMENTS)

Lower triangular matrix. ELEMENTS in the upper triangle are treated as zero.

# MINUSINF-INTERVAL

Interval from -∞ to RIGHT.

# PLUSINF-INTERVAL

Interval from LEFT to ∞.

# REAL-LINE

Representing the real line (-∞,∞).

# RELATIVE (FRACTION)

Relative sizes are in terms of width.

# SORTED-REALS

Accumulator which sorts elements. ELEMENTS return the sorted elements.

# SPACER (&OPTIONAL (WEIGHT 1))

Spacers divide the leftover portion of an interval.

# UPPER-TRIANGULAR-MATRIX (ELEMENTS)

Upper triangular matrix. ELEMENTS in the lower triangle are treated as zero.

# WRAPPED-MATRIX

A matrix that has some special structure (eg triangular, symmetric/hermitian). ELEMENTS is always a matrix. Not used directly, not exported.