Writing an eigenvalue solver in Rust for WebAssembly
4 months ago
- #Rust
- #Numerical Linear Algebra
- #WebAssembly
- The author implemented an eigenvalue solver in Rust for WebAssembly to visualize the Gershgorin Circle Theorem.
- The Gershgorin Circle Theorem helps bound the region of complex plane where matrix eigenvalues lie by using diagonal elements as centers and the sum of off-diagonal elements' norms as radii.
- The QR algorithm was used for eigenvalue computation, involving iterative QR decomposition until convergence, with enhancements like Hessenberg reduction for better performance.
- Complex number arithmetic was implemented in Rust, including operations like addition, multiplication, and norm calculations, due to the absence of a built-in complex type.
- Matrix operations, including QR decomposition and Householder reflectors, were implemented to support the eigenvalue solver.
- The project was compiled to WebAssembly using wasm-pack, with JavaScript bindings auto-generated by wasm-bindgen for seamless interoperation.
- The interactive component was embedded in a blog post using Hugo, showcasing the solver's capabilities with examples like Hadamard matrices.