public Point tryFitSum(Point point, Point X) { MatrixCalculator matrixCalculator = new MatrixCalculator(); List<Point> pointList = matrixCalculator.prepareVectors(point); pointList = matrixCalculator.gramSchmidt(X, pointList); pointList.RemoveAt(0); mMatrix = matrixCalculator.createMatrix(point, X, pointList); nMatrix = matrixCalculator.createInverse(point, X, pointList); Point local = this.toLocal(point); Console.WriteLine("=== TO LOCAL: " + local.ToString()); //solver and modyfying local double[,] m = Solver.prepareEquations(mMatrix); Solver.Solve(m); for (int i = 0; i < point.Dimensions - 1; i++) { local.p[i] = m[i,point.Dimensions-1]; } Point global = this.toGlobal(local); Console.WriteLine("=== TO GLOBAL: " + global.ToString()); return global; }