-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add tests to the library #130
Conversation
The origin is now an optional parameter at construction. The origin is already provided after the instance construction whenever the "on" method is called, it is now intercepted from that call. If the "on" method is not called and the origin is needed, an exception is raised.
The shape method of the TemplateOrchestrator class was not returning the correct type (according to its subclass Template). This is now fixed in this commit by returning an instance of Shape2D
The display_template function has a specialised path for TemplateOrchestrator instances. This path can now be used for any Template instance.
The TemplateOrchestrator.instanciate method was not behaving like the Template.instanciate method, requiering a 0 plaquette at the beginning of the provided plaquette indices. This commit fixes that by adding the 0 plaquette under-the-hood and not exposing it to the public API anymore. In particular, the 0 plaquette in no more accounted for in the expected_plaquettes_number method.
The generate_circuit function was only accepting TemplateOrchestrator instances according to the typing information. This is no longer true thanks to the Template hierarchy rework: any valid instance of Template should be supported by the generate_circuit function.
The TemplateStack class is able to represent Template instances stacked on top of each other.
The BaseLayer __init__ method was annoted to only accept TemplateOrchestrator instances. Thanks to the API unification made in QCHackers#108, the function should be able to accept any Template.
This commit simply adds the XXFromXXXXPlaquette and ZZFromZZZZPlaquette classes to the plaquette library imports.
This commit introduces a new notebook showcasing the use of the layer mecanism to perform a qubit movement. It is still a WIP: an issue with template scaling is currently blocking further improvements.
See QCHackers#80 (comment) for a quick view about why the if statement needs to be here.
The two warnings silenced are 1. in a test, where typing is less important, 2. in a context where the return type does not encode correctly the pre-conditions: cirq.CircuitOperation.repetitions is typed in cirq to be an integer, but might be encoded as a sympy expression, that should be evalf() to be used. evalf() returning a "number" (may be float or complex as well), its type annotation is too generic. In this specific case, the type should be fine as long as the user/cirq enforce the type annotation of cirq.
The current state of this PR is:
|
Calling any method that ends up calling ComposedTemplate._compute_ul_absolute_position on a ComposedTemplate instance without any template was crashing. This commit fixes the crash.
A few updates (note that the modules have been moved around since the last message #163):
Because I feel like it will take forever to implement the missing tests, I would prefer to merge that PR now and implement the missing tests incrementally, in follow-up PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! We can merge this pr for now and add more tests in the future.
This branch has been created from #100 because both #114 and #100 added/changed a lot of things and I did not want to write tests for things that will be removed soon.
There is no need to look at the changes here, the immense majority of the files changed are caused by #100 and #114 and will disappear from this PR once they are merged.
Should fix or at least help fixing #106