def test_partial_transpose_randomized(): """partial transpose: randomized tests on tripartite system""" rho = tensor(rand_dm(2, density=1), rand_dm(2, density=1), rand_dm(2, density=1)) mask = numpy.random.randint(2, size=3) rho_pt_ref = _partial_transpose_reference(rho, mask) rho_pt1 = partial_transpose(rho, mask, method="dense") numpy.abs(numpy.max(rho_pt1.full() - rho_pt_ref.full())) < 1e-12 rho_pt2 = partial_transpose(rho, mask, method="sparse") numpy.abs(numpy.max(rho_pt2.full() - rho_pt_ref.full())) < 1e-12