qdk_chemistry.data.encoding_validation module

Deprecated utilities for validating fermion-to-qubit encoding compatibility.

Deprecated since version 2.0: Encoding compatibility is superseded by the explicit MajoranaMapping fermion-to-qubit workflow. EncodingMismatchError and validate_encoding_compatibility remain as deprecated facades for backward compatibility and will be removed in a future release.

exception qdk_chemistry.data.encoding_validation.EncodingMismatchError[source]

Bases: ValueError

Exception raised when Circuit and QubitOperator have incompatible encodings.

Deprecated since version 2.0: Use the MajoranaMapping fermion-to-qubit workflow instead.

qdk_chemistry.data.encoding_validation.validate_encoding_compatibility(circuit, hamiltonian)[source]

Validate that a Circuit and QubitOperator use compatible encodings.

This function checks that both the circuit and Hamiltonian have matching encodings. Both must have their encoding specified (not None), and the encodings must match.

Deprecated since version 2.0: Use the MajoranaMapping fermion-to-qubit workflow instead.

Return type:

None

Parameters:
  • circuit (Circuit) – The quantum circuit with encoding metadata.

  • hamiltonian (QubitOperator) – The qubit Hamiltonian with encoding metadata.

Raises:

EncodingMismatchError – If the circuit or Hamiltonian encoding is None, or if the encodings don’t match.

Examples

>>> circuit = Circuit(qasm="...", encoding="jordan-wigner")
>>> hamiltonian = QubitOperator(..., encoding="jordan-wigner")
>>> validate_encoding_compatibility(circuit, hamiltonian)  # OK