Skip to content

Add modern complex-valued architectures (2.1.0) - #13

Merged
josiahwsmith10 merged 1 commit into
2.0.1from
feat/modern-cvnn-architectures
Jun 21, 2026
Merged

Add modern complex-valued architectures (2.1.0)#13
josiahwsmith10 merged 1 commit into
2.0.1from
feat/modern-cvnn-architectures

Conversation

@josiahwsmith10

Copy link
Copy Markdown
Owner

A large modern-architecture expansion of complextorch.nn / .models / .signal, landing as 2.1.0. Single commit, 100% coverage maintained, sphinx -W docs build clean.

What's added

  • Positional encodingsRotaryEmbedding (RoPE), SinusoidalPositionalEncoding, CoPE; wired into MultiheadAttention(rotary=) and ViT(pos_encoding=). (The native transformer had no positional encoding — this fills a real gap.)
  • Holographic (interference-aware) attention — phase-gated scores + coherent value superposition; MultiheadAttention(attention="holographic"). Plus HolographicReconstructionLoss and phase_smoothness.
  • State-space modelsS4D / DSS (HiPPO-Lin diagonal-complex, FFT long-conv) + S4DBlock + selective MambaBlock. Invariant test: FFT kernel == exact recurrence.
  • Unitary RNNUnitaryRNN / UnitaryRNNCell (Cayley-transform norm-preserving recurrence).
  • Time-frequency front-endsSTFT / InverseSTFT (learnable window; tie windows for exact inverse) and ComplexGaborConv1d / MorletConv1d.
  • Complex KANCVKANLayer + CVKAN model.
  • Steinmetz / Analytic networksSteinmetzNetwork, AnalyticNeuralNetwork, AnalyticSignalLoss, and signal.analytic_signal / signal.hilbert.

Each feature ships with mirrored tests, rST/LaTeX docstrings, a concept page, getting-started examples, and a CHANGELOG entry.

Review notes

A high-effort multi-agent code review was run; fixes folded into this commit:

  • InverseSTFT — made the exact-inverse contract honest (analysis/synthesis windows must match; documented istft.window = stft.window, added a tied-window test).
  • UnitaryRNN — materialize the unitary matrix once per forward instead of per timestep (L× speedup).
  • Rotary — documented it's for self-attention.

The review also flagged a phase branch-cut in the pre-existing wFMConvStrict2d. Investigated against the original author's source (RotLieNet / SurReal): the reference computes the same weighted arithmetic mean of raw angles, so our port is faithful — documented the known limitation rather than diverging from the reference.

Deferred (filed as issues)

#10 Mamba parallel-scan kernel · #11 complex GNNs (MagNet) · #12 complex generative models.

🤖 Generated with Claude Code

@josiahwsmith10
josiahwsmith10 force-pushed the feat/modern-cvnn-architectures branch 2 times, most recently from 4905ead to d377f1a Compare June 21, 2026 13:33
A large modern-architecture expansion of complextorch.nn / .models / .signal:

- Positional encodings: RotaryEmbedding (RoPE), SinusoidalPositionalEncoding,
  CoPE; wired into MultiheadAttention (rotary=) and ViT (pos_encoding=).
- Holographic (interference-aware) attention + HolographicReconstructionLoss
  and phase_smoothness anti-phase-collapse safeguards.
- Diagonal-complex state-space models: S4D, DSS, S4DBlock, and a selective
  MambaBlock (FFT long-conv == exact recurrence, verified).
- Unitary complex RNN (UnitaryRNN/Cell) via the Cayley transform.
- Learnable time-frequency front-ends: STFT/InverseSTFT (tie windows for exact
  inversion) and ComplexGaborConv1d/MorletConv1d filterbanks.
- Complex-valued KAN (CVKANLayer + CVKAN model).
- Steinmetz & Analytic networks + AnalyticSignalLoss; analytic_signal/hilbert
  signal utilities.

Also fixes wFMConvStrict2d to compute the phase mean as the circular (Fréchet)
mean on SO(2) instead of an arithmetic mean of raw angles — correct across the
±π branch cut and exactly U(1)-equivariant.

Lands with full tests (100% coverage maintained), rST/LaTeX docstrings,
concept pages, getting-started examples, and a CHANGELOG entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@josiahwsmith10
josiahwsmith10 force-pushed the feat/modern-cvnn-architectures branch from d377f1a to e9e5273 Compare June 21, 2026 13:37
@josiahwsmith10
josiahwsmith10 merged commit f7d4a56 into 2.0.1 Jun 21, 2026
11 checks passed
@josiahwsmith10
josiahwsmith10 deleted the feat/modern-cvnn-architectures branch June 21, 2026 13:44
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.

1 participant