Fwd: Re: Fwd: JAMA Improvement: Double JAMA's Speed





----- Forwarded message from Anders Peterson <anders_peterson@optimatika.se> -----
    Date: Mon, 12 Nov 2007 09:24:42 +0100
    From: Anders Peterson <anders_peterson@optimatika.se>
Reply-To: Anders Peterson <anders_peterson@optimatika.se>
 Subject: Re: Fwd: JAMA Improvement: Double JAMA's Speed
      To: jama@nist.gov

Hi,

ojAlgo already has 1/multi dimensional arrays, and already has those 
design changes made (interfaces, abstract parent classes... ) AND has 
done extensive performance testing.

My experience is that the monolithic array design that ojAlgo has is 
advantageous with larger matrices - not smaller.

For very small matrices, like 3x3, I would guess that not having arrays 
at all would be best (store 9 individual numbers instead). I believe 
this is what the vecmath package does.

Abstractions, reconfigurability and extensibility could potentially be 
very expensive. Before I began profiling and benchmarking against JAMA, 
ojAlgo did not perform very well. Now it does!

http://ojalgo.org/matrix_compare.html

/Anders

boisvert@nist.gov wrote:
> ----- 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 
> <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 -----





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