public void MFW_HW() { var A = new Matrix(4, 4); A.Elem[0][0] = 5; A.Elem[0][1] = 20; A.Elem[0][2] = 49; A.Elem[0][3] = 4; A.Elem[1][0] = 55; A.Elem[1][1] = 17; A.Elem[1][2] = 12; A.Elem[1][3] = 19; A.Elem[2][0] = 0; A.Elem[2][1] = 11; A.Elem[2][2] = 47; A.Elem[2][3] = 61; A.Elem[3][0] = 48; A.Elem[3][1] = 60; A.Elem[3][2] = 9; A.Elem[3][3] = 70; var F = new Vector(4); for (int i = 0; i < 4; i++) { F.Elem[i] = 1; } Householder.StartSolverQR(A, F); Assert.True(true); }
public void When_Solve_ORT() { // Arrange Matrix A = new Matrix(3, 3); A.Elem[0][0] = 2; A.Elem[0][1] = 3; A.Elem[0][2] = -1; A.Elem[1][0] = 1; A.Elem[1][1] = -2; A.Elem[1][2] = 1; A.Elem[2][0] = 1; A.Elem[2][1] = 0; A.Elem[2][2] = 2; Vector F = new Vector(3); F.Elem[0] = 9; F.Elem[1] = 3; F.Elem[2] = 2; // Act Vector gramSchmidtC = GramSchmidt.StartModifiedSolverQR(A, F); Vector gramSchmidtM = GramSchmidt.StartModifiedSolverQR(A, F); Vector givens = Givens.StartSolverQR(A, F); Vector householder = Householder.StartSolverQR(A, F); // Assert Assert.That(A * gramSchmidtC == F); Assert.That(A * gramSchmidtM == F); Assert.That(A * givens == F); Assert.That(A * householder == F); }