7
$\begingroup$

Let's say we have the following circuit (picture and code shown below), and now the $q_0$ is an ancilla qubit. If the system of interest has only two qubits, Is there a way to use only $q_{1,2}$ as my ansatz and plug it into the built-in VQE in qiskit?

A little more context is the following. I would like to realize a quantum circuit consists of a linear combination of two unitary operators, such as $I+g$ where $I$ is the identity operator and $g$ is the translation operator that moves the qubits as $q_0\rightarrow q_1,q_1\rightarrow q_2,q_2\rightarrow q_0$. According to this paper, https://arxiv.org/abs/1202.5822, it is possible to do so with an ancilla qubit, see Fig. 1 and Eq. 3. But suppose I would like use the resulting circuit as a variational ansatz, how can I do that? If there is an approach to realize $I+g$ without ancilla qubit, I will be very happy to learn that!

from qiskit.circuit import ParameterVector
from qiskit import QuantumCircuit
theta = ParameterVector( 'theta' , 2 )
qc = QuantumCircuit( 3 ) 
q = qc.qubits
qc.h(q) 
qc.crx( theta[0] , q[0], q[1] )
qc.cry( theta[1] , q[1], q[2] )
qc.draw('mpl')

enter image description here

$\endgroup$
1
  • $\begingroup$ Qiskit's VQE() is extremely inflexible. However, nothing stops you from defining a function taking as input parameters theta[0] and theta[1] (simply as floats, with no ParameterVector involved) and returning the corresponding circuit, and then using scipy.minimize to find the minimum of this function. The only problem with such an approach is that you will generate a new circuit each time you change the parameters. In a real experiment, however, running a circuit is so slow, that this will be a negligible time overhead. $\endgroup$
    – mavzolej
    Commented Dec 29, 2020 at 8:55

0

Browse other questions tagged or ask your own question.