MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: "Compile[]" and "InterpolatingFunction" objects

  • Subject: [mg2957] RE: [mg2939] "Compile[]" and "InterpolatingFunction" objects
  • From: jpk at (Jens-Peer Kuska)
  • Date: 17 Jan 1996 05:18:16 -0600
  • Approved:
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: mj at

> From mathgroup-adm at Sat Jan 13 12:20:47 1996
> From: Jonathan Rich <rich at>
To: mathgroup at
> To: mathgroup at
> Subject: [mg2939]  "Compile[]" and "InterpolatingFunction" objects
> Organization: Northwestern University, Evanston, IL, US
> Content-Length: 1014
> X-Lines: 29
> I am trying to produce efficient compiled code which evaluates an expression
> that includes "InterpolatingFunction" objects.  So I have two questions:
> 1) Are "InterpolatingFunction" objects Compiled by default?  The Book doesn't
> say although in Appendix A.8 under "InterpolatingFunction" it says 
> `See also:  CompiledFunction'.
> 2)  How do I compile an InterpolatingFunction w/o having the compiled
> pseudocode
> use an external evaluation (pseudocode instruction # 24) for the result of the
> InterpolatingFunction?  Here is a simple example:
> list=Table[{i,i},{i,4}];
> interpFunc=Interpolation[list];
> f1=Compile[{x},Evaluate[interpFunc[x]]];
> f1//InputForm
> In the output you will see that the compiled code uses an external evaluation,
> which defeats the whole purpose of using "Compile[]" (which is to speed up the
> computation--it may be that "Interpolation[]" produces compiled code, but I
> can't find this documented anywhere).
> Thanks for your help on this.
> -- 
> Jonathan Rich
> Geoscience Dept., Northwestern Univ.
I am *not* informed about the details of the interpolation implementation
 a) Mma uses a Newton/Lagrange interpolating formula around  the desired
 b) this need at least a searching to find the interval where the point
    lies in
 c) The compile intstructions have *no* searching command.
 d) Interpolation is a internal function that means it is compiled with
    the kernel. This will allway faster than the pseudo compilation
    by Compile

You can try to compile the output InterpolatingPolynomial if You have only
4 or five points. Otherwise the algorithm is mutch more complex.

Hope that helps

  • Prev by Date: RE: "Compile[]" and "InterpolatingFunction" objects
  • Next by Date: Re: OS/2 Vs. Windows Mathamatica (speed).
  • Previous by thread: RE: "Compile[]" and "InterpolatingFunction" objects
  • Next by thread: Re: "Compile[]" and "InterpolatingFunction" objects