You'll want to modify incanter.internal/transform-with and
incanter.internal/combine-with to recognize the sparse matrix class.
You'll also want to implement the equivalent of the incanter.Matrix
java class that implements the Clojure sequence interfaces, so that
the sparse matrix class will behave like a Clojure sequence.
Good luck and let me know how it goes, or if you have additional questions,
David
I'm not an experienced Java programmer, so tell me if this seems
reasonable: I'll create an abstract superclass Matrix with the sole
purpose of containing DenseMatrix and SparseMatrix. So all methods of
Matrix will now be abstract methods, but it will still implement iseq
and counted (via abstract methods -- is this legal?). Then each of
the DenseMatrix and SparseMatrix classes will extend their respective
Parallel Colt classes and Matrix. In this way, no clojure would need
to be modified and all type hints could stay with Matrix. We would
only need a new constructor function for SparseMatrix objects.
Uh-oh... I just checked and Java does not have multiple inheritance,
so is there another way that DenseMatrix can somehow inherit from
Matrix and from DenseColDoubleMatrix2D simultaneously (and similarly
for sparse)?
Thanks,
Ian
--
Ian Fiske
PhD Candidate
Department of Statistics
North Carolina State University
Yep, this is the weakness of Java's single inheritance, but your
approach can still work if you make incanter.Matrix an interface that
both the dense and sparse versions of the Matrix class implement.
There will just be redundancy in the implementations of Clojure's
sequence interfaces in the two classes.
David
http://code.google.com/p/clj-multiarray/
EPL licenced.
--Joel
On Feb 1, 4:51 pm, David Edgar Liebke <lie...@gmail.com> wrote:
> Excellent!
>
> On Mon, Feb 1, 2010 at 6:12 PM, Bradford Cross
>
> <bradford.n.cr...@gmail.com> wrote:
> > Is anyone picking things up with sparse matrices? I am going to convert my
> > nested-maps-as-sparse-matrices pattern to use real sparse matrices. So if
> > nobody has done it, then I am going to do it now.
>
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2634/5433 - Release Date: 12/02/12
I was looking at Incanter for a a project, but I didn't see any support for complex matrices. Is that in the offing?
Brent Meeker
I plan to try to port Incanter to matrix-api (when I'll find some free time...)