Clarification: Diffuse and Conquer

The grader checks

def run(test_case_input: str) -> str:
    ins = json.loads(test_case_input)
    out_state = qsvt_diffusion(*ins)[:4]
    rescaled_out= out_state * np.linalg.norm(b) / C
    output = rescaled_out/ np.linalg.norm(rescaled_out)

    return str(np.real(output).tolist())

There seems to be an error here.

  1. rescaled_out is redundant because it is immediately normalised in the next line.
  2. outputis a normalised state, but np.real(output) is returned. Unless the state is already completely real, the returned state will not be normalised. However, the answers of the public testcases are normalised states.

I believe the correct order should be: taking np.real first, and then normalising afterwards.

Thanks.

Hi @L3ungj, welcome to the Forum!

We have looked into it and in general you are correct about the ordering. However, we’ve reviewed the challenge setup and confirmed that this specific implementation detail won’t cause any valid solutions to fail the grader.

Thanks again for pointing this out, we really appreciate the feedback!