mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Fix default coeffs for the degenerate dimension case.
This commit is contained in:
parent
0d8e91e96c
commit
65589e3e26
1 changed files with 6 additions and 8 deletions
|
@ -416,16 +416,14 @@
|
||||||
(cond
|
(cond
|
||||||
((< i 0)
|
((< i 0)
|
||||||
res)
|
res)
|
||||||
((= (+ 1 (interval-lower-bound domain i))
|
|
||||||
(interval-upper-bound domain i))
|
|
||||||
;; (vector-set! res (+ i 1) (if (< (+ i 1) dim)
|
|
||||||
;; (interval-width domain (+ i 1))
|
|
||||||
;; 1))
|
|
||||||
(lp (- i 1) scale))
|
|
||||||
(else
|
(else
|
||||||
(let ((coeff (* scale (- (interval-upper-bound domain i)
|
(let* ((width (interval-width domain i))
|
||||||
(interval-lower-bound domain i)))))
|
(coeff (* scale width)))
|
||||||
|
;; The coefficient for stepping over each element is the
|
||||||
|
;; volume (product of widths) of all higher dimensions.
|
||||||
(vector-set! res (+ i 1) scale)
|
(vector-set! res (+ i 1) scale)
|
||||||
|
;; Offset the constant bias by the lower bound of this
|
||||||
|
;; dimension (typically but not necessarily 0).
|
||||||
(vector-set! res 0 (- (vector-ref res 0)
|
(vector-set! res 0 (- (vector-ref res 0)
|
||||||
(* scale (interval-lower-bound domain i))))
|
(* scale (interval-lower-bound domain i))))
|
||||||
(lp (- i 1) coeff)))))))
|
(lp (- i 1) coeff)))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue