Error message in exercise i.1.2

Hi,

I’m trying to solve exercise i.1.2. When I execute my solution in an external python environment I get the expected results. However, when I test it in the Codebook environment I get the error:
“Incorrect: Make sure you conjugate state_1 and not state_2.”

Could you please give any clue? hereby my function code:

def inner_product(state_1, state_2):

return  state_2[0].conjugate()*state_1[0] + state_2[1].conjugate() * state_1[1]

Thanks in advance

Hello!

Since you need to compute \langle state \ 1 \vert state \ 2 \rangle, you need to conjugate state 1. Your code conjugates state 2. The codebook may be testing with extra cases in the backend.

Hope this helps,

Alvaro

1 Like