autoqasm 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. autoqasm/__init__.py +58 -0
  2. autoqasm/api.py +694 -0
  3. autoqasm/constants.py +40 -0
  4. autoqasm/converters/__init__.py +19 -0
  5. autoqasm/converters/assignments.py +81 -0
  6. autoqasm/converters/break_statements.py +47 -0
  7. autoqasm/converters/comparisons.py +69 -0
  8. autoqasm/converters/return_statements.py +76 -0
  9. autoqasm/errors.py +124 -0
  10. autoqasm/instructions/__init__.py +31 -0
  11. autoqasm/instructions/gates.py +620 -0
  12. autoqasm/instructions/instructions.py +125 -0
  13. autoqasm/instructions/measurements.py +69 -0
  14. autoqasm/instructions/qubits.py +139 -0
  15. autoqasm/operators/__init__.py +41 -0
  16. autoqasm/operators/assignments.py +228 -0
  17. autoqasm/operators/comparisons.py +128 -0
  18. autoqasm/operators/conditional_expressions.py +76 -0
  19. autoqasm/operators/control_flow.py +169 -0
  20. autoqasm/operators/data_structures.py +83 -0
  21. autoqasm/operators/exceptions.py +36 -0
  22. autoqasm/operators/logical.py +180 -0
  23. autoqasm/operators/return_statements.py +41 -0
  24. autoqasm/operators/slices.py +107 -0
  25. autoqasm/operators/utils.py +41 -0
  26. autoqasm/program/__init__.py +31 -0
  27. autoqasm/program/gate_calibrations.py +43 -0
  28. autoqasm/program/pragmas.py +84 -0
  29. autoqasm/program/program.py +911 -0
  30. autoqasm/program/serialization_properties.py +30 -0
  31. autoqasm/pulse/__init__.py +30 -0
  32. autoqasm/pulse/pulse.py +181 -0
  33. autoqasm/simulator/__init__.py +37 -0
  34. autoqasm/simulator/conversion.py +47 -0
  35. autoqasm/simulator/linalg_utils.py +56 -0
  36. autoqasm/simulator/native_interpreter.py +153 -0
  37. autoqasm/simulator/program_context.py +224 -0
  38. autoqasm/simulator/simulation.py +65 -0
  39. autoqasm/simulator/simulator.py +86 -0
  40. autoqasm/transpiler/__init__.py +17 -0
  41. autoqasm/transpiler/transpiler.py +301 -0
  42. autoqasm/types/__init__.py +30 -0
  43. autoqasm/types/conversions.py +147 -0
  44. autoqasm/types/types.py +145 -0
  45. autoqasm-0.1.0.dist-info/LICENSE +175 -0
  46. autoqasm-0.1.0.dist-info/METADATA +256 -0
  47. autoqasm-0.1.0.dist-info/NOTICE +1 -0
  48. autoqasm-0.1.0.dist-info/RECORD +51 -0
  49. autoqasm-0.1.0.dist-info/WHEEL +5 -0
  50. autoqasm-0.1.0.dist-info/entry_points.txt +2 -0
  51. autoqasm-0.1.0.dist-info/top_level.txt +1 -0
autoqasm/__init__.py ADDED
@@ -0,0 +1,58 @@
1
+ # Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ """AutoQASM provides a native Python programming experience for building complex quantum programs
15
+ and running them on simulators and quantum hardware using Amazon Braket.
16
+
17
+ The basic usage of AutoQASM is as follows:
18
+
19
+ .. code-block:: python
20
+
21
+ import autoqasm as aq
22
+ from autoqasm.instructions import h, cnot, measure
23
+
24
+ @aq.main
25
+ def my_program():
26
+ h(0)
27
+ cnot(0, 1)
28
+ result = measure([0, 1])
29
+ return result
30
+
31
+ program = my_program()
32
+ print(program.build().to_ir())
33
+
34
+ The Python code above outputs the following OpenQASM program:
35
+
36
+ .. code-block::
37
+
38
+ OPENQASM 3.0;
39
+ qubit[2] __qubits__;
40
+ h __qubits__[0];
41
+ cnot __qubits__[0], __qubits__[1];
42
+ bit[2] result;
43
+ result[0] = measure __qubits__[0];
44
+ result[1] = measure __qubits__[1];
45
+ """
46
+ from . import errors, instructions, operators # noqa: F401
47
+ from .api import gate, gate_calibration, main, subroutine # noqa: F401
48
+ from .instructions import QubitIdentifierType as Qubit # noqa: F401
49
+ from .program import Program, build_program, verbatim # noqa: F401
50
+ from .transpiler import transpiler # noqa: F401
51
+ from .types import ArrayVar, BitVar, BoolVar, FloatVar, IntVar # noqa: F401
52
+ from .types import Range as range # noqa: F401
53
+
54
+
55
+ def __getattr__(name):
56
+ if name == "qubits":
57
+ return instructions.global_qubit_register()
58
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")