unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
363 stars 160 forks source link

Make sure that error mitigation techniques are tested for all SUPPORTED_PROGRAM_TYPES #768

Closed andreamari closed 3 years ago

andreamari commented 3 years ago

For example, at the time moment, zero-noise extrapolation is never tested with Braket circuits (see #767).

A good way to automatically test all (current and future) supported circuit types is to loop over mitiq._types.SUPPORTED_PROGRAM_TYPES when writing important tests. For example this was done here: https://github.com/unitaryfund/mitiq/blob/ff6d3e540d7f14430a3dfcf4f7d1f1a5bdc50109/mitiq/cdr/tests/test_cdr.py#L36

nathanshammah commented 3 years ago

Great. Maybe we could add something about it in the developers' guide?

rmlarose commented 3 years ago

This could use more detail / clarification.

andreamari commented 3 years ago
  • What error mitigation techniques are already tested with all support program types? and which ones need more tests?

Initially only execute_with_cdr was tested with all SUPPORTED_PROGRAM_TYPES.

A recent PR #769 , added a similar test for execute_with_zne.

I just opened #779, which does the same for execute_with_pec. So, if #779 will be merged, tI think his issue can be closed.

  • Is the issue to add tests or develop a framework to ensure they're always tested?

My proposal was to just add some tests with a loop over SUPPORTED_PROGRAM_TYPES. In this way, if in the future we add a new circuit type, such tests will be automatically up to date. I didn't have any advanced infrastructure in mind.

rmlarose commented 3 years ago

Thanks Andrea, sounds good.

I didn't have any advanced infrastructure in mind.

It might not be a bad idea to have a test like the following:

It could probably use a design document - e.g., we probably want to be able to ignore modules in development - but that's the basic idea.

Or we could just be more careful on reviews in the future. But I tend to like automating things.