tenpy.linalg.np_conserved.detect_grid_outer_legcharge(grid, grid_legs, qtotal=None, qconj=1, bunch=False)[source]

Derive a LegCharge for a grid used for grid_outer().

Note: The resulting LegCharge is not bunched.

  • grid (array_like of {Array | None}) – The grid as it will be given to grid_outer().

  • grid_legs (list of {LegCharge | None}) – One LegCharge for each dimension of the grid, except for one entry which is None. This missing entry is to be calculated.

  • qtotal (charge) – The desired total charge of the array. Defaults to 0.


new_grid_legs – A copy of the given grid_legs with the None replaced by a compatible LegCharge. The new LegCharge is neither bunched nor sorted!

Return type:

list of LegCharge

See also


similar functionality for a flat numpy array instead of a grid.