Hi Petr
> > In December 99, I ran a lot of timings for linear algebra operations in
> > REBOL, for instance matrix multiplication, matrix inversion, LU
> > decomposition, etc. on 100x100 randomly generated matrices. The bottom
line
> > was that REBOL was about 80-300 times slower than MATLAB which uses
highly
> > optimised C-code for the same operations.
>
> Uh oh, hmm, so much? Matlab is interpreted too, no? But well, MathWorks
has
> great know-how and I believe matrix operations run natively.
Yes, MATLAB is an interpreter, and a very nice one. But the work is done by
calls to a compiled C-code library. So entire matrix inversion, etc. is
done in C, only array addresses and sizes are passed to the library
functions. As a result the runtimes are (nearly) comparable to that of a
pure C program.
> I requested matrix operations being added to rebol, but got no reply. I
think
> they are "basic advanced" math stuff :-) Well, at least my friend havily
using
> Matlab told me that having such functionality natively implemented in
REBOL,
> would open us the whole field for "fast" image effect creations ... And at
later
> stage, such stuff could be moved into separate /Math module(s).
Of course with Command we could write our own matrix package in C, FORTRAN,
PASCAL, etc. and call the functions from REBOL.
A nice approach to math libraries is that used by Python. There is a free,
public-domain add-on called Num-Py distributed by Lawrence Livermore
Laboratories in source code form (check at http://www.python.org). This
package is a stripped down version of LAPACK Lite, one of the premier
numeric function libraries for linear algebra. It does most of what one
would need including FFT, SVD, LUD, linear regression, and matrix
operations. It is implemented by a fairly thin Python wrapper class which
hides the intricacies of the function calls. It is fast! Only 2 to 4 times
slower than MATLAB for the operations I timed.
I am interested in possibly creating a wrapper in Command for the Num-Py
library (or more ambitiously for LAPACK Lite itself). I would need some
help from a bona-fide C-coder, familiar with details of external library
calls (alignment, arg order, byte reversing, mem pointers, etc.). For us
numeric types, this would be a wonderful enhancement to REBOL! And very
useful for image processing as you note.
IMO using an interpreted language like REBOL to issue high-level math
commands in compiled binaries gives us the best of both worlds. In fact,
one of the world's largest and most computationally intensive simulation
programs "The Digital Orrery" uses this approach with Scheme as the
high-level interpreted programming language.
-Larry
> -pekr-
> > -Larry