qutip-qip
qutip-qip copied to clipboard
add ionq as qutip provider
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 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?
@splch How are you getting along with this?
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
Thanks & no worries. What is your overall plan?
@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.
@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.
ah yeah no problem! sorry for not seeing this earlier :) ill remove it now
@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