aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2004-11-26 22:36:10 +0000
committerJay Belanger2004-11-26 22:36:10 +0000
commit4952f0be950fda61cb64190df16047fb3f84b092 (patch)
tree53c4234d5355e8b2b813a6efe99bdecc551d80b3
parent3a7a4adb2df59ce876640b4cbb5b2361ead8db21 (diff)
downloademacs-4952f0be950fda61cb64190df16047fb3f84b092.tar.gz
emacs-4952f0be950fda61cb64190df16047fb3f84b092.zip
(calc-det-lu): New variable.
(math-det-raw, math-det-step): Replace variable lu by declared variable.
-rw-r--r--lisp/calc/calc-mtx.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/calc/calc-mtx.el b/lisp/calc/calc-mtx.el
index 99442d4d33d..762be985dfa 100644
--- a/lisp/calc/calc-mtx.el
+++ b/lisp/calc/calc-mtx.el
@@ -3,8 +3,7 @@
3;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. 3;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
4 4
5;; Author: David Gillespie <daveg@synaptics.com> 5;; Author: David Gillespie <daveg@synaptics.com>
6;; Maintainers: D. Goel <deego@gnufans.org> 6;; Maintainer: Jay Belanger <belanger@truman.edu>
7;; Colin Walters <walters@debian.org>
8 7
9;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
10 9
@@ -176,6 +175,10 @@
176 (nth 1 m) 175 (nth 1 m)
177 (math-reject-arg m 'square-matrixp)))) 176 (math-reject-arg m 'square-matrixp))))
178 177
178;; The variable math-det-lu is local to math-det-raw, but is
179;; used by math-det-step, which is called by math-det-raw.
180(defvar math-det-lu)
181
179(defun math-det-raw (m) 182(defun math-det-raw (m)
180 (let ((n (1- (length m)))) 183 (let ((n (1- (length m))))
181 (cond ((= n 1) 184 (cond ((= n 1)
@@ -211,13 +214,13 @@
211 (nth 3 (nth 3 m)))))) 214 (nth 3 (nth 3 m))))))
212 (t (let ((lud (math-matrix-lud m))) 215 (t (let ((lud (math-matrix-lud m)))
213 (if lud 216 (if lud
214 (let ((lu (car lud))) 217 (let ((math-det-lu (car lud)))
215 (math-det-step n (nth 2 lud))) 218 (math-det-step n (nth 2 lud)))
216 0)))))) 219 0))))))
217 220
218(defun math-det-step (n prod) 221(defun math-det-step (n prod)
219 (if (> n 0) 222 (if (> n 0)
220 (math-det-step (1- n) (math-mul prod (nth n (nth n lu)))) 223 (math-det-step (1- n) (math-mul prod (nth n (nth n math-det-lu))))
221 prod)) 224 prod))
222 225
223;;; This returns a list (LU index d), or nil if not possible. 226;;; This returns a list (LU index d), or nil if not possible.