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
multiplication, including matrices with 10, 100, 500, and 1000
elements,
with symmetric, non-symmetric, and non-square cases where applicable.
It would be interesting to add this to the CM documentation:
https://issues.apache.org/jira/browse/MATH-1194
In general, I was pleasantly surprised: math commons performed about
as
well as Breeze, despite the latter relying on native libraries. There
was
one exception, however:
m0.multiply(m1)
where m0 and m1 are both Array2DRowRealMatrix instances. It scaled
very
poorly in math commons, being much slower than nominally more
expensive
operations like inv and the Breeze implementation. Does anyone have a
thought as to what's going on?
Could your provide more information such as a plot of performance vs
size?
A self-contained and minimal code to run would be nice too.
See the CM micro-benchmarking tool here:
https://github.com/apache/commons-math/blob/master/src/test/java/org/apache/commons/math4/PerfTestUtils.java
And an example of how to use it:
https://github.com/apache/commons-math/blob/master/src/userguide/java/org/apache/commons/math4/userguide/FastMathTestPerformance.java
In case it's useful, one representative test
involves multiplying two instances of
new Array2DRowRealMatrix(matVals)
where matVals is 1000x1000 entries of math.random and the second
instance
is created as part of the loop. This part of the benchmark is not
specific
to the expensive multiplication step, and takes very little time
relative
to the multiplication itself. I'm using System.nanotime for the
timing, and
take the average time over several consecutive iterations, on a 3.5
GHz
Intel Core i7, Oracle JRE (build 1.8.0_05-b13).
You might want to confirm the behaviour using JMH (becoming the Java
standard
for benchmarking):
http://openjdk.java.net/projects/code-tools/jmh/
Best regards,
Gilles
Thanks,
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org