Re: Compile for different parameter types
- To: mathgroup at smc.vnet.net
- Subject: [mg97400] Re: Compile for different parameter types
- From: Raffy <raffy at mac.com>
- Date: Thu, 12 Mar 2009 05:41:41 -0500 (EST)
- References: <gpacur$mu6$1@smc.vnet.net>
This idea is kinda silly but: funcString[a_Integer,b_Integer]:="Compile[{{A,_Real,"<>ToString[a]<>"}, {B,_Real,"<>ToString[b]<>"}}, expr]"; cache[a_Integer,b_Integer]:=cache[a,b]=ToExpression[funcString[a,b]]; func[a_?ArrayQ,b_?ArrayQ]:=cache[ArrayDepth[a],ArrayDepth[b]][a,b]; You can always prebuild the cache: Array[cache,{15,15}];