Versions in this module Expand all Collapse all v0 v0.2.0 Oct 17, 2026 v0.1.0 Oct 10, 2026 Changes in this version + const FlagConvErr + const FlagConverged + const FlagSignErr + const LPInfeasible + const LPIterLimit + const LPNumericalFail + const LPOptimal + const LPUnbounded + var ErrBounds = errors.New("optimize: invalid bounds") + var ErrBracket = errors.New("optimize: f(a) and f(b) must have different signs") + var ErrDimension = errors.New("optimize: dimension mismatch") + var ErrInput = errors.New("optimize: invalid input") + var ErrMethod = errors.New("optimize: unknown method") + var ErrNotConverged = errors.New("optimize: optimal parameters not found") + func ApproxFprime(f func([]float64) float64, x []float64, epsilon float64) []float64 + func Bracket(f func(float64) float64, xa, xb float64) (x [3]float64, fx [3]float64, nfev int, err error) + func CheckGrad(f func([]float64) float64, grad func(x, g []float64), x []float64, ...) float64 + type Bound struct + Hi float64 + Lo float64 + func Unbounded() Bound + type BracketError struct + Fa float64 + Fb float64 + Fc float64 + Msg string + Nfev int + Xa float64 + Xb float64 + Xc float64 + func (e *BracketError) Error() string + type BracketOptions struct + MaxIter int + Rtol float64 + Xtol float64 + type BruteOptions struct + Finish Method + FinishOptions *Options + NoFinish bool + Ns int + Workers int + type BruteResult struct + Axes [][]float64 + Fun float64 + Jout []float64 + Success bool + X []float64 + func Brute(f func([]float64) float64, ranges []Range, o *BruteOptions) (*BruteResult, error) + type CurveFitOptions struct + AbsoluteSigma bool + Bounds []Bound + FScale float64 + Ftol float64 + Gtol float64 + Loss Loss + MaxFev int + Method LSMethod + Sigma *ndarray.Array + Workers int + Xtol float64 + type CurveFitResult struct + CovOK bool + Fvec []float64 + Message string + Nfev int + Pcov []float64 + Popt []float64 + Status int + func CurveFit(f func(x float64, p []float64) float64, xdata, ydata *ndarray.Array, ...) (*CurveFitResult, error) + func CurveFitModel(model Model, xdata, ydata *ndarray.Array, p0 []float64, o *CurveFitOptions) (*CurveFitResult, error) + func (r *CurveFitResult) PcovArray() *ndarray.Array + func (r *CurveFitResult) Perr() []float64 + func (r *CurveFitResult) PoptArray() *ndarray.Array + type FDMethod int + const FD2Point + const FD3Point + type LPConstraints struct + AEq *ndarray.Array + AUb *ndarray.Array + BEq *ndarray.Array + BUb *ndarray.Array + Bounds []Bound + type LPDual struct + Marginals []float64 + Residual []float64 + type LPMethod string + const LPInteriorPoint + const LPSimplex + type LPOptions struct + MaxIter int + Method LPMethod + NoPresolve bool + Tol float64 + type LPResult struct + Con []float64 + EqLin LPDual + Fun float64 + IneqLin LPDual + Lower LPDual + Message string + Nit int + Slack []float64 + Status int + Success bool + Upper LPDual + X []float64 + func Linprog(c []float64, cons LPConstraints, opts *LPOptions) (*LPResult, error) + func (r *LPResult) XArray() *ndarray.Array + type LSMethod string + const LM + const TRF + type LSOptions struct + Bounds []Bound + DiffStep float64 + FDMethod FDMethod + FScale float64 + Ftol float64 + Gtol float64 + Loss Loss + MaxNfev int + XScale []float64 + XScaleJac bool + Xtol float64 + type LSProblem struct + Func func(x, f []float64) + Jac func(x, jac []float64) + M int + type LSResult struct + ActiveMask []int + Cost float64 + Fun []float64 + Grad []float64 + Jac []float64 + Message string + Nfev int + Njev int + Optimality float64 + Status int + Success bool + X []float64 + func LeastSquares(p LSProblem, x0 []float64, method LSMethod, opts *LSOptions) (*LSResult, error) + func (r *LSResult) JacArray() *ndarray.Array + func (r *LSResult) XArray() *ndarray.Array + type LeastsqOptions struct + Diag []float64 + Epsfcn float64 + Factor float64 + Ftol float64 + Gtol float64 + Maxfev int + Xtol float64 + type LeastsqResult struct + CovX []float64 + Fjac []float64 + Fvec []float64 + Ier int + Ipvt []int + Mesg string + Nfev int + Njev int + Qtf []float64 + X []float64 + func Leastsq(p LSProblem, x0 []float64, opts *LeastsqOptions) (*LeastsqResult, error) + func (r *LeastsqResult) CovXArray() *ndarray.Array + func (r *LeastsqResult) FjacArray() *ndarray.Array + func (r *LeastsqResult) Success() bool + func (r *LeastsqResult) XArray() *ndarray.Array + type Loss string + const LossArctan + const LossCauchy + const LossHuber + const LossLinear + const LossSoftL1 + type Method string + const BFGS + const CG + const LBFGSB + const NelderMead + const NewtonCG + const Powell + type Model struct + F func(x, p []float64) float64 + Grad func(x, p, grad []float64) + type NewtonOptions struct + Fprime func(float64) float64 + Fprime2 func(float64) float64 + MaxIter int + Rtol float64 + Tol float64 + X1 float64 + X1Set bool + type Options struct + Adaptive bool + Bounds []Bound + C1 float64 + C2 float64 + Callback func(x []float64, f float64) (stop bool) + Direc [][]float64 + Eps float64 + FDMethod FDMethod + Fatol float64 + FiniteDiffRelStep float64 + Ftol float64 + Gtol float64 + HessInv0 []float64 + InitialSimplex [][]float64 + M int + MaxFev int + MaxIter int + MaxLS int + Norm float64 + Tol float64 + XRtol float64 + Xatol float64 + Xtol float64 + type Problem struct + Func func(x []float64) float64 + FuncGrad func(x, grad []float64) float64 + Grad func(x, grad []float64) + Hess func(x, hess []float64) + HessP func(x, p, hp []float64) + type Range struct + Hi float64 + Lo float64 + Step float64 + type Result struct + Fun float64 + HessInv []float64 + Jac []float64 + Message string + Nfev int + Nhev int + Nit int + Njev int + Status int + Success bool + X []float64 + func Minimize(p Problem, x0 []float64, method Method, opts *Options) (*Result, error) + func (r *Result) HessInvArray() *ndarray.Array + func (r *Result) XArray() *ndarray.Array + type RootOptions struct + Diag []float64 + Eps float64 + Factor float64 + Maxfev int + Xtol float64 + type RootResult struct + Fjac []float64 + Fun []float64 + Message string + Nfev int + Njev int + Qtf []float64 + R []float64 + Status int + Success bool + X []float64 + func Fsolve(p SystemProblem, x0 []float64, opts *RootOptions) (*RootResult, error) + func Root(p SystemProblem, x0 []float64, opts *RootOptions) (*RootResult, error) + func (r *RootResult) FjacArray() *ndarray.Array + func (r *RootResult) XArray() *ndarray.Array + type RootScalarOptions struct + Bracket []float64 + Fprime func(float64) float64 + Fprime2 func(float64) float64 + MaxIter int + Rtol float64 + X0 float64 + X0Set bool + X1 float64 + X1Set bool + Xtol float64 + type RootScalarResult struct + Converged bool + Flag string + FunctionCalls int + Iterations int + Method string + Root float64 + func Bisect(f func(float64) float64, a, b float64, o *BracketOptions) (*RootScalarResult, error) + func Brenth(f func(float64) float64, a, b float64, o *BracketOptions) (*RootScalarResult, error) + func Brentq(f func(float64) float64, a, b float64, o *BracketOptions) (*RootScalarResult, error) + func Newton(f func(float64) float64, x0 float64, o *NewtonOptions) (*RootScalarResult, error) + func Ridder(f func(float64) float64, a, b float64, o *BracketOptions) (*RootScalarResult, error) + func RootScalar(f func(float64) float64, method string, o *RootScalarOptions) (*RootScalarResult, error) + type ScalarMethod string + const Bounded + const Brent + const Golden + type ScalarOptions struct + Bounds *Bound + Bracket []float64 + MaxIter int + Tol float64 + Xatol float64 + Xtol float64 + type ScalarResult struct + Fun float64 + Message string + Nfev int + Nit int + Status int + Success bool + X float64 + func Fminbound(f func(float64) float64, x1, x2, xtol float64, maxfun int) (*ScalarResult, error) + func MinimizeScalar(f func(float64) float64, method ScalarMethod, o *ScalarOptions) (*ScalarResult, error) + type SystemProblem struct + Func func(x, f []float64) + Jac func(x, jac []float64)