CompiledFunction for matrices ??

*To*: mathgroup at smc.vnet.net*Subject*: [mg16069] CompiledFunction for matrices ??*From*: "Ersek, Ted R" <ErsekTR at navair.navy.mil>*Date*: Tue, 23 Feb 1999 03:45:22 -0500*Sender*: owner-wri-mathgroup at wolfram.com

While writing some code to answer a question Peter Klamser sent in I found myself wanting to write a CompiledFunction that takes a length (n) vector of real numbers. The best solution I could find is to explicitly write out (n) variables as in: foo=Compile[{x1,x2,x3, ... , xn}, expr] Then I can evaluate something like: Apply[foo, {6.2,4.1,2.5,8.6,7.7,9.1,2.2,1.4}] If I want to write a CompiledFunction that takes an (m) by (n) matrix of real numbers it's also a real chore by any method I know of. The documentation says: Compile[{{x1, t1, n1}, ... }, expr] assumes that xi is a rank ni array of objects each of a type which matches ti. I used to think this allowed the sort of thing I am looking for, but I didn't think about it long enough. It seems Compile[{{m,_Real,n}}, expr] (for n>2) takes a tensor. __________________ So how can we write a CompiledFunction that takes a large vector or large matrix? Thanks, Ted Ersek