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.

Deprecated since version 0.8.0: This method will be removed in version 1.0.0. Use tenpy.tools.params.Config.any_nonzero() instead.

Parameters:
  • params (dict | Config) – A dictionary of parameters, or a Config instance.

  • keys (list 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_msg (None | 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:

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

Return type:

bool