NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
On 15.10.2009, at 17:51, John Caron wrote:
The most efficient thing to use is this method on the Array class: public java.lang.Object get1DJavaArray(java.lang.Class wantType);this will give back the java primitive array, without copying if possible. So if you have a double Array:double[] ja = (double []) ma.get1DJavaArray( double.class);you then have to see if your chosen algebra package has a constructor that can wrap the java array without copying it. You will need the shape information:int[] shape = ma.getShape();Good luck, and drop me a note if you find out anything useful to others with the same problem.
Thanks! This should at least be efficient. I quickly checked the Colt implementation, which does have a constructor for its array class that takes the plain Java array plus the shape information, so at least in theory this should be simple. If/when I get it to work, I'll post my solution here.
On 15.10.2009, at 18:15, Doug Lindholm wrote:
You might also look at Apache Commons Math: http://commons.apache.org/math/
That looks like an interesting library as well, but its linear algebra routines use Java-style 2D arrays, so it's not a good match for my purposes.
Thanks to both of you for your suggestions! Konrad.
netcdf-java
archives: