Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

edgelaboratories/interpolator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interpolator

GoDoc Build Status GolangCI Lint Go Report Card

Description

Package interpolator provides univariate data interpolators:

The input data is specified by means of a nonempty slice of two-dimensional points XYs. If a single data point is provided, the resulting interpolator treats the input as a constant for all abscissae.

Installation

go get -u github.com/edgelaboratories/interpolator

Example

package main

import (
	"fmt"
	"log"

	"github.com/edgelaboratories/interpolator"
)

func main() {
	xys := interpolator.XYs{
		{
			X: 0.0,
			Y: 1.2,
		},
		{
			X: 0.5,
			Y: 1.0,
		},
		{
			X: 1.0,
			Y: 1.4,
		},
	}
	interp, err := interpolator.NewGeometric(xys)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("value at 0.75 is %0.2f\n", interp.Value(0.75))
	fmt.Printf("gradient at 0.75 is %0.2f\n", interp.Gradient(0.75))
}

About

Package interpolator provides univariate data interpolators.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 9