HELP REQUEST: core.matrix setup with aljabr implementation

41 views
Skip to first unread message

Seamus O'Keefe

unread,
Jul 20, 2017, 9:51:07 PM7/20/17
to Numerical Clojure
Hi.  I was wondering if someone could point me in the right direction on getting core.matrix set up for ClojureScript using the aljabr implementation.

I have the following:

(ns hellomatrix.core
  (:require [quil.core :as q :include-macros true]
            [quil.middleware :as mw]
            [clojure.core.matrix :as m :include-macros true]
            [thinktopic.aljabr.core :as nd :include-macros true]))

(enable-console-print!)
(m/set-current-implementation thinktopic.aljabr.core)
(m/implementation-check)

Which gives me a "No current clojure.core.matrix implementation available (no canonical)" error.  Not sure what to try next, as my many Google searches have come up with nothing.  Anyone's help would be greatly appreciated!

Mars0i

unread,
Jul 21, 2017, 5:01:22 AM7/21/17
to Numerical Clojure
Assuming that you have aljabr included in project.clj, the correct syntax for the second to last line in your code should be:

(m/set-current-implementation :aljabr)

Here's what I have in project.clj:

:dependencies [...
                         [thinktopic/aljabr "0.1.2-SNAPSHOT"]
                         ...]

Here's an illustration at a Clojure prompt, but I believe I had aljabr working with Clojurescript, too.  It's been a while since I experimented with aljabr.

user=> (use 'clojure.core.matrix)
nil
user=> (set-current-implementation :aljabr)
:aljabr
user=> (matrix [[1 2][3 4]])
#object[thinktopic.aljabr.core.NDArray2float64 0x5159fd25 "{:offset 0, :type :float64, :size 4, :total 4, :shape [2 2], :stride [2 1], :data #object[\"[D\" 0x4f844655 \"[D@4f844655\"]}"]

Seamus O'Keefe

unread,
Jul 21, 2017, 8:41:35 AM7/21/17
to numerica...@googlegroups.com
Thanks for the reply.

I have the 0.1.1 release specified in my dependencies, which could be the issue, but the version you have isn't available at clojars, so I'm not sure where to obtain 0.1.2-SNAPSHOT.

Also, when I use the :aljabr keyword to set the implementation in Clojurescript, it gives the following message:

INFO: No dynamic loading of implementations in Clojurescript.
You must require an implementation explicitly in a namespace, for example thinktopic.aljabr.core

--
You received this message because you are subscribed to a topic in the Google Groups "Numerical Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/numerical-clojure/tSM7WvnHXRE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to numerical-clojure+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mars0i

unread,
Jul 22, 2017, 8:42:11 AM7/22/17
to Numerical Clojure
Seamus, sorry about that--I forgot that set-current-implementation doesn't work in Clojurescript.  Please see Jeff Rose's response in the next thread.  He certainly knows more than I do. 

(If you want to use 0.1.2-SNAPSHOT I think you have to get the source by installing the aljabar git repo locally and then compiling it and installing the results locally.   I haven't done this recently, so I don't want to give you the wrong advice, so I won't say more, but it's easy to do.)
To unsubscribe from this group and all its topics, send an email to numerical-cloj...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages