Home > database >  EMJL Exception in thread "main" java.lang.RuntimeException: Uncompilable code - cannot fin
EMJL Exception in thread "main" java.lang.RuntimeException: Uncompilable code - cannot fin

Time:04-23

I am trying to get EJML to work, especially to create matrices with random numbers. Creating regular a SimpleMatrix and DMatrixRMaj works well. But I keep getting java.lang.RuntimeException: Uncompilable code - cannot find symbol when using more advanced statements such as

DMatrixRMaj D2 = new RandomMatrices_DDRM.createSymmetric(20,-2,3,rand);

or

SimpleMatrix S2 = new SimpleMatrix.random64(20,20,-2,3,rand);

Below is the full code and error messages.

Thanks!

/Benny

package com.benny.evosim;

import java.util.*;

import org.ejml.simple.SimpleMatrix;

import org.ejml.data.DMatrixRMaj;

import org.ejml.dense.row.RandomMatrices_DDRM;

public class EvoSim {

public static void main(String[] args) {

    EvoSim evoSimInstance = new EvoSim();
    evoSimInstance.start();
}

public void start() {
    
    Random rand = new Random();
    SimpleMatrix A = new SimpleMatrix(3,3);
    DMatrixRMaj​ D  = new DMatrixRMaj(3,3) ; 
    
    DMatrixRMaj D2 = new RandomMatrices_DDRM.createSymmetric(20,-2,3,rand);
    SimpleMatrix S2 = new SimpleMatrix.random64(20,20,-2,3,rand);
    
    A.print();
    }
}

ERROR MESSAGE

--------------------------< com.benny:evosim >--------------------------
Building evosim 1.0-SNAPSHOT
--------------------------------[ jar ]---------------------------------

--- exec-maven-plugin:3.0.0:exec (default-cli) @ evosim ---
Exception in thread "main" java.lang.RuntimeException: Uncompilable code - cannot find symbol
  symbol:   variable RandomMatrices_DDRM
  location: class com.benny.evosim.EvoSim
    at com.benny.evosim.EvoSim.start(EvoSim.java:1)
    at com.benny.evosim.EvoSim.main(EvoSim.java:26)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)

CodePudding user response:

Create an instance of RandomMatrices_DDRM before a method. In this case the method is actually symmetric

DMatrixRMaj d2 = new RandomMatrices_DDRM().symmetric(20,-2,3,rand);

and similarly for SimpleMatrix

  • Related