Skip to content
New issue

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

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

Already on GitHub? # to your account

[WIP] Bits and Registers #13860

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

[WIP] Bits and Registers #13860

wants to merge 12 commits into from

Conversation

raynelfss
Copy link
Contributor

Summary

Bits and registers in Rust (Part 2)

Details and comments

raynelfss and others added 5 commits February 13, 2025 16:46
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
- Use `macro_rules!` to create `Bit` and `Registers`.
- Add `new_owned` method for `BitInfo`.
@coveralls
Copy link

coveralls commented Feb 17, 2025

Pull Request Test Coverage Report for Build 13375999370

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 29 of 428 (6.78%) changed or added relevant lines in 3 files are covered.
  • 13 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.4%) to 87.86%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/circuit/src/bit.rs 11 110 10.0%
crates/circuit/src/register.rs 12 312 3.85%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 94.23%
crates/accelerate/src/unitary_synthesis.rs 3 93.29%
crates/qasm2/src/lex.rs 3 92.48%
crates/qasm2/src/parse.rs 6 97.61%
Totals Coverage Status
Change from base Build 13336190323: -0.4%
Covered Lines: 78742
Relevant Lines: 89622

💛 - Coveralls

@raynelfss raynelfss added this to the 2.0.0 milestone Feb 17, 2025
- Rebalance currently available api to allow for superclasses `Bit` and `Register` to also live in Rust.
- Remove: `ShareableBit` triat and structs that implement it. Replace them with new structs.
- Add prefix class attribute for python `Register` instances.
- Add `BitExtraInfo` as a soft identifier for `BitInfo`, can be null to identify a `Bit`.
- Add `RegisterInfo::get` method to retrieve the information of a `Bit`.
- Have the rust registers own their counters instead of having them be Python exclusive.
- Make subclassing of `Regster` and `Bit` a bit more effective by helping the subclasses inherit most methods.
…GCircuit`.

- Modify `BitData` to accept an extra generic value specifying a "sharable" object type that can also be turned into a `PyObject` to allow for compatibility with `Var`.
- Rename `BitAsKey` to `VarAsKey` as it is currently only used for `Var` instances.
- Modify methods in `CommutationChecker` and `GateDirection` passes to use the newer methods.
- Other tweaks and fixes.
…bit`.

- Remove imports of `QUBIT` and `CLBIT` from `DAGCircuit` and `CircuitData`.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a rust representation of QuantumRegister and ClassicalRegister
3 participants