def broadcast(axis):
    """
    Use numpy array broadcasting in two dimensions.

    Use numpy array broadcasting to return two views of the input axis that
    behave like a row vector (x) and a column vector (y), and which can be used
    to build memory-efficient coordinate grids without using meshgrid.

    Given an axis with length N, the naive approach using meshgrid requires
    building two NxN arrays, and combining them (e.g. to obtain a radial
    coordinate grid) produces a third NxN array. Using array broadcasting, one
    only needs to create two separate views into the original Nx1 vector to
    create the final NxN array.

    Parameters
    ----------
    axis : array_like
        1D coordinate axis

    Returns
    -------
    array_like, array_like
        Two views into axis that behave like a row and column vector,
        respectively.

    """
    x = axis[None, :]
    y = axis[:, None]
    return x, y