interp

package module
v0.0.0-...-9ab0a3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 1 Imported by: 2

README

interp

Numerical interpolation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bisect

func Bisect(x []float64, val float64) int

func Lerp

func Lerp(a float64, b float64, i float64) float64

Lerp calculates the linear interpolation between two values

func Linspace

func Linspace(i float64, j float64, n int, b bool) []float64

Linspace creates a slice of linearly distributed values in a range

func Map

func Map(a float64, b float64, c float64, d float64, i float64) float64

Map calculates the linear interpolation from one range to another

func TDMA

func TDMA(a, b, c, d []float64) []float64

TDMA implements the Thomas algorithm for solving tridiagonal systems of equations a is the lower diagonal, b is the main diagonal, c is the upper diagonal, and d is the right hand side

Types

type CubicSpline

type CubicSpline struct {
	// contains filtered or unexported fields
}

CubicSpline represents a general cubic spline

func NewCubicSpline

func NewCubicSpline(x []float64, y []float64) (CubicSpline, error)

NewCubicSpline creates a new cubic spline interpolation

func NewRegularCubicSpline

func NewRegularCubicSpline(x []float64, y []float64) (CubicSpline, error)

func (CubicSpline) Eval

func (cs CubicSpline) Eval(x float64) float64

Eval evaluates the cubic spline at a point

func (CubicSpline) EvalAtInterval

func (cs CubicSpline) EvalAtInterval(x float64, i int) float64

EvalAtInterval evaluates the cubic spline at a point in a given interval Useful when it's faster to compute the interval than Bisect, for example when the knots are evenly spaced

func (CubicSpline) GetMaxX

func (cs CubicSpline) GetMaxX() float64

func (CubicSpline) GetMinMaxX

func (cs CubicSpline) GetMinMaxX() (float64, float64)

func (CubicSpline) GetMinX

func (cs CubicSpline) GetMinX() float64

func (CubicSpline) Interval

func (cs CubicSpline) Interval(x float64) int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL