/ concept-collection / fastandaccurate
Sign in
concept-collection / fastandaccurate
fastandaccurate / src / solvers / index.ts
54 lines · 2.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 /** The resolution values a standard work-precision sweep runs. */
17 sweepN: number[];
20export const SOLVERS: SolverManifest[] = [
21 {
22 id: "mfs",
23 name: "Method of fundamental solutions",
24 description:
25 "Represents the solution as n logarithmic point charges on a curve " +
26 "a fixed distance 0.3 outside the boundary, with strengths found by " +
27 "collocation at n boundary points. Converges geometrically when the " +
28 "data continues harmonically past the charge curve; stagnates when " +
29 "it does not (the star-hard instance). Ill-conditioning caps the " +
30 "attainable accuracy near 1e-10 in exchange for very small n.",
31 version: "1.0.0",
32 backend: "cpu",
33 sweepN: [8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256],
34 },
35 {
36 id: "nystrom-dlp",
37 name: "Nystrom double-layer BIE",
38 description:
39 "Second-kind boundary integral equation for the double-layer " +
40 "density, discretized with the periodic trapezoid rule at n " +
41 "boundary nodes. Converges geometrically for any smooth data, at a " +
42 "rate set by how far the data continues analytically, so the hard " +
43 "instance costs more nodes rather than a lost method assumption.",
44 version: "1.0.0",
45 backend: "cpu",
46 sweepN: [16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768],
47 },
48];
50export function getSolver(id: string): SolverManifest {
51 const s = SOLVERS.find((x) => x.id === id);
52 if (!s) throw new Error(`Unknown solver: ${id}`);
53 return s;
moveopenescclose