public static Vector InterpolatePeriodic(Vector y_knots, Grid grid, int deg) { if (deg == 2) { return(y_knots); } Matrix A = DeBoorMethods.SlowCreateInterpolationPeriodicMatrix(grid, deg); int size = deg - 1; Vector spline = new Vector(size); for (int i = 0; i < size; i++) { spline[i] = A[2, i]; } int GridSize = y_knots.Length; A[0, GridSize - 2] = spline[0]; A[0, GridSize - 1] = spline[1]; A[1, GridSize - 1] = spline[0]; A[GridSize - 2, 0] = spline[0]; A[GridSize - 1, 0] = spline[1]; A[GridSize - 1, 1] = spline[0]; Console.WriteLine(A); Vector coefs = Solver.BCGSTAB(A, y_knots, EPS); return(coefs); }