/ concept-collection / fastandaccurate
Sign in
concept-collection / fastandaccurate
Show solver source code on the problem page
Jeremy Magland <jmagland@flatironinstitute.org> committed commit 26b5b4908ae1 parent 7fcfeb0 Browse files
1 changed file+43−0
src/app/pages/ProblemPage.tsxmodified+43−0View file
@@ -13,6 +13,7 @@ import {
1313 } from "../results";
1414 import { solverColorVar } from "../colors";
1515 import { sweepInBrowser } from "../workerClient";
16+import { solverSource } from "../matlabSources";
1617 import {
1718 WorkPrecisionChart,
1819 type ChartCurve,
@@ -242,6 +243,48 @@ export function ProblemPage({ problemId }: { problemId: string }) {
242243 <DomainView inst={inst} />
243244 </div>
244245
246+ <h2>Solvers</h2>
247+ <p className="small muted" style={{ maxWidth: 640 }}>
248+ Each solver is a MATLAB function file implementing the interface in
249+ the <a href={SPEC_URL}>specification</a>; the same file runs in the
250+ browser via numbl and from the command line.
251+ </p>
252+ {SOLVERS.map((s) => (
253+ <div
254+ key={s.id}
255+ className="panel"
256+ style={{ maxWidth: 860, marginBottom: 12 }}
257+ >
258+ <div>
259+ <span
260+ className="legend-swatch"
261+ style={{ background: solverColorVar(s.id, allSolverIds) }}
262+ />
263+ <strong>{s.name}</strong>{" "}
264+ <span className="small muted">
265+ {s.id} v{s.version} · {s.backend}
266+ </span>
267+ </div>
268+ <p className="small" style={{ color: "var(--text-2)" }}>
269+ {s.description}
270+ </p>
271+ <details>
272+ <summary className="small" style={{ cursor: "pointer" }}>
273+ solver.m
274+ </summary>
275+ <pre style={{ maxHeight: 420, overflow: "auto", marginTop: 8 }}>
276+ {solverSource(s.id)}
277+ </pre>
278+ </details>
279+ <a
280+ className="small"
281+ href={`${REPO_URL}/blob/main/src/solvers/${s.id}/solver.m`}
282+ >
283+ view on GitHub
284+ </a>
285+ </div>
286+ ))}
287+
245288 <h2>Work-precision results</h2>
246289 {committedError && (
247290 <p className="small muted">
moveopenescclose