Learn/Numerics

Numerics

A numerical and control library for Luau and Rune scripts: linear algebra, differential equations, optimization, signal processing and control design, with a table from MATLAB function names to the Eustress calls.

Time41 min readLevelIntermediateUpdatedUpdated Nov 2026
Script language
Linear Algebrasolve, svd, eig, schur,expm, roots, polyfit,residueDifferential Equationsode45, ode23, ode15s,ode23s, ode_radau, withevents and dense outputOptimizationfzero, fminsearch,fminunc, lsqnonlin,fsolveCalculus and Signalintegral, trapz, interp1,fft, filter, freqzControl DesignTf, Ss, Zpk; step, bode,margin; lqr, care, place,kalman; c2dPerformanceaccuracy and run-timetables, with how theywere measured
The section has one page per area, plus a page of measured tables. Each area page lists the routines in that area by their MATLAB names.

01Overview

What It Is

The numerics library solves the equations that simulation and control work produce: systems of linear equations, differential equations, minimization, and the design of controllers.

The library is the eustress-numerics crate. It is written in pure Rust and uses 64-bit floating-point numbers throughout. Matrices have any size. Function names follow MATLAB (the core language, the Control System Toolbox and the numerics used with it), so a MATLAB name maps directly to a Eustress name. A call with bad input returns an error and does not crash.

Luau and Rune scripts reach the library, in Studio and in the Player. Luau scripts use a read-only global table named Numerics. Rune scripts import the module eustress::realism::numerics. One implementation sits behind both, and the 42 names Luau reaches have the same names and results in Rune.

Luau reaches 42 of the library's routines. Rune reaches those 42, 101 more functions and 10 types, which makes 143 function names in all. The Script column of the name tables below states, for every row, which of three groups its routines fall in: Luau and Rune, Rune only, or Rust only. A routine in the third group is part of the Rust crate eustress-numerics and no script calls it. How a script writes a call, a matrix, a callback and an error is covered once, on this page, under Your First Call and Conventions.

What Is In It

It is organized in six areas, each with its own page. The name tables further down mark which routines of each area Luau and Rune reach, which only Rune reaches, and which stay in Rust.

  • Linear Algebra and Polynomials: solving systems, rank and null space, the LU, QR, Cholesky, singular value, eigenvalue and Schur factorizations, matrix exponential, logarithm and square root, Sylvester and Lyapunov equations, polynomial roots, fitting and partial fractions.
  • Differential Equations: the ode45, ode23, ode15s, ode23s and ode_radau solvers, with events and dense output.
  • Optimization: fzero, fminsearch, fminunc, lsqnonlin and fsolve.
  • Calculus and Signal: integral, trapz and cumtrapz, interp1 with pchip and spline, fft, filter and freqz.
  • Control Design: transfer function, state-space and zero-pole-gain models, time and frequency response, discretization, Riccati equations, LQR, pole placement, Kalman gains, model reduction and PID tuning.
  • Performance: the measured accuracy and run-time tables.

What Works Today

The library is finished and tested: 119 of 119 tests pass. Each routine in the name tables has a named test. What the library does not cover is listed under Not Covered, and What to Use Instead.

The crate compiles for the web target (wasm32-unknown-unknown). Nothing runs on the GPU.

Luau scripts run the 42 routines they reach. Rune scripts run those 42 plus the 101 more functions and the 10 types. Both run in Studio and in the Player. Every other routine on this page is part of the Rust crate only.

02Coming from MATLAB

How to Read the Tables

Each table lists a MATLAB function in the left column and the matching Eustress calls beside it.

Names follow MATLAB. Where the Eustress name differs, both appear: the MATLAB tf2zp is tf2zpk here, and MATLAB's single fminunc is two routines, one that estimates the gradient and one that takes it. One MATLAB function can map to several Eustress routines (solve, solve_vec and lstsq for mldivide), and a Eustress routine with no MATLAB counterpart has a row with a description in the MATLAB column.

The Notes column gives the status of each row. done means the routine is covered. partial means it works with the limit stated. beyond MATLAB marks a routine MATLAB does not have. A note after "done" states a difference in behavior from MATLAB. Anything that is not covered appears under Not Covered, and What to Use Instead.

The Script column states how a script reaches a row, in up to three clauses in this order. Luau and Rune lists names both languages call. The same name serves both: Luau writes Numerics.solve(...)Rune writes numerics::solve(...)?. Rune only lists what only Rune calls: a function by its name, a type by its constructor such as Tf::new, a method written as method poles of Tf and Ss (Rune calls it on a value, as in g.poles()), or an option or argument of a solver. Rust only lists names that no script calls. Every name in the Eustress column sits in exactly one clause, except pchip and spline, which a script reaches as method strings of interp1. The column lists base names; each routine that takes options also has a _with form, described under Your First Call.

Luau reaches 42 names. Rune reaches those 42, 101 more functions and 10 types. Some rows hold more than one Eustress name, and the cell then has one clause per group. A script calls solve with a vector on the right to get what solve_vec returns, and with a non-square matrix to get the least-squares solution that lstsq returns; Rune also calls lstsq itself. A script reaches pchip and spline as method strings of interp1.

Linear Algebra

Details and the factorization shapes are on the Linear Algebra and Polynomials page.

MATLABEustressScriptNotes
mldividesolve, solve_owned, solve_vecLuau and Rune: solve; Rust only: solve_owned, solve_vecdone; a non-square system goes to lstsq; solve_owned takes its matrices by value and factors in place
mldivide, non-square matrixlstsqRune only: lstsqdone; a wide or rank-deficient system returns the minimum-norm solution where MATLAB returns a basic one
invinvLuau and Rune: invdone
detdetLuau and Rune: detdone
rankrankRune only: rankdone
nullnullRune only: nulldone
orthorthRune only: orthdone
pinvpinvRune only: pinvdone
normnorm, vec_normRune only: norm, vec_normdone; the 1, 2, inf and Frobenius norms
condcondRune only: conddone (2-norm)
luluRune only: ludone
qrqr, qr_thinRune only: qr, qr_thindone
cholcholRune only: choldone
svdsvd, svd_thin, singular_valuesLuau and Rune: svd, singular_values; Rust only: svd_thindone
eigeig, eigvals, eig_symLuau and Rune: eig, eigvals; Rust only: eig_symdone
eig(A, B)generalized_eigvalsRune only: generalized_eigvalspartial: values only
schurschur, schur_complexRune only: schur, schur_complexdone
ordschurordschurRune only: ordschurdone
rsf2csfrsf2csfRune only: rsf2csfdone
hesshessRune only: hessdone
expmexpmLuau and Rune: expmdone
logmlogm, logm_realRune only: logm, logm_realdone
sqrtmsqrtm, sqrtm_realRune only: sqrtm, sqrtm_realdone
kronkronRune only: krondone
sylvestersylvesterRune only: sylvesterdone
lyaplyapRune only: lyapdone
dlyapdlyapRune only: dlyapdone

Polynomials

A polynomial is a list of coefficients with the highest power first, as in MATLAB: the coefficients 1, 2, 3 are s squared plus 2 s plus 3.

MATLABEustressScriptNotes
polypoly, poly_real, charpolyRune only: poly, poly_real, charpolydone
rootsrootsLuau and Rune: rootsdone
polyvalpolyval, polyval_cLuau and Rune: polyval; Rust only: polyval_cdone
polyfitpolyfitLuau and Rune: polyfitdone; without the centering and scaling outputs
convconvRune only: convdone
deconvdeconvRune only: deconvdone
sum of two polynomialspolyaddRune only: polyadddone; the polynomials can differ in degree
polyderpolyderRune only: polyderdone
polyintpolyintRune only: polyintdone
residueresidueRune only: residuedone; the inverse direction (rebuilding the numerator and denominator from residues, poles and the direct term) is not covered

Differential Equations

ode15s, ode23s and ode_radau are the stiff solvers. Each solver has a second form that takes event specifications; a terminal event ends the integration.

MATLABEustressScriptNotes
ode45ode45, ode45_eventsLuau and Rune: ode45; Rune only: ode45_eventsdone
ode23ode23, ode23_eventsLuau and Rune: ode23; Rune only: ode23_eventsdone
ode15sode15s, ode15s_eventsLuau and Rune: ode15s; Rune only: ode15s_eventsdone for ODEs; mass matrices and DAEs are not covered; a tolerance below what its backward-difference formulas can deliver is refused with an error that points to ode_radau
ode23sode23s, ode23s_eventsLuau and Rune: ode23s; Rune only: ode23s_eventsdone
none (MATLAB has no Radau IIA solver; this is the class of the radau5 code and of the SciPy Radau solver)ode_radau, ode_radau_eventsLuau and Rune: ode_radau; Rune only: ode_radau_eventsdone for ODEs; mass matrices and DAEs are not covered; the stiff solver to use at tight tolerances
odeset (RelTol, AbsTol, MaxStep, InitialStep, Jacobian)OdeOptionsLuau and Rune: the options rtol, atol, max_step, first_step, max_steps of the _with solvers; Rune only: the option jacobian of ode15s_events, ode23s_events, ode_radau_events; Rust only: OdeOptionspartial: scalar AbsTol only; no NonNegative, OutputFcn or Refine. The Jacobian is passed as the jac argument
odeset (Events option)EventSpecRune only: the events array, the last argument of the *_events solvers; Rust only: EventSpecdone
deval, tspan vectoreval, t_evalLuau and Rune: the option t_eval; Rune only: method eval of OdeSolutiondone; eval belongs to the solution (OdeSolution), t_eval is an option (OdeOptions)

Nonlinear Solvers and Minimization

MATLAB's fminunc is covered by two routines: fminunc estimates the gradient by central differences, and fminunc_with_grad takes the gradient from the caller. Both use BFGS with a strong-Wolfe line search.

MATLABEustressScriptNotes
fzerofzero, fzero_fromLuau and Rune: fzero, fzero_fromdone; fzero takes a bracket, fzero_from takes a starting guess
fminsearchfminsearch, fminsearch_traceLuau and Rune: fminsearch; Rust only: fminsearch_tracedone; fminsearch_trace also returns the trace: entry 0 is the best vertex of the starting simplex, entry k the best vertex after iteration k
fminunc (BFGS)fminunc, fminunc_with_gradLuau and Rune: fminunc; Rust only: fminunc_with_graddone (quasi-Newton; no trust-region variant)
lsqnonlinlsqnonlinRune only: lsqnonlinpartial: no bounds (Levenberg-Marquardt)
fsolvefsolveRune only: fsolvedone for square systems (trust-region dogleg)

Calculus and Signal

interp1 covers the linear, nearest, pchip and spline methods. The fft routines are one-dimensional. freqz takes angular frequency in radians per sample.

MATLABEustressScriptNotes
integralintegralLuau and Rune: integraldone, infinite limits included; also covers quadgk
trapztrapzRune only: trapzdone
cumtrapzcumtrapzRune only: cumtrapzdone
interp1interp1, pchip, splineLuau and Rune: interp1done; makima, previous and next are not covered
fftfft, fft_real, FftPlan, FftEngineLuau and Rune: fft; Rune only: FftPlan::new; Rust only: fft_real, FftEnginedone (1-D)
ifftifftLuau and Rune: ifftdone (1-D)
filterfilter, IirFilterRune only: filter, IirFilter::newdone
freqzfreqzRune only: freqzdone; angular frequency in radians per sample

Control Design

A model is one of four types. A transfer function (Tf) is a numerator, a denominator and a sample time. A matrix of transfer functions (TfMatrix) is a multi-input, multi-output model. A state-space model (Ss) is the matrices A, B, C and D and a sample time. A zero-pole-gain model (Zpk) is zeros, poles, a gain and a sample time. A model with no sample time is continuous time; a model with a sample time is discrete time at that sample time. Conversions between the types are listed first.

MATLABEustressScriptNotes
tfTf, TfMatrixRune only: Tf::new, TfMatrix::newdone; no time delays, no descriptor (E) form
ssSsRune only: Ss::newdone; no time delays, no descriptor (E) form
zpkZpkRune only: Zpk::newdone; no time delays, no descriptor (E) form
tf2ss, ss2tf, tf2zp, zp2tf, ss2zp, zp2sstf2ss, ss2tf, tf2zpk, zpk2tf, ss2zpk, zpk2ssRune only: tf2ss, ss2tf, tf2zpk, zpk2tf, ss2zpk, zpk2ssdone; the zero-pole-gain names end in zpk
minrealminrealRune only: method minreal of Tf, Ss, Zpkdone; works on Tf, Zpk and Ss models
seriesseriesRune only: method series of Tf and Ssdone; methods on Tf (SISO only) and on Ss (SISO and MIMO)
parallelparallelRune only: method parallel of Tf and Ssdone; methods on Tf (SISO only) and on Ss (SISO and MIMO)
feedbackfeedbackRune only: method feedback of Tf and Ssdone; methods on Tf (SISO only) and on Ss (SISO and MIMO). connect, append and lft are not covered
polepolesRune only: method poles of Tf and Ssdone
zero, tzerozerosRune only: method zeros of Tf and Ssdone; the zeros of a state-space model need a square system
dcgaindcgainRune only: method dcgain of Tf and Ssdone
evalfrevalRune only: method eval of Tf, Ss, Zpk, TfMatrixdone
freqrespfreqrespRune only: method freqresp of Tf and Ssdone
isstableis_stableRune only: method is_stable of Ssdone
stepstepRune only: stepdone (MIMO)
impulseimpulseRune only: impulsedone (MIMO)
initialinitialRune only: initialdone (MIMO)
lsimlsimRune only: lsimdone (MIMO)
stepinfostepinfo, stepinfo_sysRune only: stepinfo, stepinfo_sysdone; 2 % settling band and 10 % to 90 % rise by default
bodebode, bode_ssRune only: bode, bode_ssdone (data, SISO; no plotting); phase in degrees
nyquistnyquistRune only: nyquistdone (data, SISO; no plotting)
marginmarginRune only: margindone (SISO); phase margin in degrees, gain margin as an absolute factor
allmarginallmarginRune only: allmargindone (SISO)
c2dc2d, c2d_tf, c2d_matchedLuau and Rune: c2d; Rust only: c2d_tf, c2d_matcheddone for zoh, foh, tustin, prewarp and matched; the impulse and least-squares methods are not covered; matched is SISO
d2cd2cRune only: d2cdone for zoh, tustin and prewarp
ctrbctrb, ctrb_rankRune only: ctrb, ctrb_rankdone
obsvobsv, obsv_rankRune only: obsv, obsv_rankdone
gramgramRune only: gramdone for stable models
norm(sys, 2)h2normRune only: h2normdone for stable models
hsvdhsvdRune only: hsvddone for stable models
lyaplyapRune only: lyapdone; the generalized forms with E are not covered
dlyapdlyapRune only: dlyapdone; the generalized forms with E are not covered
carecare, care_withLuau and Rune: care, care_withdone (with the cross term S; no E); covers icare
daredare, dare_withLuau and Rune: dare, dare_withdone (with the cross term S; no E); covers idare
lqrlqr, lqr_matricesLuau and Rune: lqr; Rust only: lqr_matricesdone
dlqrdlqrLuau and Rune: dlqrdone
lqilqiRune only: lqidone
placeplaceRune only: placedone
ackerackerRune only: ackerdone
kalmankalmanRune only: kalmanpartial: steady-state gains and covariance; no assembled estimator model, no correlated noise N
lqelqeRune only: lqepartial: steady-state gains and covariance; no assembled estimator model, no correlated noise N
dlqedlqeRune only: dlqepartial: steady-state gains and covariance; no assembled estimator model, no correlated noise N
balrealbalrealRune only: balrealdone for stable models
balredbalredRune only: balreddone for stable models; truncation and DC matching
rlocusrlocusRune only: rlocusdone (points; no plot)
pidtunepidtuneRune only: pidtunepartial: P, PI, PD and PID from a target crossover and phase margin; the gains differ from the proprietary MATLAB rule for the same targets
pidPidRune only: Pid::newpartial: see pidtune
dampdampRune only: dampdone
real-time blocksDiscreteStepper, DiscretePid, IirFilter, FftPlanRune only: DiscreteStepper::new, DiscretePid::new, IirFilter::new, FftPlan::newbeyond MATLAB: the per-sample step does not allocate

03Not Covered, and What to Use Instead

What Is Not Covered

These MATLAB features are not in the library. Each row groups them by area.

AreaNot covered
Linear algebrasparse matrices, N-D arrays, funm, gsvd, qz, ldl, eigs, svds, balance; the eigenvectors of eig(A, B)
Polynomialsthe inverse direction of residue
Differential equationsode113, ode78, ode89, ode23t, ode23tb, ode15i, dde23, bvp4c, pdepe; mass matrices and DAEs in ode15s; the NonNegative, OutputFcn and Refine options; a vector AbsTol
Optimizationfminbnd, fmincon, lsqcurvefit, linprog, quadprog, ga, particleswarm, patternsearch; bounds in lsqnonlin
Calculus, interpolation and signalintegral2, integral3, interp2, griddata, fft2, fftn, filtfilt, butter and other filter design, window functions, pwelch, conv2, xcorr; the makima, previous and next methods of interp1
Control designtime delays (pade, InputDelay), descriptor systems, nichols, sigma, norm(sys, inf), bandwidth, lqg, lqgreg, reg, estim, lqry, connect, append, lft, d2d, modred, canon, frd, diskmargin, sisotool; the impulse and least-squares methods of c2d; the generalized forms of lyap, care and dare with E; an assembled kalman estimator model; correlated noise N; the Robust Control, MPC and System Identification toolboxes; plotting

The Nearest Alternative

Where a nearby route exists, this table names it. Some of the routes name routines that Luau does not reach, or that only the Rust crate holds; the Script column of the name tables shows which.

MissingUse instead
sparse matrices, N-D arrays, symbolic mathdense matrices; split N-D data into matrices
ode113ode45 with a tight tolerance
ode78, ode89ode45 with a tight tolerance (more steps for the same accuracy)
pdepediscretize in space by hand (method of lines), then use ode15s
ode23t, ode23tbode15s or ode23s
DAEs, mass matrices (ode15i)eliminate the algebraic variables, then use ode15s
dde23, bvp4cno equivalent; a boundary-value problem can be shot with ode45 inside fsolve
fminbndfzero on the derivative, or fminsearch in one variable
fmincon, bounds in lsqnonlina penalty term or a change of variables, then fminunc or lsqnonlin
lsqcurvefitlsqnonlin on the residual model(x, t) - y
linprog, quadprog, gano equivalent
particleswarm, patternsearchfminsearch from several starting points, keeping the best result
integral2, integral3nested integral calls
interp2interp1 along each axis
interp1 with makimathe pchip method of interp1, which is also shape preserving
interp1 with previous or nextthe nearest method of interp1, or find the interval by searching the sorted samples
filtfiltfilter forward, reverse the samples, filter again, reverse
butter and other filter designdesign in continuous time as a Tf, then c2d_tf with the Tustin prewarp method
time delaysa Pade approximant written as a Tf, or extra delay states in a discrete Ss
nichols, sigmabode data; singular_values of the state-space frequency response at jw (eval of an Ss model)
norm(sys, inf), bandwidththe peak of the bode magnitude on a fine grid
lqg, lqgreg, reg, estimassemble a state-space model from the lqr and kalman gains yourself
connect, appendseries, parallel, feedback, or build the block matrices yourself
d2dd2c, then c2d
modred, canonbalred; a state transformation of the state-space model (transform) with your own basis
plottingevery routine returns the series; draw them with the host application

04Your First Call

In Luau

This part covers Luau scripts. Choose Luau at the top of the page to read it; Rune scripts are covered under In Rune.

Luau scripts reach the library through the global table Numerics. There is nothing to require and no service to look up. The table is read-only, so one script cannot replace a function that another script calls. Both call styles work and give the same result: Numerics.solve(A, b) and Numerics:solve(A, b).

This script solves 2x + y = 5 and x + 3y = 6:

Luau
local x = Numerics.solve({{2, 1}, {1, 3}}, {5, 6})
print(x[1], x[2])

The result x is the array {1.8, 1.4}; the tests check both values to within 1e-12. A vector on the right gives a vector. A matrix on the right gives a matrix.

Options go in an optional last table. Each name that ends in _with, such as ode45_with, is the same function as its base name in Luau, so either spelling works. This call integrates y' = -y over the interval 0 to 1 with a tighter relative tolerance:

Luau
local sol = Numerics.ode45(function(t, y) return {-y[1]} end, {0, 1}, {1}, {rtol = 1e-8})
print(sol.t[#sol.t], sol.y[#sol.y][1])

The last time is 1 and the last state is about 0.3679, the value of e to the power -1. In the result, sol.y[k] is the state at sol.t[k]. Luau arrays start at 1.

Three routines treat a missing argument as a default in Luau:

  • fzero(f, a, b) searches the bracket from a to b. fzero(f, a) with no b starts from the guess a. fzero_from(f, x0) is the same guess form under its own name.
  • interp1(x, y, xq) uses the linear method unless a method string follows.
  • c2d(sys, ts) uses "zoh". The third argument is a method string ("zoh", "foh", "tustin" or "matched") or an options table with method and prewarp.

In Rune

This part covers Rune scripts. Choose Rune at the top of the page to read it.

Rune scripts import the module with use eustress::realism::numerics; and call its functions by path, as in numerics::solve(a, b)?. Every function returns a Result: Ok holding the value, or Err holding a message. The ? after the call turns an Err into a script error. This script solves the same system:

Rune
use eustress::log_info;
use eustress::realism::numerics;

pub fn on_init() {
    let x = numerics::solve([[2.0, 1.0], [1.0, 3.0]], [5.0, 6.0])?;
    let first = x[0];
    let second = x[1];
    log_info(`x = ${first}, ${second}`);
}

The result x is the array [1.8, 1.4]. Rune arrays start at 0. An integer is accepted wherever a number is, so [5, 6] works in place of [5.0, 6.0].

Rune has no optional arguments. A routine that takes options has a _with form whose last argument is an object written #{rtol: 1e-8}. A result that has fields is an object, and the script reads a field with square brackets:

Rune
use eustress::log_info;
use eustress::realism::numerics;

pub fn on_init() {
    let sol = numerics::ode45_with(|t, y| [-y[0]], [0.0, 1.0], [1.0], #{rtol: 1e-8})?;
    let ys = sol["y"];
    let n = ys.len();
    let last = ys[n - 1][0];
    log_info(`y(1) = ${last}`);
}

The last state is about 0.3679, the value of e to the power -1. Rune has no defaults, so three things differ from Luau:

  • fzero(f, a, b) is the bracket form and fzero_from(f, x0) is the guess form.
  • interp1(x, y, xq, method) and c2d(sys, ts, method) need the method argument. c2d takes "zoh", "foh", "tustin" or "matched". Prewarping goes through c2d_with(sys, ts, #{prewarp: w}).
  • Each routine with options has its _with form, such as ode45_with, fminsearch_with, integral_with and lqr_with.

The calls above use the 42 names that both languages reach. Rune calls 101 more functions and has 10 types, covered next.

Functions Only Rune Calls

Luau does not reach these. Choose Rune at the top of the page to read this part.

Rune calls 101 functions that Luau does not reach. They sit in the same module and follow the same conventions: matrices are arrays of rows, options go in a _with form as an object, and every function returns a Result. They cover the factorizations and matrix functions, the polynomial routines, nonlinear least squares and systems, trapz, cumtrapz, filter and freqz, the ODE solvers with events, and the control routines. The name tables mark each one Rune only. A result with several parts is an object. This script factors a matrix with lu and reads the fields:

Rune
use eustress::log_info;
use eustress::realism::numerics;

pub fn on_init() {
    let f = numerics::lu([[4.0, 3.0], [6.0, 3.0]])?;
    let l = f["l"];
    let u = f["u"];
    let p = f["p"];
    let upper = l[0][1];
    log_info(`L[0][1] = ${upper}`);
}

The result holds the matrices l, u and p. L is lower triangular, so the entry l[0][1] is 0, and L times U equals P times A.

Types in Rune

Luau does not reach these. Choose Rune at the top of the page to read this part.

Rune also has 10 types in the same module: Tf, TfMatrix, Ss, Zpk, Pid, DiscreteStepper, DiscretePid, IirFilter, FftPlan, OdeSolution. Nine are built with a constructor, written numerics::Tf::new(num, den)? and so on. OdeSolution has no constructor: it comes out of the solvers ode45_events, ode23_events, ode15s_events, ode23s_events and ode_radau_events.

A script calls a method on the value, as in g.dcgain(), and reads a field without parentheses, as in g.num. A method that returns a new model leaves the first one unchanged. A method that cannot fail, such as order and dcgain of a Tf or len of an OdeSolution, returns a plain value. A method that can fail returns a Result and needs the ?. A function that takes a model, such as step, margin or bode, accepts a Tf, an Ss, a Zpk, or an object #{a: A, b: B, c: C, d: D}. The table lists what each type offers.

TypeBuilt withMethodsFields
TfTf::new, Tf::discrete, Tf::gainis_discrete, order, is_proper, poles, zeros, eval, freq_point, freqresp, dcgain, series, parallel, feedback, feedback_unity, scale, minreal, minreal_with, to_zpk, to_ssnum, den, ts
TfMatrixTfMatrix::new, TfMatrix::from_ssn_outputs, n_inputs, get, eval, to_ssnone
SsSs::new, Ss::discrete, Ss::from_gain, Ss::from_gain_withn_states, n_inputs, n_outputs, is_discrete, is_siso, poles, is_stable, zeros, dcgain, eval, freqresp, channel, to_tf, to_zpk, series, parallel, feedback, transform, minreal, minreal_witha, b, c, d, ts
ZpkZpk::new, Zpk::discreteto_tf, to_ss, eval, minreal, minreal_withz, p, k, ts
PidPid::newto_tf, freq_pointkp, ki, kd, tf
DiscreteStepperDiscreteStepper::newstep, state, set_state, resetnone
DiscretePidDiscretePid::newwith_limits, step, resetnone
IirFilterIirFilter::newstep, state, set_state, resetnone
FftPlanFftPlan::new, FftPlan::with_enginefft, ifft, len, enginenone
OdeSolutionthe *_events solverseval, component, y_last, len, dimt, y, events, terminated, nfev, nfev_jac, njev, nlu, accepted, rejected

This script builds two transfer functions, calls a method on one and passes the other to margin:

Rune
use eustress::log_info;
use eustress::realism::numerics;

pub fn on_init() {
    let g = numerics::Tf::new([1.0], [1.0, 3.0, 2.0])?;
    let dc = g.dcgain();
    let loop_tf = numerics::Tf::new([2.0], [1.0, 3.0, 3.0, 1.0])?;
    let m = numerics::margin(loop_tf)?;
    let gm = m["gm"];
    log_info(`dc = ${dc}, gain margin = ${gm}`);
}

The first function is 1 / (s squared + 3 s + 2), and dcgain is its value at s = 0, which is 0.5. The loop 2 / (s + 1) cubed reaches -180 degrees at the angular frequency of the square root of 3, where its magnitude is 0.25, so the gain margin is 4 to within rounding.

An ODE solver with events returns an OdeSolution. The events argument is an array; an entry that is an object sets terminal and direction. This script drops a ball from a height of 10 under a gravity of 9.81 and stops the run when the height reaches zero:

Rune
use eustress::log_info;
use eustress::realism::numerics;

pub fn on_init() {
    let hit = #{g: |t, y| y[0], terminal: true, direction: -1};
    let sol = numerics::ode45_events(|t, y| [y[1], -9.81], [0.0, 10.0], [10.0, 0.0], #{dense: true}, [hit])?;
    let ev = sol.events;
    let t_hit = ev[0]["t"];
    log_info(`hit at ${t_hit}`);
}

The time of the hit is the square root of 2 times 10 divided by 9.81, which is about 1.43. The option dense: true makes sol.eval(t) return the state at any time between the first and the last.

05Conventions

Matrices, Vectors and Models

A matrix is dense and holds 64-bit floating-point numbers; a complex matrix holds complex numbers. The library sets no hard size limit. Memory use is 8 bytes times rows times columns for each real matrix. A vector is a plain list of numbers. A polynomial is a vector of coefficients, highest power first.

In a script a matrix is an array of rows. Luau writes {{1, 2}, {3, 4}}. Rune writes [[1.0, 2.0], [3.0, 4.0]]. Rows of different lengths are an error. A plain number is read as a 1 by 1 matrix. A vector is an array: {5, 6}[5.0, 6.0]. Results come back in the same shapes.

Luau arrays start at 1. Rune arrays start at 0. The data is the same in both languages: the first value of a result is x[1]x[0]. A matrix result is an array of rows, and eig returns its eigenvectors as the columns of that matrix.

A model for c2d is a table, {a = A, b = B, c = C, d = D}an object, #{a: A, b: B, c: C, d: D}. The fields c and d are optional: a missing c is the identity output and a missing d is zero feedthrough. Upper-case names also work. The result of c2d has the same fields plus ts, the sample time.

Callbacks

A script passes a callback as an ordinary function: function(t, y) return {...} end|t, y| [...]. The routine calls it once per evaluation.

  • The right-hand side of an ODE takes the time and the state array and returns the derivative as an array with one value per state.
  • The objective of fminsearch and fminunc takes the array x and returns a number.
  • The function of fzero and integral takes one number and returns a number.

The time span of an ODE is exactly two numbers, the start and the end. To get output at chosen times, pass the t_eval option. Luau has no event functions and cannot pass a Jacobian: ode15s, ode23s and ode_radau estimate the Jacobian by finite differences when a script calls them. Luau does not reach lsqnonlin, fsolve or ordschur.Rune passes event functions and a Jacobian through the *_events solvers. Their events argument is an array, and each entry is a function |t, y| value or an object #{g: f, terminal: true, direction: -1} (terminal is false and direction is 0 when absent). Their option jacobian is a function |t, y| J that returns the n by n matrix; ode15s_events, ode23s_events and ode_radau_events read it, and ode45_events and ode23_events refuse it with an error. The Rune routines lsqnonlin and fsolve take a function |x| residuals and accept the option jacobian as |x| J; ordschur takes a function |re, im| that returns true or false.

Options and Results

Options are read by name from a tablean object. An option name the routine does not know is an error that lists the valid names. A result that has fields comes back as a tablean object with these names.

RoutineResult fieldsOptions
ode45, ode23, ode15s, ode23s, ode_radaut, y, nfev, accepted, rejectedrtol, atol, max_step, first_step, max_steps, t_eval
fminsearchx, fval, iterations, evaluations, convergedtol_x, tol_fun, max_iter, max_fun_evals, adaptive
fminuncx, fval, iterations, evaluations, convergedtol_grad, tol_x, max_iter
fzero, fzero_fromx, fx, iterations, evaluationsnone
integralvalue, error, evaluationsabs_tol, rel_tol, max_intervals
lqr, dlqrx, k, eigenvalues, residualn (the cross term), method
care, darex, k, eigenvalues, residuals (the cross term), method
c2da, b, c, d, tsmethod, prewarp
eigvalues, vectorsnone
svdu, s, vnone

In an ODE result, y[k] is the state at t[k]. The Riccati methods are auto, schur and iterative. The eigenvalues field is a complex value, described next. The gain k is the state-feedback gain of the closed loop A - B K. The Luau and Rune routines not in the table return a plain number, an array or a matrix.

The Rune only routines have result fields and options of their own. Luau does not reach them. Choose Rune at the top of the page to read them.

The Rune only routines with results that have fields, and the options of their _with forms, follow. The solvers ode45_events, ode23_events, ode15s_events, ode23s_events and ode_radau_events take the options of the Luau and Rune ODE row plus dense, and the stiff ones also take jacobian. They return an OdeSolution with the fields listed under Types in Rune; a plain Luau or Rune solver returns an object. balred returns an Ss.

RoutineResult fieldsOptions
lul, u, pnone
qr, qr_thin, deconvq, rnone
schur, schur_complex, rsf2csfu, tnone
ordschuru, t, countnone
hessq, hnone
generalized_eigvalsalpha, betanone
residuer, p, knone
rank_with, null_with, orth_witha number, an array or a matrixtol
filter_withy, zfzi
lsqnonlin_with, fsolve_withx, fval, iterations, evaluations, jacobian_evaluations, convergedtol_grad, tol_x, tol_fun, max_iter, jacobian
step_with, impulse_witht, y, xinput, t
initial_witht, y, xt
lsim_witht, y, xx0, hold
stepinfo_with, stepinfo_sys_withrise_time, settling_time, settling_min, settling_max, overshoot, undershoot, peak, peak_time, final_valuey_final, settling_threshold, rise_limits
bode_withw, mag, mag_db, phase_degw
nyquist_withw, re, imw
margingm, pm, wcg, wcpnone
allmargingain_margins, gm_freqs, phase_margins, pm_freqs, delay_marginsnone
rlocus_withk, rootsgains
damppoles, wn, zetanone
lqi_withx, k, eigenvalues, residualn
kalman, lqe, dlqel, p, m, eigenvaluesnone
balrealsys, hsv, t, t_invnone
balred_witha number, an array or a matrixmethod
pidtune_withpid, crossover, phase_margincrossover
d2c_witha number, an array or a matrixmethod, prewarp

Complex Numbers

The results that are complex in general are complex numbers with a real part, an imaginary part, a modulus and an argument: eigenvalues and eigenvectors, polynomial roots, residues and poles, Fourier transforms, and frequency responses. The poles and zeros of a model are complex numbers.

Complex values exist in scripts as two arrays of the same length: {re = {...}, im = {...}}#{re: [...], im: [...]}. eigvals, roots, fft and ifft return them, and so do the eigenvalues field of the Riccati routines and the values field of eig. The vectors field of eig is {re = rows, im = rows}#{re: rows, im: rows} with one eigenvector per column. fft and ifft accept a plain array, which is read as a real signal, or the re and im form. The matrices a script passes are real.

Rune returns the same form from more routines than Luau reaches. Choose Rune at the top of the page to read the list.

Rune returns the same form from more routines. generalized_eigvals returns alpha and beta in it, residue returns its r and p fields in it, and poly, freqz and the poles and zeros methods of a model return it. logm and sqrtm return #{re: rows, im: rows}, and schur_complex and rsf2csf return u and t in that form. poly and poly_real accept the roots as a plain array or in the re and im form, and so do place and acker for the poles.

The transform of an impulse is flat:

Luau
local X = Numerics.fft({1, 0, 0, 0})
print(X.re[1], X.re[2], X.re[3], X.re[4])
Rune
use eustress::log_info;
use eustress::realism::numerics;

pub fn on_init() {
    let X = numerics::fft([1.0, 0.0, 0.0, 0.0])?;
    let re = X["re"];
    log_info(`${re[0]} ${re[1]} ${re[2]} ${re[3]}`);
}

The script prints four ones: the real part is four ones and the imaginary part is four zeros.

Errors

Bad input produces an error, not a crash. There are eight kinds of error. Each message begins with a prefix that names the kind, and then names the routine that raised it.

KindMeaningExample message
DimensionMismatchMatrix or vector sizes do not agree.dimension mismatch: solve: A is (3, 3), B is (2, 1)
NotSquareThe operation needs a square matrix.matrix must be square: inv: got 2x3
SingularThe matrix is singular, or numerically singular, for this operation.singular matrix: solve: matrix is exactly singular
NotPositiveDefiniteThe matrix is not symmetric positive definite.not positive definite: chol: matrix is not positive definite
InvalidArgumentAn argument is outside its valid range.invalid argument: roots: coefficients must be finite
NoConvergenceAn iteration did not converge within its budget.no convergence: ode: step size underflow at t = 0.99...; the problem may be stiff or singular
NoSolutionThe problem has no solution of the requested kind, for example a Riccati equation without a stabilizing solution.no solution: sqrtm_real: the result is not real
UnsupportedThe operation is not defined for this type of system, for example a continuous-only routine given a discrete model.unsupported: c2d: the matched method needs a SISO model

The step-underflow message begins with ode: for ode45 and ode23, and with ode15s:, ode23s: or ode_radau: for the stiff solvers; the rest of the text is the same for all of them. ode15s adds a sentence that names ode_radau as the solver for tolerances that tight, and it refuses a tolerance below what its backward-difference formulas can deliver with an invalid-argument error that says to use ode_radau. Routines that run out of budget handle it in one of two ways. fminsearch, fminunc and lsqnonlin return their best point with a flag that says the run did not converge. fsolve, fzero, integral and the ODE solvers raise a no-convergence error, because a point that is not a root, or an integration that did not finish, is not a usable answer.

A script sees the same messages with a prefix that names the routine.

Every failure is an ordinary Luau error, so pcall catches it. The error text begins with runtime error: Numerics.<name>: then the message, and a stack traceback follows it.

Luau
local ok, err = pcall(Numerics.solve, {{1, 2}, {2, 4}}, {1, 1})
print(ok, err)

Here ok is false and err begins with runtime error: Numerics.solve: singular matrix: solve: matrix is exactly singular, followed by a stack traceback.

A failure is an Err holding a string that begins numerics::<name>: and continues with the message. Use ? to turn it into a script error, or match to handle it:

Rune
use eustress::log_info;
use eustress::realism::numerics;

pub fn on_init() {
    match numerics::solve([[1.0, 2.0], [2.0, 4.0]], [1.0, 1.0]) {
        Ok(x) => log_info(`solved`),
        Err(e) => log_info(`failed: ${e}`),
    }
}

The message is numerics::solve: singular matrix: solve: matrix is exactly singular. An error raised inside a callback comes back carrying the script's own message. An error raised inside a callback comes back as numerics::<name>: the callback failed: .... The constructors and methods of the Rune types name the type, as in numerics::Tf::new: for a failed constructor and numerics::Tf::series: for a failed method. A bad argument names its position, as in argument 1 (A) must be a matrix.

Units

The library is unit-free: it treats every number as a plain quantity and converts nothing. Time, length and the rest mean whatever units you use for the inputs.

  • Angles are in radians. The exceptions follow MATLAB: the phase that bode returns and the phase margin are in degrees.
  • Frequencies are angular, in radians per time unit. They are never in hertz. freqz takes radians per sample.
  • bode returns the magnitude as an absolute value and in decibels. margin returns the gain margin as an absolute factor.

Determinism

By default every routine runs on one thread. With one thread, every routine returns the same bits on every run. Results from different thread counts can differ in the last bits.

In the measured bit-for-bit table, svd is the one kernel whose bits differ between one thread and several. The table is on the Linear Algebra and Polynomials page.

Scripts cannot change the thread count. The thread setting is part of the Rust crate, and no script routine reaches it.

What the Crate Computes Itself

Most dense routines call the faer library (LU, QR, Cholesky, the Hessenberg reduction, symmetric and generalized eigenvalues, matrix products) and the rustfft library. Five paths are written in this crate instead. The ODE solvers, ode_radau included, are in-crate throughout and use their own small real and complex LU.

  • eig and eigvals reduce the matrix to Hessenberg form with faer and then run the real Schur QR written in this crate: a multishift algorithm with aggressive early deflation, with a double-shift iteration below order 75 and inside the deflation windows. The sweeps update the Schur vectors with faer matrix products. The eigenvectors come from a back-substitution on the quasi-triangular factor and one triangular matrix product with the Schur vectors. This path serves every order. If the QR iteration does not converge, eig and eigvals fall back to faer's eigensolver. There is no balancing, so the routine is the counterpart of MATLAB's eig(A, 'nobalance').
  • The consuming solve, solve_owned, takes both matrices by value. For one right-hand side and 128 unknowns or more it factors A in place and overwrites B: there is no copy and no scan of the inputs. A NaN or infinite input is caught by the check on the result and reported as a singular-matrix error. Smaller systems and several right-hand sides take faer's owning LU. The borrowing solve makes one copy for the in-place route; when that route fails it looks at the inputs again, so a non-finite input is still named as an invalid argument.
  • svd and svd_thin reduce the matrix to bidiagonal form with faer, run a divide-and-conquer method written in this crate on the bidiagonal (the method of LAPACK's dbdsdc, after Gu and Eisenstat), and apply faer's blocked Householder back-transform. A matrix more than 11/6 times taller than wide, or the reverse, and any case where the divide and conquer does not finish, use faer's own SVD.
  • singular_values, the values-only routine, reduces the matrix to bidiagonal form with faer and then runs a dqds iteration written in this crate (root-free, of order n squared). A bidiagonal with a zero on its diagonal goes through an implicit-shift QR iteration instead.
  • fft has four kernels. When the machine has AVX2 and FMA and every prime factor of the length is at most 13, the default is the mixed-radix kernel written in this crate (radix 8, 4, 2, 3, 5, 7, 11 and 13, two complex values per instruction). It uses its direct form below 32 768 points and its depth-first form from 32 768 points on. A cache-blocked six-step form stays available through FftEngine, and the default does not pick it. Every other case goes to rustfft: other machines (wasm32 included) and lengths with a larger prime factor. FftPlan has with_engine, which forces a kernel, and engine, which reports which one a plan got.

The fixtures kernels.json (19 cases), svd.json (7) and eig.json (4), the unit tests of the in-crate code, and the mutation proof check these paths; see How It Is Proven.

Cost and the Frame Budget

A long call cannot be cancelled from outside and reports no progress. The ODE solvers stop early through a terminal event or a limit on the number of steps. A Luau script has no events: it limits a run with the max_steps option.A Rune script limits a run with the max_steps option or ends it at a terminal event of an *_events solver.

Info
Keep design calls outside the frame loop

On an 18-core test machine, a 200 by 200 eigenproblem takes about 18 ms and a 100-state Riccati solve takes about 60 ms. Both are too long for a frame at 60 Hz. Run design calls (factorizations, Riccati solves, discretization) outside the frame loop. The per-sample blocks are the ones meant to run inside it: the step calls of DiscreteStepper, DiscretePid and IirFilter, and the in-place transform of FftPlan, do not allocate.

The times on this page are of the Rust routines called directly. A script call adds the cost of converting tables to matrices and back, and a script callback runs once per evaluation. That cost is not measured here.

Luau reaches the design calls (lqr, care, dare, c2d and the factorizations eig, svd and solve) but not the per-sample blocks. A Luau controller computes its gain once with lqr, keeps k, and applies u = -K x with ordinary arithmetic at each step. Rune reaches the per-sample blocks as types: DiscreteStepper::new takes a discrete model, DiscretePid::new takes a Pid and a sample time, IirFilter::new takes the filter coefficients, and each has a step method that runs one sample; FftPlan::new plans a transform of one length. A Rune controller can use them in place of its own arithmetic.

For measured run times, see Performance.

06How It Is Proven

Reference Libraries and Fixtures

Every result is checked against an independent reference. The reference libraries are NumPy 2.5.5, SciPy 1.18.1 and python-control 0.10.2. A generator script runs them on a fixed set of inputs and writes the inputs, the expected outputs and the library versions into JSON fixture files in the crate's tests folder. There are ten files.

Fixture fileCasesArea
linalg.json25Linear algebra
poly.json11Polynomials
ode.json6Differential equations
optim.json6Optimization
calc.json12Calculus, interpolation and signal
control.json30Control design
kernels.json19The mixed-radix, depth-first and six-step FFT, the values-only SVD and the consuming solve
radau.json10The ode_radau stiff solver: Radau references for the stiff Van der Pol and Robertson problems, and the error and cost of the SciPy Radau solver at four tolerances
svd.json7Full SVD of random, graded, clustered, rank-deficient and near-identity matrices
eig.json4Eigenvalues and eigenvectors of order 80 defective, clustered, graded and cyclic-permutation matrices

Tests

119 of 119 tests pass. A test compares a routine with the stored reference output, or checks a defining property: a factorization multiplies back to the input, a Schur vector matrix is orthogonal, an inverse undoes its forward step. The test names for each routine are on the area pages.

Mutation Proof

A passing test proves little unless it can fail. The mutation check breaks one line of the library at a time and expects a named test to fail. It ran 43 mutations. 41 were caught: the named test failed. 2 survived, and both survivals are expected.

MutationTestResult
eig: eigenvalues scaled by 1 + 1e-6linalg::eig_general_matches_scipycaught: the test failed
care: Q term of the Riccati residual scaled by 1.001control::care_and_lqr_on_an_unstable_plant_match_scipycaught: the test failed
c2d tustin: 0.5 * dt replaced by 0.4 * dt in the numerator factorcontrol::c2d_zoh_foh_tustin_match_scipycaught: the test failed
ode45 step control: error estimate under-reported 1000 timesode_optim::ode45_error_tracks_the_tolerancecaught: the test failed
ode45 step control: rejected steps accepted (accept threshold raised to 1e6)ode_optim::ode45_step_control_spends_work_where_the_tolerance_askscaught: the test failed
margin: phase margin offset by one degreecontrol::margin_matches_python_controlcaught: the test failed
margin: gain crossover polynomial uses |N|^2 - 1.01 |D|^2control::margin_matches_python_controlcaught: the test failed
expm: last Pade coefficient 182 replaced by 181linalg::expm_of_a_rotation_generator_matches_the_closed_formcaught: the test failed
ode15s: gamma coefficients accumulate 1/(i+1) instead of 1/iode_optim::ode15s_solves_stiff_van_der_pol_mu_1000caught: the test failed
dare: X scaled by 1.001 in the returned gaincontrol::dare_and_dlqr_match_scipycaught: the test failed
mixed-radix fft: radix-4 pass loses its rotation by -i (vector code)kernels::fft_mixed_radix_matches_scipy_on_long_lengthscaught: the test failed
mixed-radix fft: odd-radix pass swaps the sign of the sine sum (vector code)kernels::fft_mixed_radix_matches_numpy_on_composite_lengthscaught: the test failed
singular values: sign error in the row rotation of the bidiagonal QR sweepkernels::singular_values_match_scipycaught: the test failed
solve_owned: single right-hand side solved with A' instead of Akernels::solve_owned_matches_numpycaught: the test failed
six-step fft: twiddle built from the coarse table onlykernels::fft_six_step_matches_scipy_on_very_long_lengthscaught: the test failed
dqds: transform applies the shift twicekernels::singular_values_match_scipycaught: the test failed
bidiagonal divide and conquer: secular bracket updated on the wrong sidelib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonalcaught: the test failed
bidiagonal divide and conquer: vectors built from the original z instead of the recomputed onelib::bdc::tests::hard_cases_graded_clustered_rank_deficientcaught: the test failed
bidiagonal divide and conquer: deflation rotation with sine and cosine swappedlib::bdc::tests::hard_cases_graded_clustered_rank_deficientcaught: the test failed
bidiagonal divide and conquer: null vector combined with the wrong signlib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonalcaught: the test failed
bidiagonal divide and conquer: first component of the left vectors +1 instead of -1lib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonalcaught: the test failed
svd: right reflectors applied one row too highkernels::full_svd_matches_scipy_on_hard_casescaught: the test failed
ode_radau: third error-estimate weight -1/3 replaced by -1/4ode_optim::ode_radau_matches_scipy_radau_on_stiff_van_der_pol_at_four_tolerancescaught: the test failed
ode_radau: real eigenvalue of the Newton system 3.6378 replaced by 3.6ode_optim::ode_radau_has_order_five_dense_output_events_and_an_analytic_jacobian_pathcaught: the test failed
ode_radau: collocation polynomial coefficient -8/3 replaced by -7/3ode_optim::ode_radau_matches_scipy_radau_on_robertson_at_four_tolerancescaught: the test failed
ode15s: tolerance refusal removedode_optim::ode15s_refuses_tolerances_it_cannot_reach_and_points_to_ode_radaucaught: the test failed
radix-8 fft pass, scalar: the quarter turn of the third difference droppedlib::mixed_fft::tests::every_radix_matches_the_definition_in_scalar_and_simd_codecaught: the test failed
radix-8 fft pass, AVX2: the eighth-root factor 1/sqrt 2 replaced by 0.7kernels::fft_mixed_radix_matches_numpy_on_composite_lengthscaught: the test failed
depth-first fft: outputs of the parts copied back without interleavingkernels::fft_depth_first_matches_scipy_on_long_lengthscaught: the test failed
depth-first fft: the parts are left untransformed after the first split of a partlib::mixed_fft::tests::depth_first_matches_the_direct_kernelcaught: the test failed
divide and conquer merge: the middle row is left out of the upper half of Vlib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonalcaught: the test failed
divide and conquer merge: sorted singular values written to unsorted placeskernels::full_svd_matches_scipy_on_hard_casescaught: the test failed
divide and conquer merge: rows of block two stored one row too highlib::bdc::tests::hard_cases_graded_clustered_rank_deficientcaught: the test failed
in-crate eig: sweep U row bound taken from the lowest active bulge onlylib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathcaught: the test failed
in-crate eig: sweep left pass skips the newest bulge's own columnlib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathcaught: the test failed
in-crate eig: AED spike test reads the second row of Vlib::hqr::tests::hard_matrices_on_every_driver_pathcaught: the test failed
in-crate eig: 1x1 block swap rotates Q the wrong waylib::hqr::tests::block_swaps_of_every_shapecaught: the test failed
in-crate eig: 2x2 standardization rotation with the wrong sine signlib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathcaught: the test failed
in-crate eig: complex eigenvector started for the conjugate eigenvaluelib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathcaught: the test failed
in-crate eig: overflow guard of the real back-substitution removedlib::hqr::tests::repeated_eigenvalues_give_finite_vectorscaught: the test failed
in-crate eig: second column of a complex pair not conjugatedlinalg::eig_hard_matrices_match_scipy_through_the_in_crate_solvercaught: the test failed
ode15s: order-2 NDF coefficient kappa -1/9 replaced by 0 (this is plain BDF2: a valid method, not a bug)ode_optim::ode15s_solves_stiff_van_der_pol_mu_1000survived, as expected: the test passed
dare: doubling iteration drops the G update (the Newton correction that follows repairs the start value)control::dare_handles_a_singular_state_matrixsurvived, as expected: the test passed

The first survivor changes the order-2 coefficient of the ode15s method to the plain second-order backward-difference method, which is a valid method and not a bug. The second drops one update from the doubling iteration of dare, and the Newton correction that follows repairs the start value.

Accuracy and Speed

The measured accuracy and speed tables are on their own page.

See Performance for the tables and how they were measured.

07What's Next

Pick an Area

Start with the area that matches your problem. Linear Algebra and Polynomials covers solving systems, factorizations and polynomial work. Differential Equations covers integrating a model through time. Optimization covers roots and minimization. Calculus and Signal covers integrals, interpolation, the Fourier transform and filters. Control Design covers models, responses and controller design. Performance holds the measured tables.

Loading Eustress Engine...