javamavennd4j

org.nd4j.linalg.factory.Nd4j.zeros(long, long)


Trying to use io.github.ensozos.core.MPdistance.getMPdistance using Maven, I get the following error:

Exception in thread "main" java.lang.NoSuchMethodError:
 'org.nd4j.linalg.api.ndarray.INDArray org.nd4j.linalg.factory.Nd4j.zeros(long, long)'
    at io.github.ensozos.core.MPdistance.getMassDistMatrix(MPdistance.java:116)
    at io.github.ensozos.core.MPdistance.getMPdistance(MPdistance.java:52)
    at Main.Main.main(Main.java:104)

I am using Nd4j version 1.0.0-beta7.

I believe that this is an error related to org.nd4j.linalg.api.ndarray.INDArray not having a zeros(long, long) method. Is there a way to solve the problem?


Solution

  • I ran mvn dependency:tree on your project and it turns out there were older versions being pulled in:

    io.github.ensozos:matrix-profile:jar:0.0.3:compile
    [INFO] |  \- org.nd4j:nd4j-native-platform:jar:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:android-arm:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:android-arm64:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:android-x86:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:android-x86_64:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:ios-arm64:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:ios-x86_64:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:linux-x86_64:1.0.0-beta2:compile
    [INFO] |     +- org.nd4j:nd4j-native:jar:macosx-x86_64:1.0.0-beta2:compile
    [INFO] |     \- org.nd4j:nd4j-native:jar:linux-ppc64le:1.0.0-beta2:compile
    [INFO] +- org.nd4j:nd4j-native:jar:1.0.0-beta7:compile
    [INFO] |  +- org.nd4j:nd4j-native:jar:windows-x86_64:1.0.0-beta7:compile
    [INFO] |  +- org.nd4j:nd4j-native-api:jar:1.0.0-beta7:compile
    [INFO] |  \- org.nd4j:nd4j-api:jar:1.0.0-beta7:compile
    [INFO] |     \- org.nd4j:protobuf:jar:1.0.0-beta7:compile
    [INFO] +- org.datavec:datavec-api:jar:1.0.0-beta7:compile
    [INFO] |  +- org.nd4j:jackson:jar:1.0.0-beta7:compile
    [INFO] |  \- org.nd4j:nd4j-common:jar:1.0.0-beta7:compile
    [INFO] |     \- org.nd4j:guava:jar:1.0.0-beta7:compile
    [INFO] \- org.deeplearning4j:deeplearning4j-parallel-wrapper:jar:1.0.0-beta7:compile
    [INFO]    +- org.nd4j:nd4j-parameter-server:jar:1.0.0-beta7:compile
    [INFO]    |  +- org.nd4j:nd4j-parameter-server-model:jar:1.0.0-beta7:compile
    [INFO]    |  \- org.nd4j:nd4j-aeron:jar:1.0.0-beta7:compile
    [INFO]    \- org.nd4j:nd4j-parameter-server-client:jar:1.0.0-beta7:compile
    

    (See beta2 vs beta7) I would suggest just taking the source code of this library and updating it. A fork is needed unless the author of the library intends to update the version.

    Updating the version that's included with your project won't work because some changes from beta2 to 7 were done that broke the backwards compatibility here.