Matrix allocation as single array instead of array of arrays
Change matrix (and any other) allocation/member from:
double[][]
to:
double[] OR double[,]
and handle indexing etc internally. Not having matrix data as one continuous memory area is not a good thing for e.g. interop. Additionally, allocation is a lot slower for many rows.
11
votes
Math.NET Numerics uses double[] for matrice data storage (mainly for native code compatibility)
1 comment
-
Greg
commented
I have seen benchmarks that show jagged arrays[][] are faster than block arrays[,].
http://www.heatonresearch.com/content/choosing-best-c-array-type-matrix-multiplication