unitaria.verify

unitaria.verify(node: Node, reference: ndarray | None = None, atol: float = 1e-08, **kwargs)[source]

Verify a node using the default Verifier.

This checks for node that

  • The dimesions of subspace_in and subspace_out match dimension_in and dimension_out, and the total qubits of these subspaces matches the qubits in circuit.

  • compute and compute_adjoint match and that their batched version are equivalent.

  • compute matches the circuit implementation given through subspace_in, subspace_out, and circuit.

If one of these checks does not pass, the same tests will be run for all children to find out whether the implementation of this node, or one of its childrens is erroneous.

Parameters:
  • node – The node to be checked.

  • reference – An optional reference, to which the circuit and matrix arithmetic implementations should be compared. For example for Identity(1) one could pass np.eye(2).

  • atol – Absolute tolerance when comparing to reference

  • kwargs – See Verifier