0
$\begingroup$

I need a way to add scalar values to a quantum string.

Say if $| v \rangle = |1 1 0 \rangle + |1 0 1 \rangle$ then $|v \rangle + 5 = |1 0 1 1 \rangle + |1 1 0 0\rangle$

Is there a known method to do this?

I don't want tot express 5 as a qubit string in order to save qubits.

$\endgroup$
  • $\begingroup$ A vector and a scalar are different dimensions. I don't think you can add them. $\endgroup$ – Victory Omole Sep 10 at 17:16
2
$\begingroup$

Generally you have to perform the addition modulo some constant; you can't grab another qubit if you need to overflow. Code for modular addition of a constant is available in the Increment.qs file in the Q# standard library, in the IncrementByInteger operation. Check out the documentation here.

$\endgroup$
  • $\begingroup$ There can be a carryOut qubit that will act as a most significant qubit in the case of overflow, but this method work fine for me, thanks. $\endgroup$ – Sorin Bolos Sep 11 at 6:31
1
$\begingroup$

There are definitely ways to do this; the first one I could find is described in this paper by Thomas Draper (page 6).

$\endgroup$
-1
$\begingroup$

I don't know the answer to this question but I will try to put my thoughts. Why do you want to add a number to a state? A state is unknown untill it is measured. and in your equation the sum of squares of probabilities is 2, how could that be possible.

A classical 5 means 101 which means presence, absence, presence of electrons(not electron or photon). Another doubt I got is, we use classical gates to add scalars and quantum gates for quantum operations, how can we do both in one equation.

May be unless we measure the state we cannot add 5.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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