public virtual void ConstructorTests() { InsightsVector iv = new InsightsVector(10, 3.0); Assert.True(iv.size() == 10); for (int i = 0; i < iv.size(); i++) { Assert.True(iv.get(i) == 3.0); } double[] data = new double[] { 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0 }; InsightsVector iv3 = new InsightsVector(data, false); for (int i = 0; i < iv3.size(); i++) { Assert.True(iv3.get(i) == 3.0); } }
public virtual void SolverTestSimple() { double[][] A = new double[][] { new double[] { 2.0 } }; double[] B = new double[] { 4.0 }; double[] solution = new double[] { 2.0 }; InsightsMatrix im = new InsightsMatrix(A, true); InsightsVector iv = new InsightsVector(B, true); InsightsVector solved = im.solveSPDIntoVector(iv, -1); for (int i = 0; i < solved.size(); i++) { Assert.True(solved.get(i) == solution[i]); } }
public virtual void TimesVectorTestSimple() { double[][] A = new double[][] { new double[] { 1.0, 1.0 }, new double[] { 2.0, 2.0 } }; double[] x = new double[] { 3.0, 4.0 }; double[] solution = new double[] { 7.0, 14.0 }; InsightsMatrix im = new InsightsMatrix(A, true); InsightsVector iv = new InsightsVector(x, true); InsightsVector solved = im.timesVector(iv); for (int i = 0; i < solved.size(); i++) { Assert.True(solved.get(i) == solution[i]); } }