Common Lisp Package: AFFI

README:

FUNCTION

Public

CALCULATE-INDEX (AFFI SUBSCRIPTS)

Calculate the index of a given vector of subscripts.

CHECK-CONFORMABILITY (AFFI1 AFFI2 &OPTIONAL (CONFORMABILITY DROPPED))

Check that two affine indexes are conformable. There are three types of conformability: :strict requires that the two domains are exactly the same, :dropped checks if they are the same when we drop dimensions of size 1, and :size just checks the size of the two ranges.

DIAGONAL (AFFI &OPTIONAL (OFFSET 0) (INDICES '(0 1)))

Select a subarray where the two indices are equal or differ by the offset, e.g. the diagonal affi for the matrix. The offset specifies sub- (offset<0) or super- (offset>0) diagonals.

DROP (AFFI &OPTIONAL (WHICH T))

Drop the dimensions from the domain which have size 1, provided that their index is in `which', or `which' is t. Return new affine index. If `which' is nil, no dimension is dropped.

EXTRUDE (AFFI INDEX NEW-DIMENSION)

Create a new AFFI that makes the grid look as if it has an additional dimension, with each element replicated along that dimension.

GET-COEFF (AFFI)

Return the coefficients in an affine index (copy is made).

GET-CONST (AFFI)

Return the constant in an affine index.

GET-DOMAIN (AFFI)

Return the domain in an affine index (copy is made).

MAKE-AFFI-CM (DIMENSIONS)

Setup a _column major_ affine mapping using dimensions.

MAKE-WALKER (AFFI &OPTIONAL INITIAL-SUBSCRIPTS)

Create a walker for an affine index that starts at the given subscripts (zeroes by default). Return two functions: one that returns the current index and increments the walker, the other just returns the index without any side effects.

PERMUTE (AFFI PERMUTATION)

Permute the subscripts of an affine index using the given list.

RANGE (AFFI)

Return the smallest and the largest integer in the range of an affine index.

RANK (AFFI)

Return the rank of an affine index.

SIZE (AFFI)

Return the size (ie number of integers in the range) of an affine index. Note that size is not necessarily the difference of the endpoints of the range, as the range may be non-contiguous.

STRIDE (AFFI STRIDE)

Create a new AFFI that makes the grid look as if is been reduced by taking only every stride-th element.

SUBRANGE (AFFI DIMS &OPTIONAL DIM-POSITIONS START)

Create an affi selecting a subrange from the given affi corresponding to the dimensions dims in the positions dim-positions.

TRANSPOSE (AFFI &OPTIONAL (INDICES '(0 1)))

Transpose any pair of indices.

Private

APPLY-TRANSFORMERS (AFFI &REST TRANSFORMERS)

Create a new affi with the transformers applied in succession.

COPY-INTO-FIXNUM-VECTOR (SEQ)

Copy a sequence into a vector of fixnums.

INSERT-AT (ELEM ORG-LIST POS)

Insert into the list at the indicated position.

MAKE-AFFI-INT (DIMENSIONS COEFF &OPTIONAL (OFFSET 0))

Make an affi instance with the contents not set, except for dimensions.

MAKE-FIXNUM-VECTOR (LENGTH)

Create a vector with element type fixnum.

MAP-AFFI (AFFI-IN AFFI-OUT)

A function mapping linearized index between affis.

PARSE-RANGE (RANGE D)

Parse a range specification, returning two values: the starting point, and the length of the range, whose sign determines the direction. [0,d) is the domain. A range specification is either and atom or a list of two integers. Negative integers are interpreted as counted backwards from the right edge of the domain, ie i < 0 denotes element d+i. If range is an atom, then it can be :all or :rev, denoting the entire range in regular and reversed order, respectively, or refer to a single element. A two-element list denotes an interval, inclusive. If the first one is larger then the second, reverse ordering is used.

REMOVE-POSITION (SEQUENCE POSITION &OPTIONAL (RESULT-TYPE 'LIST))

Remove the element at position.

ROW-MAJOR-COEFF-FROM-DIMENSIONS (DIMENSIONS)

Find the coeff from the dimensions.

SUBRANGE-INT (AFFI RANGE)

Constrain an affine map to a subrange, which is given as a list of ranges. For details, see parse-range. Return the new affine index.

Undocumented

COPY-AFFI (AFFI)

DELINEARIZE-INDEX (AFFI LINEAR-INDEX)

GENERIC-FUNCTION

Public

MAKE-AFFI (OBJECT &OPTIONAL OFFSET)

Create an affine mapping conforming to the given object.

TEST-WALKER (OBJECT)

Output the indices generated by a walker. For testing purposes.

SLOT-ACCESSOR

Private

Undocumented

DOMAIN (OBJECT)

CLASS

Public

Undocumented

AFFI