((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/interp1d" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "interp1d" (p "One-dimensional numerical interpolation.") (toc)) (section 2 "Usage" (p "(require-extension interp1d)")) (section 2 "Documentation" (p "The " (tt "interp1d") " library provides routines for linear and piecewise quadratic interpolation, as well as a facility for \"sliding window\" interpolation over a long, or possibly infinite, sequence of data.") (section 3 "Procedures" (def (sig (procedure "interp1d:nearest:: XDATA * YDATA * X  -> Y" (id interp1d:nearest))) (p "Interpolates function " (tt "y=f(x)") " at the point " (tt "x") " using the data point nearest to " (tt "x") ". Arguments " (tt "XDATA") " and " (tt "YDATA") " are lists of numeric values that correspond to sample points of the function being interpolated. Argument " (tt "X") " must be within the range of values contained in " (tt "XDATA") ".")) (def (sig (procedure "interp1d:linear:: XDATA * YDATA * X  -> Y" (id interp1d:linear))) (p "Interpolates function " (tt "y=f(x)") " at the point " (tt "x") " using the linear interpolation method. Arguments " (tt "XDATA") " and " (tt "YDATA") " are lists of numeric values that correspond to sample points of the function being interpolated. Argument " (tt "X") " must be within the range of values contained in " (tt "XDATA") ".")) (def (sig (procedure "interp1d:piecewise-quadratic:: XDATA * YDATA * X  -> Y" (id interp1d:piecewise-quadratic))) (p "Interpolates function " (tt "y=f(x)") " at the point " (tt "x") " using the piecewise quadratic interpolation method. Arguments " (tt "XDATA") " and " (tt "YDATA") " are lists of numeric values that corresponds to sample points of the function being interpolated. Argument " (tt "X") " must be within the range of values contained in " (tt "XDATA") ".")) (def (sig (procedure "interp1d:from-sequence:: METHOD * STEP * YDATA [* START * CAR * CDR * NULL? * DELTA-WINDOW-LEN * MAX-WINDOW-LEN] -> (LAMBDA X -> Y)" (id interp1d:from-sequence))) (p "Constructs a sliding window interpolation procedure, for a given sequence " (tt "YDATA") " that contains uniformly sampled values of a function " (tt "y = f(x)") ", where " (tt "X") " has an initial value of " (tt "START") " (default 0) and is incremented by " (tt "STEP") " amount. The returned procedure performs interpolation using the given " (tt "METHOD") " procedure, while the window is shifted forwards by the appropriate amount if " (tt "X") " is outside the current window range. Backward shifting is not supported.") (p "Argument " (tt "METHOD") " is one of the interpolation procedures above.") (p "Optional argument " (tt "START") " specifies the initial (smallest) " (tt "X") " and defaults to 0.") (p "Optional arguments " (tt "CAR") ", " (tt "CDR") ", " (tt "NULL?") " are used to access " (tt "YDATA") " and default to the standard list procedures. If the input sequence is not a list (e.g. an SRFI-40 stream), these arguments can be used to specify the appropriate accessors and predicates.") (p "Optional arguments " (tt "DELTA-WINDOW-LEN") " and " (tt "MAX-WINDOW-LEN") " specify the window increment (default 4) and maximum window size (default 128).")) (def (sig (procedure "interp1d:lbound:: XDATA * YDATA * X  -> Y" (id interp1d:lbound))) (p "Returns the value of the data point nearest to " (tt "X") " that does not exceed the value of " (tt "X") ".")) (def (sig (procedure "interp1d:ubound:: XDATA * YDATA * X  -> Y" (id interp1d:ubound))) (p "Returns the value of the data point nearest to " (tt "X") " that is larger than " (tt "X") ".")))) (section 2 "Examples") (section 2 "About this egg" (section 3 "Author" (p (int-link "/users/ivan-raikov" "Ivan Raikov"))) (section 3 "Version history" (dl (dt "1.12") (dd "Eliminated dependency on easyffi") (dt "1.11") (dd "Documentation converted to wiki format") (dt "1.10") (dd "Ported to Chicken 4") (dt "1.9") (dd "Removed testeez as a dependency") (dt "1.8") (dd "Added lbound and ubound routines") (dt "1.7") (dd "Added nearest interpolation method") (dt "1.6") (dd "Bug fix in bounds routine") (dt "1.5") (dd "Bug fix in the sliding window routine for the case of non-list input data") (dt "1.4") (dd "Added a proper error message routine") (dt "1.3") (dd "Added a boundary exceeded error message to the sliding window routine") (dt "1.2") (dd "Build script updated for better cross-platform compatibility") (dt "1.1") (dd "Documentation updates") (dt "1.0") (dd "Initial release"))) (section 3 "License" (pre "Copyright 2007-2012 Ivan Raikov and the Okinawa Institute of Science and Technology\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nA full copy of the GPL license can be found at\n<http://www.gnu.org/licenses/>."))))