I’m trying to use GitHub - adereth/apache-commons-matrix: Implementation of core.matrix backed by Apache Commons Math matrices 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
, from 2013!? Surprise, surprise, there seems to have been some code
rot. Several issues in particular:
-
The code in the mvn repo is missing an extension
(extend-protocol mp/PMatrixMultiply)
present in the github repo here
apache-commons-matrix/core.clj at ef1e2bccbee7f8b8f5d9fbfdfe7639c23f6c406f · adereth/apache-commons-matrix · GitHub ? -
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
-
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?