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

Is QFT/inverse QFT available on Qulacs? #278

Open
pat-phattharaporn opened this issue Jan 27, 2021 · 5 comments
Open

Is QFT/inverse QFT available on Qulacs? #278

pat-phattharaporn opened this issue Jan 27, 2021 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@pat-phattharaporn
Copy link

Hi! I'm wondering is QFT/inverse QFT available on Qulacs? If they are, would you mind pointing me to the documentation? Otherwise, are you planning to include it in the package or we need to manually construct the circuit? Thank you very much!

@corryvrequan
Copy link
Contributor

Hi @pat-phattharaporn
Qulacs does not have an API to generate QFT / Inverse QFT circuit, and currently, we have no plan to include a template for constructing QFT circuit in the library. (It is possible to include it in the future, but we have currently working on speed-up of simulation rather than improving usability.)
Thus, yes, we need to manually construct the circuit.

@ghost
Copy link

ghost commented Feb 14, 2021

Hello! On a related note, I'm trying to construct the QFT circuit from scratch yardstiq/quantum-benchmarks#30 but I was unable to find a CUz gate because of which I'm decomposing the CUz into dense matrix and CNOT gates. Am I missing the API for CUz gate?

@corryvrequan
Copy link
Contributor

corryvrequan commented Mar 26, 2021

Hi @Codewithsk .

Sorry for very late reply.
Qulacs does not have controled-RZ gate as a basic gate.
(There are CUz gate in qft modules inside C-language codes, but they are not exported to python.)
Instead, you can use the following.

gate = DenseMatrix([target], matrix2x2)
gate.add_control_qubit(control, 1)

or

gate = DenseMatrix([target, control], matrix4x4)

I guess which is faster depends on the environment.

@ghost
Copy link

ghost commented Jun 5, 2021

Hi @corryvrequan!

We're using the following:

circuit.add_dense_matrix_gate(wire, [[1,0],[0, np.exp(1j * (np.pi/(2**(wire-i)))/2)]])
circuit.add_CNOT_gate(i, wire)
circuit.add_dense_matrix_gate(wire, [[1,0],[0, np.exp(-1j * (np.pi/(2**(wire-i)))/2)]])
circuit.add_CNOT_gate(i, wire)

Is there a performance difference between these two implementations?

@KowerKoint
Copy link
Contributor

Sorry for very late reply.
I have no idea that which implementation is better, but I think there is just a little difference.
You can measure the performance.
You can use U1 gate to implement circuit.add_dense_matrix_gate(wire, [[1,0],[0, np.exp(1j * (np.pi/(2**(wire-i)))/2)]]) circuit.add_CNOT_gate(i, wire) and it is better.

@KowerKoint KowerKoint added the help wanted Extra attention is needed label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants