sgreben / piecewiselinear Goto Github PK
View Code? Open in Web Editor NEWtiny linear interpolation library for go
Home Page: https://pkg.go.dev/github.com/sgreben/piecewiselinear
License: MIT License
tiny linear interpolation library for go
Home Page: https://pkg.go.dev/github.com/sgreben/piecewiselinear
License: MIT License
Would a pull request to modify At() to return (float64, error) be accepted? In my use case I'd prefer not to rely on a magic value of 0 to indicate not found but would propose instead we returned something like 0, fmt.Errorf("value out of range") so the user could decide how to handle those cases?
Hello!
I've tried to run simple example before using in project:
f := piecewiselinear.Function{Y: []float64{100, 105, 120}}
f.X = piecewiselinear.Span(10, 16, len(f.Y))
fmt.Println(f.X)
fmt.Println(f.Y)
fmt.Println(
f.At(10), // f.At(x) evaluates f at x
f.At(11),
f.At(12),
f.At(13),
f.At(14),
f.At(15),
f.At(16),
)
And I've got the output:
[10 13 16]
[100 105 120]
0 101.66666666666667 103.33333333333334 105 110.00000000000001 115 120
Everything is fine except zero on defined X value.
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.