I use EJML to solve a linear equation system.
EJML uses doubles. My inputs (and expected outputs) are integers. I will omit the .000 from the toString().
My Matrix A looks like this (though it is ~1000x1000):
1 0 0 0 0
1 -1 1 0 0
0 1 -1 1 0
0 0 1 -1 1
0 0 0 0 1
My b is just a vector with a value in the first and the last index, the rest is 0.
{-10 0 0 0 10}'
For size 5x5 I can use EJML just fine, but for my 1000x1000 Matrix I get a Solution contains uncountable numbers
-Error.
The result looks like this:
{NaN NaN NaN ... NaN -Infinity -Infinity 1}'
My code looks like this (the matrices are correct, I checked that via Sysout and Debugger):
// Setup A
// Setup b
SimpleMatrix x = A.solve(b);
Now I assume my System somehow behaves badly. Sadly I'm not that much into matrices, so I assume I'm maybe using the wrong methods to solve this particular problem. The other thing I can think of is that double-precision gets in my way.
Is there anything I can do or is EJML simply not the right tool here?