Help us shape the future of Go! Take the 2026 Go Developer Survey

poly

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

README

poly

Polynomials in pure Go (CGO_ENABLED=0): evaluation, arithmetic, least-squares fitting, roots, and the Chebyshev, Legendre, Hermite, HermiteE and Laguerre bases, with the semantics of numpy.polyfit, numpy.roots, the numpy.poly1d helpers and the numpy.polynomial package.

import "github.com/go-approx/poly"

fit, _ := poly.Polyfit(x, y, 3, nil)        // highest degree first, like np.polyfit
r, _ := poly.Roots(fit.Coef)                // companion-matrix eigenvalues
v := poly.Polyval(fit.Coef, 0.5)            // Horner; PolyvalComp is compensated

s, _, _ := poly.FitSeries(poly.Chebyshev, x, y, 8, nil) // lowest degree first, like numpy.polynomial
y0, _ := s.Val(0.3)

Coefficient order differs between the two families, as in NumPy: the poly1d family is highest degree first, the numpy.polynomial family lowest degree first. See doc.go.

What is provided

here NumPy SciPy / MATLAB
Polyval, PolyvalAll np.polyval MATLAB polyval
PolyvalComp, PolyvalCompAll (none) compensated Horner, Graillat-Langlois-Louvet 2009
Polyder, Polyint np.polyder, np.polyint polyder, polyint
Conv, Deconv, Polymul, Polyadd, Polysub np.convolve, np.polydiv, np.polymul, np.polyadd, np.polysub conv, deconv
PolyFromRoots, PolyFromComplexRoots np.poly poly
Polyfit (weights, rcond, covariance scaled or unscaled, rank) np.polyfit polyfit
Roots np.roots roots
Basis (Chebyshev, Legendre, Hermite, HermiteE, Laguerre) with Val, Vander, Der, Int, RootsBasis, FitBasis chebval, chebvander, chebder, chebint, chebroots, chebfit and the leg, herm, herme, lag equivalents
Series (NewSeries, FitSeries, Val, Der, Int, Roots), MapParms, MapDomain, GetDomain numpy.polynomial.Chebyshev etc. with domain/window mapping

Verification

Reference: NumPy 2.5.4 (SciPy 1.18.1 installed alongside), run as an oracle from Go (internal/oracle starts uv run --with numpy==2.5.4 python -c ..., JSON over a pipe; the Python is only the minimal call). Octave is not installed on the host, so no Octave oracle was run. A tagged test (-tags oracle) generates the fixtures in testdata/ (deterministic PCG inputs, large cases regenerated from their seed); the ordinary tests read them and need no Python.

Edge cases: degree 0, degree at or above the number of points, 1 and 2 points, duplicate and unsorted x, NaN and Inf, zero weights, x spanning 1e-8..1e8, ill-conditioned degree-20 fits, repeated and clustered roots, leading and trailing zero coefficients, complex-conjugate roots, n up to 1e6. Where NumPy raises, the Go function returns an error, and the fixture records it.

Measured against NumPy (go test -v -run 'TestOracle|TestFixtureInventory'):

quantity result
Polyval, Polyder, Polyint, Polyadd, Polysub, Deconv, PolyFromRoots 3434 of 3434 values bit-identical
Conv, Polymul 229 of 917 bit-identical; max error 0.90 eps relative to sum of abs(a_i b_j) (NumPy's convolve uses a different summation order)
PolyvalComp worst error / theoretical bound = 0.00095; more accurate than Horner at 677 of 780 points
each of the 5 bases: Val, Vander, Der, Int, Series.Val/Der/Int 10016 of 10016 values bit-identical
Roots 8 of 24 cases identical in value and order; well-conditioned random degree <= 50: max positional error 4e-15; backward error at most 2.24 times NumPy's
basis roots (sorted as NumPy sorts) max positional error 6e-15 .. 8e-13 over 48 cases per basis
Polyfit 78 fits; coefficient deviation at most 1.67 conditioning units, SSR deviation at most 167 eps y^2
basis fits 80 fits per basis; coefficient deviation 1.2 .. 24.8 conditioning units
SSR, when ours and NumPy's differ by more than 1000 eps y^2 both are judged against the exact residual (normal equations at 256 bits); ours must stay within one decade of NumPy's distance (both solvers are backward stable, with different constants). On the large HermiteE fit our distance is 0.29x NumPy's on arm64 and 4.7x on riscv64, where the SIMD lane order differs

The bit-identical rows hold on every architecture because every product that feeds a sum is rounded explicitly (float64(a*b)), which forbids fused multiply-add. The least-squares fits are not bit-identical across architectures: their QR runs on go-simd/floats, whose Dot adds in SIMD lanes in an order that depends on the vector width (the last bits can differ between amd64 and arm64) and whose Axpy is one fused multiply-add per element everywhere. The fit tolerances above hold on every architecture CI runs. A "conditioning unit" is eps times the condition-number-based bound of the least-squares perturbation theory, so a deviation of a few units means the two solvers (Householder QR here, SVD in NumPy) agree to the accuracy the problem allows.

Gates: gofmt -l . empty, go vet, go test -race, 100.0% statement coverage with -coverpkg=./..., and the CI described in .github/workflows/ci.yml (Linux, macOS, Windows, arm64, qemu riscv64/loong64/ppc64le/s390x/arm, 386, every GOOS/GOARCH compiled, govulncheck).

Performance

See docs/perf.md. The comparison is Go against NumPy on one core, interleaved rounds. It is only meaningful on an idle machine; the table states the load it was taken at. The Householder QR of the fits runs its inner products and updates on go-simd/floats (Dot, Axpy: assembly generated by go-asmgen), and the Vandermonde and series design matrices are built in cache-sized row blocks.

Gaps

  • float64 only; one-dimensional coefficient and data arrays; a single integer degree (no list of degrees as np.polyfit allows in 2.x).
  • No complex-coefficient Polyval or fits (PolyFromComplexRoots returns complex coefficients).
  • No numpy.polynomial.Polynomial (power-basis series) class beyond the poly1d functions.
  • Conv is not bit-identical to np.convolve (summation order).
  • No Octave oracle (Octave is not installed on the build host).

Licence

BSD-3-Clause.

Documentation

Overview

Package poly provides polynomial evaluation, arithmetic, least-squares fitting and root finding with the semantics of numpy.polyfit, numpy.roots, numpy.poly1d helpers and the numpy.polynomial package (Chebyshev, Legendre, Hermite, HermiteE and Laguerre series), in pure Go (CGO_ENABLED=0).

Coefficient order: read this first

Two conventions coexist, exactly as in NumPy, and they are NOT the same:

  • HIGHEST degree first (np.poly1d, np.polyfit, np.roots, np.polyval ...): Polyval, PolyvalComp, Polyder, Polyint, Conv, Deconv, Polyadd, Polysub, Polymul, PolyFromRoots, Polyfit, Roots. The slice {1, -3, 2} is x^2 - 3x + 2.
  • LOWEST degree first (numpy.polynomial): Basis, Series, Val, Vander, Der, Int, FitBasis, FitSeries, RootsBasis. The slice {2, -3, 1} is 2 + (-3) B_1(x) + B_2(x), B_k being the k-th basis polynomial.

Faithfulness to NumPy

Evaluation, Vandermonde matrices, differentiation and integration follow NumPy's arithmetic operation by operation, each product rounded before its sum (explicit float64 conversions forbid fused multiply-add), so their results are bit-identical to NumPy's; the README lists the measured equality. Least-squares fits use Householder QR on the column-scaled design matrix, NumPy's SVD answer being recovered through github.com/go-ndarray/ndarray's Lstsq whenever the fit is rank-deficient or nearly so. Roots are eigenvalues of the companion matrix (Edelman and Murakami 1995, doi:10.1090/S0025-5718-1995-1262279-2), in LAPACK's order; the series companion ("comrade") matrices are NumPy's. PolyvalComp is the compensated Horner scheme of Graillat, Langlois and Louvet (2009), as accurate as Horner computed in twice the precision.

Where NumPy raises an exception the functions return an error. Only float64 data, one-dimensional coefficient and data arrays, and a single integer degree are supported (see the README's "Gaps").

Index

Examples

Constants

This section is empty.

Variables

View Source
var ErrArg = errors.New("poly: invalid argument")

ErrArg is returned for an invalid argument (negative order, short k, ...), where NumPy raises ValueError.

View Source
var ErrBasis = errors.New("poly: unknown basis")

ErrBasis is returned for an unknown Basis value.

View Source
var ErrEmpty = errors.New("poly: empty input")

ErrEmpty is returned where NumPy raises because an input array is empty.

View Source
var ErrNonFinite = errors.New("poly: non-finite value in least-squares problem")

ErrNonFinite is returned when a least-squares problem contains NaN or Inf (NumPy's lstsq raises LinAlgError there).

View Source
var ErrRankDeficient = errors.New("poly: rank-deficient fit has no covariance")

ErrRankDeficient is returned when a covariance matrix is requested for a rank-deficient fit.

Functions

func Conv

func Conv(a, v []float64) ([]float64, error)

Conv is numpy.convolve(a, v) in "full" mode, a direct O(len(a)*len(v)) sum. Either input empty is an error, as in NumPy.

func Deconv

func Deconv(u, v []float64) (q, r []float64, err error)

Deconv is numpy.polydiv (scipy.signal.deconvolve's long division): the quotient and remainder of u by v, highest degree first. Leading remainder entries with |r| <= 1e-8 are dropped, which is what NumPy's allclose(r[0], 0, rtol=1e-14) (default atol 1e-8) does. A zero leading coefficient of v gives Inf/NaN as in NumPy. Empty inputs are an error.

Example
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	q, r, _ := poly.Deconv([]float64{1, 3, 3, 1}, []float64{1, 1}) // (x+1)^3 / (x+1)
	fmt.Println(q, r)
}
Output:
[1 2 1] [0]

func Der

func Der(b Basis, c []float64, m int, scl float64) ([]float64, error)

Der is numpy's chebder/legder/hermder/hermeder/lagder: the m-th derivative of the series c (lowest degree first), each derivative scaled by scl (scl = d(window)/d(domain) for a variable change).

func FitSeries

func FitSeries(b Basis, x, y []float64, deg int, o *SeriesFitOptions) (Series, Fit, error)

FitSeries is ABCPolyBase.fit (e.g. Chebyshev.fit): the domain is taken from x unless given, x is mapped onto the window, and the fit is FitBasis.

Example
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	// Fit y = x^2 on [0, 2] with Chebyshev polynomials: the domain [0, 2]
	// is mapped to the window [-1, 1].
	x := []float64{0, 0.5, 1, 1.5, 2}
	y := []float64{0, 0.25, 1, 2.25, 4}
	s, _, err := poly.FitSeries(poly.Chebyshev, x, y, 2, nil)
	if err != nil {
		panic(err)
	}
	v, _ := s.Val(1.5)
	fmt.Printf("domain %v coef %.4f value %.4f\n", s.Domain, s.Coef, v)
}
Output:
domain [0 2] coef [1.5000 2.0000 0.5000] value 2.2500

func GetDomain

func GetDomain(x []float64) ([2]float64, error)

GetDomain returns [min(x), max(x)] (polyutils.getdomain); a NaN in x gives NaN, as numpy's min/max. Empty x is an error.

func Int

func Int(b Basis, c []float64, m int, k []float64, lbnd, scl float64) ([]float64, error)

Int is numpy's chebint/legint/hermint/hermeint/lagint: the m-fold integral of the series c (lowest degree first) with integration constants k (missing ones are 0), lower bound lbnd, each integral scaled by scl.

func MapDomain

func MapDomain(dst, x []float64, old, new [2]float64) []float64

MapDomain maps x from the interval old to new (polyutils.mapdomain), into dst (allocated when too short) and returns it.

func MapParms

func MapParms(old, new [2]float64) (off, scl float64)

MapParms returns (off, scl) such that x -> off + scl*x maps the interval old onto new (numpy.polynomial.polyutils.mapparms).

func PolyFromComplexRoots

func PolyFromComplexRoots(roots []complex128) (coef []complex128, realOnly bool)

PolyFromComplexRoots is numpy.poly for complex roots. The coefficients are complex; when the roots are closed under conjugation (as numpy checks, by sorting) the imaginary parts are dropped (set to 0) and realOnly is true.

func PolyFromRoots

func PolyFromRoots(roots []float64) []float64

PolyFromRoots is numpy.poly for real roots: the monic polynomial with the given roots, highest degree first. No roots gives [1].

func Polyadd

func Polyadd(a, b []float64) []float64

Polyadd is numpy.polyadd (highest degree first, no trimming).

func Polyder

func Polyder(p []float64, m int) ([]float64, error)

Polyder is numpy.polyder: the m-th derivative of p (highest degree first). The derivative of a constant is the empty slice, as in NumPy.

func Polyint

func Polyint(p []float64, m int, k []float64) ([]float64, error)

Polyint is numpy.polyint: the m-fold antiderivative of p (highest degree first) with integration constants k (nil: zeros; one value: reused for every integration; otherwise at least m values, k[0] being the constant of the first integration).

func Polymul

func Polymul(a, b []float64) []float64

Polymul is numpy.polymul: the product of two polynomials (highest degree first); like numpy.poly1d it strips leading zeros of both operands first.

func Polysub

func Polysub(a, b []float64) []float64

Polysub is numpy.polysub.

func Polyval

func Polyval(p []float64, x float64) float64

Polyval evaluates the polynomial p (coefficients HIGHEST degree first) at x by Horner's rule, with NumPy's exact arithmetic: y = 0; y = y*x + c for every coefficient, each product rounded before the sum (no fused multiply-add), so the result is bit-identical to numpy.polyval. As in NumPy the start value 0*x makes the result NaN for an infinite x.

Example
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	// 2x^2 - 3x + 1, coefficients highest degree first.
	fmt.Println(poly.Polyval([]float64{2, -3, 1}, 4))
}
Output:
21

func PolyvalAll

func PolyvalAll(dst, p, x []float64) []float64

PolyvalAll evaluates p at every element of x, writing into dst (allocated when nil or too short) and returning it.

func PolyvalComp

func PolyvalComp(p []float64, x float64) float64

PolyvalComp evaluates p (highest degree first) at x with the compensated Horner scheme of Graillat, Langlois and Louvet (2009): the result is as accurate as Horner's rule computed in twice the working precision, then rounded, whatever the arch's FMA fusing (TwoSum and an explicit math.FMA TwoProduct are used).

Example
package main

import (
	"fmt"
	"math"
	"math/big"

	"github.com/go-approx/poly"
)

func main() {
	// (x-1)^8 at x = 1.01 is 1e-16, but Horner works with terms of size 1:
	// it loses every digit to cancellation, the compensated scheme keeps
	// them. The exact value comes from math/big.
	p := []float64{1, -8, 28, -56, 70, -56, 28, -8, 1}
	x := 1.01
	exact := new(big.Float).SetPrec(2000)
	bx := new(big.Float).SetPrec(2000).SetFloat64(x)
	for _, c := range p {
		exact.Mul(exact, bx).Add(exact, big.NewFloat(c))
	}
	ex, _ := exact.Float64()
	rel := func(v float64) float64 { return math.Abs(v-ex) / ex }
	fmt.Println("Horner is off by more than 100%:", rel(poly.Polyval(p, x)) > 1)
	fmt.Println("compensated is within 1e-14:   ", rel(poly.PolyvalComp(p, x)) < 1e-14)
}
Output:
Horner is off by more than 100%: true
compensated is within 1e-14:    true

func PolyvalCompAll

func PolyvalCompAll(dst, p, x []float64) []float64

PolyvalCompAll applies PolyvalComp to every element of x.

func Roots

func Roots(p []float64) ([]complex128, error)

Roots is numpy.roots: the roots of the polynomial p (coefficients HIGHEST degree first). Leading zeros are stripped, each trailing zero adds a zero root (appended last), and the others are the eigenvalues of the companion matrix (Edelman & Murakami 1995 show the companion eigenvalue method is backward stable for balanced companions), in LAPACK order. NaN or Inf in p is an error (numpy raises LinAlgError through eig). The result is always complex128; NumPy returns a real array when every imaginary part is zero.

Example
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	roots, err := poly.Roots([]float64{1, -3, 2, 0}) // x^3 - 3x^2 + 2x
	if err != nil {
		panic(err)
	}
	for _, r := range roots {
		fmt.Printf("%.4f ", real(r))
	}
	fmt.Println()
}
Output:
2.0000 1.0000 0.0000

func RootsBasis

func RootsBasis(b Basis, c []float64) ([]complex128, error)

RootsBasis is numpy's chebroots/legroots/hermroots/hermeroots/lagroots: the roots of the series c (lowest degree first, trailing zeros trimmed) as eigenvalues of the companion (comrade) matrix of the three-term recurrence, sorted lexicographically (real, then imaginary part). An empty c is an error; NaN/Inf coefficients are an error through the eigensolver.

func Val

func Val(b Basis, c []float64, x float64) (float64, error)

Val evaluates the series sum c[i]*B_i(x) by Clenshaw's recurrence with numpy's exact operation order (chebval, legval, hermval, hermeval, lagval): every product is rounded before its sum, so results are bit-identical to NumPy's. An empty c is an error (NumPy raises IndexError).

func ValAll

func ValAll(b Basis, dst, c, x []float64) ([]float64, error)

ValAll evaluates the series at every element of x (dst reused if large enough).

func Vander

func Vander(b Basis, x []float64, deg int) ([]float64, error)

Vander returns the pseudo-Vandermonde matrix of the family, row-major len(x) rows by deg+1 columns: element (i,j) is B_j(x[i]), computed by numpy's forward recurrences (bit-identical to chebvander, legvander, ...).

Example
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	v, _ := poly.Vander(poly.Chebyshev, []float64{0.5, 1}, 3) // rows: T0..T3
	fmt.Println(v)
}
Output:
[1 0.5 -0.5 -1 1 1 1 1]

Types

type Basis

type Basis int

Basis names an orthogonal-polynomial family of numpy.polynomial.

Coefficient order: the Basis / Series API follows numpy.polynomial and stores coefficients LOWEST degree first (Coef[i] multiplies the i-th basis polynomial). The np.poly1d-style functions (Polyval, Polyfit, Roots, ...) store them HIGHEST degree first.

const (
	Chebyshev Basis = iota // T_n, numpy.polynomial.chebyshev
	Legendre               // P_n, numpy.polynomial.legendre
	Hermite                // physicists' H_n, numpy.polynomial.hermite
	HermiteE               // probabilists' He_n, numpy.polynomial.hermite_e
	Laguerre               // L_n, numpy.polynomial.laguerre
)

The supported families.

func (Basis) Domain

func (b Basis) Domain() [2]float64

Domain returns the default domain of the family (numpy class attribute).

func (Basis) String

func (b Basis) String() string

String returns the numpy class name.

func (Basis) Window

func (b Basis) Window() [2]float64

Window returns the default window of the family.

type CovMode

type CovMode int

CovMode selects the covariance estimate returned by Polyfit, as numpy.polyfit's cov argument.

const (
	// CovNone returns no covariance matrix.
	CovNone CovMode = iota
	// CovScaled scales inv(AᵀA) by the residual variance SSR/(m-n),
	// numpy.polyfit(cov=True); it needs m > n.
	CovScaled
	// CovUnscaled returns inv(AᵀA) (numpy.polyfit(cov="unscaled")).
	CovUnscaled
)

type Fit

type Fit struct {
	// Coef are the coefficients: HIGHEST degree first for Polyfit, LOWEST
	// degree first for FitBasis.
	Coef []float64
	// Rank is the effective rank of the (scaled) design matrix.
	Rank int
	// Residuals is [sum of squared residuals] when the rank is full and there
	// are more points than coefficients, empty otherwise (as numpy's lstsq).
	Residuals []float64
	// Cov is the row-major (deg+1)x(deg+1) covariance matrix, in the order of
	// Coef, or nil when not requested.
	Cov []float64
}

Fit is the result of a least-squares fit.

func FitBasis

func FitBasis(b Basis, x, y []float64, deg int, w []float64, rcond float64) (Fit, error)

FitBasis is numpy.polynomial.<basis>.<basis>fit: a least-squares fit in the given family WITHOUT any domain mapping (x is used as is). The columns of the pseudo-Vandermonde matrix are scaled to unit norm (a zero column keeps scale 1), then solved by the same Householder QR as Polyfit. Coefficients are lowest degree first.

func Polyfit

func Polyfit(x, y []float64, deg int, o *FitOptions) (Fit, error)

Polyfit is numpy.polyfit(x, y, deg, rcond, w=, cov=): the least-squares polynomial of degree deg, coefficients HIGHEST degree first. The Vandermonde matrix columns are scaled to unit 2-norm, then solved by Householder QR (see lstsqQR for the rank-deficient path).

Example
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	x := []float64{0, 1, 2, 3, 4}
	y := []float64{1, 3, 7, 13, 21} // x^2 + x + 1
	fit, err := poly.Polyfit(x, y, 2, nil)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%.6f rank=%d\n", fit.Coef, fit.Rank)
}
Output:
[1.000000 1.000000 1.000000] rank=3
Example (Covariance)
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	x := []float64{0, 1, 2, 3, 4, 5}
	y := []float64{0.1, 1.1, 1.9, 3.2, 3.9, 5.1}
	fit, err := poly.Polyfit(x, y, 1, &poly.FitOptions{Cov: poly.CovScaled})
	if err != nil {
		panic(err)
	}
	fmt.Printf("slope %.4f +- %.4f\n", fit.Coef[0], sqrt(fit.Cov[0]))
}

func sqrt(v float64) float64 {
	z := v
	for i := 0; i < 60; i++ {
		z = (z + v/z) / 2
	}
	return z
}
Output:
slope 0.9914 +- 0.0325

type FitOptions

type FitOptions struct {
	// W are the weights: rows of the Vandermonde matrix AND the right-hand
	// side are multiplied by W[i], as NumPy does (so W[i] = 1/sigma[i], not
	// 1/sigma²). nil means unweighted.
	W []float64
	// Rcond is the relative cutoff on singular values; 0 means NumPy's
	// default len(x)*eps.
	Rcond float64
	// Cov selects the covariance matrix.
	Cov CovMode
}

FitOptions are the optional arguments of Polyfit.

type Series

type Series struct {
	Coef   []float64
	Domain [2]float64
	Window [2]float64
	Basis  Basis
}

Series is numpy.polynomial's ABCPolyBase: coefficients LOWEST degree first, in one of the Basis families, with a Domain mapped linearly onto the Window where the basis polynomials live.

func NewSeries

func NewSeries(b Basis, coef []float64) (Series, error)

NewSeries returns a series with the family's default domain and window. The coefficients are copied; an empty slice is an error (NumPy raises).

func (Series) Der

func (s Series) Der(m int) (Series, error)

Der returns the m-th derivative (ABCPolyBase.deriv: derivatives scaled by the domain-to-window slope).

func (Series) Int

func (s Series) Int(m int, k []float64, lbnd *float64) (Series, error)

Int returns the m-fold integral (ABCPolyBase.integ): integrals are scaled by 1/slope; lbnd, when non-nil, is a point of the DOMAIN mapped to the window (nil means the window origin 0, as NumPy's lbnd=None).

func (Series) Roots

func (s Series) Roots() ([]complex128, error)

Roots returns the roots of the series in the domain, sorted by real part then imaginary part.

Example
package main

import (
	"fmt"

	"github.com/go-approx/poly"
)

func main() {
	// 1 - 2x^2 in the Legendre basis is not what it looks like: P2 = (3x^2-1)/2.
	s, _ := poly.NewSeries(poly.Legendre, []float64{0, 0, 1})
	roots, _ := s.Roots()
	fmt.Printf("%.4f %.4f\n", real(roots[0]), real(roots[1]))
}
Output:
-0.5774 0.5774

func (Series) Val

func (s Series) Val(x float64) (float64, error)

Val evaluates the series at x: x is first mapped from Domain to Window.

func (Series) ValAll

func (s Series) ValAll(dst, x []float64) ([]float64, error)

ValAll evaluates the series at every element of x.

type SeriesFitOptions

type SeriesFitOptions struct {
	// Domain, when nil, defaults to [min(x), max(x)] (widened to
	// [min-1, max+1] when they are equal, as NumPy).
	Domain *[2]float64
	// Window, when nil, is the family's default window.
	Window *[2]float64
	// W are the weights (rows of the design matrix and y are multiplied).
	W []float64
	// Rcond is the singular-value cutoff; 0 means len(x)*eps.
	Rcond float64
}

SeriesFitOptions are the optional arguments of FitSeries.

Directories

Path Synopsis
internal
oracle
Package oracle drives NumPy/SciPy as a reference implementation from Go.
Package oracle drives NumPy/SciPy as a reference implementation from Go.

Jump to

Keyboard shortcuts

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