linux build environment updated
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/chfenger/goNum"
|
||||
"github.com/nuknal/goNum"
|
||||
)
|
||||
|
||||
type LagrangeInterpolator struct {
|
||||
|
||||
@@ -46,13 +46,13 @@ func (p PolynomialInterpolator) Predict(x float64) float64 {
|
||||
return y
|
||||
}
|
||||
|
||||
func InterpPolynomial(x []float64, y []float64, xq float64) float64 {
|
||||
func InterpPolynomial(x []float64, y []float64, xq float64, degree int) float64 {
|
||||
if len(x) != len(y) {
|
||||
return 0.0
|
||||
}
|
||||
|
||||
start, end := FindClosestSubset(x, xq, 4)
|
||||
interp := &PolynomialInterpolator{Degree: 3}
|
||||
start, end := FindClosestSubset(x, xq, degree+1)
|
||||
interp := &PolynomialInterpolator{Degree: degree}
|
||||
interp.Fit(x[start:end+1], y[start:end+1])
|
||||
return interp.Predict(xq)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user