Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Compiled functions
Posted:
Aug 7, 1996 4:05 AM


Dear Mathematica users,
is it possible to compile a mathematica expression that uses vectors of real numbers as input? Since in my application I need to solve a symmetric tridiagonal linear system which is diagonally dominate quite often I am thinking about defining a compiled function that could look something like
SymmTridiagonalSolve = Compile[{{a, _List}, {b, _List}, {r, _List}}, Module[{ n = Length[r], solution = Array[0, Length[r]], aux1 = Array[0, Length[r]], aux, a1 = Prepend[a, 0], i }, aux = 1/b[[1]]; solution[[1]] = r[[1]] aux; Do[{ aux1[[i]] = a1[[i]] aux, aux = 1/(b[[i]]a1[[i]] aux1[[i]]), solution[[i]] = (r[[i]]a1[[i]] solution[[i1]]) aux }, {i, 2, n}]; Do[{ solution[[i]] = aux1[[i+1]] solution[[i+1]] }, {i, n1, 1, 1}]; solution ] ]
Since according to the Mathematica book, the only types that can be specified for compilation are _Integer, _Real, _Complex, and True  False I know that this construct does not work, but has somebody perhaps come up with a clever workaround to make it possible to also pass vectors as arguments?
Many thanks in advance.
Regards,
Stefan
====this message is transmitted on 100 % recycled electrons====     sschulz@chemie.fuberlin.de  Stefan Schulz   Tel. ++49/30/838 5384  FU Berlin  Theoretical Chemistry   ++49/30/838 2351  Takustrasse 3   FAX. ++49/30/838 4792  D14195 Berlin  ====================================



