0
$\begingroup$

How to calculate the sum of $\sum\limits_{j}{\langle A|{{B}_{j}}\rangle |{{C}_{j}}\rangle }$ with quantum circuits by qiskit, where $\sum\limits_j \langle A| B_j\rangle |C_j \rangle$, $A,B_j,$ and $C_j$ are three quantum states of the same dimension?

$\endgroup$
2
  • 1
    $\begingroup$ Are $A, B_j$ and $C_j$ Statevectors in Qiskit? How is the question related to Qiskit? Please provide a more elaborate formulation. $\endgroup$ Jun 8, 2022 at 16:23
  • $\begingroup$ Yes, these are three state vectors of the same dimension, but they are not equal $\endgroup$ Jun 9, 2022 at 12:58

1 Answer 1

1
$\begingroup$

Here is one way to do it:

  1. You can compute the inner product $\langle A |B_j\rangle$ with inner() method of Statevector. Just type A.inner(B).
  2. You can multiply a Statevector with a scalar. So you can write $\langle A |B_j\rangle |C\rangle$ like A.inner(B)*C, since the inner product of two states is a scalar.
  3. You add can Statevector as well, so summing over j should be straightforward.
  4. Notice though, that a valid Statevector must have a norm 1. That is, S.inner(S) must be equal 1. Adding or multiplying with a scalar doesn't, in general, preserve the norm. You can check if your Statevector is normalized with is_valid() method.
$\endgroup$
1
  • $\begingroup$ Sorry this is not what I want, I want to implement each step of the above formula on a quantum computer, instead of the classical computer sharing too many problems for the quantum computer $\endgroup$ Jun 10, 2022 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.