Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Fix or clarification needed on Codercise I.1.2? #57

Closed
1 task done
gabrielsanchez opened this issue Oct 22, 2023 · 1 comment
Closed
1 task done

Fix or clarification needed on Codercise I.1.2? #57

gabrielsanchez opened this issue Oct 22, 2023 · 1 comment

Comments

@gabrielsanchez
Copy link

Node number

Codercise I.1.2

Expected behavior

The example says:

Suppose we are given two states

  state_1 = np.array([0.8, 0.6])
  state_2 = np.array([1 / np.sqrt(2), 1j / np.sqrt(2)]) 

Your function should compute and return the value of the inner product:

 0.56568542-0.42426407j

I coded my solution and got the same result as the example 0.565685424949238-0.42426406871192845j by using:

    inner_product = np.dot(state_1, np.conjugate(state_2).T)

but when I tried to submit this, I got the following message:

Incorrect: Make sure you conjugate state_1 and not state_2.

I changed the conjugate to be on state_1 and the exercise was submitted correctly:

inner_product = np.dot(np.conjugate(state_1).T, state_2)

However, if tried inner_product = np.dot(np.conjugate(state_1).T, state_2) with the example it gives me the following result:

(0.565685424949238+0.42426406871192845j)

I think the example needs to be like below for it to be consistent with the code solution:

Suppose we are given two states

  state_1 = np.array([1 / np.sqrt(2), 1j / np.sqrt(2)]) 
  state_2 = np.array([0.8, 0.6])

Your function should compute and return the value of the inner product:

 0.56568542-0.42426407j

OR

Suppose we are given two states

 state_1 = np.array([0.8, 0.6])
 state_2 = np.array([1 / np.sqrt(2), 1j / np.sqrt(2)]) 

Your function should compute and return the value of the inner product:

 0.56568542+0.42426407j

Actual behavior

Small inconsistency between the example and the codercise solution can be clarified/fixed by changing the example or adding some extra clarification in the instructions.

Additional information

No response

Source code

No response

Tracebacks

No response

Check other issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@CatalinaAlbornoz
Copy link

Hi @gabrielsanchez, thank you for reporting this! We will review this to make sure the example doesn't make the codercise more confusing.

@doctorperceptron doctorperceptron closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants