projection_error()#
- projection_error(states, basis)[source]#
Calculate the absolute and relative projection errors induced by projecting states to a low dimensional basis, i.e.,
absolute_error = ||Q - Vr Vr^T Q||_F, relative_error = ||Q - Vr Vr^T Q||_F / ||Q||_F
where Q = states and Vr = basis. Note that Vr Vr^T is the orthogonal projector onto subspace of R^n defined by the basis.
- Parameters:
- states(n, k) or (k,) ndarray
Matrix of k snapshots where each column is a single snapshot, or a single 1D snapshot. If 2D, use the Frobenius norm; if 1D, the l2 norm.
- Vr(n, r) ndarray
Low-dimensional basis of rank r. Each column is one basis vector.
- Returns:
- absolute_errorfloat
Absolute projection error ||Q - Vr Vr^T Q||_F.
- relative_errorfloat
Relative projection error ||Q - Vr Vr^T Q||_F / ||Q||_F.