next up previous contents index
Next: Nonlinear Regression Up: XLISP-STAT A Statistical Previous: Plot Methods

Matrices and Arrays

      XLISP-STAT includes support for multidimensional arrays patterned after the Common Lisp standard described in detail in Steele [15]. The functions supported are listed in Section gif of the appendix.

In addition to the standard Common Lisp array functions XLISP-STAT also includes a number of linear algebra functions such as inverse, solve, transpose, chol-decomp, lu-decomp and sv-decomp. These functions are listed in the appendix as well.

An array is printed using the standard Common Lisp format. For example, a 2 by 3 matrix with rows (1 2 3) and (4 5 6) is printed as

#2A((1 2 3)(4 5 6))
The prefix #2A indicates that this is a two-dimensional array. This form is not particularly readable, but it has the advantage that it can be pasted into expressions and will be read as an array by the XLISP reader.gif For matrices you can use the function print-matrix to get a slightly more readable representation:
> (print-matrix '#2a((1 2 3)(4 5 6)))
    (1 2 3)
    (4 5 6)

The select function can be used to extract elements or subarrays from an array. If A is a two dimensional array then the expression

(select a 0 1)
will return element 1 of row 0 of A. The expression
(select a (list 0 1) (list 0 1))
returns the upper left hand corner of A.

Luke Tierney
Tue Jan 21 15:04:48 CST 1997