misc

  • full name: tenpy.tools.misc

  • parent module: tenpy.tools

  • type: module

Functions

add_with_None_0(a, b)

Return a + b, treating None as zero.

any_nonzero(params, keys[, verbose_msg])

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

anynan(a)

check whether any entry of a ndarray a is ‘NaN’

argsort(a[, sort])

wrapper around np.argsort to allow sorting ascending/descending and by magnitude.

atleast_2d_pad(a[, pad_item])

Transform a into a 2D array, filling missing places with pad_item.

build_initial_state(size, states, filling[, …])

Initial state builder.

chi_list(chi_max[, dchi, nsweeps, verbose])

inverse_permutation(perm)

reverse sorting indices.

lexsort(a[, axis])

wrapper around np.lexsort: allow for trivial case a.shape[0] = 0 without sorting

list_to_dict_list(l)

Given a list l of objects, construct a lookup table.

pad(a[, w_l, v_l, w_r, v_r, axis])

Pad an array along a given axis.

setup_executable(mod, run_defaults[, …])

Read command line arguments and turn into useable dicts.

to_array(a[, shape])

Convert a to an numpy array and tile to matching dimension/shape.

to_iterable(a)

If a is a not iterable or a string, return [a], else return a.

transpose_list_list(D[, pad])

Returns a list of lists T, such that T[i][j] = D[j][i].

zero_if_close(a[, tol])

set real and/or imaginary part to 0 if their absolute value is smaller than tol.

Module description

Miscellaneous tools, somewhat random mix yet often helpful.