Skip to content

Commit

Permalink
Merge branch 'main' into feature/interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
speller26 authored Jun 28, 2023
2 parents 1736f62 + 3bfe329 commit f1505f4
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 2,351 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand All @@ -32,3 +32,4 @@ jobs:
tox -e unit-tests
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
if: ${{ strategy.job-index }} == 0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ src/braket/default_simulator/.DS_Store
test/.DS_Store
test/unit_tests/.DS_Store
test/unit_tests/braket/.DS_Store
test/.benchmarks
.DS_Store
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.15.0 (2023-06-12)

### Features

* add optional third angle to MS gate

## v1.14.0.post0 (2023-05-25)

### Documentation Changes
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)
2 changes: 1 addition & 1 deletion src/braket/default_simulator/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "1.14.1.dev0"
__version__ = "1.15.1.dev0"
33 changes: 27 additions & 6 deletions src/braket/default_simulator/gate_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,25 +1008,46 @@ class MS(GateOperation):
Reference: https://ionq.com/docs/getting-started-with-native-gates#entangling-gates
"""

def __init__(self, targets, angle_1, angle_2, ctrl_modifiers=(), power=1):
def __init__(self, targets, angle_1, angle_2, angle_3=np.pi / 2, ctrl_modifiers=(), power=1):
super().__init__(
targets=targets,
ctrl_modifiers=ctrl_modifiers,
power=power,
)
self._angle_1 = angle_1
self._angle_2 = angle_2
self._angle_3 = angle_3

@property
def _base_matrix(self) -> np.ndarray:
return np.array(
[
[1, 0, 0, -1j * np.exp(-1j * (self._angle_1 + self._angle_2))],
[0, 1, -1j * np.exp(-1j * (self._angle_1 - self._angle_2)), 0],
[0, -1j * np.exp(1j * (self._angle_1 - self._angle_2)), 1, 0],
[-1j * np.exp(1j * (self._angle_1 + self._angle_2)), 0, 0, 1],
[
np.cos(self._angle_3 / 2),
0,
0,
-1j * np.exp(-1j * (self._angle_1 + self._angle_2)) * np.sin(self._angle_3 / 2),
],
[
0,
np.cos(self._angle_3 / 2),
-1j * np.exp(-1j * (self._angle_1 - self._angle_2)) * np.sin(self._angle_3 / 2),
0,
],
[
0,
-1j * np.exp(1j * (self._angle_1 - self._angle_2)) * np.sin(self._angle_3 / 2),
np.cos(self._angle_3 / 2),
0,
],
[
-1j * np.exp(1j * (self._angle_1 + self._angle_2)) * np.sin(self._angle_3 / 2),
0,
0,
np.cos(self._angle_3 / 2),
],
]
) / np.sqrt(2)
)

@property
def targets(self) -> Tuple[int, ...]:
Expand Down
Loading

0 comments on commit f1505f4

Please sign in to comment.