Writing an eigenvalue solver in Rust for WebAssembly

Rust brings math magic to your browser — fans cheer, nitpickers pounce

TLDR: A developer made a browser demo that finds matrix eigenvalues using Rust and WebAssembly. Comments loved the visuals but clashed over speed claims and shaky math functions, pushing divide-and-conquer and warning that ‘hypot’ varies by platform—cool project, caution on precision.

A brave soul built a browser toy that finds a matrix’s "special numbers" (eigenvalues) using Rust compiled to WebAssembly, and the comments instantly turned into a math-and-browser slap fight. The demo leans on the Gershgorin Circle Theorem, which draws friendly circles where those numbers should live — cue memes about “donut shops in the complex plane.” The crowd loved learning-in-public and skipping JavaScript (“bless”), but the mood got spicy fast. One camp says: cool viz, solid idea. Another camp: your math library is vibes. A Python veteran jumped in to say their solver didn’t hit the promised speed, pushing the divide‑and‑conquer method over the usual QR approach. Meanwhile, a precision hawk warned that Rust’s hypot just calls your system’s math library, so results can wobble by platform — the word “hand‑wavy” got a workout. People joked the LLM‑generated HTML/JS was the most stable part, while web devs rolled eyes at “I don’t like JavaScript” yet still shipping a JS wrapper. Verdict from the peanut gallery: gorgeous circles, but if you care about exact answers, mind your algorithm and your floating‑point gremlins. Still, it’s the most fun math class the browser’s had in ages.

Key Points

  • The author implements an eigenvalue solver in Rust, compiles it to WebAssembly, and embeds it in a web page for an interactive visualization.
  • The article explains the Gershgorin Circle Theorem and how it bounds eigenvalues within the union of discs defined from matrix rows.
  • For real symmetric matrices, eigenvalues are real and the Gershgorin discs reduce to intervals on the real line.
  • Examples include a 3×3 matrix with discs D(2,1), D(1,1), D(5,0) and a 4th-order Hadamard matrix with eigenvalues {±√2 ± √2 i}.
  • HTML/CSS/JavaScript for the component were generated by an LLM, while the Rust and mathematical logic were written by the author.

Hottest takes

"It did not converge in O(n^3) as sometimes claimed" — threeducks
"Everything about the results of libm functions is incredibly hand‑wavy" — jcranmer
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.