SimPEG.utils.estimate_diagonal#

SimPEG.utils.estimate_diagonal(matrix_arg, n, k=None, approach='Probing')[source]#

Estimate the diagonal of a matrix.

This function estimates the diagonal of a matrix using one of the following iterative methods:

  • Probing: cyclic permutations of vectors with 1’s and 0’s (default)

  • Ones: random +/- 1 entries

  • Random: random vectors with entries in the range [-1, 1]

The user can estimate the diagonal of the matrix by providing the matrix, or by providing a function hangle which computes the dot product of the matrix and a vector.

For background information on this method, see Bekas (et al., 2005) and Selig (et al., 2012)

Parameters:
matrix_argnumpy.ndarray or function

The matrix as a numpy.ndarray, or a function handle which computes the dot product between the matrix and a vector.

nint

The length of the random vectors used to compute the diagonal; equals number of columns

kint

Number of vectors to be used to estimate the diagonal; i.e. number of iterations in estimation

approachstr

Method used for approximating diagonal. Must be one of {‘probing’, ‘ones’, ‘random’}

Returns:
numpy.ndarray

Estimate of the diagonal elements of the input matrix