tel/clatrix

Would you consider a pr for get and submatrix? (:Question)

Closed this issue · 4 comments

Some Criterium benchmark checks revealed a significant performance potential for the core API function 'get'. Based on this, a new macro 'submatrix' could be introduced, which gives a significantly better performance than the current implementation via 'matrix'.

You may check the proposal prototypes here, lines 49 and 85.

You find the performance results here. Please note that the warnings relate to a variant the I do not advocate here.

I could imagine to intoduce the get variant as 'get-2D' (and 'get-1D' resp.).

Approach looks sound - note that we have protocols already to do this in core.matrix however.

See e.g.:

  • clojure.core.matrix.protocols/PIndexedAccess for the 1d / 2d getting cases

My suggestion is just to implement and/or call these directly?

My thought was, having these kind of changes (also definitively 'set' and most likely others) in Clatrix would allow a consistent implementation extension in core.matrix.

I would argue that a "dangling" JBLAS based implementation of a few selected functions in core.matrix independently of Clatrix is conceptionally weak.

Sorry to be clear: I wasn't suggesting using JBlas separately from Clatrix. What I was saying is that you shouldn't need to introduce a new separate PGetByIndex protocol in Clatrix when it can just use the core.matrix equivalent (i.e. PIndexedAccess).

I think we´re on the same page now. I´ll proceed accordingly.