[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT2 performance for number crunching
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 16 Feb 2011 15:30:34 +0200
On Wed, Feb 16, 2011 at 3:15 PM, Alex Bradbury <asb@asbradbury.org> wrote:
> You said you were playing with templating Francesco's code. Do share
> if you find any particularly helpful tricks.
One pattern works like this:
-- k3 step
$(VL'k_') = f(t + 0.5 + h,$(VL'ytmp_'))
expands to
k_0,k_1 = f(t + 0.5 + h,ytmp_0,ytmp_1)
the definition of VL is easy:
# function VL(var)
# local res = {}
# for i = N1,N2 do
# res[i+1-N1] = var..i
# end
# return table.concat(res,',')
# end
Another common one is:
$(AL 's.y') = $(VL 'v_')
meaning
s.y[0],s.y[1] = v_0,v_1
About as pretty as it can get, although a little meta magic can make
$(V.v) behave like $(VL 'v_')
That is while still keeping to the original, very simple preprocessor.
A macro expansion facility on top of that can eliminate some dollars
but the interactions could get hairy...
> http://snippets.luacode.org/snippets/Lua_Preprocessor_118, though
> providing a preprocess function that takes an environment argument.
Yes, that's the way to go... Still thinking about how to organize
template 'instantiation' since a template function may depend on
several other template functions.
steve d.
- References:
- LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Mike Pall
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Mike Pall
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Florian Weimer
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Leo Razoumov
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Leo Razoumov
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, T T
- Re: LuaJIT2 performance for number crunching, steve donovan
- Re: LuaJIT2 performance for number crunching, Alex Bradbury