simpeg.potential_fields.magnetics.Simulation3DIntegral.getJtJdiag#
- Simulation3DIntegral.getJtJdiag(m, W=None, f=None)[source]#
- Compute diagonal of \(\mathbf{J}^T \mathbf{J}`\). - Parameters:
- m(n_param,) numpy.ndarray
- The model parameters. 
- W(nD,nD)np.ndarrayorscipy.sparse.sparray,optional
- Diagonal matrix with the square root of the weights. If not None, the function returns the diagonal of \(\mathbf{J}^T \mathbf{W}^T \mathbf{W} \mathbf{J}`\). 
- fIgnored
- Not used, present here for API consistency by convention. 
 
- m(n_param,) 
- Returns:
- (nparam)np.ndarray
- Array with the diagonal of - J.T @ J.
 
- (
 - Notes - If - store_sensitivitiesis- "forward_only", the- Gmatrix is never allocated in memory, and the diagonal is obtained by accumulation, computing each element of the- Gmatrix on the fly.- This method caches the diagonal - G.T @ W.T @ W @ Gand the sha256 hash of the diagonal of the- Wmatrix. This way, if same weights are passed to it, it reuses the cached diagonal so it doesn’t need to be recomputed. If new weights are passed, the cache is updated with the latest diagonal of- G.T @ W.T @ W @ G.
