Lp_error()#

Lp_error(Qtrue, Qapprox, t=None, p=2)[source]#

Compute the absolute and relative Lp-norm error (with respect to time) between the snapshot sets Qtrue and Qapprox, where Qapprox approximates Qtrue:

absolute_error = ||Qtrue - Qapprox||_{L^p}, relative_error = ||Qtrue - Qapprox||_{L^p} / ||Qtrue||_{L^p},

where

||Z||_{L^p} = (int_{t} ||z(t)||_{p} dt)^{1/p}, p < infinity, ||Z||_{L^p} = sup_{t}||z(t)||_{p}, p = infinity.

The trapezoidal rule is used to approximate the integrals (for finite p). This error measure is only consistent for data sets where each snapshot represents function values, i.e.,

Qtrue[:, j] = [q(t1), q(t2), …, q(tk)]^T.

Parameters
Qtrue(n, k) or (k,) ndarray

“True” data corresponding to time t. Each column is one snapshot, i.e., Qtrue[:, j] is the data at time t[j]. If one-dimensional, each entry is one snapshot.

Qapprox(n, k) or (k,) ndarray

An approximation to Qtrue, i.e., Qapprox[:, j] approximates Qtrue[:, j] and corresponds to time t[j]. If one-dimensional, each entry is one snapshot.

t(k,) ndarray

Time domain of the data Qtrue and the Qapprox. Required unless p == np.inf.

pfloat > 0

Order of the Lp norm. May be infinite (np.inf).

Returns
abs_errfloat

Absolute error ||Qtrue - Qapprox||_{L^p}.

rel_errfloat

Relative error ||Qtrue - Qapprox||_{L^p} / ||Qtrue||_{L^p}.