Re: [math] matrix multiplication surprisingly slow?

2016-04-08 Thread Gilles
On Thu, 7 Apr 2016 19:25:43 +0100, Chris Lucas wrote: On 7 April 2016 at 18:41, Gilles wrote: It's certainly worth ascertaining with more data points (to make a nice plot). I can run mult on both for {10, 100, 500, 1000, 1500, 2000, 2500, 5000} if that would help. That would help if

Re: [math] matrix multiplication surprisingly slow?

2016-04-07 Thread Chris Lucas
On 7 April 2016 at 18:41, Gilles wrote: > > It's certainly worth ascertaining with more data points (to make a nice > plot). > I can run mult on both for {10, 100, 500, 1000, 1500, 2000, 2500, 5000} if that would help. > > Naturally, better asymptotic >> performance would be nice, >> > > What

Re: [math] matrix multiplication surprisingly slow?

2016-04-07 Thread Gilles
On Thu, 7 Apr 2016 18:09:10 +0100, Chris Lucas wrote: Sorry, you're right that I should have summarized the key implications (at least as I see them). The short version: (1) If you're multiplying small matrices with AMC, BlockRealMatrix is your friend. For large matrices, stick with Array2

Re: [math] matrix multiplication surprisingly slow?

2016-04-07 Thread Chris Lucas
Sorry, you're right that I should have summarized the key implications (at least as I see them). The short version: (1) If you're multiplying small matrices with AMC, BlockRealMatrix is your friend. For large matrices, stick with Array2DRowRealMatrix (or something else?). (2) Scaling isn't g

Re: [math] matrix multiplication surprisingly slow?

2016-04-07 Thread Gilles
On Thu, 7 Apr 2016 16:17:52 +0100, Chris Lucas wrote: Thanks for suggesting the BlockRealMatrix. I've run a few benchmarks comparing the two, along with some other libraries. The email is not really suited for tables (see your message below). What are the points which you want to make? As said

Re: [math] matrix multiplication surprisingly slow?

2016-04-07 Thread Chris Lucas
Thanks for suggesting the BlockRealMatrix. I've run a few benchmarks comparing the two, along with some other libraries. I'm using jmh 1.11.3, JDK 1.8.0_05, VM 25.5-b02, with 2 warmups and 10 test iterations. The suffixes denote what's being tested: MC: AMC 3.6.1 using Array2DRowRealMatrix SB

Re: [math] matrix multiplication surprisingly slow?

2016-04-07 Thread Gilles
On Wed, 6 Apr 2016 12:55:06 +0100, Chris Lucas wrote: Thanks for the quick reply! I've pasted a small self-contained example at the bottom. It creates the matrices in advance, but nothing meaningful changes if they're created on a per-operation basis. Results for 50 multiplications of [size]

Re: [math] matrix multiplication surprisingly slow?

2016-04-06 Thread Chris Lucas
Thanks for the quick reply! I've pasted a small self-contained example at the bottom. It creates the matrices in advance, but nothing meaningful changes if they're created on a per-operation basis. Results for 50 multiplications of [size]x[size] matrices: Size: 10, total time: 0.012 seconds, t

Re: [math] matrix multiplication surprisingly slow?

2016-04-05 Thread Gilles
Hi. On Tue, 5 Apr 2016 15:43:04 +0100, Chris Lucas wrote: I recently ran a benchmark comparing the performance math commons 3.6.1's linear algebra library to the that of scala Breeze ( https://github.com/scalanlp/breeze). I looked at det, inverse, Cholesky factorization, addition, and multipli

[math] matrix multiplication surprisingly slow?

2016-04-05 Thread Chris Lucas
I recently ran a benchmark comparing the performance math commons 3.6.1's linear algebra library to the that of scala Breeze ( https://github.com/scalanlp/breeze). I looked at det, inverse, Cholesky factorization, addition, and multiplication, including matrices with 10, 100, 500, and 1000 element