/ concept-collection / fastandaccurate
Sign in
concept-collection / fastandaccurate
fastandaccurate / src / solvers / index.ts
77 lines · 3.1 KBBlameHistoryRaw
1// The in-browser solvers shipped with the site. Each solver is a MATLAB
2// function file (solver.m) implementing the interface documented in
3// docs/problems/laplace-dirichlet-2d.md. A submitted solver adds a
4// directory here plus a manifest entry.
6export interface SolverManifest {
7 /** Short stable identifier used in results and URLs. */
8 id: string;
9 name: string;
10 /** One-paragraph description of the method for the problem page. */
11 description: string;
12 /** Semantic version of the solver code; bump on any change that could
13 * alter results. */
14 version: string;
15 backend: "cpu" | "gpu";
16 /** What executes the solver: "numbl" solvers run in the browser and in
17 * the CLI; "matlab" solvers run only in real MATLAB via the CLI. */
18 runtime: "numbl" | "matlab";
19 /** The resolution values a standard work-precision sweep runs. */
20 sweepN: number[];
23export const SOLVERS: SolverManifest[] = [
24 {
25 id: "mfs",
26 name: "Method of fundamental solutions",
27 description:
28 "Represents the solution as n logarithmic point charges on a curve " +
29 "a fixed distance 0.3 outside the boundary, with strengths found by " +
30 "collocation at n boundary points. Converges geometrically when the " +
31 "data continues harmonically past the charge curve; stagnates when " +
32 "it does not (the star-hard instance). Ill-conditioning caps the " +
33 "attainable accuracy near 1e-10 in exchange for very small n.",
34 version: "1.0.0",
35 backend: "cpu",
36 runtime: "numbl",
37 sweepN: [8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256],
38 },
39 {
40 id: "nystrom-dlp",
41 name: "Nystrom double-layer BIE",
42 description:
43 "Second-kind boundary integral equation for the double-layer " +
44 "density, discretized with the periodic trapezoid rule at n " +
45 "boundary nodes. Converges geometrically for any smooth data, at a " +
46 "rate set by how far the data continues analytically, so the hard " +
47 "instance costs more nodes rather than a lost method assumption.",
48 version: "1.0.0",
49 backend: "cpu",
50 runtime: "numbl",
51 sweepN: [16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768],
52 },
53 {
54 id: "chunkie-dlp",
55 name: "chunkie double-layer BIE",
56 description:
57 "The same second-kind double-layer formulation as nystrom-dlp, " +
58 "discretized by chunkie, a production MATLAB boundary-integral " +
59 "toolbox: n uniform 16th-order Gauss-Legendre panels, high-order " +
60 "singular quadrature in the assembly, a direct dense solve, and " +
61 "near-corrected evaluation of the potential. Runs in real MATLAB " +
62 "only: the command line invokes matlab -batch and fetches chunkie " +
63 "on first use, so its results appear here but cannot be rerun in " +
64 "the browser. chunkie's default quadrature tolerances cap the " +
65 "attainable accuracy near 1e-11.",
66 version: "2.0.0",
67 backend: "cpu",
68 runtime: "matlab",
69 sweepN: [2, 3, 4, 6, 8, 12, 16, 24, 32, 48],
70 },
71];
73export function getSolver(id: string): SolverManifest {
74 const s = SOLVERS.find((x) => x.id === id);
75 if (!s) throw new Error(`Unknown solver: ${id}`);
76 return s;
moveopenescclose