Since this is a specific helper function used to implement the actual protocol PQRDecomposition/qr, and the helper itself is written in terms of core.matrix protocols apparently, then any core.matrix implementation should work. So even the default core.matrix implementation (I think vectorz-clj is included by default, as well as the protocols working with double arrays and persistent vectors) should work with this as-is.
(defn tstHouse [g]
(let [n (first (m/shape g))
us (double-array n)
gamma (double-array n)]
(def rv (m/householder-qr lap3 0 n n us gamma))
(prn rv)
)
)
generates this compile error:
Syntax error compiling at (/private/var/folders/v0/f06jgp6n6rq140nhcb3_9xpw0000gp/T/form-init6998699632090313895.clj:4:13).
No such var: m/householder-qr
I don’t know the specifics of this particular case but I had similar issues. Every implementations of ‘core.matrix’ seemed to have a different broken/unimplemented subset. For instance the default backend doesnt implement the LU decomposition, but it you switch to ‘vectorz’ then it works
Fortunately it’s really easily to swap backends, so I’d change backends depends on what I was doing
Here is the poorly documented solution I figured out after inspecting the code. The point you are missing is that, while you “can” invoke the householder function, you really aren’t meant to. Instead, you leverage the qr protocol function, which in turn uses the householder helper function in its default implementation (the PQRDecomposition protocol is extended to the base Object type). So then it “just works” if you provide it a matrix implementation that has all the requisite protocols. The other implicit/undocumented trick is that you have to pass an options map on what to return. It looks like it takes a sequence of keys, expecting [:Q :R] e.g. if you want both back. There is also an option for the key :compact, which is boolean supplied to the helper compute-r, which I have no idea what it’s supposed to do.
Just realized in re-reading this, the stuff in the let binding is not necessary:
(defn qr [g] (mp/qr g {:return [:Q :R]})))
Since you already have a valid matrix, just use the qr protocol function, e.g.
(mp/qr g {:return [:Q :R]})
If you want to submit your own args for the lower level householder function, then the stuff you supplied would come into play (although apparently it’s not in the interface).