MathGroup Archive 2011

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

Search the Archive

Re: Compile and Total

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120284] Re: Compile and Total
  • From: Neil Stewart <neil.stewart at warwick.ac.uk>
  • Date: Sat, 16 Jul 2011 05:43:15 -0400 (EDT)
  • References: <201107150120.VAA23682@smc.vnet.net>

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.


  • Prev by Date: Re: Compile and Total
  • Next by Date: Solve never calls Equal?
  • Previous by thread: Re: Compile and Total
  • Next by thread: Re: Compile and Total