Re:Why I Still Use Python for High Performance Scientific Co...
by eonwe on Wednesday December 02, 2015 @12:09PM
(#10664188)
For normal dense matrix laid out as a double[] and accessed directly as i* N_ROW + j probably won't get its loop check elided. For double[][] I would _think_ that happens more easily.
But how are sparse matrices then generally laid out? A naive approach would be some hash map, perhaps with some locality, in which I don't see JIT problems.
Re:Why I Still Use Python for High Performance Scientific Co...
by srean on Wednesday December 02, 2015 @12:49PM
(#10664516)
There are some defacto standard formats such as CRS, CSC, list of tuples etc. Layout of the third should be obvious and it is not used much for cases where speed matters because one loses locality in this layout. For the other two they are laid out column after column (or row by row), row ids, and offsets to indicate the start and end of columns (rows).
Re:Why I Still Use Python for High Performance Scientific Co...
by eonwe on Thursday December 03, 2015 @05:57AM
(#10668941)
Thanks, this helped. Using CSC and CRS is probably quite problematic with JVM bounds check elimination (or the lack of it). So if they would need to be used on JVM, I think it would be wise to drop the safety and use _sun.misc.Unsafe_ for unchecked array access.
A structural problem of JVM is that its runtime semantics is over-specified, there is very little room for the JIT to do its stuff. For example function arguments are evaluated right to left, there goes an opportunity for parallelism.