[plt-scheme] Matrix Determinants

From: Jens Axel Soegaard (jensaxel at soegaard.net)
Date: Mon Mar 31 10:54:46 EDT 2008

Henk Boom wrote:

> Can anyone come up with a simple matrix determinant implementation?
> (other than the obvious O(n!) one of course)

Geoff wrote:
 > On Mar 28, 2008, at 07:04, Alex Shinn wrote:
 >>  There's a Scheme implementation of determinant in the
 >>  gauche.array library which uses Gaussian elimination and if
 >>  I recall is much faster than SLIB's.
 > Time to look at Gauche again, thanks for the tip!

If you are interested in Scheme code for Gaussian elimination,
then don't cheat yourself from a looking at Noel Welsh's code
in Schematics. Due to "matrix friendly" macros it is quite
pretty.

http://schematics.cvs.sourceforge.net/schematics/schemathics/matrix.ss?revision=1.3&view=markup

After studying Noel's code a while it dawned on my, that I used and
extended precisely that code in my old experiment "Math Repl".

The file matrix.ss was extended slightly with some general
linear algebra operations (as opposed to focusing on equation
solving). In matrix.ss the vector-of-vector representation is
used.

In linear-algebra.scm the list-of-lists representation is used
(due to the way the math repl worked).

   > (require "linear-algebra.scm")
   > (det '((1 2)
            (3 4)))
   -2

Relevant files are attached.

-- 
Jens Axel Søgaard
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: matrix.ss
URL: <http://lists.racket-lang.org/users/archive/attachments/20080331/6e6b7179/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: linear-algebra.scm
URL: <http://lists.racket-lang.org/users/archive/attachments/20080331/6e6b7179/attachment-0001.ksh>

Posted on the users mailing list.