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

Add Unitary Gate #9

Merged
merged 1 commit into from
Feb 24, 2020
Merged

Add Unitary Gate #9

merged 1 commit into from
Feb 24, 2020

Conversation

kshitijc
Copy link
Contributor

Issue #, if available:

Description of changes:

  • Added:
    • Unitary gate which accepts a list of targets and a two dimensional matrix. The matrix specifies how the system evolves under the action of the gate.
    • TwoDimensionalMatrix model for specifying a two dimensional matrix with complex entries. Each complex entry is represented using a List[float] of size 2, with element[0] specifying the real part and element[1] specifying the imaginary part. (Pydantic doesn't support python's complex datatype).
  • Modified:
    • MultiTarget model to support >= 1 targets instead of >= 2.
    • MultiControl model to match the MultiTarget specification.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

matrix: conlist(
conlist(
conlist(confloat(gt=float("-inf"), lt=float("inf")), min_items=2, max_items=2),
min_items=1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be min_items=2 for both of these to be valid and to be used on target qubits? Also, why list for the complex number and not tuple?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant for this to represent a general two-dimensional non-empty matrix. The operators using these matrices are validating whether these have the correct dimensions based on the length of the supplied target.

Tuples are serialized as lists, so I thought it would be clearer to specify them as lists here. I can change this to tuples if there's an upside.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see your point. 1x1 gates are possible though not widely used, but I also found some mention of them in a paper online. Works for me.

@kshitijc kshitijc merged commit 9fc0476 into master Feb 24, 2020
@kshitijc kshitijc deleted the unitary branch February 24, 2020 18:17
math411 pushed a commit that referenced this pull request Feb 27, 2022
* feature: support for StartPreserveBlock and EndPreserveBlock instructions. (#94)

* prepare release v1.3.0

* update development version to v1.3.1.dev0

* Update copyright headers (#95)

* feature: StartVerbatimBox and EndVerbatimBox (#96)

Added the StartVerbatimBox and EndVerbatimBox instructions.
The code between the start and end instructions will not be modified by
the compiler, thus delineating a "verbatim" box of code.

The astute reader will notice that this is merely a renaming of the
instructions StartVerbatimBlock and EndVerbatimBlock; this change is
marked as a feature to emphasize the incompatibility with v1.3.0.

* prepare release v1.4.0

* update development version to v1.4.1.dev0

* doc: Fix jaqcd typo in README.md (#97)

* prepare release v1.4.0.post0

* update development version to v1.4.1.dev0

* Fix: Pin pydantic and jsonschema versions (#98)

* prepare release v1.4.1

* update development version to v1.4.2.dev0

* added openqasm program and device capability.

* OpenQASM support initial commit.

* added rigetti/ionq tests; added result_type.py

* updated README.md

* reformatted.

* removed unused import.

* reformatted docstring in openqasm_device_action_properties.py

* reformatted.

* [fix] updated docstring.

* [fix] incoporate Kshitij's comments.

* added openqasm schema header in test_schema_base.py

* reformatted.

* reformatted.

* turn off flake8 for jaqcd results/shared_models import alias.

* updated jaqcd __init__.py to support import results from jaqcd folder.

* empty commit to test github checker.

* empty commit 2 to test github checker.

* Merging in changes from main and updating imports for OpenQASM

* Fixing names and defaults to match docs

* Reformatted with `black`

* Bring in internal changes

* Merge changes from the internal repository (#8)

* Fix typo in supportsPhysicalQubits

cr: https://code.amazon.com/reviews/CR-61878135

* Removing `results` from OpenQASM Program

cr: https://code.amazon.com/reviews/CR-62355578

* Reformat files

Co-authored-by: Srikrishna Jaliparthy <jalipart@amazon.com>
Co-authored-by: Jeffrey Heckey <heckey@amazon.com>

* fix: Revert to old module structure (#9)

Co-authored-by: Sergei-kag-aws <kag@amazon.com>
Co-authored-by: ci <ci>
Co-authored-by: Cody Wang <speller26@gmail.com>
Co-authored-by: Jacky Ko <60188942+kjacky@users.noreply.github.com>
Co-authored-by: Jeffrey Heckey <heckey@amazon.com>
Co-authored-by: shiyunon <shiyunon@amazon.com>
Co-authored-by: Jeff Heckey <jheckey@gmail.com>
Co-authored-by: ℂ𝓞𝔇𝚈 <caw@amazon.com>
Co-authored-by: Srikrishna Jaliparthy <jalipart@amazon.com>
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.

2 participants