summaryrefslogtreecommitdiffstats
path: root/determ.scm
diff options
context:
space:
mode:
authorThomas Bushnell, BSG <tb@debian.org>2005-11-02 14:55:21 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:32 -0800
commit34c54a22ff7818bb8b38ef4d9c87dbbcb221ba73 (patch)
tree1189d06a81277bcf8539b0260a69a19f6038effb /determ.scm
parent611b3db17894e5fdc0db3d49eaf6743d27b44233 (diff)
parent5145dd3aa0c02c9fc496d1432fc4410674206e1d (diff)
downloadslib-c93d164f90a2c6f04bbccce83704a763f8abc8b3.tar.gz
slib-c93d164f90a2c6f04bbccce83704a763f8abc8b3.zip
Import Debian changes 3a2-1debian/3a2-1
slib (3a2-1) unstable; urgency=low * New upstream release. * Acknowledge NMU. (Closes: #281809) * Makefile: Don't hack Makefile; use rules instead. * debian/rules: Set on make invocations: prefix, htmldir, TEXI2HTML. * debian/rules (clean): Clean more stuff here. * Makefile: Comment out old rule for $(htmldir)slib_toc.html. Instead, specify directly that the texi2html invocation produces that file. * debian/rules (binary-indep): Find web files in slib subdir. * debian/control (Build-Depends-Indep): Go back to using scm.
Diffstat (limited to 'determ.scm')
-rw-r--r--determ.scm32
1 files changed, 16 insertions, 16 deletions
diff --git a/determ.scm b/determ.scm
index 1078750..0962e4a 100644
--- a/determ.scm
+++ b/determ.scm
@@ -1,5 +1,5 @@
;;; "determ.scm" Matrix Algebra
-;Copyright 2002 Aubrey Jaffer
+;Copyright 2002, 2004 Aubrey Jaffer
;
;Permission to copy this software, to modify it, to redistribute it,
;to distribute modified versions, and to use it for any purpose is
@@ -24,30 +24,30 @@
;;@noindent
;;A Matrix can be either a list of lists (rows) or an array.
-;;As with linear-algebra texts, this package uses 1-based coordinates.
+;;Unlike linear-algebra texts, this package uses 0-based coordinates.
;;; Internal conversion routines
(define (matrix2array matrix prototype)
- (let* ((shp (list (list 1 (length matrix))
- (list 1 (length (car matrix)))))
- (mat (apply create-array '#() shp)))
- (do ((idx 1 (+ 1 idx))
+ (let* ((dim1 (length matrix))
+ (dim2 (length (car matrix)))
+ (mat (make-array '#() dim1 dim2)))
+ (do ((idx 0 (+ 1 idx))
(rows matrix (cdr rows)))
- ((> idx (cadar shp)) rows)
- (do ((jdx 1 (+ 1 jdx))
+ ((>= idx dim1) rows)
+ (do ((jdx 0 (+ 1 jdx))
(row (car rows) (cdr row)))
- ((> jdx (cadadr shp)))
+ ((>= jdx dim2))
(array-set! mat (car row) idx jdx)))
- mat))
+ mat))
(define (matrix2lists matrix)
- (let ((shp (array-shape matrix)))
- (do ((idx (cadar shp) (+ -1 idx))
- (rows '()
- (cons (do ((jdx (cadadr shp) (+ -1 jdx))
+ (let ((dims (array-dimensions matrix)))
+ (do ((idx (+ -1 (car dims)) (+ -1 idx))
+ (rows '()
+ (cons (do ((jdx (+ -1 (cadr dims)) (+ -1 jdx))
(row '() (cons (array-ref matrix idx jdx) row)))
- ((< jdx (caadr shp)) row))
+ ((< jdx 0) row))
rows)))
- ((< idx (caar shp)) rows))))
+ ((< idx 0) rows))))
(define (coerce-like-arg matrix arg)
(cond ((array? arg) (matrix2array matrix arg))
(else matrix)))