Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

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


  • Prev by Date: Re: Evaluation of limit
  • Next by Date: Re: what's wrong?!!
  • Previous by thread: Array of arrays of various sizes and compile
  • Next by thread: Re: Array of arrays of various sizes and compile