MathGroup Archive 2011

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

Search the Archive

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


  • Prev by Date: Re: Numerical accuracy/precision - this is a bug or a feature?
  • Next by Date: Re: Compile and Total
  • Previous by thread: Re: Compile and Total
  • Next by thread: Re: Compile and Total