Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apache-commons-matrix not playing well with core.matrix? #358

Open
rbelew opened this issue May 2, 2022 · 1 comment
Open

apache-commons-matrix not playing well with core.matrix? #358

rbelew opened this issue May 2, 2022 · 1 comment

Comments

@rbelew
Copy link

rbelew commented May 2, 2022

I'm trying to use https://github.com/adereth/apache-commons-matrix to
access the functionality of Apache Commons Math, via the Maven repo
https://mvnrepository.com/artifact/org.apache.commons/commons-math3 .

My main guide is Matt Adereth's
http://adereth.github.io/blog/2013/11/08/core-dot-matrix-plus-apache-commons-math/
, from 2013!? Surprise, surprise, there seems to have been some code
rot. Several issues in particular:

  1. The code in the mvn repo is missing an extension (extend-protocol mp/PMatrixMultiply) present in the github repo here
    https://github.com/adereth/apache-commons-matrix/blob/ef1e2bccbee7f8b8f5d9fbfdfe7639c23f6c406f/src/apache_commons_matrix/core.clj#L192 ?

  2. Matt's guide suggests using (m/set-current-implementation :apache-commons), but
    clojure.core.matrix.implementations/KNOWN-IMPLEMENTATIONS has as
    its entry :commons-math apache-commons-matrix.core

  3. But (m/set-current-implementation :commons-math) throws a
    different error:

     Error loading core.matrix implementation:  apache-commons-matrix.core
     #error {
     :cause Too many arguments to throw, throw expects a single Throwable instance
     :via
     [{:type clojure.lang.Compiler$CompilerException
     :message Syntax error compiling throw at (apache_commons_matrix/core.clj:19:13).
     :data #:clojure.error{:phase :compile-syntax-check, :line 19, :column 13, :source apache_commons_matrix/core.clj, :symbol throw}
     :at [clojure.lang.Compiler analyzeSeq Compiler.java 7132]}
    

    indeed, the referenced line uses what looks like a bad call to
    clojure' (throw):

     (throw (ex-info "Apache Commons Math matrices only supports up to 2 dimensions") {:requested-shape dims})
    

anyone trying to make this potentially useful interop work?

@mikera
Copy link
Owner

mikera commented May 2, 2022

It would be useful interop! I'm not using apache commons matrix library myself, but happy to merge core.matrix PRs if needed to help make it work if anyone wants to try updating the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants