pyFDN.td.TimeVaryingMatrix#

class pyFDN.td.TimeVaryingMatrix(channels, fs, *, rate, depth, spread=0.0, rng=None)[source]#

Stateful sinusoidally modulated orthogonal mixing matrix (time-varying feedback).

Each adjacent channel pair is rotated by a sinusoidally modulated angle, so the operator is orthogonal at every sample but never constant. Sitting on a Recursion feedback path, e.g. Series([Gain(A), TimeVaryingMatrix(N, fs, rate=1.5, depth=0.35)]), it makes the loop genuinely time-varying – there is no static transfer function. It also goes straight into a graph’s post_matrix hook, e.g. pyFDN.dss_to_td(*dss, post_matrix=TimeVaryingMatrix(N, fs, rate=1.5, depth=0.35)).

The knobs are named as in TimeVaryingKroneckerMatrix.

Translation of the MATLAB implementation timeVaryingMatrix.m from fdnToolbox. Original MATLAB code: (c) Sebastian Jiro Schlecht, 2019. Python translation: Alma Hova, 2026.

Parameters:
  • channels (int) – Number of channels N (the matrix is N x N), a positive even integer.

  • fs (float) – Sampling rate in Hz; the modulation clock.

  • rate (float) – Modulation frequency in Hz.

  • depth (float) – Modulation amplitude (maximum angle deflection) in radians.

  • spread (float) – Relative random spread of rate and depth across the rotation planes: each plane draws from value * (1 +- spread).

  • rng (Generator | int | None) – Random generator or integer seed for the per-plane phases and spread.

Variables:
  • num_pairs (int) – Number of eigenmode pairs (N // 2), i.e. independent 2-D rotation planes.

  • phase (rate, depth,) – Per-plane modulation frequency, amplitude and initial phase.

  • sample_index (int) – Current sample index; the modulation clock.

__init__(channels, fs, *, rate, depth, spread=0.0, rng=None)[source]#

Methods

__init__(channels, fs, *, rate, depth[, ...])

impulse_response(ir_len)

Impulse response from zero state, one Dirac per input channel.

process_block(block)

Apply the time-varying orthogonal transformation to one block.

process_signal(signal, *[, squeeze])

Process a whole signal in one call, from the current state.

reset()

Clear internal state (no-op for stateless operators).

Attributes

in_channels

out_channels

process_block(block)[source]#

Apply the time-varying orthogonal transformation to one block.

The operation is equivalent to constructing the block-diagonal rotation matrix from rotation_matrix_from_angles at every sample, but applies the 2-D rotations directly to the whole input block.

Return type:

ndarray

reset()[source]#

Clear internal state (no-op for stateless operators).

Return type:

None