TransWikia.com

Implementing Partial Trace in IBMs quantum computer

Quantum Computing Asked on November 14, 2020

I am trying to implement the partial trace operation on IBMs quantum computer. I am simulating the depolarising channel with the following code

#aim here is to build the decoherence channel
p=0.1;
z=0.5+0.5*math.sqrt(1-p);
desiredvec=[
    math.sqrt(1-z),
    math.sqrt(z)]
circuit2 = QuantumCircuit(4,3);
circuit2.initialize(desiredvec,0)
circuit2.initialize(desiredvec,1)
circuit2.initialize(desiredvec,2)
circuit2.cx(0,3)
circuit2.h(3)
circuit2.s(3)
circuit2.cx(1,3)
circuit2.h(3)
circuit2.s(3)
circuit2.cx(2,3)
circuit2.h(3)
circuit2.s(3)
circuit2.draw()

I would now like to trace out all but qubit 3 as it is the only qubit I am interested in. I can get around this by just ignoring the other qubits but I would rather not do this. Is there any easy way to trace out unwanted qubits?

Or equivalently is there a way to initalise the qubit in a mixed state so that the extra ancillary qubits aren’t needed in the first place?

2 Answers

qiskit.quantum_info has a partial_trace method you can use for this.

It takes as input either a Statevector or a DensityMatrix object. Both these classes implement the from_instruction routine that you can use with the QuantumCircuit object you already have. You would have to do something along the lines of:

circuit2 = QuantumCircuit(4,3)

...
# your operations
...

statevec = Statevector.from_instruction(circuit2)
trace = partial_trace(statevec, 3)

Hope this helps!

Correct answer by Aditya Giridharan on November 14, 2020

On a quantum computer, there is no point in implementing a partial trace. Just ignore the qubits which you want to trace.

Answered by Norbert Schuch on November 14, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP