Initialization


<matrix>[sealed Class]

Meta-information container

Superclasses

<array>

Initialization Keywords

None.

Description

This class contains two slots: dimensions, a <sequence>, which contains the two values of the size of the matrix, and components, a <simple-object-vector>, that contain the matrix elements.


initialize[Method]

Used by make to create instances of a <matrix>

Synopsis

initialize (#key dimensions, fill) => (mat)

Parameters

dimensions:An instance of <object>. A sequence of two elements which represent the rows and column of the matrix respectively Defaults to #[1, 1].
fill:An instance of <object>. The objects that each element of matrix should be initialized to Defaults to 0.

Return Values

matAn instance of <matrix>.

Description

Use make with the above keywords to obtain a <matrix> instance


matrix[Method]

Create instances of a <matrix> from a list of <vector>s

Synopsis

matrix (#rest row-vectors) => (mat)

Parameters

row-vectorsInstances of <object>.

Return Values

matAn instance of <matrix>.

Description

This method takes a list of <vectors> and creates a <matrix> instance from them, for example:

let mat = matrix(#[1, 1, 2], #[3, 5, 8], #[13, 21, 34]);
	  

creates a 3x3 matrix.

Note: The row-vectors must all be of the same size.


identity-matrix[Method]

Creates the identity matrix

Synopsis

identity-matrix (#key dimensions) => (mat)

Parameters

dimensions:An instance of <object>. Note: enter 2 dimensions for the matrix, an error may occur if both dimensions are not equal. Defaults to #[1, 1].

Return Values

matAn instance of <matrix>. The identity matrix, sized to dimensions

Description

This function simply returns the identity matrix of the specified dimension. It is a very simple algorithm, it merely fills a matrix with zeros, and then puts ones down the diagonal.