Learn/Numerics/Performance

Performance

Run time and accuracy of the numerics library measured against SciPy and NumPy, every row of the table, and how to run the same measurement again.

Time44 min readLevelAdvancedUpdatedUpdated Nov 2026
Info
Summary

Faster than SciPy on every routine timed (eig 1.3x at 200 and 1.15x to 1.2x at 500, solves 1.4x to 1.7x, FFT level at 131,072 points); more accurate on eig residuals, Riccati, LQR and solves; SciPy keeps smaller full-SVD residuals and better stiff accuracy than ode15s, where ode_radau matches SciPy's Radau. MATLAB not measured.

The eig figures in the sentence above are the paired-run figures, where Eustress and SciPy ran back to back: 1.31x to 1.36x at 200 and 1.15x to 1.22x at 500. The single run in the speed table reads higher: 1.44x at 200 and 1.25x at 500. The machine was loaded, and the paired figures are the ones to trust where a single row swings. The ODE solver and optimizer ratios, 39.1x to 905x in the table, are callback-bound: SciPy calls back into Python for every function evaluation and the Eustress run calls compiled code.

01Overview

What Is Measured

This page reports two measurements of the numerics library: how long a call takes, and how close its result is to a reference. Run times are compared with SciPy and NumPy. Accuracy is reported beside each run time, and again against stored reference results for every routine the tests cover.

The run times are compared with SciPy 1.18.1 and NumPy 2.5.5, running on OpenBLAS (scipy-openblas 0.3.34.237.2). The reference results for the accuracy tests were produced with NumPy 2.5.5, SciPy 1.18.1 and python-control 0.10.2. python-control is a source of reference results only; no run time was measured against it.

Each row is one routine at one problem size, run on one machine. The tables show every row that was measured. No row is left out, and rows are grouped by area, not ordered by result. Where SciPy or NumPy took less time or returned a more accurate result, the row says so in the same words and the same table as the rows where Eustress did.

MATLAB Was Not Measured

Info
No MATLAB measurement

MATLAB was not measured, so this page makes no speed comparison with it.

The library's routine names follow MATLAB so that a MATLAB user can find them. Nothing on this page says how a MATLAB call compares with a call here.

Summary

The summary at the top of the page states the result in one sentence. The tables under Speed and Accuracy hold the figures behind it, and the paired runs under Speed hold the figures to trust where a single row swings. The ODE solver and optimizer tables are callback-bound: they compare Eustress calling compiled code against SciPy calling back into Python for every function evaluation. Read the note above those tables before using their ratios.

02Method

Machine and Build

  • Machine: Intel Core i9-10980XE (18 cores, 36 logical processors, AVX-512), 256 GB, Windows 11.
  • Build: --release, lto = "fat", codegen-units = 1, Rust 1.100.0.
  • Timer: std::time::Instant and time.perf_counter.
  • Python side: SciPy 1.18.1, NumPy 2.5.5, BLAS scipy-openblas 0.3.34.237.2 (OpenBLAS 0.3.34.237.2 USE64BITINT DYNAMIC_ARCH NO_AFFINITY SkylakeX MAX_THREADS=24); the SciPy process reported 36 logical processors.
  • One thread unless stated.

Generic is the default x86-64 build and is what ships. Native is the same code built with the compiler flag -C target-cpu=native, which targets the CPU of the machine that builds it.

The ratio in every table uses the generic build. The native column is reported beside it.

How Time Was Measured

Each call is repeated and the minimum over the repetitions is reported. The machine was shared with other work, so the minimum, the run least disturbed by that work, is used in place of the average. There is no separate warm-up run. Rows with a short call repeat many times, so that the minimum falls after the processor has settled.

The number of repetitions depends on the row and is chosen so that short calls run many times and long calls run a few times. Eustress rows ran from 3 to 2000 repetitions per run, and SciPy and NumPy rows from 3 to 2000 repetitions.

  • Each Eustress time is the minimum over two separate runs of the benchmark program, one set per build.
  • SciPy and NumPy were run twice, once with one BLAS thread and once with the default number of threads. The ratio uses the lowest time of those two runs and, where a row has several SciPy or NumPy variants, of those variants. Each variant's time is in the table.
  • Eustress ran on one thread unless the Threads section says otherwise.
  • For the solve rows in the consuming form, the input copies were made outside the timer, for Eustress and for the SciPy call with overwriting turned on. The NumPy solve copies its inputs inside the timer. The borrowing form of the Eustress solve copies once inside the timer.
  • The times on this page are of the Rust routines called directly, from a compiled benchmark program. 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 on this page.

How Accuracy Was Measured

Three accuracy measures appear beside the run times. Each is computed by the benchmark program for the Eustress result and by the Python script for the SciPy or NumPy result, with the same formula on both sides.

  • residual is the scaled residual of the factorization or equation. A residual is how far the returned answer is from satisfying the problem, scaled by the size of the problem.
  • error is the largest relative error against a reference solution computed at 1e-11 or tighter.
  • fval is the objective value reached. The objective in these rows is a sum of squares with a minimum value of 0, so a lower fval is closer to the minimum.

A lower value is a more accurate result for all three measures. The separate table under Accuracy lists the error of each routine against stored reference results, with the tolerance the test allows. Those reference results come from SciPy, NumPy and python-control, stored with their inputs in the fixture files under the library's tests folder, together with the library versions that produced them.

Problem Sets

The Radau function evaluation counts exclude the evaluations used for finite-difference Jacobians, as SciPy's counter does. The benchmark matrices are deterministic. Entry (i, j) with seed s is the fractional part of sin(12.9898 i + 78.233 j + s) times 43758.5453, minus 0.5. The Eustress program and the Python script use the same formula, so both sides receive the same numbers.

RoutineInput
eig, eigvals200 by 200 matrix with seed 0.1 (eig and eigvals), and 500 by 500 with seed 0.1 (eig)
solven by n matrix with seed 0.2 and a right-hand side with seed 0.3, n from 200 to 2000
singular values, svdn by n matrix with seed 0.4, n of 300 and 1000
careA is 100 by 100 (seed 0.5), B is 100 by 10 (seed 0.6), Q and R are identity matrices
lqr, c2dA is 50 by 50 (seed 0.7) minus twice the identity, B is 50 by 5 (seed 0.8), C is 3 by 50 (seed 0.9), D is zero; lqr uses identity Q and R; c2d uses zero-order hold with a sample time of 0.01
fftcomplex signal whose real part is the seeded entry formula (seed 1.0) and whose imaginary part is 0; lengths as named in the rows, from 1,024 to 2,097,152 points
ode45, Lorenzsigma 10, rho 28, beta 8/3, start (1, 1, 1); to t = 100 with rtol 1e-6 and atol 1e-9, and to t = 5 with rtol 1e-8 and atol 1e-10. SciPy runs RK45 with the same tolerances. The t = 5 error is measured against a stored SciPy reference solution.
stiff Van der Polmu 1000, start (2, 0), to t = 3000, with (rtol, atol) of (1e-4, 1e-6), (1e-6, 1e-8) and (1e-8, 1e-10). Eustress runs ode15s; SciPy runs BDF, LSODA and Radau. The error is the largest relative error of the first component against a stored reference at the reference time points.
ode_radau, Van der Polmu 1000, start (2, 0), to t = 3000, with rtol of 1e-4, 1e-6, 1e-8 and 1e-10 and atol equal to rtol times 1e-2. SciPy runs Radau with the same tolerances. The error is the largest relative error of the first component against a stored reference at the reference time points.
ode_radau, Robertsonthe Robertson chemical kinetics problem (rate constants 0.04, 1e4 and 3e7), start (1, 0, 0), to t = 4000, with rtol of 1e-4, 1e-6, 1e-8 and 1e-10 and atol equal to rtol times 1e-6. SciPy runs Radau with the same tolerances. The error is the largest relative error of all three components against a stored reference.
Nelder-Mead, BFGSthe 10-dimensional Rosenbrock function, start alternating between -1.2 and 1.0. Nelder-Mead uses tolerances of 1e-8 on x and on the function value and up to 100000 iterations and evaluations, plain and adaptive. BFGS uses the analytic gradient and a gradient tolerance of 1e-8.

03Speed

The Speed Tables

Times are in milliseconds. Each area has two tables with the same rows in the same order: a time table and a table of accuracy and work. In the time table, generic and native are the two Eustress builds, and the SciPy columns give the SciPy or NumPy times (one BLAS thread, and the lowest time over the variants at default threads). The ratio is the lowest SciPy or NumPy time of the row divided by the Eustress generic time, followed by the side that took less time: a ratio above 1 reads , a ratio below 1 reads . The ratio is not a statement about which result is correct; the second table shows that.

Dense linear algebra

These rows are the like-for-like comparison of kernels: dense factorizations and solves, with no Python code called back during the run on either side.

RoutineEustress generic (ms)Eustress native (ms)SciPy 1 thread (ms)SciPy default (ms)Ratio
eig, 200x200 (values and vectors)16.81724.235.41.44x Eustress
eigvals, 200x200 (values only)11.911.720.330.31.71x Eustress
eig, 500x500 (values and vectors)1591471982841.25x Eustress
solve (A\b), 200x200, consuming form0.2340.228numpy.linalg.solve 0.408
scipy.linalg.solve overwrite, no checks 0.59
2.511.74x Eustress
solve (A\b), 500x500, consuming form2.842.78numpy.linalg.solve 4.13
scipy.linalg.solve overwrite, no checks 5.26
61.21.45x Eustress
solve (A\b), 1000x1000, consuming form17.216.7numpy.linalg.solve 28.4
scipy.linalg.solve overwrite, no checks 28.7
1051.65x Eustress
solve (A\b), 2000x2000, consuming form119123numpy.linalg.solve 167
scipy.linalg.solve overwrite, no checks 180
1811.41x Eustress
solve (A\b), 500x500, borrowing form (one copy)3.63.4numpy.linalg.solve 4.13
scipy.linalg.solve overwrite, no checks 5.26
61.21.15x Eustress
singular values, 300x3007.177.188.410.61.17x Eustress
singular values, 1000x10002892873273371.13x Eustress
svd, 300x300 (full)15.516.317.136.21.1x Eustress
svd, 1000x1000 (full)4594545415461.18x Eustress
RoutineMeasureEustressSciPy or NumPy
eig, 200x200 (values and vectors)residual5.77e-156.30e-15
eigvals, 200x200 (values only)n/an/an/a
eig, 500x500 (values and vectors)residual8.17e-159.05e-15
solve (A\b), 200x200, consuming formresidual1.10e-16numpy.linalg.solve 1.26e-16
solve (A\b), 500x500, consuming formresidual1.74e-16numpy.linalg.solve 1.99e-16
solve (A\b), 1000x1000, consuming formresidual2.33e-16numpy.linalg.solve 3.31e-16
solve (A\b), 2000x2000, consuming formresidual3.49e-16numpy.linalg.solve 5.79e-16
solve (A\b), 500x500, borrowing form (one copy)n/an/an/a
singular values, 300x300n/an/an/a
singular values, 1000x1000n/an/an/a
svd, 300x300 (full)residual2.76e-152.59e-15
svd, 1000x1000 (full)residual4.31e-153.58e-15

Control design routines

Each row is one call of the routine on the model described under Problem Sets.

RoutineEustress generic (ms)Eustress native (ms)SciPy 1 thread (ms)SciPy default (ms)Ratio
care, 100 states, 10 inputs63.260.71071221.7x Eustress
lqr, 50 states, 5 inputs9.127.917.820.31.96x Eustress
c2d zoh, 50 states0.1470.2610.1530.371.04x Eustress
RoutineMeasureEustressSciPy or NumPy
care, 100 states, 10 inputsresidual1.12e-131.02e-10
lqr, 50 states, 5 inputsresidual7.73e-169.73e-15
c2d zoh, 50 statesn/an/an/a

Fourier transform

The second table names the Eustress kernel the plan selected for each length: the in-crate mixed-radix kernel or the rustfft crate.

RoutineEustress generic (ms)Eustress native (ms)SciPy 1 thread (ms)SciPy default (ms)Ratio
fft, 1 024 points0.00350.0031scipy.fft 0.0129
numpy.fft 0.0166
0.01213.46x Eustress
fft, 4 096 points0.01970.019scipy.fft 0.0399
numpy.fft 0.0615
0.03541.8x Eustress
fft, 10 000 points0.05260.0519scipy.fft 0.102
numpy.fft 0.145
0.09291.77x Eustress
fft, 12 000 points0.05950.0611scipy.fft 0.152
numpy.fft 0.168
0.1372.3x Eustress
fft, 15 000 points0.07790.0756scipy.fft 0.204
numpy.fft 0.222
0.1842.36x Eustress
fft, 16 384 points0.1160.0973scipy.fft 0.213
numpy.fft 0.262
0.1941.66x Eustress
fft, 32 768 points0.2550.232scipy.fft 0.449
numpy.fft 0.587
0.411.61x Eustress
fft, 65 536 points0.5850.581scipy.fft 0.949
numpy.fft 1.41
0.951.62x Eustress
fft, 131 072 points1.51.46scipy.fft 2.05
numpy.fft 3.05
1.641.09x Eustress
fft, 196 608 points2.852.74scipy.fft 3.75
numpy.fft 5.64
3.331.17x Eustress
fft, 262 144 points3.713.75scipy.fft 4.91
numpy.fft 6.89
4.341.17x Eustress
fft, 400 000 points6.376.25scipy.fft 9.62
numpy.fft 10.4
9.681.51x Eustress
fft, 524 288 points9.398.53scipy.fft 16.7
numpy.fft 25.7
16.51.75x Eustress
fft, 1 000 003 points (prime)171193scipy.fft 258
numpy.fft 311
2571.5x Eustress
fft, 1 048 576 points21.320.9scipy.fft 35
numpy.fft 52.9
33.41.57x Eustress
fft, 2 097 152 points47.547scipy.fft 73.7
numpy.fft 110
70.91.49x Eustress
RoutineEustress FFT kernel
fft, 1 024 pointsMixedRadix
fft, 4 096 pointsMixedRadix
fft, 10 000 pointsMixedRadix
fft, 12 000 pointsMixedRadix
fft, 15 000 pointsMixedRadix
fft, 16 384 pointsMixedRadix
fft, 32 768 pointsDepthFirst
fft, 65 536 pointsDepthFirst
fft, 131 072 pointsDepthFirst
fft, 196 608 pointsDepthFirst
fft, 262 144 pointsDepthFirst
fft, 400 000 pointsDepthFirst
fft, 524 288 pointsDepthFirst
fft, 1 000 003 points (prime)RustFft
fft, 1 048 576 pointsDepthFirst
fft, 2 097 152 pointsDepthFirst

ODE solvers

Every row in these two tables is callback-bound. SciPy calls back into Python for every function evaluation, and the Eustress run calls compiled code. The ratio is large for that reason as well as for the solver. It is not a comparison of kernels. The second table gives the function evaluation counts (nfev), which show how much work each run did.

RoutineEustress generic (ms)Eustress native (ms)SciPy 1 thread (ms)SciPy default (ms)Ratio
ode45, Lorenz to t = 100 (rtol 1e-6)0.7220.63288273377x Eustress
ode45, Lorenz to t = 5 (rtol 1e-8)0.06230.054822.926367x Eustress
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-40.2080.202BDF 163
LSODA 10.3
Radau 189
9.1343.9x Eustress
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-60.3640.389BDF 303
LSODA 16
Radau 399
16.644x Eustress
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-80.6540.68BDF 652
LSODA 25.6
Radau 1220
2739.1x Eustress
RoutineMeasureEustressSciPy or NumPynfev Eustressnfev SciPy
ode45, Lorenz to t = 100 (rtol 1e-6)n/an/an/a2950430224
ode45, Lorenz to t = 5 (rtol 1e-8)error8.27e-088.27e-0824922492
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-4error0.00361BDF 0.00259
LSODA 0.00479
Radau 1.39e-05
1928BDF 2350
LSODA 2114
Radau 3883
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-6error6.02e-05BDF 7.50e-05
LSODA 8.08e-05
Radau 1.34e-07
3261BDF 5107
LSODA 3575
Radau 9920
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-8error1.49e-06BDF 1.03e-06
LSODA 8.27e-07
Radau 8.78e-10
5727BDF 11480
LSODA 5574
Radau 29951

ode_radau against SciPy Radau

Every row in these two tables is callback-bound. ode_radau is the in-crate Radau IIA solver, measured against SciPy Radau at the same tolerances on two stiff problems. SciPy calls back into Python for every function evaluation, and the Eustress run calls compiled code, so the ratio is not a comparison of kernels. The function evaluation counts leave out the evaluations used for finite-difference Jacobians on both sides.

RoutineEustress generic (ms)Eustress native (ms)SciPy 1 thread (ms)SciPy default (ms)Ratio
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-40.1750.201156163891x Eustress
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-60.4270.537419385902x Eustress
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-81.281.5512101160905x Eustress
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-103.734.6835703350896x Eustress
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-40.03990.04852624.3608x Eustress
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-60.09970.12166.164.3645x Eustress
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-80.2580.353199184714x Eustress
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-100.7551.04595559740x Eustress
RoutineMeasureEustressSciPy or NumPynfev Eustressnfev SciPy
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-4error1.39e-051.39e-0538563883
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-6error1.25e-071.34e-0799209920
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-8error8.41e-108.79e-102981629951
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-10error1.27e-111.27e-118850187898
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-4error6.04e-066.15e-06514514
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-6error7.50e-081.36e-0714211421
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-8error1.12e-091.21e-0941844180
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-10error1.40e-111.27e-111263612669

Optimizers

Every row in these two tables is callback-bound. SciPy calls back into Python for every function evaluation, and the Eustress run calls compiled code. The ratio is large for that reason as well as for the optimizer. It is not a comparison of kernels. The second table gives the function evaluation counts (nfev), which show how much work each run did.

RoutineEustress generic (ms)Eustress native (ms)SciPy 1 thread (ms)SciPy default (ms)Ratio
Nelder-Mead, Rosenbrock 10-D1.271.5256256202x Eustress
Nelder-Mead (adaptive), Rosenbrock 10-D0.4980.621165189331x Eustress
BFGS, Rosenbrock 10-D (analytic gradient)0.05010.051916.717.7333x Eustress
RoutineMeasureEustressSciPy or NumPynfev Eustressnfev SciPy
Nelder-Mead, Rosenbrock 10-Dfval1.68e-163.9966026946
Nelder-Mead (adaptive), Rosenbrock 10-Dfval3.998.02e-1728944617
BFGS, Rosenbrock 10-D (analytic gradient)fval4.10e-223.99101136

Ratio by Row

0.5x1x2x5x10x20x50x100x200x500x1000x2000x1x: equal timeDense linear algebraeig 200x2001.44xeigvals 200x2001.71xeig 500x5001.25xsolve 200x2001.74xsolve 500x5001.45xsolve 1000x10001.65xsolve 2000x20001.41xsolve 500x500, one copy1.15xsingular values 3001.17xsingular values 10001.13xsvd 300x3001.1xsvd 1000x10001.18xControl design routinescare 100 states1.7xlqr 50 states1.96xc2d zoh 50 states1.04xFourier transformfft 10243.46xfft 40961.8xfft 100001.77xfft 120002.3xfft 150002.36xfft 163841.66xfft 327681.61xfft 655361.62xfft 1310721.09xfft 1966081.17xfft 2621441.17xfft 4000001.51xfft 5242881.75xfft 1000003 (prime)1.5xfft 10485761.57xfft 20971521.49xODE solvers (callback-bound)ode45 Lorenz t=100377xode45 Lorenz t=5367xstiff Van der Pol rtol 1e-443.9xstiff Van der Pol rtol 1e-644xstiff Van der Pol rtol 1e-839.1xode_radau against SciPy Radau (callback-bound)Radau VdP rtol 1e-4891xRadau VdP rtol 1e-6902xRadau VdP rtol 1e-8905xRadau VdP rtol 1e-10896xRadau Robertson rtol 1e-4608xRadau Robertson rtol 1e-6645xRadau Robertson rtol 1e-8714xRadau Robertson rtol 1e-10740xOptimizers (callback-bound)Nelder-Mead 10-D202xNelder-Mead adaptive 10-D331xBFGS 10-D333xEustress time lowerSciPy or NumPy time lowercallback-bound row (SciPy calls Python per function evaluation)ratio of the lowest SciPy or NumPy time to the Eustress generic time (logarithmic axis)bars right of 1x: Eustress took less time; bars left of 1x: SciPy or NumPy took less time
Ratio of the lowest SciPy or NumPy time to the Eustress generic time for every row of the tables above, on a logarithmic axis, from head_to_head.json. Bars to the right of the 1x line are rows where Eustress took less time; bars to the left are rows where SciPy or NumPy took less time. Amber bars are the callback-bound rows: SciPy calls back into Python for every function evaluation and the Eustress run calls compiled code, so those ratios are not a comparison of kernels. The dense linear algebra rows are the like-for-like comparison.

Reading the Speed Tables

The callback-bound rows are the ODE solvers and the optimizers. SciPy calls back into Python for every function evaluation in those rows, and the Eustress run calls compiled code. Their ratios are large because of that difference and are not a comparison of kernels. The dense linear algebra rows are the like-for-like comparison of kernels. The function evaluation counts in the table below show how much work each run did.

Several hot paths in the library are Eustress code and do not go through a dependency's high-level call:

  • eig and eigvals reduce the matrix to Hessenberg form with faer, then run an in-crate real Schur QR iteration: the multishift algorithm with aggressive early deflation of LAPACK's dhseqr family, with the double-shift step below order 75 and inside the deflation windows. Eigenvectors come from back-substitution on the quasi-triangular factor and one triangular product. If the iteration does not converge, faer's eigensolver is used. There is no balancing.
  • The consuming solve takes both matrices by value. For one right-hand side and 128 unknowns or more it factors the matrix in place and overwrites the right-hand side, with no copy and no scan of the inputs. Smaller systems and several right-hand sides use faer's owning LU.
  • The full SVD reduces to bidiagonal form with faer, runs an in-crate divide and conquer on the bidiagonal, and applies faer's blocked Householder back-transform. Matrices 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.
  • The singular values routine reduces to bidiagonal form with faer and runs an in-crate dqds iteration on the bidiagonal, which is O(n^2).
  • The 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 in-crate mixed-radix kernel (radix 8, 4, 2, 3, 5, 7, 11 and 13): its direct form below 32,768 points and its depth-first form from 32,768 points on. Every other case goes to the rustfft crate.
  • The ODE solvers, ode_radau included, are in-crate throughout.

Ratio range by area

  • Dense linear algebra: ratio from 1.1 (svd 300x300) to 1.74 (solve 200x200). Eustress time lower in 12 of 12 rows; SciPy or NumPy time lower in 0 of 12 rows.
  • Control design routines: ratio from 1.04 (c2d zoh 50 states) to 1.96 (lqr 50 states). Eustress time lower in 3 of 3 rows; SciPy or NumPy time lower in 0 of 3 rows.
  • Fourier transform: ratio from 1.09 (fft 131072) to 3.46 (fft 1024). Eustress time lower in 16 of 16 rows; SciPy or NumPy time lower in 0 of 16 rows.
  • ODE solvers: ratio from 39.1 (stiff Van der Pol rtol 1e-8) to 377 (ode45 Lorenz t=100). Eustress time lower in 5 of 5 rows; SciPy or NumPy time lower in 0 of 5 rows.
  • ode_radau against SciPy Radau: ratio from 608 (Radau Robertson rtol 1e-4) to 905 (Radau VdP rtol 1e-8). Eustress time lower in 8 of 8 rows; SciPy or NumPy time lower in 0 of 8 rows.
  • Optimizers: ratio from 202 (Nelder-Mead 10-D) to 333 (BFGS 10-D). Eustress time lower in 3 of 3 rows; SciPy or NumPy time lower in 0 of 3 rows.

Rows where SciPy or NumPy took less time than Eustress

In this round 0 of 47 rows have a ratio below 1. The narrowest rows in the table run are c2d zoh 50 states (1.04x), fft 131072 (1.09x), and svd 300x300 (1.1x). A ratio this close to 1 is inside the spread between repeated runs on a loaded machine; the paired runs below give three sweeps for these rows.

Rows where the two times are within 10 percent

c2d zoh 50 states (ratio 1.04), and fft 131072 (ratio 1.09).

Callback-bound rows and the work done

In the callback-bound rows the ratio runs from 39.1 to 905. The number of function evaluations differs between Eustress and the SciPy variant that sets the ratio by a factor of at most 1.6 in these rows (the smallest factor is 1). The table gives the counts.

RoutineSciPy variantnfev Eustressnfev SciPyLarger / smallerTime ratio
ode45, Lorenz to t = 100 (rtol 1e-6)solve_ivp RK4529504302241.02377x
ode45, Lorenz to t = 5 (rtol 1e-8)solve_ivp RK45249224921367x
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-4solve_ivp LSODA192821141.143.9x
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-6solve_ivp LSODA326135751.144x
stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-8solve_ivp LSODA572755741.0339.1x
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-4solve_ivp Radau385638831.01891x
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-6solve_ivp Radau992099201902x
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-8solve_ivp Radau29816299511905x
ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-10solve_ivp Radau88501878981.01896x
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-4solve_ivp Radau5145141608x
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-6solve_ivp Radau142114211645x
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-8solve_ivp Radau418441801714x
ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-10solve_ivp Radau12636126691740x
Nelder-Mead, Rosenbrock 10-Dminimize Nelder-Mead660269461.05202x
Nelder-Mead (adaptive), Rosenbrock 10-Dminimize Nelder-Mead289446171.6331x
BFGS, Rosenbrock 10-D (analytic gradient)minimize BFGS1011361.35333x

Which FFT kernel ran

  • MixedRadix: fft 1024, fft 4096, fft 10000, fft 12000, fft 15000, and fft 16384.
  • DepthFirst: fft 32768, fft 65536, fft 131072, fft 196608, fft 262144, fft 400000, fft 524288, fft 1048576, and fft 2097152.
  • RustFft: fft 1000003 (prime).

Paired Runs

A paired run times both libraries back to back, within each of three sweeps, so that both see the same machine load. The machine was shared and loaded while the single-run tables were measured, so one table row can swing from run to run. Where a row in the speed table and its paired run differ, the paired figures are the ones to trust.

The machine was shared with other work while the benchmarks ran. The report on this run measured the CPU load at 77 percent. Single table rows therefore swing from run to run.

Dense linear algebra, SciPy on one BLAS thread

CaseSweepSciPy (ms)Eustress (ms)Ratio
svd, 300x300 (full)117.8171.05x
svd, 300x300 (full)218.5171.09x
svd, 300x300 (full)317.816.81.06x
eig, 200x200 (values and vectors)122.316.61.34x
eig, 200x200 (values and vectors)222.716.71.36x
eig, 200x200 (values and vectors)322.3171.31x
eig, 500x500 (values and vectors)11851521.22x
eig, 500x500 (values and vectors)21921651.17x
eig, 500x500 (values and vectors)32001731.15x
CaseWorst ratioResidual, EustressResidual, SciPy
svd, 300x300 (full)1.05x2.76e-152.59e-15
eig, 200x200 (values and vectors)1.31x4.08e-164.46e-16
eig, 500x500 (values and vectors)1.15x3.65e-164.05e-16

c2d zoh, 50 states

SweepSciPy (ms)Eustress (ms)Ratio
10.1540.1291.19x
20.1540.131.19x
30.1540.131.19x

Fourier transform, every length swept

Each sweep cell gives the SciPy time in milliseconds, the Eustress time in milliseconds, and the ratio. The kernel is the one the Eustress plan selected.

PointsKernelSweep 1Sweep 2Sweep 3Worst ratio
1024MixedRadix0.0128 / 0.0031 = 4.13x0.0118 / 0.0028 = 4.21x0.0131 / 0.0031 = 4.23x4.13x
2048MixedRadix0.0215 / 0.0101 = 2.13x0.0198 / 0.008 = 2.47x0.022 / 0.0083 = 2.65x2.13x
4096MixedRadix0.0381 / 0.0171 = 2.23x0.0389 / 0.0183 = 2.13x0.0381 / 0.0207 = 1.84x1.84x
8192MixedRadix0.0867 / 0.0468 = 1.85x0.0818 / 0.0464 = 1.76x0.0864 / 0.0607 = 1.42x1.42x
16384MixedRadix0.193 / 0.11 = 1.75x0.192 / 0.102 = 1.89x0.193 / 0.102 = 1.9x1.75x
32768DepthFirst0.45 / 0.303 = 1.48x0.409 / 0.276 = 1.48x0.41 / 0.274 = 1.5x1.48x
65536DepthFirst0.981 / 0.62 = 1.58x0.943 / 0.589 = 1.6x0.938 / 0.581 = 1.61x1.58x
131072DepthFirst1.79 / 1.63 = 1.1x1.6 / 1.58 = 1.02x1.57 / 1.55 = 1.02x1.02x
196608DepthFirst3.28 / 2.81 = 1.16x3.2 / 2.89 = 1.11x3.47 / 2.86 = 1.21x1.11x
262144DepthFirst5.2 / 4.13 = 1.26x4.37 / 4.02 = 1.09x4.45 / 3.82 = 1.16x1.09x
400000DepthFirst10 / 6.48 = 1.55x11.3 / 7.02 = 1.6x10.6 / 6.47 = 1.64x1.55x
524288DepthFirst18.2 / 9.22 = 1.98x16.3 / 9.42 = 1.73x15.2 / 8.65 = 1.76x1.73x
1048576DepthFirst37.6 / 21.1 = 1.78x34.4 / 22.4 = 1.53x33.9 / 21.7 = 1.56x1.53x
2097152DepthFirst73.7 / 46.8 = 1.57x75.2 / 48 = 1.57x70.1 / 46.3 = 1.52x1.52x

Across the Fourier transform lengths the lowest worst-sweep ratio is 1.02x. Lengths with a worst-sweep ratio below 1.05: 131072 points (worst 1.02x). A ratio that close to 1 is inside the spread between sweeps.

04Accuracy

Accuracy Beside Speed

The speed tables carry the accuracy of each run in the same row. The care and lqr rows use the Riccati residual: the Frobenius norm of the equation residual divided by the norm of the solution, computed with the same formula on both sides. The care and dare solvers apply Newton corrections until the corrections stop improving the residual.

Where SciPy is more accurate

  • svd, 300x300 (full) (residual): Eustress 2.76e-15; lower SciPy or NumPy values: 2.59e-15.
  • svd, 1000x1000 (full) (residual): Eustress 4.31e-15; lower SciPy or NumPy values: 3.58e-15.
  • stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-4 (error): Eustress 0.00361; lower SciPy or NumPy values: BDF 0.00259; Radau 1.39e-05. SciPy or NumPy values that are not lower: LSODA 0.00479.
  • stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-6 (error): Eustress 6.02e-05; lower SciPy or NumPy values: Radau 1.34e-07. SciPy or NumPy values that are not lower: BDF 7.50e-05; LSODA 8.08e-05.
  • stiff Van der Pol mu = 1000 to t = 3000, rtol 1e-8 (error): Eustress 1.49e-06; lower SciPy or NumPy values: BDF 1.03e-06; LSODA 8.27e-07; Radau 8.78e-10.
  • ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-10 (error): Eustress 1.40e-11; lower SciPy or NumPy values: 1.27e-11.
  • Nelder-Mead (adaptive), Rosenbrock 10-D (fval): Eustress 3.99; lower SciPy or NumPy values: 8.02e-17.
  • ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-10 (function evaluations): Eustress 88501; SciPy 87898. Eustress used 0.686 percent more.
  • ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-8 (function evaluations): Eustress 4184; SciPy 4180. Eustress used 0.0957 percent more.
  • eig, order 80, clustered (eigenvalue error against the exact eigenvalues): Eustress 3.63e-15; SciPy 3.13e-15.

Where Eustress is more accurate

  • eig, 200x200 (values and vectors) (residual): Eustress 5.77e-15; SciPy or NumPy 6.30e-15.
  • eig, 500x500 (values and vectors) (residual): Eustress 8.17e-15; SciPy or NumPy 9.05e-15.
  • solve (A\b), 200x200, consuming form (residual): Eustress 1.10e-16; SciPy or NumPy numpy.linalg.solve 1.26e-16.
  • solve (A\b), 500x500, consuming form (residual): Eustress 1.74e-16; SciPy or NumPy numpy.linalg.solve 1.99e-16.
  • solve (A\b), 1000x1000, consuming form (residual): Eustress 2.33e-16; SciPy or NumPy numpy.linalg.solve 3.31e-16.
  • solve (A\b), 2000x2000, consuming form (residual): Eustress 3.49e-16; SciPy or NumPy numpy.linalg.solve 5.79e-16.
  • care, 100 states, 10 inputs (residual): Eustress 1.12e-13; SciPy or NumPy 1.02e-10.
  • lqr, 50 states, 5 inputs (residual): Eustress 7.73e-16; SciPy or NumPy 9.73e-15.
  • ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-6 (error): Eustress 1.25e-07; SciPy or NumPy 1.34e-07.
  • ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-8 (error): Eustress 8.41e-10; SciPy or NumPy 8.79e-10.
  • ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-4 (error): Eustress 6.04e-06; SciPy or NumPy 6.15e-06.
  • ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-6 (error): Eustress 7.50e-08; SciPy or NumPy 1.36e-07.
  • ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-8 (error): Eustress 1.12e-09; SciPy or NumPy 1.21e-09.
  • Nelder-Mead, Rosenbrock 10-D (fval): Eustress 1.68e-16; SciPy or NumPy 3.99.
  • BFGS, Rosenbrock 10-D (analytic gradient) (fval): Eustress 4.10e-22; SciPy or NumPy 3.99.
  • ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-4 (function evaluations): Eustress 3856; SciPy 3883.
  • ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-8 (function evaluations): Eustress 29816; SciPy 29951.
  • ode_radau against SciPy Radau, Robertson to t = 4000, rtol 1e-10 (function evaluations): Eustress 12636; SciPy 12669.
  • eig, order 80, defective (eigenvalue error against the exact eigenvalues): Eustress 1.69e-05; SciPy 2.05e-05.
  • eig, order 80, defective (residual): Eustress 3.35e-16; SciPy 3.72e-16.
  • eig, order 80, clustered (residual): Eustress 3.19e-16; SciPy 3.34e-16.
  • eig, order 80, graded (residual): Eustress 1.89e-16; SciPy 2.79e-16.
  • eig, order 80, cyclic (eigenvalue error against the exact eigenvalues): Eustress 5.33e-15; SciPy 7.63e-15.
  • eig, order 80, cyclic (residual): Eustress 5.12e-16; SciPy 6.82e-16.

Where the values agree to the digits shown

  • ode45, Lorenz to t = 5 (rtol 1e-8) (error): Eustress 8.27e-08; SciPy or NumPy 8.27e-08.
  • ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-4 (error): Eustress 1.39e-05; SciPy or NumPy 1.39e-05.
  • ode_radau against SciPy Radau, Van der Pol mu = 1000, rtol 1e-10 (error): Eustress 1.27e-11; SciPy or NumPy 1.27e-11.

Optimizer runs and the converged flag

Routinefval, Eustressconverged, Eustressfval, SciPyconverged, SciPy
Nelder-Mead, Rosenbrock 10-D1.68e-16true3.99true
Nelder-Mead (adaptive), Rosenbrock 10-D3.99true8.02e-17true
BFGS, Rosenbrock 10-D (analytic gradient)4.10e-22true3.99false

Error Against Every Reference

The accuracy example runs every routine the tests cover against its stored reference result and prints the error reached with the tolerance the test allows. The metric is the largest relative error, except for the Bode data, which is the largest absolute error in decibels and degrees.

AreaFunctionReferenceMetricError reachedTest toleranceError / tolerance
linalgsolvescipy.linalg.solvelargest relative error3.95e-161e-120.000395
linalglstsqnumpy.linalg.lstsqlargest relative error3.87e-161e-110.0000387
linalginvscipy.linalg.invlargest relative error1.55e-151e-110.000155
linalgdetscipy.linalg.detlargest relative error8.88e-161e-110.0000888
linalgpinvscipy.linalg.pinvlargest relative error7.41e-161e-097.41e-7
linalgnorm (2)numpy.linalg.normlargest relative error6.66e-161e-130.00666
linalgcondnumpy.linalg.condlargest relative error3.33e-151e-110.000333
linalgcholscipy.linalg.choleskylargest relative error1.14e-161e-120.000114
linalgsvd (values)scipy.linalg.svdvalslargest relative error1.12e-161e-120.000112
linalgeig (values)scipy.linalg.eigvalslargest relative error2.13e-151e-090.00000213
linalgeig, symmetricscipy.linalg.eigvalshlargest relative error3.86e-161e-120.000386
linalgschur (eigenvalues)scipy.linalg.eigvalslargest relative error2.03e-151e-090.00000203
linalgexpmscipy.linalg.expmlargest relative error6.56e-161e-120.000656
linalglogmscipy.linalg.logmlargest relative error2.33e-151e-110.000233
linalgsqrtmscipy.linalg.sqrtmlargest relative error1.73e-151e-120.00173
linalgsylvesterscipy.linalg.solve_sylvesterlargest relative error2.17e-151e-110.000217
linalglyapscipy.linalg.solve_continuous_lyapunovlargest relative error1.05e-151e-110.000105
linalgdlyapscipy.linalg.solve_discrete_lyapunovlargest relative error5.80e-151e-110.00058
polyrootsnumpy.rootslargest relative error6.64e-161e-110.0000664
polypolyfitnumpy.polyfitlargest relative error8.72e-161e-100.00000872
polyresiduescipy.signal.residuelargest relative error8.88e-161e-110.0000888
calcintegralscipy.integrate.quadlargest relative error4.44e-161e-120.000444
calcinterp1 pchipscipy PchipInterpolatorlargest relative error3.71e-161e-130.00371
calcinterp1 splinescipy CubicSpline (not-a-knot)largest relative error4.81e-161e-120.000481
calcfft (1000 points)numpy.fft.fftlargest relative error4.99e-161e-130.00499
calcfilterscipy.signal.lfilterlargest relative error1.31e-151e-120.00131
controlstepscipy.signal.steplargest relative error2.64e-151e-100.0000264
controlimpulsescipy.signal.impulselargest relative error2.10e-151e-100.000021
controllsimscipy.signal.lsimlargest relative error2.59e-151e-100.0000259
controlbodescipy.signal.bodelargest absolute error (dB, degrees)8.53e-141e-090.0000853
controlmargincontrol.marginlargest relative error01e-090
controlc2d zohscipy.signal.cont2discretelargest relative error4.21e-161e-120.000421
controlc2d fohscipy.signal.cont2discretelargest relative error2.22e-161e-120.000222
controlc2d bilinearscipy.signal.cont2discretelargest relative error2.22e-161e-120.000222
controlgramscipy solve_continuous_lyapunovlargest relative error2.88e-151e-100.0000288
controlhsvd / balrealscipy (square-root method)largest relative error1.38e-141e-080.00000138
controlcare (X)scipy.linalg.solve_continuous_arelargest relative error3.22e-161e-093.22e-7
controllqr (K)scipy.linalg.solve_continuous_arelargest relative error2.59e-151e-090.00000259
controldare (X)scipy.linalg.solve_discrete_arelargest relative error2.70e-141e-090.000027
controlplace (K, single input)scipy.signal.place_poleslargest relative error2.34e-151e-090.00000234
controllqe / kalman (L)scipy.linalg.solve_continuous_are (dual)largest relative error5.16e-151e-085.16e-7

Hard eigenvalue problems

Four eigenvalue problems of order 80 that run the multishift path. Each is compared with the exact eigenvalues where they are known and with SciPy otherwise. The residual is the scaled residual of the eigenvector equation.

MatrixValues againstEigenvalue error, EustressEigenvalue error, SciPyResidual, EustressResidual, SciPy
order 80, defectiveexact values1.69e-052.05e-053.35e-163.72e-16
order 80, clusteredexact values3.63e-153.13e-153.19e-163.34e-16
order 80, gradedSciPy values2.46e-15n/a1.89e-162.79e-16
order 80, cyclicexact values5.33e-157.63e-155.12e-166.82e-16
1e-171e-151e-131e-111e-91e-7linalgsolvelstsqinvdetpinvnorm (2)condcholsvd (values)eig (values)eig, symmetricschur (eigenvalues)expmlogmsqrtmsylvesterlyapdlyappolyrootspolyfitresiduecalcintegralinterp1 pchipinterp1 splinefft (1000 points)filtercontrolstepimpulselsimbodemarginc2d zohc2d fohc2d bilineargramhsvd / balrealcare (X)lqr (K)dare (X)place (K, single input)lqe / kalman (L)error reached against the referencetolerance the test allowserror of exactly 0 (drawn at the left edge)error (logarithmic axis); the bode row is an absolute error in dB and degrees, every other row a relative error
Error reached by each routine against its reference, with the tolerance the test allows, from accuracy.jsonl. The accuracy example writes one line per function and the tests fail when an error exceeds its tolerance. Real output of the library.

Reading the Accuracy Tables

The error in the table is the distance from the reference library's result, not from the exact answer. Where the reference library and Eustress both carry rounding error, the table shows how far apart they are.

Rows closest to their tolerance (error divided by tolerance)

  • norm (2): 6.66e-16 against a tolerance of 1e-13; the error is 0.00666 of the tolerance. Reference: numpy.linalg.norm.
  • fft (1000 points): 4.99e-16 against a tolerance of 1e-13; the error is 0.00499 of the tolerance. Reference: numpy.fft.fft.
  • interp1 pchip: 3.71e-16 against a tolerance of 1e-13; the error is 0.00371 of the tolerance. Reference: scipy PchipInterpolator.
  • sqrtm: 1.73e-15 against a tolerance of 1e-12; the error is 0.00173 of the tolerance. Reference: scipy.linalg.sqrtm.
  • filter: 1.31e-15 against a tolerance of 1e-12; the error is 0.00131 of the tolerance. Reference: scipy.signal.lfilter.

The largest error reached in the table is 8.53e-14 (bode, largest absolute error (dB, degrees)).

Error of exactly 0: margin.

05Threads

One Thread Against Four

Eustress runs on one thread unless the host calls set_threads. The benchmark ran the dense kernels and the control design rows again with 4 threads on the generic build. Scripts cannot change the thread count. Nothing runs on the GPU.

More threads take longer at the smaller sizes: the work per call is too small to repay the cost of splitting it. The table shows where that changes.

Routine1 thread (ms)4 threads (ms)4-thread time / 1-thread time
eig, 200x200 (values and vectors)16.818.21.08
eigvals, 200x200 (values only)11.911.60.978
eig, 500x500 (values and vectors)1591771.11
solve (A\b), 200x200, consuming form0.2341.275.43
solve (A\b), 500x500, consuming form2.847.352.59
solve (A\b), 1000x1000, consuming form17.224.91.45
solve (A\b), 2000x2000, consuming form119880.742
solve (A\b), 500x500, borrowing form (one copy)3.67.662.13
singular values, 300x3007.1719.12.66
singular values, 1000x10002892911.01
svd, 300x300 (full)15.530.21.95
svd, 1000x1000 (full)4593920.855
care, 100 states, 10 inputs63.280.41.27

Rows where 4 threads took more time than 1 thread (10 of 13): eig 200x200, eig 500x500, solve 200x200, solve 500x500, solve 1000x1000, solve 500x500, one copy, singular values 300, singular values 1000, svd 300x300, and care 100 states.

Rows where 4 threads took less time than 1 thread (3 of 13): eigvals 200x200, solve 2000x2000, and svd 1000x1000.

The same comparison for SciPy and NumPy, default BLAS threads against 1 BLAS thread, using the lowest time of each row. Default threads took more time than 1 thread in 23 of 47 rows and less time in 24 rows: fft 1024, fft 4096, fft 10000, fft 12000, fft 15000, fft 16384, fft 32768, fft 131072, fft 196608, fft 262144, fft 524288, fft 1000003 (prime), fft 1048576, fft 2097152, ode45 Lorenz t=100, stiff Van der Pol rtol 1e-4, Radau VdP rtol 1e-6, Radau VdP rtol 1e-8, Radau VdP rtol 1e-10, Radau Robertson rtol 1e-4, Radau Robertson rtol 1e-6, Radau Robertson rtol 1e-8, Radau Robertson rtol 1e-10, and Nelder-Mead 10-D. The tables above report both, and the ratio uses the lower of the two.

06Bit Reproducibility

Same Bits Across Runs and Thread Counts

With one thread, every routine returns the same bits on every run. Results from different thread counts can differ in the last bits. The reproducibility example runs each kernel twice at each thread count and compares the output bits.

Thread counts compared: 1, 4 and 36 (all threads on this machine). Each kernel was run twice at each count and the output bits compared. Each cell answers whether the bits were the same: between two runs at one thread count (the first two columns) or between one thread and the thread count named (the last two columns).

KernelRun to run, 1 threadRun to run, 36 threads1 against 4 threads1 against 36 threads
matmul_500yesyesyesyes
solve_500yesyesyesyes
eig_200yesyesyesyes
svd_300yesyesnono
care_100yesyesyesyes
expm_200yesyesyesyes
schur_200yesyesyesyes

Kernels whose bits change with the thread count (1 of 7): svd_300.

Kernels whose bits change from one run to the next at the same thread count (0 of 7): none.

07Limits of the Comparison

What These Numbers Do Not Show

  • One machine and one operating system. The machine was shared with other work, and the minimum over the repetitions reduces that effect without removing it. Other hardware gives other times.
  • One or a few sizes per routine, on deterministic pseudo-random inputs. A different size, a structured matrix, or a different stiffness can change a ratio.
  • Only the routines in the tables were timed. Every other routine in the library has no run time on this page.
  • The SciPy or NumPy time in each row is the lowest time among the variants measured, which is not always the call a user would write.
  • The callback-bound rows measure the cost of calling back into Python for every function evaluation together with the solver or optimizer. They do not measure the solver or optimizer alone.
  • The times 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 on this page.
  • Luau reaches 42 routines by name. Rune reaches the same 42 plus 101 more functions and 10 types. Of the routines timed here, eig, eigvals, solve, svd, singular_values, care, lqr, c2d, fft, ode45, ode15s, ode_radau and fminsearch have a name in both languages. The consuming form of solve and the analytic-gradient BFGS row are Rust forms: the script solve is the borrowing form, and the script fminunc uses finite-difference gradients.
  • MATLAB was not measured. python-control supplied reference results and was not timed.
  • The accuracy columns compare against the reference library's result or a stored reference solution. They are not a proof of correctness against the exact answer.

08How to Rerun It

Steps

The numerics crate is in the Eustress source at eustress/crates/numerics, with Cargo.toml, README.md, src and tests. The tests folder holds the 119 tests and the fixture files they read, in tests/fixtures: stored reference results from SciPy, NumPy and python-control, each next to its inputs and the library versions that produced it. From the crate folder, run the tests with:

Shell
cargo test

The SciPy comparison harness is not part of the crate folder. The fixture generator, the mutation-proof script, the benchmark programs for Eustress and for SciPy, the paired-run scripts, and the accuracy and reproducibility programs that produced the speed, paired-run, accuracy, bit-reproducibility and mutation tables on this page are not in it. Those tables cannot be regenerated from the crate folder. They were produced by that harness on the machine described under Method. The 119 tests check the library against the stored fixtures with the tolerances listed in the accuracy table.

09Test Totals

What the Tests Cover

The totals come from one run of cargo test. Each line below is one test binary; the counts were matched to the number of test functions in each file.

Test binaryPassedFailed
unit tests in src (bdc 2, hqr 4, mixed_fft 4, ode 1)110
tests/control.rs330
tests/kernels.rs80
tests/linalg.rs270
tests/ode_optim.rs220
tests/poly_calc.rs150
tests/realtime.rs30
documentation tests00
Total1190

Mutation Proof

A passing test proves little unless it can fail. The mutation proof edits one line of the library at a time to introduce a plausible mistake and checks that the named test fails.

Each mutation breaks one line of the library and runs the named test. A caught mutation makes the test fail; a survivor is a mutation after which the test still passes. Before each mutation the same test was run unmodified as a control; the control passed in 43 of 43 cases. After the last mutation the source was restored and the test files rerun.

MutationTestResult
eig: eigenvalues scaled by 1 + 1e-6linalg::eig_general_matches_scipytest failed (caught)
care: Q term of the Riccati residual scaled by 1.001control::care_and_lqr_on_an_unstable_plant_match_scipytest failed (caught)
c2d tustin: 0.5 * dt replaced by 0.4 * dt in the numerator factorcontrol::c2d_zoh_foh_tustin_match_scipytest failed (caught)
ode45 step control: error estimate under-reported 1000 timesode_optim::ode45_error_tracks_the_tolerancetest failed (caught)
ode45 step control: rejected steps accepted (accept threshold raised to 1e6)ode_optim::ode45_step_control_spends_work_where_the_tolerance_askstest failed (caught)
margin: phase margin offset by one degreecontrol::margin_matches_python_controltest failed (caught)
margin: gain crossover polynomial uses |N|^2 - 1.01 |D|^2control::margin_matches_python_controltest failed (caught)
expm: last Pade coefficient 182 replaced by 181linalg::expm_of_a_rotation_generator_matches_the_closed_formtest failed (caught)
ode15s: gamma coefficients accumulate 1/(i+1) instead of 1/iode_optim::ode15s_solves_stiff_van_der_pol_mu_1000test failed (caught)
dare: X scaled by 1.001 in the returned gaincontrol::dare_and_dlqr_match_scipytest failed (caught)
mixed-radix fft: radix-4 pass loses its rotation by -i (vector code)kernels::fft_mixed_radix_matches_scipy_on_long_lengthstest failed (caught)
mixed-radix fft: odd-radix pass swaps the sign of the sine sum (vector code)kernels::fft_mixed_radix_matches_numpy_on_composite_lengthstest failed (caught)
singular values: sign error in the row rotation of the bidiagonal QR sweepkernels::singular_values_match_scipytest failed (caught)
solve_owned: single right-hand side solved with A' instead of Akernels::solve_owned_matches_numpytest failed (caught)
six-step fft: twiddle built from the coarse table onlykernels::fft_six_step_matches_scipy_on_very_long_lengthstest failed (caught)
dqds: transform applies the shift twicekernels::singular_values_match_scipytest failed (caught)
bidiagonal divide and conquer: secular bracket updated on the wrong sidelib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonaltest failed (caught)
bidiagonal divide and conquer: vectors built from the original z instead of the recomputed onelib::bdc::tests::hard_cases_graded_clustered_rank_deficienttest failed (caught)
bidiagonal divide and conquer: deflation rotation with sine and cosine swappedlib::bdc::tests::hard_cases_graded_clustered_rank_deficienttest failed (caught)
bidiagonal divide and conquer: null vector combined with the wrong signlib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonaltest failed (caught)
bidiagonal divide and conquer: first component of the left vectors +1 instead of -1lib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonaltest failed (caught)
svd: right reflectors applied one row too highkernels::full_svd_matches_scipy_on_hard_casestest failed (caught)
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_tolerancestest failed (caught)
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_pathtest failed (caught)
ode_radau: collocation polynomial coefficient -8/3 replaced by -7/3ode_optim::ode_radau_matches_scipy_radau_on_robertson_at_four_tolerancestest failed (caught)
ode15s: tolerance refusal removedode_optim::ode15s_refuses_tolerances_it_cannot_reach_and_points_to_ode_radautest failed (caught)
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_codetest failed (caught)
radix-8 fft pass, AVX2: the eighth-root factor 1/sqrt 2 replaced by 0.7kernels::fft_mixed_radix_matches_numpy_on_composite_lengthstest failed (caught)
depth-first fft: outputs of the parts copied back without interleavingkernels::fft_depth_first_matches_scipy_on_long_lengthstest failed (caught)
depth-first fft: the parts are left untransformed after the first split of a partlib::mixed_fft::tests::depth_first_matches_the_direct_kerneltest failed (caught)
divide and conquer merge: the middle row is left out of the upper half of Vlib::bdc::tests::divide_and_conquer_reconstructs_and_is_orthogonaltest failed (caught)
divide and conquer merge: sorted singular values written to unsorted placeskernels::full_svd_matches_scipy_on_hard_casestest failed (caught)
divide and conquer merge: rows of block two stored one row too highlib::bdc::tests::hard_cases_graded_clustered_rank_deficienttest failed (caught)
in-crate eig: sweep U row bound taken from the lowest active bulge onlylib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathtest failed (caught)
in-crate eig: sweep left pass skips the newest bulge's own columnlib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathtest failed (caught)
in-crate eig: AED spike test reads the second row of Vlib::hqr::tests::hard_matrices_on_every_driver_pathtest failed (caught)
in-crate eig: 1x1 block swap rotates Q the wrong waylib::hqr::tests::block_swaps_of_every_shapetest failed (caught)
in-crate eig: 2x2 standardisation rotation with the wrong sine signlib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathtest failed (caught)
in-crate eig: complex eigenvector started for the conjugate eigenvaluelib::hqr::tests::schur_and_eigenvectors_on_every_driver_pathtest failed (caught)
in-crate eig: overflow guard of the real back-substitution removedlib::hqr::tests::repeated_eigenvalues_give_finite_vectorstest failed (caught)
in-crate eig: second column of a complex pair not conjugatedlinalg::eig_hard_matrices_match_scipy_through_the_in_crate_solvertest failed (caught)
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_1000test passed (survivor)
dare: doubling iteration drops the G update (the Newton correction that follows repairs the start value)control::dare_handles_a_singular_state_matrixtest passed (survivor)

41 of 43 mutations were caught by the named test. 2 survived, and each survivor was expected, with the reason in its Mutation cell. Results that differ from the expected column: none.

10What's Next

Related Pages

The routines in the dense linear algebra rows are described in Linear Algebra and Polynomials. The solvers in the ODE rows are in Differential Equations, and the optimizers in Optimization. The Fourier transform is in Calculus and Signal, and the Riccati solvers, the discretization and the other control rows are in Control Design. The full list of routines is on the Numerics overview.

Read the routine, then check its row.

Loading Eustress Engine...