Hi Alex, I tried it and it says “cannot resolve symbol malloc. The specified procedure cannot be found”. Do I have to declare it on C side? Best regards, Thomas Beddell From: luajit-bounce@xxxxxxxxxxxxx [mailto:luajit-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Sent: 7. august 2014 21:49 To: luajit@xxxxxxxxxxxxx Subject: Re: LuaJIT Matrix Algebra Function Here's a fully-compileable FFI version, based off of Kordic's: https://gist.github.com/ColonelThirtyTwo/56a06902c49f57edd70d<https://urldefense.proofpoint.com/v1/url?u=https://gist.github.com/ColonelThirtyTwo/56a06902c49f57edd70d&k=rYVT%2BQIbByDGfw04ADASxQ%3D%3D%0A&r=Z%2BQTzSXoYfn2aVXXze9h9xUjv%2BDjFRaIHobDQaXRmqQ%3D%0A&m=xC9egAR1WrU%2BIwktLIE9oPbTsIQIdQHT7%2B43FA8Gj5M%3D%0A&s=854392d4bf40bd86d842231145399494de1fd032d73ec84af8599f7081e89e54> It runs much faster. Primarily, large allocations (>128 bytes) aren't jit compiled [1]. Calls to malloc are though, so this code allocates the matrices with that. Additionally, caching the `entries` field in a local actually hurts performance [2]. [1] http://luajit.org/ext_ffi_semantics.html<https://urldefense.proofpoint.com/v1/url?u=http://luajit.org/ext_ffi_semantics.html&k=rYVT%2BQIbByDGfw04ADASxQ%3D%3D%0A&r=Z%2BQTzSXoYfn2aVXXze9h9xUjv%2BDjFRaIHobDQaXRmqQ%3D%0A&m=xC9egAR1WrU%2BIwktLIE9oPbTsIQIdQHT7%2B43FA8Gj5M%3D%0A&s=ccf464722827355dcd96f18d60f2fb9e839a9fa2ff9642c6e7a7325ed4d47356> in the Current Status section [2] http://wiki.luajit.org/Numerical-Computing-Performance-Guide<https://urldefense.proofpoint.com/v1/url?u=http://wiki.luajit.org/Numerical-Computing-Performance-Guide&k=rYVT%2BQIbByDGfw04ADASxQ%3D%3D%0A&r=Z%2BQTzSXoYfn2aVXXze9h9xUjv%2BDjFRaIHobDQaXRmqQ%3D%0A&m=xC9egAR1WrU%2BIwktLIE9oPbTsIQIdQHT7%2B43FA8Gj5M%3D%0A&s=a714796abfb857b1a87d509d9ebc0eabc196c88208f1f478213a17173d95a9f1>, confirmed with my tests. -- Sincerely, Alex Parrill