qiskit-aer icon indicating copy to clipboard operation
qiskit-aer copied to clipboard

Setting the initial state to a basis state

Open yaelbh opened this issue 4 years ago • 3 comments

What is the expected behavior?

We have a use case where the initial state is a basis state. Right now we have two options:

  1. Using the initialize instruction. This involves creating a 2^n state vector outside of the simulator and transmitting it to the simulator.
  2. Inserting X gates at the beginning of the circuit. This has the cost of increasing the circuit depth, affecting run time.

I suggest to do at least one of the following:

  1. Allow initialize to receive the vector in the form of a dictionary that maps basis states to amplitudes, where zero amplitudes do not have to be present.
  2. Implement an optimization in the simulator that simulates a sequences of Pauli gates in one matrix loop.

yaelbh avatar Jun 10 '20 15:06 yaelbh

Option 2 above is related to #715.

yaelbh avatar Jun 25 '20 10:06 yaelbh

The rest of this issue is for Option 1. Issue #715 is for Option 2. We will probably need to write a function ket2vec in utils.hpp, similar to the existing vec2ket. It will be nice if Terra eventually supports initialize that accepts a ket; in the meantime we can create our own instruction and add it to the set of basis gates when transpiling. Alternatively, it may be possible to hack parameters and data types of initialize.

yaelbh avatar Jul 02 '20 11:07 yaelbh

Hello, is this issue still open? I am new to the project, happy to work on this with some guidance :)

pradkrish avatar May 23 '22 15:05 pradkrish

Let me close this issue. Please create a new issue if this is required to users.

hhorii avatar May 16 '23 12:05 hhorii