Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into blocksparse_impro…
Browse files Browse the repository at this point in the history
…ved_unique_encoding_2
  • Loading branch information
mganahl committed Aug 4, 2020
2 parents 964b59a + daf53fc commit 69f4268
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tensornetwork/tests/tensornetwork_symmetric_test.py
Expand Up @@ -43,6 +43,28 @@ def get_random_symmetric(shape, flows, num_charges, seed=10, dtype=np.float64):
indices = [Index(charge, flows[n]) for n in range(R)]
return BlockSparseTensor.random(indices=indices, dtype=dtype)

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)


def get_zeros(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.zeros(indices=indices, dtype=dtype)


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)

@pytest.mark.parametrize("dtype", [np.float64, np.complex128])
@pytest.mark.parametrize("num_charges", [1, 2, 3])
def test_network_copy_reordered(dtype, num_charges):
Expand Down

0 comments on commit 69f4268

Please sign in to comment.