StateSpaceDynamics

class hcipy.util.StateSpaceDynamics(transition_matrix, noise_matrix, observation_matrix=None, initial_state=None, seed=None)[source]

Bases: object

A continuous-time state space stochastic process.

This class generates trajectories of a continuous-time state space model of the form

\[\frac{\mathrm{d} x}{\mathrm{d}t} = Ax + Bw,\]

where x is the internal state, \(A\) is the transition matrix, \(B\) is the noise matrix, and \(w\) is white noise with unit variance. The model must be stable: all eigenvalues of \(A\) must have negative real parts.

The observation equation

\[y = Cx\]

maps the internal state to output coefficients.

Parameters:
transition_matrixarray

Continuous-time state transition matrix \(A\) (num_states x num_states).

noise_matrixarray

Continuous-time noise/input matrix \(B\) (num_states x num_inputs).

observation_matrixarray, optional

Observation matrix \(C\) (num_outputs x num_states). If None, uses identity matrix (state directly maps to output).

initial_statearray, optional

Initial state vector. If None, samples from the stationary distribution.

seedint, optional

Random seed for reproducibility.

Attributes:
transition_matrixarray

Continuous-time state transition matrix A.

noise_matrixarray

Continuous-time noise/input matrix B.

observation_matrixarray

Observation matrix C.

Attributes Summary

coefficients

Current output coefficients (y = C @ x).

num_outputs

Number of output coefficients.

num_states

Number of internal states.

state

Current internal state vector.

stationary_covariance

Stationary covariance matrix P of the state.

t

Current simulation time.

Methods Summary

evolve_until(t)

Evolve the state from current time to time t.

Attributes Documentation

coefficients

Current output coefficients (y = C @ x).

num_outputs

Number of output coefficients.

num_states

Number of internal states.

state

Current internal state vector.

stationary_covariance

Stationary covariance matrix P of the state.

t

Current simulation time.

Methods Documentation

evolve_until(t)[source]

Evolve the state from current time to time t.

Uses exact matrix exponential for the deterministic part and exact noise covariance for the stochastic part.

Parameters:
tfloat

Target time to evolve to. Must be greater than or equal to the current time.

Raises:
ValueError

If t is less than the current time (backwards evolution not allowed).