@Test public void test1DSolving () { TriDiagonalMatrix M = new TriDiagonalMatrix(0); Vector D = new Vector(0); Vector X = M.solve(D); Assert.assertEquals(new Vector(1), X); D = new Vector(1); X = M.solve(D); Assert.assertEquals(new Vector(Double.NaN), X); M = new TriDiagonalMatrix(1); D = new Vector(0); X = M.solve(D); Assert.assertEquals(new Vector(0), X); D = new Vector(1); X = M.solve(D); Assert.assertEquals(new Vector(1), X); }
public Vector solve (Vector d) { if (d.size() != _n) throw new IllegalArgumentException("Attempt to find tri-diagonal solution with improper-sized vector"); double[] x = new double[_n]; solve(d, x, 0, (_n > 0 ? _b[0] : 0), (_n > 1 ? _c[0] : 0), (_n > 0 ? d.coord(0) : 0)); return new Vector(x); }
TriDiagonalMatrix { public Vector solve (Vector d) { if (d.size() != _n) throw new IllegalArgumentException("Attempt to find tri-diagonal solution with improper-sized vector"); double[] x = new double[_n]; solve(d, x, 0, (_n > 0 ? _b[0] : 0), (_n > 1 ? _c[0] : 0), (_n > 0 ? d.coord(0) : 0)); return new Vector(x); } }
TriDiagonalMatrix { public Vector solve (Vector d) { if (d.size() != _n) throw new IllegalArgumentException("Attempt to find tri-diagonal solution with improper-sized vector"); double[] x = new double[_n]; solve(d, x, 0, (_n > 0 ? _b[0] : 0), (_n > 1 ? _c[0] : 0), (_n > 0 ? d.coord(0) : 0)); return new Vector(x); } TriDiagonalMatrix(double... entries); }
TriDiagonalMatrix { public Vector solve (Vector d) { if (d.size() != _n) throw new IllegalArgumentException("Attempt to find tri-diagonal solution with improper-sized vector"); double[] x = new double[_n]; solve(d, x, 0, (_n > 0 ? _b[0] : 0), (_n > 1 ? _c[0] : 0), (_n > 0 ? d.coord(0) : 0)); return new Vector(x); } TriDiagonalMatrix(double... entries); void setPrecision(double precision); Vector solve(Vector d); Vector times(Vector X); }
TriDiagonalMatrix { public Vector solve (Vector d) { if (d.size() != _n) throw new IllegalArgumentException("Attempt to find tri-diagonal solution with improper-sized vector"); double[] x = new double[_n]; solve(d, x, 0, (_n > 0 ? _b[0] : 0), (_n > 1 ? _c[0] : 0), (_n > 0 ? d.coord(0) : 0)); return new Vector(x); } TriDiagonalMatrix(double... entries); void setPrecision(double precision); Vector solve(Vector d); Vector times(Vector X);  }