Search code examples
javaejml

Error when assigning value for matrix element with Equation


I have several simple lines of code in Java using ejml Equation as follows:

eq.process("T = zeros(2,3)");
eq.process("T(1,1)=10");
eq.process("T(1,0)=1");
eq.process("T(1,2)=8");

The last line doesn't work, throwing error "Submatrix out of bounds. Lower extent". Apparently, matrix T has size of 2x3 and indexes start from 0 so T(1,2) mus be valid. I also tried to convert to raw matrix as follows:

DenseMatrix64F m=eq.lookupMatrix("T");
m.set(1, 2, 7);

And it works. Is it a bug from this library?


Solution

  • That is a bug. Internally the bounds check was being done col,row instead of row,col.

    Latest github code has the fix. You can also checkout the follow SHA.

    ec2dffbabc38c1e86f1ef58da2553cec9287b0f3
    

    Asking questions on Stackoverflow is fine since more people see it. However please report bugs and feature requests using github and the message board. Those will send me a message right away, but who knows when I'll see it over here.