compiled functions
- To: mathgroup@smc.vnet.net
- Subject: [mg10711] compiled functions
- From: Zahnd Beat <zahnb@odis.isbiel.ch>
- Date: Fri, 30 Jan 1998 04:24:46 -0500
- Organization: Engineering School Biel
Hy Can me anyone say what I must do wenn I use a self declared function in a compiled function? Example: In[6]:= f[vec_] := Sqrt[Plus @@ (vec^2)] In[12]:= c = Compile[{{a, _Real, 1}, {b, _Real, 1}}, a/f[a]*f[b]]; In[13]:= c[{1, 1, 0}, {1, 0, 0}] Results in some error messages and returns a correct but symbolical answer In[14]:= c = Compile[{{a, _Real, 1}, {b, _Real, 1}}, a/Sqrt[Plus @@ (a^2)]*Sqrt[Plus @@ (b^2)]] Same function, but without function f In[15]:= c[{1, 1, 0}, {1, 0, 0}] Correct answer: Out[15]= {0.707107,0.707107,0.} Beat Zahnd Engineering School Biel Switzerland http://www.isbiel.ch/~zahnb/