Hi,
When I try to run the following simple code:
import org.nd4j.linalg.eigen.Eigen
import org.nd4j.linalg.factory.Nd4j
object App {
def main(args : Array[String]) {
val nd3 = Nd4j.create(Array[Float](1, 2, 3, 4), Array[Int](2,2));
println(Eigen.eigenvalues(nd3))
}
}
I get :
Exception in thread "main" java.lang.UnsupportedOperationException
at org.nd4j.linalg.factory.BaseBlasWrapper.geev(BaseBlasWrapper.java:467)
at org.nd4j.linalg.eigen.Eigen.eigenvalues(Eigen.java:42)
Any ideas ? The other dl4j examples seem to work fine.
I've looked into this a bit. Posting some initial thoughts to get the discussion going.
The issue here is we need the geev BLAS routine (technically LAPACK routine), or use some other approach for calculating eigenvalues/eigenvectors. geev in BaseBlasWrappen isn't implemented, hence the UnsupportedOperationException.
For CPU, I had hoped we could utilize the LAPACK interface from netlib-java, however, this appears to be deprecated.
https://github.com/fommil/netlib-java/blob/master/legacy/src/main/java/org/netlib/lapack/LAPACK.java
The above link does reference another implementation, but I can't find what it is referring to. Even IntelliJ can't find it - "cannot resolve symbol" on the link after cloning + importing the netlib-java project. No luck searching in the netlib-java repo either (https://github.com/fommil/netlib-java/search?utf8=%E2%9C%93&q=LAPACK+language%3Ajava)
Might have to ask the author of netlib-java about that one.
Lapack dgeev method, for reference:
http://www.netlib.org/lapack/explore-html/d9/d8e/group__double_g_eeigen.html#ga66e19253344358f5dee1e60502b9e96f
Perhaps the easiest alternative would be to use the apache commons math math implementation, handling the conversion to/from INDArrays internally. It wouldn't be fast, but at least we'd have something that works. Might be a good option in the short term.
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/linear/EigenDecomposition.html
Replacing with: https://github.com/deeplearning4j/nd4j/issues/900
This is still not working as of 0.8.0, although all referenced issues are closed. I think this should get reopened.
@ziggystar Indeed, it looks like we need to implement at least syevr():
https://github.com/deeplearning4j/nd4j/search?q=syevr
Might be a job for @rcorbish ?
I'll take a look.
Cuda supports limited eigen functions - symmetric matrices only
Merged.
This is still happening as of 0.9.1 although related issues are closed.
java.lang.UnsupportedOperationException
at org.nd4j.linalg.factory.BaseBlasWrapper.geev(BaseBlasWrapper.java:462)
at org.nd4j.linalg.eigen.Eigen.eigenvalues(Eigen.java:43)
java.lang.UnsupportedOperationException
at org.nd4j.linalg.factory.BaseBlasWrapper.geev(BaseBlasWrapper.java:462)
at org.nd4j.linalg.eigen.Eigen.eigenvectors(Eigen.java:95)
Is there a workaround that I don't see in the references?
I think that's been added in 0.9.2-SNAPSHOT. Could you give it a try?
Not working for me with 1.0.0-beta (nd4j-api and nd4j-native)
@johnhearn @jeremy-lc Please open another issue, and let's have @rcorbish take a look at that again if that's OK? :)
Happy to take a look.
Sent from my Samsung Galaxy smartphone.
-------- Original message --------
From: Samuel Audet notifications@github.com
Date: 6/7/18 9:45 PM (GMT-05:00)
To: deeplearning4j/deeplearning4j deeplearning4j@noreply.github.com
Cc: Richard Corbishley rcorbish@outlook.com, Mention mention@noreply.github.com
Subject: Re: [deeplearning4j/deeplearning4j] UnsupportedOperationException in Eigen.eigenvalues (#927)
@johnhearnhttps://github.com/johnhearn @jeremy-lchttps://github.com/jeremy-lc Please open another issue, and let's have @rcorbishhttps://github.com/rcorbish take a look at that again if that's OK? :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/deeplearning4j/deeplearning4j/issues/927#issuecomment-395619204, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE5Yq3n83VqzRXloZP8oogZkWhZPiRikks5t6dcegaJpZM4GudEe.
Thanks, I've just created a new issue
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.