weyns49570 / efficient-java-matrix-library

Automatically exported from code.google.com/p/efficient-java-matrix-library
0 stars 0 forks source link

possible problem with solve with larger dimensions #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

private static void initRandom(DenseMatrix64F m) {
  for(int i = 0; i < m.numRows; i++) {
    for(int j = 0; j < m.numCols; j++) {
      m.set(i, j, Math.random());
    }
  }
}

private static void sTest(int r, int c) {
  System.out.println("sTest r: " + r + " c: " + c);
  DenseMatrix64F A = new DenseMatrix64F(r, c);
  DenseMatrix64F x = new DenseMatrix64F(c, 1);
  DenseMatrix64F b = new DenseMatrix64F(r, 1);
  initRandom(A);
  initRandom(b);
  CommonOps.solve(A, b, x);
}

sTest(3, 2); // fine
sTest(2, 401); // throws exception

What is the expected output? What do you see instead?

Should solve, instead throws exception

What version of the product are you using? On what operating system?

0.21, Windows

Please provide any additional information below.

Original issue reported on code.google.com by phube...@beyondcore.com on 1 Jul 2014 at 6:08

GoogleCodeExporter commented 9 years ago
You're trying to solve for a system with more unknowns than equations.  A 
pseudo-inverse is needed to find a solution which is valid.  I've improved the 
error message to catch this problem.

Original comment by peter.ab...@gmail.com on 17 Nov 2014 at 10:09