summaryrefslogtreecommitdiff
path: root/mixer.scm
diff options
context:
space:
mode:
Diffstat (limited to 'mixer.scm')
-rw-r--r--mixer.scm20
1 files changed, 10 insertions, 10 deletions
diff --git a/mixer.scm b/mixer.scm
index b79ea10..7506d41 100644
--- a/mixer.scm
+++ b/mixer.scm
@@ -136,21 +136,21 @@
(row 0))
(do ((j 0 (+ 1 j)))
((= j n))
- (if (not (= (vector-ref pivots j) 1))
+ (if (not (= (pivots j) 1))
(begin
(do ((k 0 (+ 1 k)))
((= k n))
- (if (= (vector-ref pivots k) 0)
+ (if (= (pivots k) 0)
(let ((val (abs (mat matrix j k))))
(if (> val biggest)
(begin
(set! col k)
(set! row j)
(set! biggest val))))
- (if (> (vector-ref pivots k) 1)
+ (if (> (pivots k) 1)
(return #f)))))))
(if (< biggest zero) (return #f)) ; this can be fooled (floats...): (invert-matrix (make-mixer 3 1 2 3 3 2 1 4 5 6))
- (vector-set! pivots col (+ (vector-ref pivots col) 1))
+ (set! (pivots col) (+ (pivots col) 1))
(if (not (= row col))
(let ((temp (if b (frame-ref b row) 0.0)))
(if b
@@ -162,8 +162,8 @@
(set! temp (mat matrix row k))
(set! (mat matrix row k) (mat matrix col k))
(set! (mat matrix col k) temp))))
- (vector-set! cols i col)
- (vector-set! rows i row)
+ (set! (cols i) col)
+ (set! (rows i) row)
;; round-off troubles here
(if (< (abs (mat matrix col col)) zero)
(return #f))
@@ -184,12 +184,12 @@
(if b (frame-set! b k (- (frame-ref b k) (* scl (frame-ref b col))))))))))
(do ((i (- n 1) (- i 1)))
((< i 0))
- (if (not (= (vector-ref rows i) (vector-ref cols i)))
+ (if (not (= (rows i) (cols i)))
(do ((k 0 (+ 1 k)))
((= k n))
- (let ((temp (mat matrix k (vector-ref rows i))))
- (set! (mat matrix k (vector-ref rows i)) (mat matrix k (vector-ref cols i)))
- (set! (mat matrix k (vector-ref cols i)) temp)))))
+ (let ((temp (mat matrix k (rows i))))
+ (set! (mat matrix k (rows i)) (mat matrix k (cols i)))
+ (set! (mat matrix k (cols i)) temp)))))
(list matrix b)))))
;;; it would be faster to use invert-matrix to calculate the determinant, but that