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

(matrix/set-current-implementation :vectorz) or (set-current-implementation :vectorz); which one is correct? #72

Open
madeinquant opened this issue Dec 14, 2020 · 1 comment

Comments

@madeinquant
Copy link

What is the difference between both statements?

  1. with a ns matrix, (matrix/set-current-implementation :vectorz)
  2. without a ns matrix , (matrix/set-current-implementation :vectorz)

dependencies

[net.mikera/core.matrix "0.62.0"]
[net.mikera/vectorz-clj "0.48.0"]

Create a matrix successfully.

(use 'clojure.core.matrix)
(use 'clojure.core.matrix.random)
(use 'clojure.core.matrix.operators)  ;; for +, -, * etc.
**(matrix/set-current-implementation :vectorz)**
(def v (matrix [1 2]))

#'cljsl.ch1.examples/v

Create a matrix unsuccessfully.

(use 'clojure.core.matrix)
(use 'clojure.core.matrix.random)
(use 'clojure.core.matrix.operators)  ;; for +, -, * etc.
**(set-current-implementation :vectorz)**
(def v (matrix [1 2]))

Execution error at clojure.core.matrix.implementations/get-canonical-object (implementations.clj:64).
Unable to find implementation: [:vectorz]
@mikera
Copy link
Owner

mikera commented Jan 20, 2021

They should be equivalent, so this is a bit surprising.

However the latter error strongly suggests that the :vectorz implementation hasn't yet been loaded. There could be some dependency issue or namespaces weren't properly loaded. core.matrix makes a "best efforts" attempt to find the implementation but will fail if it can't find it.

It might be possible to require one of the vectorz namespaces explicitly (maybe with :reload?) to force it to register 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