Exemplo n.º 1
0
def get_ones(shape, dtype=np.float64):
    R = len(shape)
    charges = [U1Charge(np.random.randint(-5, 5, shape[n])) for n in range(R)]
    flows = list(np.full(R, fill_value=False, dtype=np.bool))
    indices = [Index(charges[n], flows[n]) for n in range(R)]
    return BlockSparseTensor.ones(indices=indices, dtype=dtype)
Exemplo n.º 2
0
def get_square_matrix(shape, dtype=np.float64):
    charge = U1Charge(np.random.randint(-5, 5, shape))
    flows = [True, False]
    indices = [Index(charge, flows[n]) for n in range(2)]
    return BlockSparseTensor.random(indices=indices, dtype=dtype)