Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Problem with Compile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119907] Re: Problem with Compile
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 29 Jun 2011 05:28:10 -0400 (EDT)
  • References: <201106281155.HAA21492@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

g = Compile[{{z, _Integer}},
    NestWhileList[# + z &, 0, # < 10 &, 1,
     9], {{NestWhileList[__], _Integer, 1}}];
g[1]

{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

Bobby

On Tue, 28 Jun 2011 06:55:48 -0500, Arthur Evans <24evansa at gmail.com>  
wrote:

> Dear Mathgroup,
>
> I am having some problems with Compile.
>
> Here the below expression compiles and executes as expected
>
> f = Compile[{{z, _Integer}}, NestList[# + z &, 0, 9]];
> f[1]
>
> Out[89]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
>
>
> But this one gives an error
>
> g = Compile[{{z, _Integer}},NestWhileList[# + z &, 0, # < 10 &, 1, 9]]
> g[1]
>
> CompiledFunction::cfse: Compiled expression {0,1,2,3,4,5,6,7,8,9}
> should be a machine-size integer. >>
>
> CompiledFunction::cfex: Could not complete external evaluation at
> instruction 1; proceeding with uncompiled evaluation. >>
>
> Any help is appreciated.
>
> Regards,
>
> Arthur
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Improt vs Get
  • Next by Date: Re: how to visualize unstructured data
  • Previous by thread: Problem with Compile
  • Next by thread: Re: Problem with Compile