1.16 Matrix Operations: "matrix.ss"
The experimental teachpack supports matrices and matrix operations. A
matrix is just a rectangle of ’objects’. It is displayed as an image, just
like the images from Manipulating Images: "image.ss". Matrices are images and, indeed,
scenes in the sense of the Simulations and Animations: "world.ss".
No educational materials involving matrices exist.
The operations access a matrix in the usual (school-mathematics) manner:
row first, column second.
The operations aren’t tuned for efficiency so don’t expect to build
programs that process lots of data.
Rectangle
A Rectangle (of X) is a non-empty list of lists containing X where all
elements of the list are lists of equal (non-zero) length.
determines whether the given object is a matrix?
determines how many rows this matrix m has
determines ow many columns this matrix m has
creates a rectangle from this matrix m
creates an n by m matrix from l
NOTE: make-matrix would consume an optional number of entries, if
it were like make-vector
creates an
n by
m matrix by applying
f to
(0 ,0),
(0 ,1), ..., (
(sub1 m) ,(sub1 n))
retrieve the item at (i,j) in matrix m
creates a new matrix with x at (i,j) and all
other places the same as in m
renders this matrix m as a rectangle of strings
creates a matrix minor from m at (i,j)