Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 29 lines (25 sloc) 0.994 kb
34a5123 @tpapp Reorgainzation, added complex numbers.
authored
1 (in-package :ffa)
2
3 ;; various utilities, not exported
4
5 (defun find-original-array (array)
6 "Find the original parent of a displaced array, return this and the
7 sum of displaced index offsets."
8 (let ((sum-of-offsets 0))
9 (tagbody
10 check-displacement
11 (multiple-value-bind (displaced-to displaced-index-offset)
12 (array-displacement array)
13 (when displaced-to
14 (setf array displaced-to)
15 (incf sum-of-offsets displaced-index-offset)
16 (go check-displacement))))
17 (values array sum-of-offsets)))
18
19 (defun displace-array (array dimensions index-offset)
20 "Make a displaced array from array with the given dimensions and the
21 index-offset and the same element-type as array. Tries to displace
22 from the original array."
23 (multiple-value-bind (original-array sum-of-offsets)
24 (find-original-array array)
25 (make-array dimensions
26 :element-type (array-element-type array)
27 :displaced-to original-array
28 :displaced-index-offset (+ sum-of-offsets index-offset))))
Something went wrong with that request. Please try again.