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

Change Gate constructor to structure like intead of tuple like #9

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

y-yu
Copy link
Collaborator

@y-yu y-yu commented Aug 8, 2022

  • We use tuple like constructors to instantiate Gate's values now
  • For example Controlled(u32, u32, unsafe extern "C" fn(u32, u32, *mut CTYPE, u64)), the 1st and 2nd parameters are the same type u32
    • If we would make a mistake the order of the 1st and 2nd parameters of Controlled, it will be an runtime error not to fix easy
  • So I think it would be better to use labeled constructor like Controlled { control_qubit_index: x, target_qubit_index: y ...} instead of the current tuple like constructor
  • And I also implement custom tuple like constructors for Single and Rotation
    • Because their arguments ordering is obvious

@coveralls
Copy link

coveralls commented Aug 8, 2022

Pull Request Test Coverage Report for Build 3008859935

  • 13 of 38 (34.21%) changed or added relevant lines in 2 files are covered.
  • 5 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.7%) to 80.085%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/binding.rs 11 14 78.57%
src/gate.rs 2 24 8.33%
Files with Coverage Reduction New Missed Lines %
src/binding.rs 1 81.82%
src/gate.rs 4 9.72%
Totals Coverage Status
Change from base Build 2911580732: -0.7%
Covered Lines: 378
Relevant Lines: 472

💛 - Coveralls

@y-yu y-yu changed the title Change Gate constructer to structure like intead of tuple like Change Gate constructor to structure like intead of tuple like Aug 8, 2022
@y-yu y-yu requested a review from CKiumi August 10, 2022 09:27
@y-yu
Copy link
Collaborator Author

y-yu commented Sep 7, 2022

@CKiumi
I removed clippy warnings. Please check 🙏

@y-yu y-yu mentioned this pull request Sep 7, 2022
@CKiumi CKiumi merged commit d5a868d into QunaSys:main Sep 8, 2022
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.

3 participants