qutip-qip icon indicating copy to clipboard operation
qutip-qip copied to clipboard

add ionq as qutip provider

Open splch opened this issue 1 year ago • 8 comments

adds ionq as a provider for interoperability with qutip-qip

from qutip.qip.circuit import QubitCircuit
from qutip_qip.ionq import Provider, IonQSimulator

# QuTiP Circuit
qc = QubitCircuit(N=2)
qc.add_gate("H", targets=0)
qc.add_gate("CNOT", controls=1, targets=0)

# IonQ Integration
provider = Provider()
backend = IonQSimulator(provider=provider)

job = backend.run(qc)
results = job.get_results()
print(results.get_final_states())
[Quantum object: dims = [[2, 2], [1, 1]], shape = (4, 1), type = ket
Qobj data =
[[1.]
 [0.]
 [0.]
 [0.]], Quantum object: dims = [[2, 2], [1, 1]], shape = (4, 1), type = ket
Qobj data =
[[0.]
 [0.]
 [0.]
 [1.]]]
  • [x] create jobs from qutip circuits
  • [x] use CircuitResult object to parse results

splch avatar Sep 02 '23 07:09 splch

@splch Let us know when you would like a review.

Would it be possible to add some tests similar to the ones in https://github.com/qutip/qutip-qip/blob/master/tests/test_qiskit.py?

hodgestar avatar Sep 07 '23 22:09 hodgestar

@splch How are you getting along with this?

hodgestar avatar Oct 09 '23 12:10 hodgestar

hey! sorry i havent made much progress - im working on this independently from work so it's harder to find time. i definitely plan on continuing work on this integration though

splch avatar Oct 09 '23 18:10 splch

Thanks & no worries. What is your overall plan?

hodgestar avatar Oct 09 '23 22:10 hodgestar

@splch Sorry for being a pain, but could you remove the demo notebook with output from the branch and perhaps replace it with a test or documentation addition? It's a small thing, but if large outputs accidentally get committed it hard to remove them from history later.

hodgestar avatar Mar 18 '24 00:03 hodgestar

@splch Sorry for being a pain, but could you remove the demo notebook with output from the branch and perhaps replace it with a test or documentation addition? It's a small thing, but if large outputs accidentally get committed it hard to remove them from history later.

P.S. Posting this straight away so that hopefully it's easy to just force push the removal to your branch because there aren't many commits on top of it.

hodgestar avatar Mar 18 '24 00:03 hodgestar

ah yeah no problem! sorry for not seeing this earlier :) ill remove it now

splch avatar Mar 19 '24 16:03 splch

@hodgestar im trying to use the CircuitResult object as the result from the job. but i see it uses a list of density matrices to be initialized - is there some documentation you know of that can help me convert:

{'0': 0.5, '3': 0.5}

into a list of qobjs?

currently im doing: https://github.com/qutip/qutip-qip/pull/216/files#diff-dca8c04466f14c3fc623bb06f1546485896ef77c2fcafd4723b9b641493e0c19R37-R74 but feel like there should be a better way

splch avatar Mar 20 '24 15:03 splch