private void NewtonIterationProcess_GetQMatrix_ValidQMatrix() { FillListsCoordinationData(PathToTestTxt, out var listSrc, out var listDest); var qMatrixActual = ReadControlDataFromFile(PathToTestTxt + "\\qMatrix.txt", 7, 7); var nip = new NewtonIterationProcess(listSrc, listDest); var aMatrix = nip.FormingAMatrixTst(); var qMatrixExpected = nip.GetQMatrixTst(aMatrix); for (int row = 0; row < qMatrixExpected.RowCount; row++) { for (int col = 0; col < qMatrixExpected.ColumnCount; col++) { Assert.Equal(qMatrixExpected[row, col], qMatrixActual[row, col], 5); } } }
private void NewtonIterationProcess_GetMeanSquareErrorsMatrix_ValidMeanSquareErrorsMatrix() { FillListsCoordinationData(PathToTestTxt, out var listSrc, out var listDest); var mceMatrixActual = ReadControlDataFromFile(PathToTestTxt + "\\mceMatrix.txt", 7, 1); var nip = new NewtonIterationProcess(listSrc, listDest); var aMatrix = nip.FormingAMatrixTst(); var yMatrix = nip.FormingYMatrixTst(); var paramsTransformMatrix = nip.GetVectorWithTransformParametersTst(aMatrix, yMatrix); var vMatrix = nip.GetVMatrixTst(aMatrix, yMatrix, paramsTransformMatrix); var fCoefficient = nip.CalculateFCoefficientTst(vMatrix); var mCoefficient = nip.CalculateMCoefficientTst(fCoefficient); var qMatrix = nip.GetQMatrixTst(aMatrix); var mceMatrixExpected = nip.GetMeanSquareErrorsMatrixTst(qMatrix, mCoefficient); for (int row = 0; row < mceMatrixExpected.Count; row++) { Assert.Equal(mceMatrixExpected[row], mceMatrixActual[row, 0], 8); } }