Search code examples
javamatrixejml

SimpleMatrix getMatrix().getData() issue


I am using EJML SimpleMatrix and I get the error The method getData() is undefined for the type Matrix when I try to return a double[] using the following code:

double[] test = result.getMatrix().getData();

Any help is appreciated!


Solution

  • I needed to import DMatrixRMaj and cast the .getMatrix() to a DMatrixRMaj then use .getData(). See code below

    double[] ret = ((DMatrixRMaj)result.getMatrix()).getData();