Hi All.
I have been experimenting with the Java interop in Clojure by trying
to talk to the matrix maths library Jama:
(http://math.nist.gov/javanumerics/jama/doc/)
I can create a new Matrix if I specify row col integers for the
constructor and I have been able to read and write to the embedded
double array successfully, but I am failing to create a new matrix
from a converted vector.
The signature for the Java constructor I am trying to use is:
; Matrix(double[][] A)
(ns clojure-matrix
(:import (Jama Matrix)))
clojure-matrix=> (new Matrix (to-array-2d [[1.0 2.0] [3.0 4.0]])))
java.lang.ClassCastException: [[Ljava.lang.Object; cannot be cast to
[[D
java.lang.ClassCastException: [[Ljava.lang.Object; cannot be cast to
[[D
at clojure_matrix.eval__2370.invoke(Unknown Source)
at clojure.lang.Compiler.eval(Compiler.java:3891)
at clojure.lang.Repl.main(Repl.java:75)
clojure-matrix=> java.lang.Exception: Unmatched delimiter: )
java.lang.Exception: ReaderError:(105,1) Unmatched delimiter: )
at clojure.lang.LispReader.read(LispReader.java:164)
at clojure.lang.Repl.main(Repl.java:68)
Caused by: java.lang.Exception: Unmatched delimiter: )
at clojure.lang.LispReader$UnmatchedDelimiterReader.invoke
(LispReader.java:831)
at clojure.lang.LispReader.read(LispReader.java:130)
... 1 more
clojure-matrix=>
If I inspect the array produced by to-array-2d from closure the
elements look correct and are reported as doubles.
The Clojure is version is 20080916 (download from the Closure site).
Should this have worked?
Do I need do unbox (?) the doubles or something?
Suggestions welcome.
Thanks.
Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---