[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Numeric Lua 0.3
- From: Luis Carvalho <lexcarvalho@...>
- Date: Sun, 21 Aug 2011 12:56:30 -0400
> Most of it is very nice. I had great trouble with LuaRocks and could
> not get LuaHelp to see the NumLua help files, so I wrote the Lua script
> below, which does not need LuaHelp.
Thanks again for the report and the script. Unfortunately, as you noted, it
relies on `package.searchpath`. My `numlua` is just an alias to
`lua -lluarocks.loader -lnumlua.seeall`. :)
> The following is not so nice:
>
> 1. x:fft() is only allowed when x is already complex.
>
> > x=matrix{1,2,3}
> > =x:fft()
> stdin:1: calling 'fft' on bad self
> > y=matrix({1,2,3},true)
> > =y:fft():pretty()
> 6+0i -1.5+0.866025i -1.5-0.866025i
Yes, that's stated in the docs as well. But in Lua 5.1 I still get
> x=matrix{1,2,3}
> = x:fft()
stdin:1: calling 'fft' on bad self (complex matrix expected)
stack traceback:
[C]: in function 'fft'
stdin:1: in main chunk
[C]: ?
> = x:complex():fft()
6+0i -1.5+0.866025i -1.5-0.866025i
so there is a warning.
> 2. But one can't use `complex` to convert a real matrix to complex.
> Worse, you're not warned about it.
>
> > =complex(x)
> 0+0i
You can use `matrix.complex` for that (or `mcomplex` if using `seeall`).
I've fixed the __call method for complex to actually check its argument
instead of just converting it to a number:
> = complex(x)
stdin:1: bad argument #1 to 'complex' (number or complex expected, got userdata)
stack traceback:
[C]: in function 'complex'
stdin:1: in main chunk
[C]: ?
> = mcomplex(x)
1+0i 2+0i 3+0i
Cheers,
Luis
--
Computers are useless. They can only give you answers.
-- Pablo Picasso
--
Luis Carvalho (Kozure)
lua -e 'print((("lexcarvalho@NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'