/// @return DhbMatrixAlgebra.SymmetricMatrix public SymmetricMatrix ErrorMatrix() { double[,] rows = new double[2, 2]; rows[1, 1] = 1.0 / (_sumXX * _sum1 - _sumX * _sumX); rows[0, 1] = _sumXX * rows[1, 1]; rows[1, 0] = rows[0, 1]; rows[0, 0] = _sumXX * rows[1, 1]; SymmetricMatrix answer = null; try { try { answer = SymmetricMatrix.FromComponents(rows); } catch (DhbIllegalDimension) { } } catch (DhbNonSymmetricComponents) { } return(answer); }
/// @return DhbEstimation.EstimatedPolynomial public EstimatedPolynomial Evaluate() { for (int i = 0; i < _systemConstants.Length; i++) { for (int j = i + 1; j < _systemConstants.Length; j++) { _systemMatrix[i, j] = _systemMatrix[j, i]; } } try { LUPDecomposition lupSystem = new LUPDecomposition(_systemMatrix); double[,] components = lupSystem.InverseMatrixComponents(); LUPDecomposition.SymmetrizeComponents(components); return(new EstimatedPolynomial( lupSystem.Solve(_systemConstants), SymmetricMatrix.FromComponents(components))); } catch (DhbIllegalDimension) { } catch (DhbNonSymmetricComponents) { } return(null); }