Skip to content

Feature/cycle benchmarking - #1108

Open
cdbf1 wants to merge 53 commits into
mainfrom
feature/cycle_benchmarking
Open

Feature/cycle benchmarking#1108
cdbf1 wants to merge 53 commits into
mainfrom
feature/cycle_benchmarking

Conversation

@cdbf1

@cdbf1 cdbf1 commented Nov 26, 2024

Copy link
Copy Markdown
Contributor

Add cycle benchmarking to the QCVV framework

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@vietphamngoc
vietphamngoc marked this pull request as ready for review September 17, 2025 15:40
@dowusu-antwi
dowusu-antwi self-requested a review December 1, 2025 15:49
Comment thread supermarq-benchmarks/supermarq/qcvv/cb.py Outdated
Comment thread supermarq-benchmarks/supermarq/qcvv/cb.py
f" +/- {self._undressed_process_fidelity_estimate_std:.5f}"
)

def _analyze(self) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we factor out some of this logic? IT's a lot to put in one method, e.g., you could say expectation and fidelity calculations are done separately before actual analysis. (Although, I realize we may already have the momentum of doing this for the other QCVV features.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering doing it but didn't find the courage to do it. Guess now is the time

control_axis=sorted_qubits.index(op.qubits[0]),
target_axis=sorted_qubits.index(op.qubits[1]),
exponent=op.gate.exponent,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is an else branch necessary here? Just so we fail loudly if Cirq CZTargetGateset ever changes, although maybe that's unlikely.

Comment thread supermarq-benchmarks/supermarq/qcvv/cb.py Outdated
Comment on lines +510 to +513
tableau.apply_z(
axis=sorted_qubits.index(op.qubits[0]),
exponent=-round(op.gate.axis_phase_exponent, 4),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do the exponents here need to be rounded? Is this just a quirk of cirq.CliffordTableau or is it something about Clifford circuits in general?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember exactly why the rounding is here for but I think it has to do with some quirk of cirq.CliffordTableau.

"""
records = []
data: pd.DataFrame = self.data
for _, entry in data.iterrows():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but maybe we should have a separate issue about optimizing this sort of thing (thinking of the pandas iterrows meme: https://ryxcommar.com/2020/01/15/for-the-love-of-god-stop-using-iterrows/).

But also, I think this is fine because we're not running very large experiments anytime soon, and "Premature optimization is the root of all evil."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I've moved away from iterrows

Comment thread supermarq-benchmarks/supermarq/qcvv/cb_test.py Outdated
@dowusu-antwi

Copy link
Copy Markdown
Contributor

@cdbf1 @vietphamngoc Does this need re-reviewing? Or is it ready to be approved?

@cdbf1

cdbf1 commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

@dowusu-antwi if you have the time to give it one final review I think that would be valuable - since this PR has been a bit on/off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants