mitiq icon indicating copy to clipboard operation
mitiq copied to clipboard

Make changes to the functions in `mitiq.shadows`

Open purva-thakre opened this issue 1 year ago • 2 comments

This issue will be used to keep track of all the things that could be changed, removed etc. from mitiq.shadows.

  • [ ] A function to calculate fidelity is in the utilities. But a similar function also exists in cirq.fidelity. The function is mitiq also has some lines flagged by pytest as uncovered. https://github.com/unitaryfund/mitiq/blob/05be477d2453ce647a32a4df7170426c5ca0b83f/mitiq/shadows/shadows_utils.py#L140
  • [ ] Re-word all the function docstrings to clarify what the function is supposed to do. Right now, some of the functionalities in this module are not clear for this reason.
  • [ ] Remove random strings in the middle of a function. Are these supposed to be comments? https://github.com/unitaryfund/mitiq/blob/05be477d2453ce647a32a4df7170426c5ca0b83f/mitiq/shadows/shadows.py#L138-L144 https://github.com/unitaryfund/mitiq/blob/05be477d2453ce647a32a4df7170426c5ca0b83f/mitiq/shadows/shadows.py#L191-L195 https://github.com/unitaryfund/mitiq/blob/05be477d2453ce647a32a4df7170426c5ca0b83f/mitiq/shadows/classical_postprocessing.py#L45-L48 https://github.com/unitaryfund/mitiq/blob/05be477d2453ce647a32a4df7170426c5ca0b83f/mitiq/shadows/classical_postprocessing.py#L176-L179
  • [ ] If some error is raised, make sure it is mentioned exactly in the docstring as Raises: SomeError instead of as a Warning.
  • [ ] Is there some kind of check to verify classical shadow size chosen by user is appropriate for the functionality in mitiq.shadows to work as expected?
  • [ ] n_measurements_tomography_bound is only used in a tutorial in the docs. it might be better to define this function there instead of having it in mitiq/shadows/shadows_utils.py

More to be added later.

purva-thakre avatar Dec 18 '23 23:12 purva-thakre

Partially addressed in Refactor classical postprocessing in shadows module #2152 , but more work to be done to close this issue. Remove from 0.34.0.

Misty-W avatar Jan 26 '24 17:01 Misty-W

Compared to other techniques, mitiq.shadows does not follow the pattern of having a function called execute_with_shadows, shadows.mitigate_executor, and shadows.decorator.

Whenever we get to the cleanup of this module, we should consider a refactor of the above.

purva-thakre avatar Apr 10 '24 20:04 purva-thakre