Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add StaticSizeCircuit #554

Open
wants to merge 2 commits into
base: feat/badgerv2
Choose a base branch
from
Open

Conversation

lmondada
Copy link
Contributor

@lmondada lmondada commented Aug 19, 2024

I am starting work on an MVP for Badger v2. This will not be merged into main for a while, as
i) the performance of portmatching is currently significantly worse than the last version
ii) the set of operations and types of circuits that is supported is very limited.

Description of StaticSizeCircuit

This simple struct captures circuits with no classical data (and hence also no parametric angle). This will be the starting point to build patterns and compute updateable hashes.

This could in principle be extended in the future to handle more cases, but neither Agustin nor I are convinced that this should ever find its way to main... Handling more general cases will require work into fast and updateable hashing.

@lmondada lmondada requested a review from a team as a code owner August 19, 2024 16:26
@lmondada lmondada requested review from ss2165 and removed request for a team August 19, 2024 16:26
@lmondada
Copy link
Contributor Author

I'm reworking the definition of StaticSizeCirc, I'll let you know when this is ready to review!

@lmondada lmondada marked this pull request as draft August 20, 2024 14:22
@lmondada lmondada marked this pull request as ready for review August 20, 2024 15:46
@lmondada lmondada added the badgerv2 New badger dev, ontop of portdiff label Aug 26, 2024
Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this go inside portmatching/? Or do we expect it to be used by anything else?

/// A circuit with a fixed number of qubits numbered from 0 to `num_qubits - 1`.
#[derive(Clone, Default)]
pub struct StaticSizeCircuit {
/// All quantum operations on qubits.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Clarify a bit what's each vector about.

Suggested change
/// All quantum operations on qubits.
/// All quantum operations on each qubit.

fn exists(&self, loc: OpLocation) -> bool {
self.qubit_ops
.get(loc.qubit.0)
.map_or(false, |ops| ops.get(loc.op_idx).is_some())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
.map_or(false, |ops| ops.get(loc.op_idx).is_some())
.map_or(false, |ops| loc.op_idx < ops.len())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
badgerv2 New badger dev, ontop of portdiff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants