Re: Compile and Total
- To: mathgroup at smc.vnet.net
- Subject: [mg120276] Re: Compile and Total
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sat, 16 Jul 2011 05:41:49 -0400 (EDT)
- References: <201107150120.VAA23682@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
The Head is Function in the second case, but not in the first. Maybe
that's the difference.
Bobby
On Fri, 15 Jul 2011 05:32:32 -0500, Neil Stewart
<neil.stewart at warwick.ac.uk> wrote:
> Fred, DrMajorBob, Patrick---thank you very much for your replies.
> Continuing
> Fred's code:
>
> <<CompiledFunctionTools`;
>
> (* This does not compile *)
> g = Total;
> gC = Compile[{{x, _Real, 1}}, g[x],
> CompilationOptions -> {"InlineExternalDefinitions" -> True}];
> CompilePrint[gC]
>
> (* This does *)
> g = Total[#] &;
> gC = Compile[{{x, _Real, 1}}, g[x],
> CompilationOptions -> {"InlineExternalDefinitions" -> True}];
> CompilePrint[gC]
>
> I don't understand why, so I must be missing something fundamental about
> functions. Do you know the Mathematica keyword for the concept I'm
> missing?
>
> Thanks,
> Neil.
--
DrMajorBob at yahoo.com
- References:
- Compile and Total
- From: Neil Stewart <neil.stewart@warwick.ac.uk>
- Compile and Total