# README
B-Spline function support for Go
Example With Plots
This library provides 2 implementations of B-Spline using the same API: one that evaluates fully in Go (CPU, slower)
and one using GoMLX
for ML and/or accelerators.
Highlights:
- Support for zero, constant or linear extrapolation beyond the region defined by the knots.
- Derivative B-spline.
- GoMLX "vector" version in github.com/gomlx/gomlx/ml/layers/kan
- Building block to build KAN: Kolmogorov–Arnold Networks
- Batch evaluation.
- Multiple control points -- for various different B-splines to be applied to the same input points. They share the same basis function calculation for improved efficiency.
- Plotting using
GoNB
Jupyter Notebook. - See demo notebook with some plot samples.
Changes Log
v0.2.0
- Moved GoMLX code to github.com/gomlx/gomlx/ml/layers/kan, to avoid circular dependency across repositories.
# Packages
Package plotly implements plotting in Jupyter Notebooks using [github.com/janpfeifer/gonb] (Notebook Kernel) and the Plotly [github.com/MetalBlueberry/go-plotly] library.
# Functions
New create a new B-spline with the given [degree] (`order == degree+1`).
NewRegular creates a new B-spline that is defined with enough knots for [numControlPoints].
# Constants
ExtrapolateConstant configures a B-spline to take the constant value of the first/last control point outside the knots.
ExtrapolateLinear configures a B-spline to extrapolate linearly outside the first/last control point outside the knots.
ExtrapolateZero configures a B-spline to take value of 0 outside the knots.
# Type aliases
ExtrapolationType defines how a B-spline should behave outside the knots (for x < knots[0] or x > knots[-1]).