8.16.0.4
Simple Matrix Arithmetic
(require simple-matrix) | package: simple-matrix |
1 Introduction
This library is used to perform some simple matrix arithmetic like multiplication, transposition, addition, and inversion. It is truly "simple" and very naive in its implementation but it will do its job without much overhead from typed racket.
Matrices are represented as lists of rows, which are lists of numbers.
So a 3x3 identity matrix would look like '((1 0 0) (0 1 0) (0 0 1)).
Determines if the argument is a matrix in the sense this library understands.
A convenience for turning a simple list of numbers into a column vector.
Example:
> (column '(1 2 -2)) '((1) (2) (-2))
2 Arithmetic
Adds two matricies element-wise.
Multiplies two matrices using matrix multiplication. It is an error if the sizes
do not correspond to proper matrix multiplication.
procedure
(matrix-expt m e) → matrix?
m : matrix? e : nonnegative-integer?
Repeated multiplication of a matrix.
Exchange rows and columns of a matrix.
procedure
(determinant m) → number?
m : matrix?
Calculate the determinant of a matrix.
3 Utilities
The transpose of the cofactor matrix. Not efficiently calculated.
procedure
(invert-matrix m) → (or/c matrix? boolean?)
m : matrix?
Attempts to invert a matrix. If the matrix has no inverse, then
this procedure evaluates to #f.