Expand description
Structured matrix-vector products — the unifying object: semiseparable, Toeplitz, Cauchy, and Vandermonde matvecs.
Functions§
- cauchy_
matvec - Cauchy kernel evaluation — original S4’s (DPLR) kernel-generation
step. Given complex evaluation points
nodes(z_k, typically roots of unity), complexpoles(lambda_i, the diagonalized state matrix’s eigenvalues), and complexweights(w_i, the per-pole residues, e.g. C_i * B_i), computes for each node: out[k] = sum_i weights[i] / (nodes[k] - poles[i]) - semiseparable_
matvec - Semiseparable matrix-vector product, diagonal/selective parameterization (Mamba-2 / SSD style). Each row i computes: y_i = C_i . h_i, where h_i = a_i * h_{i-1} + B_i * x_i — i.e. the matvec IS the SSM recurrence; this function just exposes it as “apply this implicit matrix to a vector” for callers that think in those terms (e.g. an attention-equivalent API).
- toeplitz_
matvec - Causal Toeplitz matrix-vector product — the convolutional view of an
SSM. Implicitly applies the lower-triangular matrix
M[i][j] = kernel[i - j] for j <= i, 0 otherwise
to
x, i.e. computes the causal convolution: y[i] = sum_{j=0}^{i} kernel[i - j] * x[j] - vandermonde_
matvec - Vandermonde kernel evaluation — S4D’s (diagonal-only) direct
kernel-generation step. Given complex
poles(lambda_i, the diagonalized state matrix’s eigenvalues) and complexweights(w_i, the per-pole residues, e.g. C_i * B_i), computes the SSM’s convolution kernel directly: kernel[t] = sum_i weights[i] * poles[i]^t, for t = 0..length