Skip to content

to_pytket maps controlled-phase (cp) to CRz instead of controlled-phase #630

@ryanhill1

Description

@ryanhill1

Version: 0.8.2

In src/qrisp/interface/converter/pytket_converter.py, the controlled-phase gate cp is mapped to OpType.CRz:

elif op.name == "cp":
    if hasattr(op, "ctrl_state"):
        tket_ins = OpType.CRz   # <-- controlled-Rz, not controlled-phase

CRz != CP. Controlled-phase is diag(1,1,1,e^{iλ}), but the conversion yields diag(1,1,e^{-iλ/2},e^{iλ/2}) — an observable error (not a global phase), inconsistent with qrisp's own get_unitary() for cp:

import qrisp
from qrisp.circuit.library import CPGate
qc = qrisp.QuantumCircuit(2); qc.append(CPGate(0.7), [0, 1])
# diag(qc.get_unitary())        -> [1, 1, 1, e^{0.7i}]
# diag(qc.to_pytket unitary)    -> [1, 1, e^{-0.35i}, e^{0.35i}]

Fix: map cp to OpType.CU1 (pytket's controlled-phase).

Discovered during PR review integrating Qrisp as a supported framework in the qBraid-SDK: qBraid/qBraid#1211

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions