MathGroup Archive 1996

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

Search the Archive

Re: Help - Compile[] problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4897] Re: Help - Compile[] problems
  • From: "David B. Wagner" <dbwagner at princon.com>
  • Date: Fri, 4 Oct 1996 00:17:36 -0400
  • Organization: Principia Consulting
  • Sender: owner-wri-mathgroup at wolfram.com

(Please ignore the extra level of quoting in this message;
my mail reader refused to do the right thing.)

> FrankEye wrote:
> >
> > Compile[{{inputimage,_Real,2},{aA,_Real,2}, ...}
> > ....etc....
> > ,
> > {{i,_Integer},{j,_Integer},{k,_Integer},{m,_Integer},
> > {indices,_Integer,2},{halfWts,_Integer},...etc...}]
> >
> > So, I try to Enter this Compile[] request, and get back messages such as
> > the following:
> >
> > Compile::"cpintlt":
> >     "Range[i-halfWts,i+halfWts] at position <<2>> of
> > image[[ Range[i-halfWts,i+halfWts],
> >                         Range[j-halfWts,j+halfWts] ]]
> > should be either a non-zero integer or a vector of non-zero integers;
> > evaluation will use the uncompiled function."
> >
> > Well, I thought that my declaration of sub-expression types in the
> > trailing portion of the Compile[] request would tell Mathematica what it
> > is apparently not understanding.  I *am* using Version 3.0 beta 3.
> 
> It's not surprising that the compiler doesn't know what type Range will return,
> since depending on the arguments, it could be a list of nearly any numeric types.
> (I know, you could argue that the compiler ought to be able to infer this from the
> declared types of the arguments to Range, but apparently it doesn't.)
> 
> The way around this problem (in theory) is to add a declaration like
> 
>         {Range[__], _Integer, 1}
> 
> in the last (declaration-list) argument to compile. This tells Compile that any
> expression matching the pattern Range[__] returns a rank-1 tensor of integers.
> 
> I say "in theory", because in Beta 2 this didn't always work.
> 
> >Would the more bulletproof version 2.2.2
> > work?
> 
> Version 2.2.2 doesn't understand tensor arguments.
> 
>                 Dave Wagner
>                 Principia Consulting
>                 http://www.princon.com/princon



==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Different Plots in the Same Window?
  • Next by Date: Re: Help - Compile[] problems
  • Previous by thread: ArcTan[-Cotan[theta]]
  • Next by thread: Re: Help - Compile[] problems