any_nonzero

  • full name: tenpy.tools.misc.any_nonzero

  • parent module: tenpy.tools.misc

  • type: function

tenpy.tools.misc.any_nonzero(params, keys, verbose_msg=None)[source]

Check for any non-zero or non-equal entries in some parameters.

Parameters
paramsdict

A dictionary of parameters.

keyslist of {key | tuple of keys}

For a single key, check params[key] for non-zero entries. For a tuple of keys, all the params[key] have to be equal (as numpy arrays).

verbose_msgNone | str

If params[‘verbose’] >= 1, we print verbose_msg before checking, and a short notice with the key, if a non-zero entry is found.

Returns
matchbool

False, if all params[key] are zero or None and True, if any of the params[key] for single key in keys,

of if any of the entries for a tuple of keys