MathGroup Archive 1996

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

Search the Archive

Help - Compile[] problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4871] Help - Compile[] problems
  • From: frankeye at aol.com (FrankEye)
  • Date: Thu, 26 Sep 1996 22:42:25 -0400
  • Organization: America Online, Inc. (1-800-827-6364)
  • Sender: owner-wri-mathgroup at wolfram.com

Apparently, either Compile[] has trouble inferring variable types, or I
don't well understand how to use it.  Insights wanted -- TIA.  

Here's the problem, with code snippets below.  I'm trying to compile an
expression, which is a function which takes arguments and passes into a
Module:   

imgCSAc=Compile[{{inputimage,_Real,2},{aA,_Real,2},
{sigma2,_Real},{torflag,_Integer},{nsweeps, _Integer}},

Module[{m,n,i,j,k,l,indices...etc},

...etc...{stuff which causes no problem for Compile[]}...

For[m=1, m<=npix, m++, 
   i=indices[[m,1]]; j=indices[[m,2]];
(* indices is a rank-2 matrix of integer indices *)
   storem=Flatten[ image[[ Range[i-halfWts,i+halfWts],
                        Range[j-halfWts,j+halfWts] ]] ];
....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.  

What am I doing that is wrong?  Would the more bulletproof version 2.2.2
work?  

Regards, 

Frank J. Iannarilli, Jr.
frankeye at aol.com  OR franki at aerodyne.com

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


  • Prev by Date: Re: functional code
  • Next by Date: Length of cubic polynomial (spline) ?
  • Previous by thread: Different Plots in the Same Window?
  • Next by thread: Length of cubic polynomial (spline) ?