Skip to content
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

TFIM 2 CNOT not 3 CNOT compiling #70

Open
marekgluza opened this issue Jul 17, 2024 · 2 comments · May be fixed by #94
Open

TFIM 2 CNOT not 3 CNOT compiling #70

marekgluza opened this issue Jul 17, 2024 · 2 comments · May be fixed by #94

Comments

@marekgluza
Copy link
Contributor

Zrzut ekranu z 2024-07-17 17-22-48

Please implement this as an evolution oracle similar to #69

Here are some checks for the decomposition

c.add(gates.CNOT(0,1))
c.add(gates.Z(0))
c.add(gates.CNOT(0,1))

c2 = qibo.Circuit(2)
c2.add(gates.Z(0))

np.linalg.norm(c2.unitary()-c.unitary())
c = qibo.Circuit(2)

c.add(gates.CNOT(0,1))
c.add(gates.X(0))
c.add(gates.CNOT(0,1))

c2 = qibo.Circuit(2)
c2.add(gates.X(0))
c2.add(gates.X(1))
np.linalg.norm(c2.unitary()-c.unitary())
@marekgluza marekgluza added the enhancement New feature or request label Oct 15, 2024
@Sam-XiaoyueLi Sam-XiaoyueLi self-assigned this Oct 23, 2024
@shangtai
Copy link
Contributor

shangtai commented Oct 23, 2024

Opened a new branch called tfim_2cnot and added the class tfim_EvolutionOracle(EvolutionOracle). It can be accessed here.

This is a work in progress.

@shangtai
Copy link
Contributor

Example of code:

hamiltonian = SymbolicHamiltonian(nqubits=3)

# Instantiate the oracle with 10 Trotter steps
oracle = tfim_EvolutionOracle(h=hamiltonian, steps=10, evolution_oracle_type="trotter")

# Example: Run the circuit for qubit a=0, B_a=0.8, and t_duration=1.0
circuit = oracle.circuit(a=0, t_duration=1.0, B_a=0.8)

# Print the resulting circuit to visualize it
print(circuit.summary())

Produces

Circuit depth = 22
Total number of gates = 22
Number of qubits = 3
Most common gates:
rx: 10
rz: 10
cx: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants