rsehgal / barcQ

A repository to share ideas related to Quantum computing, and code to implement Quantum Algorithms
2 stars 0 forks source link

Wrong name appear for user defined controlled gates in the JSON #40

Closed rsehgal closed 4 years ago

rsehgal commented 4 years ago

When we create the user defined gates, it assign wrong name to the gates as can be seen in the JSON produced. Currently it just assign the name of gate which is at the top, which is wrong.

Ideally it should assign correct gate name which should corresponds to the gates available in QuTiP, Various gate available in QuTip are as follows,

Gate name Description
“RX” Rotation around x axis
“RY” Rotation around y axis
“RZ” Rotation around z axis
“SQRTNOT” Square root of NOT gate
“SNOT” Hardmard gate
“PHASEGATE” Add a phase one the state 1
“CRX” Controlled rotation around x axis
“CRY” Controlled rotation around y axis
“CRZ” Controlled rotation around z axis
“CPHASE” Controlled phase gate
“CNOT” Controlled NOT gate
“CSIGN” Same as CPHASE
“BERKELEY” Berkeley gate
“SWAPalpha” SWAPalpha gate
“SWAP” Swap the states of two qubits
“ISWAP” Swap gate with additional phase for 01 and 10 states
“SQRTSWAP” Square root of the SWAP gate
“SQRTISWAP” Square root of the ISWAP gate
“FREDKIN” Fredkin gate
“TOFFOLI” Toffoli gate
“GLOBALPHASE” Global phase

This needs to be fixed, otherwise the backend code will break if user introduce user defined gate in the circuit

Bhartih commented 4 years ago

Wrong name was appearing because on creation of custom gate, the gate and name of parent div was not changing. Kindly check for all attribute of parent div and notify. I mean what should be num_bits, target bit etc.

rsehgal commented 4 years ago

That's what you have to set all the attributes of parent div.

rsehgal commented 4 years ago

Any update on this ??

rsehgal commented 4 years ago

Did we stuck somewhere ?? Need any discussion ??

This is very much required functionality.

rsehgal commented 4 years ago

For the time lets stick to only those controlled gate which are provided in the above list. ie. CNOT, TOFFOLI, FREDKIN, CRX, CRY, CRZ, CSIGN. Will allow user to allow creation of only these control gates on arbitrary lines

Bhartih commented 4 years ago

Can we discuss it today .

On Fri, Jun 5, 2020, 12:08 rsehgal notifications@github.com wrote:

For the time lets stick to only those controlled gate which are provided in the above list. ie. CNOT, TOFFOLI, FREDKIN, CRX, CRY, CRZ, CSIGN. Will allow user to allow creation of only these control gates on arbitrary lines

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/rsehgal/barcQ/issues/40#issuecomment-639289235, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYHONWJMZ4FI3U7GN6IXWTRVCHIFANCNFSM4NL2EI7A .

rsehgal commented 4 years ago

Thanks for the wonderful work. I think you missed the following test case for the TOFFOLI gate image

Currently its not allowing me to create a TOFFOLI gate with this configuration , getting alert message. image

May be you would like to have a look.

Good Job

rsehgal commented 4 years ago

There is a missing call for GenerateCode() function when we create the UserDefined Control gates. Please add a call to this function in the end of DisplayDivIds() function defined in userdefinedcontrolgates.js.

This is required to generate the QuTiP code in real time with correct gate name.

Bhartih commented 4 years ago

Corrected

rsehgal commented 4 years ago

Great, I think its ready to go.

Create the pull request.

rsehgal commented 4 years ago

Can you please clarify, if branch bharti/issue39update and bharti/issue40 corresponds to same work If yes, then which branch should we keep.

If there is any redundant branch, i would request your to delete that.

rsehgal commented 4 years ago

Create a pull request, so that we can merge this to master

Bhartih commented 4 years ago

bharti/issue39update correspond to issue 40 work . By mistake the name is given wrong. creating pull request.

rsehgal commented 4 years ago

Thanks, Shall i delete the branch bharti/issue40

rsehgal commented 4 years ago

Closing the issue because the corresponding work is done in branch bharti/issue39update, and is already merged to master