[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pdf-devel] pdf_function.c
From: |
jemarch |
Subject: |
Re: [pdf-devel] pdf_function.c |
Date: |
Mon, 17 Sep 2007 22:51:15 +0200 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.1.50 (powerpc-unknown-linux-gnu) MULE/5.0 (SAKAKI) |
Hello.
cubic spline interpolation ( 1D case ) can be done in
about 60 lines of C code implementing
double pdf_eval_spline( double x, int nsamples,
const double y[],
const double y1[] )
void pdf_solve_spline(int nsamples,
const double y[],
double y1[] ) ;
http://mathworld.wolfram.com/CubicSpline.html
Do a general formula to solve m-dimensional cubic splines exist?
Something like that (the link talks about multi-linear interpolation):
http://kanushu.uwaterloo.ca/~tveldhui/papers/MAScThesis/node32.html
If that helps, there is an implementation of multidimensional cubic
splines in Octave 2.9.3 (written in octave). I dont know the approach
used to implement it.
It is the `interpn' octave function
(http://www.gnu.org/software/octave/doc/interpreter/Multi_002ddimensional-Interpolation.html).
You
can find the implementation in the
/home/jemarch/tmp/octave-2.9.13/scripts/polynomial/ directory.
I have finished an implementation of type 2 functions.
Many thanks!
BTW: are you using the `pdf_stm_peek' function? In the process of
writing the lexer I rewrote the file backend to achieve more
efficiency managing single characters. I removed the `pdf_stm_peek'
function ("peek an arbitrary large string from the stream") from the
API and added a new one: `pdf_stm_peek_char' ("peek a single character
from the stream"). The later is immediately useful in the lexer while
the first hurts the performance of char-oriented input/output.