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


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

Re: Compile and Total

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Compile and Total
Date 2011-07-16 09:44 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ivrmip$85k$1@smc.vnet.net> (permalink)
References <201107150120.VAA23682@smc.vnet.net>

Show all headers | View raw


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

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


Thread

Re: Compile and Total DrMajorBob <btreat1@austin.rr.com> - 2011-07-16 09:44 +0000

csiph-web