Skip to content

Commit

Permalink
Issue #161 Fixed so that when Min x is used at argument to curve GetY…
Browse files Browse the repository at this point in the history
… it will return Y value for Min x
  • Loading branch information
AndersMalmgren committed Jun 11, 2018
1 parent ebdfca7 commit 11a4729
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions FreePIE.Core/Common/CurveMath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public static double SolveCubicSpline(IList<Point> knownSamples, double z)

if (np > 1)
{
if (knownSamples[0].X == z) return knownSamples[0].Y;

double[] a = new double[np];

Expand Down Expand Up @@ -182,13 +183,13 @@ public static double SolveCubicSpline(IList<Point> knownSamples, double z)

private static void SolveTridiag(double[] sub, double[] diag, double[] sup, ref double[] b, int n)
{
/* solve linear system with tridiagonal n by n matrix a
using Gaussian elimination *without* pivoting
where a(i,i-1) = sub[i] for 2<=i<=n
a(i,i) = diag[i] for 1<=i<=n
a(i,i+1) = sup[i] for 1<=i<=n-1
(the values sub[1], sup[n] are ignored)
right hand side vector b[1:n] is overwritten with solution
/* solve linear system with tridiagonal n by n matrix a
using Gaussian elimination *without* pivoting
where a(i,i-1) = sub[i] for 2<=i<=n
a(i,i) = diag[i] for 1<=i<=n
a(i,i+1) = sup[i] for 1<=i<=n-1
(the values sub[1], sup[n] are ignored)
right hand side vector b[1:n] is overwritten with solution
NOTE: 1...n is used in all arrays, 0 is unused */
int i;
/* factorization and forward substitution */
Expand Down

0 comments on commit 11a4729

Please sign in to comment.