#lang scribble/doc
@(require scribble/manual
(for-label scheme)
(for-label "matrix.ss")
(for-label "matrix-base.ss"))
@title{The @scheme[simple-matrix] Library}
@table-of-contents[]
This library contains basic functions for manipulating matrices and
vectors. The functions come in two modules: @filepath{matrix-base.ss}
for manipulating two-dimensional collections of objects, and
@filepath{matrix.ss} for matipulating two-dimensional collections of
numbers. If you do not need the numerical operations on matrices
(matrix addition, multiplication, etc), use the
@filepath{matrix-base.ss} module; otherwise, use the
@filepath{matrix.ss} module. The @filepath{matrix.ss} module
re-exports all the definitions from @filepath{matrix-base.ss}.
The functions provided from the @filepath{matrix-base.ss} library
include: iterators and looping constructs, getters and setters, and
matrix-transpose. The functions provided from the
@filepath{matrix.ss} library include: basic algebraic operations on
matrices (addition, subtraction, ...), matrix-matrix-multiplication,
matrix-vector multiplication, etc. The library does not include any
functions from traditional linear algebra (such as solving linear
equations, finding eigenvalues, etc). The library comes with an
initial module language, @filepath{matrix-lang.ss}, which re-defines
the standard scheme functions @scheme[+], @scheme[-], @scheme[*],
@scheme[/] to operate on numbers, vectors and matrices, and
re-provides all of @scheme['scheme] and @filepath{matrix.ss} as well.
Use this module language when you are more concerned with clarity than
speed---basic arithmetic operations on scalars will no longer be
inlined, and performance will suffer.
This library is released under the GNU GPL v3; see the
@seclink["License"]{License} section for details.
@section[#:tag "matrix-base"]{The @filepath{matrix-base.ss} Module}
@defmodule[(planet wmfarr/simple-matrix:1:1/matrix-base)]
@defstruct[matrix ((rows natural-number/c)
(cols natural-number/c)
(elts (vectorof number?))) #:inspector #f]{
A matrix with the given dimensions. The @scheme[elts] are stored in
row-major order.
}
@defproc[(matrix* (rows natural-number/c) (cols natural-number/c)
(elt number?) ...) matrix?]{
Constructs a matrix from the given @scheme[elt ...], in row-major
order.
}
@defproc[(matrix-ref (m matrix?)
(i (and/c natural-number/c
(