SumMetaSimulation.getJtJdiag(m, W=None, f=None)[source]#

Return the squared sum of columns of the Jacobian.

Evaluates the weighted squared norm of each column of the Jacobian matrix. This is usually used to construct sensitivity weighting matrices or for diagonal preconditioners to iterative solvers.

m(n_m) numpy.ndarray

The model to evalute the Jacobian at.

W(n_d, n_d) scipy.sparse.csr_matrix, optional

A diagonal data weighting matrix.

ffields, optional

The fields object created from this class.

(n_m) numpy.ndarray

Squared sum of columns of the Jacobian matrix


Internally, this function evaluates the getJtJdiag method of each simulation, then applies the model mapping to the output as:

>>> sq_sum = 0
>>> for i in range(n_sim):
...    row = sim[i].getJtJdiag(model)
...    sq_sum += W[i] * (sp.diag(sqrt(row)) @ mapping[i].deriv()).power(2).sum(axis=0)

This approach is correct for mapping that match input parameters to a single output parameter, (i.e. the mapping.deriv has only 1 element in each column). For other mappings, it is usually close within a scaling factor, whose accuracy is then controlled by how diagonally dominant J.T @ J is.