old lispstat config variable names changed to cls- names.
[CommonLispStat.git] / src / numerics / sweep.lisp
blobba730f0971dd8d0546e2cc47b7cf7fc6bdc93a21
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2009-01-17 18:00:55 tony>
4 ;;; Creation: <2008-03-11 19:18:34 user>
5 ;;; File: packages.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2009--, AJ Rossini. BSD, LLGPL, or GPLv2, depending
8 ;;; on how it arrives.
9 ;;; Purpose: sweep operator implementation.
11 ;;; What is this talk of 'release'? Klingons do not make software
12 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
13 ;;; designers and quality assurance people in its wake.
15 ;;; This organization and structure is new to the 21st Century
16 ;;; version.
19 (in-package :lisp-stat-numerics-sweep)
21 ;; macros
23 ;; internal: divide up the operator strategy to handle the variety of
24 ;; possibilities that we consider for analysis of the matrix, in
25 ;; prticular we needf to think about what it is that we want to do to
26 ;; identify the matrix
28 (defun op-swap-rows (m r1n r2n))
30 (defun op-scalar-mult-row (m s r))
32 (defun op-subtract-rows (m r1 r2))
36 ;; external
37 (defun sweep-operator (m type)
38 "Return the swept matrix n.
40 The basic idea behind the sweep operator is that we can get a
41 matrix A converted to I in a few steps. It is critical that we can
42 figure out the general approach for the algorithm, as doing it in
43 line, i.e. [A|I] => [I|A^*] means we can probably do something a bit
44 more like [A] => [A^*], since the original operations work on a
45 column-by-column basis."
46 (let ((n (copy! m)))
47 (dotimes (i (nrows m))
48 (set-ith-ith-entry-to-1 n)
49 (zero-other-entries))
50 n))