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.

Re: [netcdf-java] Linear algebra on data read from a netCDF file

Konrad Hinsen wrote:
I would like to do some data processing in Clojure (a JVM language), with the data being read from a netCDF file. The processing involves mostly standard linear algebra operations, e.g. singular value decomposition.

Both Colt and JAMA contain all the operations I need, but unfortunately they use different multiarray implementations than netCDF. I looks like I'd have to copy the data between two array classes, which is a pretty stupid (and inefficient) thing to do. Is there any other option? For example a linear algebra library that works directly on Unidata's Java array classes? If there is no other way than copying, what would be the most efficient approach?

Thanks,
  Konrad.

_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/

Hi Konrad:

There are no known algebra packages using ucar.ma2.

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.

John



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: