Re: Array of arrays of various sizes and compile
- To: mathgroup at smc.vnet.net
- Subject: [mg115723] Re: Array of arrays of various sizes and compile
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Wed, 19 Jan 2011 05:26:56 -0500 (EST)
I'd use
example=Total@Flatten@#&
Bobby
On Tue, 18 Jan 2011 04:47:47 -0600, Ramiro <ramiro.barrantes at gmail.com>
wrote:
> Is it possible to include such a variable in a compiled function?
>
> { {1}, {2,3}, {1}, {5,7,8} }
>
> I am getting an error with such input.
>
> Example:
>
> example=Compile[{{m,_Integer,2}},Plus@@Flatten[m]]
>
> example[{{1},{2}}]
>
> Works ok.
>
> But for the following:
> example[{{1},{2,1}}]
>
> During evaluation of In[338]:= CompiledFunction::cfta: Argument {{1},
> {2,1}} at position 1 should be a rank 2 tensor of machine-size
> integers. >>
> Out[340]= 4
>
> Any suggestions?
>
> Thanks,
> Ramiro
>
--
DrMajorBob at yahoo.com