tenpy.linalg.np_conserved.grid_concat(grid, axes, copy=True)[source]

Given an np.array of npc.Arrays, performs a multi-dimensional concatentation along ‘axes’.

Similar to numpy.block(), but only for uniform blocking.

Stacks the qind of the array, without sorting/blocking.

  • grid (array_like of Array) – The grid of arrays.

  • axes (list of int) – The axes along which to concatenate the arrays, same len as the dimension of the grid. Concatenate arrays of the i`th axis of the grid along the axis ``axes[i]`

  • copy (bool) – Whether the _data blocks are copied.


Assume we have rank 2 Arrays A, B, C, D of shapes (1, 2), (1, 4), (3, 2), (3, 4) sharing the legs of equal sizes. Then the following grid will result in a (1+3, 2+4) shaped array:

>>> g = grid_concat([[A, B], [C, D]], axes=[0, 1])
>>> g.shape
(4, 6)

If A, B, C, D were rank 4 arrays, with the first and last leg as before, and sharing common legs 1 and 2 of dimensions 1, 2, then you would get a rank-4 array:

>>> g = grid_concat([[A, B], [C, D]], axes=[0, 3])
>>> g.shape
(4, 1, 2, 6)

See also


can be used to block by charges.