unable to compile function with Part as an argument
- To: mathgroup at smc.vnet.net
- Subject: [mg55701] unable to compile function with Part as an argument
- From: jules at julesfrancis.co.uk (Julian)
- Date: Mon, 4 Apr 2005 00:59:08 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Folks,
I have got a fairly complex program which I am trying to compile as it's
quite numerically intensive, but I am running into problems when passing
in a value that comes from an array.
I've boiled it down to a toy example which illustrates what is going wrong.
why the following code fails to compile?
In[1]:=
Developer`SetSystemOptions["CompileReportExternal" -> True]
Out[1]=
"CompileReportExternal" -> True
In[2]:=
f[x_] = Log[x]
Out[2]=
Log[x]
In[4]:=
Compile[{{v, _Real, 1}}, f[Part[v, 1]]]
From In[4]:=
Compile::"extscalar": "\!\(f[\(\(v \[LeftDoubleBracket] 1 \
\[RightDoubleBracket]\)\)]\) cannot be compiled and will be evaluated \
externally. The result is assumed to be of type \!\(Real\)."
Out[4]=
CompiledFunction[{v},
f[v\[LeftDoubleBracket]1\[RightDoubleBracket]], "-CompiledCode-"]
Any help would be greatly appreciated.
Thanks & regards,
Julian.