Performance of RevMedia on matrix diagonalization

Mark Smith lists at futilism.com
Thu Aug 27 07:21:27 EDT 2009


I saw this over on the forum (the diagonalisation takes about twenty  
seconds on my MacBookPro with rev enterprise), and two things occur  
to me.

'Arrays' in revolution are actually hash tables, so are very nice for  
random access to elements, but will not be as efficient for  
sequential access as more traditional, fixed width arrays in other  
languages.
I suspect that this is the main speed issue with your eigen function.

Secondly, I understand that all numbers in revolution (which is an un- 
typed language) are floats - though there may be conversions to and  
from integers going on in the engine. I doubt that this will have any  
effect on the speed of your functions, but it's probably unneccessary  
to write '1.0' or '1.' - simply '1' will do, I think.

I think that using the a[i][j] approach instead of a[i,j] might get  
you maybe 10% more speed, but then you'd have to convert to a[i,j]  
anyway in order to use the built in matrixmultiply and transpose  
functions (this should be updated, I'd have thought).

My maths is nowhere near good enough to suggest mathematical  
optimisations (which you might not want for educational purposes,  
anyway) and I can't see any obvious optimisations to make in the code  
you've written.

Hopefully, someone here will be able to be more helpful, but this may  
be one of those things that revolution simply isn't best suited for :(

Best,

Mark Smith


On 27 Aug 2009, at 08:16, Piero Ugliengo wrote:

> I am completely new to Revolution. I have downloaded the RevMedia  
> alpha
> version and played a bit with it. I was impressed by how fast I was  
> able to
> port a little VB6 code to RevMedia. This code diagonalizes a symmetric
> matrix using the Jacobi algorithm. I checked against the VB6 code  
> and I got
> exactly the same results in the same number of iterations so that  
> numerics
> is the same. However the RevMedia code is at least one order of  
> magnitude
> slower than the VB6 one. For instance a 50x50 matrix is  
> diagonalized in a
> couple of seconds in VB6 and it tooks more than a minute on  
> RevMedia. I know
> that RevMedia is not meant for numerical intensive calculations;  
> however, I
> would like to use it in a scientific teaching context so some power is
> needed. I wonder if anybody much expert than me can try the code  
> using the
> most powerful Revolution Studio and if there is a clever way to  
> deal with
> matrix algebra.
> The link to download the rev script is here:
> http://sites.google.com/site/pierougliengo/download-1/test.rev? 
> attredirects=0
>
> <http://sites.google.com/site/pierougliengo/download-1/test.rev? 
> attredirects=0>One
> can set the size of the matrix in the onmouse routine.
> Thanks a lot
> _________________
> Piero Ugliengo
>
> -- 
> Prof. Piero Ugliengo
> University of Torino
> Dip. Chimica IFM,  Via P. Giuria, 7 I-10125 Torino
> ITALY
> Phone: +39-011-670.4596
> FAX:   +39-011-236.4596
> E-mail:  piero.ugliengo at unito.it
> Home page:
> http://web086.unito.it/cgi-bin/chimifm/persone.pl/Show? 
> _id=ugliengo&sort=DEFAULT&search=&hits=70
> MOLDRAW: http://www.moldraw.unito.it
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list