Robert Smith avatar Robert Smith committed cafb178

Add optimization notes, copyright, and change interpolation function name.

Comments (0)

Files changed (1)

linear-interpolation.lisp

+;;;; linear-interpolation.lisp
+;;;; Copyright (c) 2012-2013 Robert Smith
+
+;;; Technically we don't need to take conses for this program. Conses
+;;; are used only as a formality and can be avoided.
 (defun linear-interpolator (p1 p2)
   "Construct a linear interpolator for the points
 
         :collect (linear-interpolator (cons i (aref src i))
                                       (cons (1+ i) (aref src (1+ i))))))
 
-(defun src->dst (src w_d)
+(defun interpolate-array (src w_d)
   "Interpolate the 1D array SRC to a destination array of size W_D."
   (let* (
          ;; Where the interpolated points go.
          (delta-w (- w_d w_s))
          
          ;; The width of each gap (this will get computed).
+         ;;
+         ;; XXX: There are actually only two gap lengths: the
+         ;; BASE-GAP-SIZE and that plus one. The only thing we need to
+         ;; do is remember when to stop using the increased gap
+         ;; width. By doing this we don't have to remember gap widths,
+         ;; which is favorable for huge interpolations. The advantage
+         ;; of using a concrete array of widths is that we can do more
+         ;; flexible things, like distributing the larger gaps if we
+         ;; want to.
          (gap-widths nil)
          
          ;; Linear interpolation functions.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.