Fwd: JAMA Improvement: Double JAMA's Speed




----- Forwarded message from "Castro, Giovanny A" <> -----
    Date: Fri, 9 Nov 2007 20:26:04 -0500
    From: "Castro, Giovanny A" <>
 Subject: JAMA Improvement: Double JAMA's Speed
      To: boisvert@nist.gov


JAMA Authors, 


I have a somewhat strange but valid proposal to improve the JAMA
library:

There should be a Matrix subclass for Matrix sizes under 15.
Why? To take advantage of dramatic performance increases when using 
one dimensional arrays at these sizes.

For a 4x4 matrix a one dimensional array implementation is TWICE as fast
as the JAMA implementation. 

Why are 4x4 and 3x3 matrices important? They are critical to computer
graphics and engineering applications. It would be my guess that a large
percentage of people interested in a matrix library are interested in 
using it in a computer graphics application - or in other engineering
applications requiring scaling, translation and rotation.

As it stands, JAMA is completely unacceptable for these applications.

Especially in computer graphics applications, Java developers are
already at a disadvantage compared to C/C++ (even Flash) developers. 

If they could DOUBLE their Matrix and Vector multiplication (rotation)
performance why would they choose JAMA?

Unfortunately, implementing this proposal would require a redesigning of
the JAMA library which is why I know this is a strange proposal.

Developers cant subclass the Matrix class to do this themselves because
it contains the double A[][] variable. Matrix might have to be an 
abstract class with subclasses defining the data storage. There might 
have to be a factory method by which to create matrices because
it would have to return a one-dimensionally or two-dimensionally backed
matrix depending on the dimensions...

Obviously, I haven't considered the specifics of what would have to be
done to JAMA to achieve this but I hope ive piqued someone curiosity 
on this subject.  

This thread is extremely chaotic but by the end the disparity between
one-dimensional and two-dimensional arrays is shown:

http://forum.java.sun.com/thread.jspa?threadID=5234721&tstart=0

These are the results of JAMA vs a one-dimensional implementation doing 
2 million matrix multiplication operations on 4x4 matrices (in
milliseconds):

One Dim Time: 3626
JAMA Time: 7625

One Dim Time: 3438
JAMA Time: 7610

One Dim Time: 3235
JAMA Time: 7516 

One Dim Time: 3235
JAMA Time: 7532

One Dim Time: 3250
JAMA Time: 7610
 

Giovanny Castro


----- End forwarded message -----


 

JAMA Authors,

 

I have a somewhat strange but valid proposal to improve the JAMA library:

There should be a Matrix subclass for Matrix sizes under 15.

 

Why? To take advantage of dramatic performance increases when using

one dimensional arrays at these sizes.

 

For a 4x4 matrix a one dimensional array implementation is TWICE as fast

as the JAMA implementation.

 

Why are 4x4 and 3x3 matrices important? They are critical to computer graphics

and engineering applications. It would be my guess that a large percentage of

people interested in a matrix library are interested in using it in a computer

graphics application – or in other engineering applications requiring scaling, translation

and rotation.

 

As it stands, JAMA is completely unacceptable for these applications.

Especially in computer graphics applications, Java developers are already at a

disadvantage compared to C/C++ (even Flash) developers.

If they could DOUBLE their Matrix and Vector multiplication (rotation) performance

why would they choose JAMA?

 

Unfortunately, implementing this proposal would require a redesigning of the JAMA library

which is why I know this is a strange proposal.

 

Developers cant subclass the Matrix class to do this themselves because it contains the

double A[][] variable. Matrix might have to be an abstract class with subclasses defining the

data storage. There might have to be a factory method by which to create matrices because

it would have to return a one-dimensionally or two-dimensionally backed matrix depending

on the dimensions…

 

Obviously, I haven’t considered the specifics of what would have to be done

to JAMA to achieve this but I hope ive piqued someone curiosity on this subject.  

 

This thread is extremely chaotic but by the end the disparity between one-dimensional and two-dimensional arrays is shown:

http://forum.java.sun.com/thread.jspa?threadID=5234721&tstart=0

 

These are the results of JAMA vs a one-dimensional implementation doing

2 million matrix multiplication operations on 4x4 matrices (in milliseconds):

 

One Dim Time: 3626

JAMA Time: 7625

 

One Dim Time: 3438

JAMA Time: 7610

 

One Dim Time: 3235

JAMA Time: 7516

 

One Dim Time: 3235

JAMA Time: 7532

 

One Dim Time: 3250

JAMA Time: 7610

 

 

Giovanny Castro

Lockheed Martin Maritime Systems & Sensors (MS2)

199 Borton Landing Road

Moorestown, NJ 08057

Phone:  (856) 866-6463

 

 



Date Index | Thread Index | Problems or questions? Contact list-master@nist.gov