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
  • params (dict) – A dictionary of parameters.

  • 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,

of if any of the entries for a tuple of keys

Return type

bool