simpeg.regularization.Sparse.test#

Sparse.test(x=None, num=4, random_seed=None, **kwargs)[source]#

Run a convergence test on both the first and second derivatives.

They should be second order!

Parameters:
xNone or (n_param, ) numpy.ndarray, optional

The evaluation point for the Taylor expansion.

numint

The number of iterations in the convergence test.

random_seedRandomSeed or None, optional

Random seed used for generating a random array for x if it’s None, and the v array for testing the second derivatives. It can either be an int, a predefined Numpy random number generator, or any valid input to numpy.random.default_rng.

Returns:
bool

True if both tests pass. False if either test fails.