File tree Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Original file line number Diff line number Diff line change @@ -119,23 +119,7 @@ def main():
119119 mps = build_qutrit_circuit_mps (n = n , d = d , theta = theta )
120120 qc = build_qutrit_circuit_dense (n = n , d = d , theta = theta )
121121
122- # Obtain statevectors (shape [-1])
123- psi_mps = tc .backend .numpy (mps .wavefunction (form = "default" ))
124- psi_dense = tc .backend .numpy (qc .wavefunction (form = "default" ))
125-
126- # Normalize both just in case of tiny numerical drift
127- def _norm (v ):
128- return v / np .linalg .norm (v )
129-
130- psi_mps = _norm (psi_mps )
131- psi_dense = _norm (psi_dense )
132-
133- # \ell_\infty comparison: :math:`\max_i |(\psi_{\mathrm{MPS}} - \psi_{\mathrm{dense}})_i|`
134- inf_err = np .max (np .abs (psi_mps - psi_dense ))
135- print (r"Max $|\Delta|$ between MPS and dense:" , inf_err )
136-
137- tol = 1e-10
138- assert inf_err < tol , f"States differ too much: { inf_err } >= { tol } "
122+ np .testing .assert_allclose (mps .wavefunction (), qc .wavefunction ())
139123 print ("OK: MPSCircuit matches QuditCircuit for d=3 with unitary-applied gates." )
140124
141125
You can’t perform that action at this time.
0 commit comments