Next: , Previous: Array Mapping, Up: Data Structures


7.1.4 Array Interpolation

(require 'array-interpolate)

— Function: interpolate-array-ref ra x1 ... xj

ra must be an array of rank j containing numbers. interpolate-array-ref returns a value interpolated from the nearest j-dimensional cube of elements of ra.

          (interpolate-array-ref '#2A:fixZ32b((1 2 3) (4 5 6)) 1 0.1)
                                        ==> 4.1
          (interpolate-array-ref '#2A:fixZ32b((1 2 3) (4 5 6)) 0.5 0.25)
                                        ==> 2.75
— Procedure: resample-array! ra1 ra2

ra1 and ra2 must be numeric arrays of equal rank. resample-array! sets ra1 to values interpolated from ra2 such that the values of elements at the corners of ra1 and ra2 are equal.

          (define ra (make-array (A:fixZ32b) 2 2))
          (resample-array! ra '#2A:fixZ32b((1 2 3) (4 5 6)))
          ra              ==>  #2A:fixZ32b((1 3) (4 6))
          (define ra (make-array (A:floR64b) 3 2))
          (resample-array! ra '#2A:fixZ32b((1 2 3) (4 5 6)))
          ra              ==>  #2A:floR64b((1.0 3.0) (2.5 4.5) (4.0 6.0))