Re: passing arg to CompiledFunction array
- To: mathgroup at smc.vnet.net
- Subject: [mg6870] Re: [mg6833] passing arg to CompiledFunction array
- From: jpk at max.mpae.gwdg.de
- Date: Fri, 25 Apr 1997 02:31:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> From dtuch at athena.mit.edu Tue Apr 22 10:11:29 1997 > Date: Tue, 22 Apr 1997 02:33:02 -0400 (EDT) > From: dtuch at athena.mit.edu (David S Tuch) > To: mathgroup at smc.vnet.net > Subject: [mg6833] passing arg to CompiledFunction array > > Given an array of CompiledFunctions such as > > array={{Compile[{x},Sin[x]],Compile[{x},Cos[x]]}, > {Compile[{x},-Cos[x]],Compile[{x},Sin[x]]}}; > > how can one pass the argument to each CompiledFunction? > I suspect the answer looks something like > > array/.CompiledFunction[x__]->CompiledFunction[x__][arg] > > which obviously doesn't work. Any tips would be greatly > appreciated. Thanks in advance. > > Dave Tuch > Hi Dave, the answer is simple, try mfun[x_]:=Map[# @ x &,array,{2}] and mfun[Pi] will work. Hope that helps Jens