Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3384

Re: Problem with Compile

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Problem with Compile
Date 2011-06-29 21:45 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iug6ct$9jo$1@smc.vnet.net> (permalink)
References <201106281155.HAA21492@smc.vnet.net>

Show all headers | View raw


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@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@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem with Compile DrMajorBob <btreat1@austin.rr.com> - 2011-06-29 21:45 +0000

csiph-web