simpeg.data_misfit.L2DataMisfit.residual#

L2DataMisfit.residual(m, f=None)[source]#

Computes the data residual vector for a given model.

Where \(\mathbf{d}_\text{obs}\) is the observed data vector and \(\mathbf{d}_\text{pred}\) is the predicted data vector for a model vector \(\mathbf{m}\), this function computes the data residual:

\[\mathbf{r} = \mathbf{d}_\text{pred} - \mathbf{d}_\text{obs}\]
Parameters:
m(n_param, ) numpy.ndarray

The model for which the function is evaluated.

fNone or simpeg.fields.Fields, optional

A SimPEG fields object. Used when the fields for the model m have already been computed.

Returns:
(n_data, ) numpy.ndarray

The data residual vector.