qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Synthesis algorithms for Operators

Open ajavadia opened this issue 4 years ago • 8 comments

We need a general category of synthesis algorithms for things that have exponential descriptions. This basically means things defined by Operator or Statevector. A start of this is under qiskit.quantum_info.synthesis, but a bunch of the algorithms are scattered under qiskit.extensions.quantum_initializer.

Then I think instead of defining these operators as circuit libraries (they are really not), we just have a way to insert operators into circuits, and rely on these synthesis algorithms to give us the corresponding decomposition. This would include: Diagonal, Statevector, Unitary, Clifford, Isometry, etc.

ajavadia avatar Apr 28 '20 03:04 ajavadia

I can help with handling this issue - could you please assign me to it?

ShellyGarion avatar Dec 11 '20 06:12 ShellyGarion

A few questions:

  1. Where should we put all the synthesis algorithms? Should they all be in qiskit.quantum_info.synthesis ? or in another place?

  2. Should we just move all the functions in qiskit.extensions.quantum_initializer to the synthesis folder?

  3. Here is a list of the relevant synthesis algorithms - are there some more?

  • In qiskit.quantum_info.synthesis:

    • clifford_decompose.py
    • ion_decompose.py
    • local_invariance.py
    • one_qubit_decompose.py #5554
    • quaternion.py
    • two_qubit_decompose.py
    • weyl.py
    • cnotdihedral_decompose.py #5442
  • In qiskit.extensions.quantum_initializer:

    • diagonal.py
    • isometry.py
    • mcg_up_to_diagonal.py
    • squ.py
    • uc.py
    • uc_pauli_rot.py
    • ucrx.py
    • ucry.py
    • ucrz.py
  • In qiskit.transpiler.synthesis:

    • graysynth.py (include the functions graysynth and cnot_synth)

ShellyGarion avatar Feb 18 '21 10:02 ShellyGarion

I think if they're general synthesis (where they go from a quantum_info object or a matrix) to a circuit they should live in qiskit.quantum_info.synthesis. Ideally I feel like the qiskit.extensions module really should be deprecated and we move things from there either to circuits or the circuit library (like the gate classes) and/or quantum_info.

mtreinish avatar Apr 06 '21 14:04 mtreinish

What about qiskit.transpiler.synthesis? currently it has only graysynth.py. what should be there?

ShellyGarion avatar Apr 06 '21 14:04 ShellyGarion

Where should we put all the synthesis algorithms? Should they all be in qiskit.quantum_info.synthesis ? or in another place?

I think we can make a separate qiskit.synthesis directory that can contain everything currently under qiskit.quantum_info.synthesis and qiskit.transpiler.synthesis and qiskit.extensions. This would contain all synthesis algorithms which the compiler can use. Some will be from quantum_info objects, and some will not.

Should we just move all the functions in qiskit.extensions.quantum_initializer to the synthesis folder?

Yeah. As Matthew says the extensions folder should be deprecated and removed.

Here is a list of the relevant synthesis algorithms - are there some more?

  • patel-hayes-markov algorithm is missing from your list (for synthesizing CNOT-only circuits from linear functions)

  • we have 2 state preparation algorithms in Qiskit, one is the one in qiskit.extensions and the other is a special case of isometry (I believe the latter one is used by default when we do circuit.initialize). Can we link these to the synthesis of the qiskit Statevector object (with a to_circuit() method)?

  • different algorithms for synthesizing multi-controlled gates could go here as well. @Cryoris and I talked about this. In line with the rest of the synthesis methods, I'd like to separate the description of an object from its implementation. A multi-controlled Toffoli is a well-defined object that we should be able to insert into the circuit as is (e.g. using x.control(4). How it is implemented in terms of more primitive gates should be the domain of the synthesizer and there are many different methods.

ajavadia avatar Apr 07 '21 20:04 ajavadia

There is a lot here, and there are other open issues on synthesis too (https://github.com/Qiskit/qiskit-terra/issues/4687, https://github.com/Qiskit/qiskit-terra/issues/6038). @ShellyGarion can you please make an Epic from them? The good thing is there are many good synthesis algorithms already implemented in Qiskit, but user interface and compiler interface need work.

ajavadia avatar Apr 07 '21 20:04 ajavadia

TODO: List of items related to synthesis:

  • [ ] Make a separate qiskit.synthesis directory that contain everything currently under qiskit.quantum_info.synthesis and qiskit.transpiler.synthesis and qiskit.extensions #4699
  • [ ] Handle state preparation algorithms and link them to the synthesis of the qiskit Statevector object.
  • [ ] Different algorithms for synthesizing multi-controlled gates.

Other relevant issues:

  • [ ] #4687
  • [ ] #6038

ShellyGarion avatar Apr 12 '21 13:04 ShellyGarion

Are we still planning to fix this for 0.20?

HuangJunye avatar Mar 22 '22 15:03 HuangJunye