ufv_empty_frame#

t3toolbox.backend.uniform_padded_frames.ufv_empty_frame(shape, N=None, stack_shape=(), use_jax=False)#
def ufv_empty_frame(
        shape:        typ.Sequence[int],        # len=d, the real mode sizes
        N:            typ.Optional[int] = None, # the padded mode size; None = max(shape)
        stack_shape:  typ.Sequence[int] = (),   # C
        use_jax:      bool = False,             # array-free constructor: chooses the supercore type (masks are always host)
) -> typ.Tuple[                                 # the frame of the zero tensor (Na = 0, Rb = 1; default float):
    NDArray,               # down.  shape=(d,)+C+(0, N)
    NDArray,               # up.    shape=(d,)+C+(1, 0, 1)
    NDArray,               # left.  shape=(d,)+C+(1, 0, 1)
    NDArray,               # right. shape=(d,)+C+(1, 0, 1)
    typ.Tuple[int, ...],   # shape, len=d
    typ.Tuple[NDArray, NDArray, NDArray, NDArray],   # masks, HOST bool: down/up (d,)+C+(0,); left/right (d+1,)+C+(1,), True at bonds 0 and d only
]:

The frame of the zero tensor in block layout: its orthogonal representation’s prefix masks at widths (0, 0, 1, 1).

Examples

>>> import t3toolbox.backend.uniform_padded_frames as uniform_padded_frames
>>> down, up, left, right, shape, masks = uniform_padded_frames.ufv_empty_frame((5, 6, 7), stack_shape=(2,))
>>> print(down.shape, up.shape, shape)
(3, 2, 0, 7) (3, 2, 1, 0, 1) (5, 6, 7)
>>> print(masks[2][:, 0].ravel().tolist())         # left masks, stack element 0: real at bonds 0 and d only
[True, False, False, True]
Parameters:
  • shape (t3toolbox.backend.common.typ.Sequence[int])

  • N (t3toolbox.backend.common.typ.Optional[int])

  • stack_shape (t3toolbox.backend.common.typ.Sequence[int])

  • use_jax (bool)

Return type:

t3toolbox.backend.common.typ.Tuple[NDArray, NDArray, NDArray, NDArray, t3toolbox.backend.common.typ.Tuple[int, …], t3toolbox.backend.common.typ.Tuple[NDArray, NDArray, NDArray, NDArray]]