Given two matrices a and x, each of shape [B, L] (batch size × sequence length),
compute the linear recurrence h of shape [B, L] defined by:
h[b, 0] = x[b, 0] and h[b, t] = a[b, t] × h[b, t−1] + x[b, t] for t ≥ 1.
All values are float32. This operation is the core computational primitive of
State Space Models (SSMs) such as Mamba, S4, and H3.
Implementation Requirements
Use only native features (external libraries are not permitted)
The solve function signature must remain unchanged
The result must be stored in the output tensor h
Examples
Example 1 — exponential decay (a = 0.5, single impulse):
Guided walkthrough coming soon. Below is the official starter signature in each language; the clickable line-by-line explanation hasn't been authored yet.