MathGroup Archive 2005

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

Search the Archive

Re: How can I get a nonscalar logical variable into a compiled function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56183] Re: [mg56172] How can I get a nonscalar logical variable into a compiled function?
  • From: yehuda ben-shimol <bsyehuda at gmail.com>
  • Date: Mon, 18 Apr 2005 03:08:43 -0400 (EDT)
  • References: <200504170707.DAA08487@smc.vnet.net>
  • Reply-to: yehuda ben-shimol <bsyehuda at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

A quote from the first bulleted line of the help for Compile[]
"Nested lists given as input to a compiled function must be full
arrays of numbers. "
So I suspect that this is the case.
In addition I tried your code and got the following warning message 
(at run time)

CompiledFunction::cfsa:"Argument \!\({True, True, False}\) at position 1 \
should be a \!\(\"True or False\"\)
So the compiled version expect a scalar.

Moreover, inserting a non scalar of 1's and 0's that will stand for
True and False respectively, and then in the compiled code trying to
convert it back into True and False will not work either.

sorry that I couldn't help more
yehuda

On 4/17/05, barrowes at alum.mit.edu <barrowes at alum.mit.edu> wrote:
> I can't seem to figure out how to get a nonscalar logical variable into
> a compiled function.
> 
> I can get a nonscalar variable of other kinds into compiled function or
> a scalar True or False into a compiled function.
> 
> For example the following two things work:
> 
> fun1=Compile[{{x,_Real,2}}
> Print[x];
> ];
> 
> fun2=Compile[{{x,True|False}}
> Print[x];
> ];
> 
> but how can I specify a two-dimensional input variable into the second
> case?
> fun2=Compile[{{x,True|False,1}}
> Print[x];
> ];
> doesn't work. It returns:
> gg = {False, True, True, True, True, True, True}
> fun2[gg]
> CompiledFunction::cfsa: Argument {False, True, True, True, True, True,
> True} \
> at position 1 should be a True or False.
> 
> Can only scalar logical variables be input into compiled functions? Am
> I missing something?
> 
> Thanks,
> Ben
> 
>


  • Prev by Date: Integrate is driving me crazy, please help!
  • Next by Date: Re: sparse matrix question
  • Previous by thread: How can I get a nonscalar logical variable into a compiled function?
  • Next by thread: Re: How can I get a nonscalar logical variable into a compiled function?