-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactored notebook for Hamiltonian Simulation #77
base: main
Are you sure you want to change the base?
Conversation
def circuit(self, t_duration: int, steps:int=1, order=None): | ||
dt = t_duration/steps | ||
c = self.h.circuit(dt) | ||
nqubits = c.nqubits | ||
c_recompiled_into_CNOT = Circuit(nqubits=nqubits) | ||
|
||
for gate in c.queue: | ||
if len(gate.qubits) > 1: #if gate is two qubit | ||
gate_decomposition = two_qubit_decomposition(*gate.qubits, gate.matrix()) | ||
for gate_elem in gate_decomposition: | ||
c_recompiled_into_CNOT.add(gate_elem) | ||
else: | ||
c_recompiled_into_CNOT.add(gate) | ||
|
||
multi_layer = Circuit(nqubits=nqubits) | ||
for _ in range(steps): | ||
multi_layer += c_recompiled_into_CNOT | ||
|
||
return multi_layer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point given that this is a generic method that can be applied to any oracle, wouldn't it better to apply it directly to EvolutionOracle
? Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good point. Would you have time to put it into EvolutionOracle? Is it just copy paste of the entire SymbolicHamiltonian_EvolutionOracle
and merge circuit
or is there some dataclass
subtlety to keep in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should be able to do it today, there should be no issues with dataclass
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, for now I'm learning the formalism by looking at your implementations :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case it would be better to have complete contributions. I think that as we already discussed the core devs are not supposed to refactor contributions.
@marekgluza I've concluded the refactor. From the notebook everything seems to be fine. |
Feel free to pull and test |
This has stalled because for a simple model Sam was running it and we ran into 2 qubit unitary decompositions that were not real in the magic basis qiboteam/qibo#1501 |
@Edoardo-Pedicillo @andrea-pasquale : proposed solution - add dependancy on |
Implementing #69 thanks @jykhoo1987 for input