On Monday, 7 January 2013 15:53:20 UTC+8, Konrad Hinsen wrote:

> Mikera writes: 
>
>  > Initial tests seem to suggest that supporting N-dimensional arrays 
>  > should be pretty easy in terms of the API itself. We could also 
>  > provide fast-paths for 1D and 2D arrays. 
>  > 
>  > Of course, actual support for N-dimensional arrays would depend on 
>  > the underlying implementation. 
>
> There are a few array implementations that support N-d arrays, for example 
> the ones in JHDF5 (https://wiki-bsse.ethz.ch/display/JHDF5) and in netCDF 
> (http://www.unidata.ucar.edu/software/netcdf-java/). 
>
>  > Yep, the idea is to be flexible enough to support many different 
> implementations. 
>
> The real problem I see in making all this practically usable is 
> efficient conversion between implementations. The fragmentation of the 
> scientific computing ecosystem in Java makes it nearly impossible to 
> get any real work done without some conversion between array 
> libraries. If I want to read a matrix from an HDF5 file and then 
> calculate its eigenvalues, I need to convert from HDF5 arrays to Colt 
> (or whatever) arrays. Some libraries provide a way to construct an N-d 
> array from a 1-d data storage area plus a shape vector, without 
> copying the data. I think it's important to leverage such 
> functionality in a Clojure API in order to let conversion happen as 
> much as possible behind the scenes. 
>

I've actually got this working to an extent via a "coercion" protocol that 
can be extended to different implementations. It's not perfect yet but it 
works, e.g. you can do

(+ m [[2 0] [0 2]])

And it is smart enough to figure out how to coerce the nested persistent 
vectors into something that the implementation for matrix m understands.

There's a lot of scope to make this much more efficient of course....
 

>
> BTW, I started my own attempt at something similar a while ago, but 
> never found the time to get it to a usable state: 
>
>    https://code.google.com/p/clj-multiarray/ 
>
> Konrad. 
>

Very interesting, thanks! I like the use of protocols to construct the 
specialised array types in particular.

Would you be willing and interested to work on merging this into the 
"core.matrix" code base? I had started on a simple NDArray implementation 
myself but your code is clearly much further along than mine.....

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to