Testing

test_canonize.test_left_canonize()[source]

Test if left_canonize works as expected

test_canonize.test_mixed_canonize()[source]

Test if left_canonize and right_canonize work as expected when used together

test_canonize.test_right_canonize()[source]

Test if right_canonize works as expected

test_mps.new_random_state(d, n)[source]

Generate a random (normalized) state in dense representation for a system of n d-dimensional sites.

Parameters
  • n (int) -- Number of degrees of freedom

  • d (int) -- Local dimension of the single degree of freedom

Returns

random_state -- Normalized dense random state of n degrees of freedom of dimension d

Return type

numpy array shape (d^n)

test_mps.test_approx_error()[source]

For a sufficiently high chi, the approximation error should go to 0

test_mps.test_bond_dimension()[source]

The maximum bond dimension should be d**(np.floor(N/2))

test_mps.test_ghz_state()[source]

Test with the ghz state, for which a chi=2 dimension should suffice for full precision

test_mps.test_left_canonical()[source]

Test if MPS are in left-canonical form

test_mps.test_random_states()[source]

Generate random states of n qubits, convert them to MPS and back to dense, and see if the results match with the originals.

test_mps.test_with_quimb_mps()[source]

Convert a random state with the manual algorithm and with quimb. Check if they are compatible with each other

test_qft.test_ghz()[source]

Apply the QFT to ghz states, for which a (approx9 chi=2 should still give the exact result

test_qft.test_random_states()[source]

Apply the QFT to random states and compare the (exact) result with that of Cirq