Skip to content

WebAssembly support improvements#56

Merged
jjjkkkjjj merged 15 commits intojjjkkkjjj:masterfrom
GoodNotes:master
Feb 5, 2026
Merged

WebAssembly support improvements#56
jjjkkkjjj merged 15 commits intojjjkkkjjj:masterfrom
GoodNotes:master

Conversation

@pedrovgs
Copy link
Contributor

@pedrovgs pedrovgs commented Feb 4, 2026

Summary

This PR extends the WebAssembly support in Matft by implementing missing linear algebra functions that weren't available before.

Key changes:

  • Add pure Swift eigenvalue decomposition (dgeev equivalent) using the QR algorithm with implicit double-shift
  • Add comprehensive test coverage for WASM linear algebra operations including matrix inverse, determinant, and eigenvalue decomposition
  • Enable CI workflow to run on pull requests
  • Remove CLAPACK library and use instead just pure swift so we can avoid linking errors with other platforms and also reduce the final binary size for WASM.

Motivation

The initial WASM support (PR #55) provided basic functionality but was missing several important linear algebra operations. Specifically, dgeev (eigenvalue decomposition).

Pure Swift Eigenvalue Implementation

  • Implements swiftEigenDecomposition function using:
    • Householder reduction to upper Hessenberg form
    • Implicit double-shift QR iteration for eigenvalue computation
    • SIMD-optimized vector operations where applicable
  • Handles both real and complex conjugate eigenvalue pairs
  • Computes left and right eigenvectors

Extended Test Coverage

  • Adds 15+ new tests in WASIFallbackTests.swift covering:
    • Matrix inverse (2x2, 3x3, batched)
    • Determinant computation
    • Eigenvalue decomposition (diagonal, symmetric, complex eigenvalues)
    • Singular matrix error handling

Copy link
Owner

@jjjkkkjjj jjjkkkjjj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@jjjkkkjjj jjjkkkjjj merged commit cdea737 into jjjkkkjjj:master Feb 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants