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

More efficient synthesis of StatePreparation and Initialize based on Isometry #12081

Closed
ShellyGarion opened this issue Mar 26, 2024 · 0 comments · Fixed by #12178
Closed

More efficient synthesis of StatePreparation and Initialize based on Isometry #12081

ShellyGarion opened this issue Mar 26, 2024 · 0 comments · Fixed by #12178
Assignees
Labels

Comments

@ShellyGarion
Copy link
Member

ShellyGarion commented Mar 26, 2024

What should we add?

The current code for StatePreparation and Initialize is based on [1], but there is a more efficient code in [2] which is currently implemented in Isometry.

Therefore, it would be better to replace the internal implementation of StatePreparation and Initialize by the one implemented in Isometry.

References
[1] Shende, Bullock, Markov. Synthesis of Quantum Logic Circuits (2004) https://arxiv.org/abs/quant-ph/0406176v5
[2] Iten et al., Quantum circuits for isometries (2016). Phys. Rev. A 93, 032318

For example,

for n_qubits in [5, 7, 10, 12, 15]:

    state = np.random.rand(2 ** n_qubits) + np.random.rand(2 ** n_qubits) * 1j
    state = state/np.linalg.norm(state)

    # State preparation
    qc = QuantumCircuit(n_qubits)
    qc.append(StatePreparation(state), range(n_qubits))

    transpiled = transpile(qc, basis_gates=['u', 'cx'], optimization_level=0)
    cx_sp = transpiled.count_ops()['cx']

    # Isometry
    reg_iso = QuantumRegister(n_qubits)
    circuit_iso = QuantumCircuit(reg_iso)
    isom = Isometry(state, 0, 0)

    qc = QuantumCircuit(n_qubits)
    qc.append(isom, range(n_qubits))

    transpiled = transpile(qc, basis_gates=['u', 'cx'], optimization_level=0)
    cx_isom = transpiled.count_ops()['cx']

    print ("num qubits=", n_qubits, "cx count StatePreparation=", cx_sp, "cx count Isometry=", cx_isom)

gives:

num qubits= 5 cx count StatePreparation= 52 cx count Isometry= 26 
num qubits= 7 cx count StatePreparation= 240 cx count Isometry= 120 
num qubits= 10 cx count StatePreparation= 2026 cx count Isometry= 1013 
num qubits= 12 cx count StatePreparation= 8166 cx count Isometry= 4083 
num qubits= 15 cx count StatePreparation= 65504 cx count Isometry= 32752 
@ShellyGarion ShellyGarion self-assigned this Mar 26, 2024
@ShellyGarion ShellyGarion changed the title More efficient synthesis of StatePreparation and Initialize base on Isometry More efficient synthesis of StatePreparation and Initialize based on Isometry Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant