Re: Argument typing in Compile
- To: mathgroup at smc.vnet.net
- Subject: [mg9415] Re: Argument typing in Compile
- From: Hein Hundal <hundalhm at vicon.net>
- Date: Wed, 5 Nov 1997 01:56:32 -0500
- Sender: owner-wri-mathgroup at wolfram.com
You could try f[x_Integer] := Compile[{{y, _Integer}}, y^2][x]; f[x_Real] := Compile[{{y, _Real}}, Sqrt[y]][x]; or g1= Compile[{{y, _Integer}}, y^2]; g2= Compile[{{y, _Real}}, Sqrt[y]]; g[x_Integer] := g1[x]; g[x_Real] := g2[x]; The first method compiles every time f is executed. The second method doesn't have that problem. Cheers, Hein Hundal