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

Docs examples #19

Merged
merged 7 commits into from
Oct 26, 2023
Merged

Docs examples #19

merged 7 commits into from
Oct 26, 2023

Conversation

a-barlow
Copy link
Owner

I acknowledge that:

  • my code passes all tests by running cargo test;
  • my code is formatted with cargo fmt;
  • I have added unit testing to test my new code (if applicable);
  • I have signed off on all commits with my name and email;
  • I have answered all the questions below and given justification
    where appropriate; and
  • I am merging with the dev branch.

What is the current problem, or feature that should be added?

What aspect of the project needs changing?

When printing large diagrams, the non-connected vertical lines with horizontal wires was discomforting for the eyes; especially when the circuit diagram is large.

Implementing custom functions are also tricky as there are a lack of methods for States and SuperPosition that makes manipulating the qubits easier.

More examples are need in the documentation for Circuit and Printer. Moreover, more runnable examples, that is of the form cargo run --example file, should be added and appropriately commented.

How does this fix and/or better quantr?

If it's a feature, please add examples on how you would use it.

The diagrams now have 'connected' wires when overlapping, causing less strain on the eyes, particularly for dark backgrounds. It's noted though, that the 'grid illusion' still appears for diagrams with many control nodes.

Two methods have been introduced that invert the binary labels of states in the computational basis, in addition to converting a ProductState into a SuperPosition structure (although mathematically a lone product state is in a superposition itself).

Examples of methods have been added to the documentation, and the grovers example taken from the quantr-book has been added to the examples folder too. This will help users in learning quanta and using it for projects.

Finally, the Printer::flush is being deprecated as it cannot be meaningfully used in conjunction with Rust's lifetimes. It will be removed in the next major breaking update.

Is this pull request a major or minor change with respect to the dev branch?

Please refer to semantic versioning for Rust. If this is a major/breaking change, please add an explanation to why it could not be minor, or equally why it should break the current version.

Minor.

What do the unit tests cover?

Description of the unit tests added (if applicable).

Tests the two new methods introduced for manipulating qubits.

Added a 10 qubit grovers algorithm test, that should be complex enough to detect errors from custom functions and the circuit simulation itself.

Additional comments.

Any more justifications, examples of output, or even suggestions for improving this pull request template are all welcome!

Bumped Rust version from 1.72.1 to 1.73.0.

Signed-off-by: Andrew Barlow <a.barlow.dev@gmail.com>
Adds an external test. This test is an algorithm for confirming a row of
3x3 sudoku. For the testing practicality, it is a 10 qubit circuit with
two custom functions and several hadamard gates. This should also
compile and run quickly enough, in addition to having enough complexity,
to be regarded as a good practical test of quantr.

Signed-off-by: Andrew Barlow <a.barlow.dev@gmail.com>
Signed-off-by: Andrew Barlow <a.barlow.dev@gmail.com>
Added many examples to the methods documentation in Printer and Circuit
structs.

Chose to deprecate flush as there's no way to use it due to Rust
lifetimes. For now, this will be removed next major update.

Signed-off-by: Andrew Barlow <a.barlow.dev@gmail.com>
Added the complete grovers code in the quantr-book into the examples
folder. Plan is to add more examples later.

Edited the changelog to reflect this change too.

Signed-off-by: Andrew Barlow <a.barlow.dev@gmail.com>
Signed-off-by: Andrew Barlow <a.barlow.dev@gmail.com>
Signed-off-by: Andrew Barlow <a.barlow.dev@gmail.com>
@a-barlow a-barlow merged commit 9bcf7a0 into dev Oct 26, 2023
1 check passed
@a-barlow a-barlow deleted the docs-examples branch October 26, 2023 20:16
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.

1 participant