2

I want to create a Sparse Matrix using Universal Java Matrix package(UJMP)(https://ujmp.org/). I download a zip file (https://github.com/ujmp/universal-java-matrix-package) name universal-java-matrix-package-master. Unzip it.

I am using intellij Idea for java program. I create a folder UJMP in Intellij as java project and create a java file uj under the src folder of UJMP folder. Here I copy paste universal-java-matrix-package-master folder.

Now I write down code in my Uj.java file.

import org.ujmp.core.Matrix;
import org.ujmp.core.SparseMatrix;
public class Uj {
public static void main(String args[]){
Matrix sparse = SparseMatrix.Factory.zeros(4, 4);}}

Here I getting an error : Required: org.ujmp.core.Matrix Found: org.ujmp.core.SparseMatrix

To fix this problem I try something. I change my code as shown below

import org.ujmp.core.Matrix;
import org.ujmp.core.SparseMatrix;
public class Uj {
public static void main(String args[]){
SparseMatrix sparse = SparseMatrix.Factory.zeros(4, 4);
sparse.setAsDouble(2.0,0,0); }}

After change this previous error gone new error occurred that cannot resolve method setAsDouble.

For better understanding I attached a screenshot with this questionSparse Matrix

What should I do to fix this error?

Encipher
  • 1,370
  • 1
  • 14
  • 31
  • 1
    You should get a jar file from the releases at https://github.com/ujmp/universal-java-matrix-package/releases, then create a new java project in IntelliJ IDEA, then add this jar to the module dependencies: https://www.jetbrains.com/help/idea/working-with-module-dependencies.html. – CrazyCoder Jul 11 '18 at 18:43
  • After adding that dependency previous error gone. But at the compile time error occurred. `Error:(26, 24) java: package org.junit does not exist`, `Error:(26, 26) java: package no.uib.cipr.matrix does not exist`,`Error:(26, 24) java: package org.junit.runner does not exist`,`Error:(28, 40) java: package org.apache.commons.collections15 does not exist`,`Error:(26, 21) java: package javax.vecmath does not exist`,`Error:(27, 21) java: package org.ejml.data does not exist` etc. How could I overcome this? – Encipher Jul 11 '18 at 19:15
  • You can try using a Maven project and configure all the dependencies per https://ujmp.org/. – CrazyCoder Jul 11 '18 at 19:18
  • I hear about Maven Project lots of time. What is that Maven project? How to create it?Can I create it within my already existing project. I have a project name UJMP where I add the jar file dependency as you suggested. Can I create Maven project there? – Encipher Jul 11 '18 at 19:23
  • https://stackoverflow.com/a/7642607/104891 – CrazyCoder Jul 11 '18 at 19:24

0 Answers0