1
$\begingroup$

I read and re-read the documentation for MCMT and MCX and still can't figure out how to do this. For example I have 10 qubits $q_0,\cdots q_9$; I want to apply pauli string $X_2 Y_4 Z_5$ with control bits $q_7,q_9$. How would this be done? I don't think this can be done in stim since these gates are not clifford; am I right?

$\endgroup$
2
  • $\begingroup$ It's unclear to me if you're asking about how to do something in qiskit or if it can be done in stim. Questions should be one question. $\endgroup$ Commented Sep 3, 2022 at 1:22
  • $\begingroup$ @CraigGidney Actually both...I didn't think stim could do it based on non-clifford gate support...please correct if I'm wrong $\endgroup$
    – unknown
    Commented Sep 3, 2022 at 3:08

3 Answers 3

1
$\begingroup$

I think that MCMT allows one type of target gate only (i.e you can apply an $X$ gate for example on multiple target qubits, but applying $X$ on that qubit and $Z$ on another qubit, for example - is not supported).

However we can write a piece of code that does that pretty easily:

def pauliStringCustomGate(qubits_span, gates_list, qubits_list):
    qc = QuantumCircuit(qubits_span)
    
    count = 0
    for g in gates_list:
        if g == 'X':
            qc.x(qubits_list[count])
        elif g == 'Y':
            qc.y(qubits_list[count])
        elif g == 'Z':
            qc.z(qubits_list[count])
        count += 1

    gate_qc = qc.to_gate(label = "Custom Pauli String")
    return gate_qc

cps = pauliStringCustomGate(qubits_span = 4, gates_list = ['X','Y','Z'], qubits_list = [0,2,3])
qc = QuantumCircuit(10)
qc.append(instruction = cps.control(num_ctrl_qubits = 2), qargs = [7,9,2,3,4,5])

The quantum circuit you get is:

enter image description here

And the content of the "Custom Pauli String" box is:

enter image description here

$\endgroup$
1
  • $\begingroup$ this also worked...it was a tossup to decide which answer to accept $\endgroup$
    – unknown
    Commented Sep 3, 2022 at 21:23
4
$\begingroup$

Qiskit provides PauliGate which makes it really easy to achieve that:

from qiskit.circuit.library import PauliGate

pauli_string = 'ZYX'
gate = PauliGate(pauli_string).control(2)
circ.append(gate, [7, 9, 2, 4, 5])

Where circ is you quantum circuit.

enter image description here

$\endgroup$
1
  • $\begingroup$ thanks, this worked $\endgroup$
    – unknown
    Commented Sep 3, 2022 at 21:23
2
$\begingroup$

Stim doesn't allow multiple controls.

Actually, it doesn't even allow combining multiple classical controls, though in most other contexts those are considered okay for stabilizer circuits. It's due to an underlying algorithmic issue, where samples produces by circuits with such operations lack a group structure that enables extremely fast bulk simulations.

This refers specifically to what can be put into a stim.Circuit. Obviously nothing prevents the python code driving a stim.TableauSimulator from making decisions that depend on multiple measurement results in complex ways.

$\endgroup$
2
  • $\begingroup$ I have to learn how you can still do QECC with this limitation...I think I'm missing some key ideas behind stim's approach. $\endgroup$
    – unknown
    Commented Sep 3, 2022 at 21:26
  • $\begingroup$ @unknown You can't do universal computation under this constraint, even with magic states. But you can still determine what the error rates of those constructions would be. $\endgroup$ Commented Sep 3, 2022 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.