MathGroup Archive 1998

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

Search the Archive

Re: Compiling



John,

I'm not an expert, but since I don't see any other replies...

I've been looking at this same problem with a Perlin noise function. I'm
plotting images from it, which means minutes of wait for each one to
get a reasonable resolution.

Trying to compile it produced the same result that you report. After
scrutinizing the doc, I've concluded that compiling only works for
functions that use numeric variables - no lists, no vectors, etc.

This is rather odd since high-quality dynamic languge compilers have
been available for decades. I'm sure there must be some reason for this
limitation, but perhaps there's much less benefit to compiling
"dynamically rewriting" language like Mathematica when compared to,
say, Common Lisp.

I'm trying to decide now whether it's better to rewrite my Perlin
function to avoid all lists or just MathLink to my C version. Rewriting
will make the code much more obscure.

I suspect that in your case you won't be able to rewrite the function to
avoid touching lists, but you might be able to get away with using some
accessor functions that return scalars, so that the body of your main
function can be list-free.

I hope this helps.

  - Stoney


In article <6d0cod$2o6@smc.vnet.net>, TTCJ34A@prodigy.com ( JOHN C ERB)
wrote:

> I am trying to compile an interpolation routine which is used thousands
> of times in my program
> 
> alaway is a 2D table of data {{x1,y1,data1},{x2,y2,data2} ... }
> 
> h is an array of data; e.g. h = {{1,2},{2,3,} ... }, representing x's &
> y's for which I want data's; this array has 1000's of entries
> 
> I can use
> 
> Map[Interpolation[alaway][#[[1]],#[[2]]]&,h]
> 
> and get an answer, but it takes several minutes to complete.
> 
> When I try to compile the routine:
> 
> fc=Compile[{h,_Real},Map[Interpolation[alaway][#[[1]],#[[2]]]&,h]]
> 
> I get:
> 
> Compile::"cplist": 
>     h should be a tensor of type Integer, Real, or Complex;  evaluation
> will use the uncompiled function."
> 
> General::"stop": 
>     "Further output of Compile::cplist will be suppressed during this 
> calculation."
> 
> 
> I have tried several variations with no lukc. Anyone have any ideas?
> 
> Thanks
> 
> John C. Er

-- 
Stonewall Ballard                    StoneSoft, Inc.
sb.nospam@stonesoft.com    http://www.stonesoft.com/



  • Prev by Date: Extract a contour from a 3-D plot.
  • Next by Date: Long movies
  • Prev by thread: Re: Compiling
  • Next by thread: Re: Compiling