Skip to content

Commit

Permalink
Merge branch 'main' into local_detuning
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeCoull authored Apr 9, 2024
2 parents 49bba6c + 3ea6899 commit 9a4d841
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 13 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## v1.76.3 (2024-04-09)

### Bug Fixes and Other Changes

* Replace pkg_resources with importlib.metadata

### Documentation Changes

* Improve gphase unitary matrix definition in docstring

## v1.76.2 (2024-04-08)

### Bug Fixes and Other Changes

* backwards compatiblity for local detuning

## v1.76.1 (2024-04-08)

### Bug Fixes and Other Changes
Expand Down
5 changes: 2 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""Sphinx configuration."""

import datetime

import pkg_resources
from importlib.metadata import version

# Sphinx configuration below.
project = "amazon-braket-sdk"
version = pkg_resources.require(project)[0].version
version = version(project)
release = version
copyright = "{}, Amazon.com".format(datetime.datetime.now().year)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"amazon-braket-schemas>=1.21.0",
"amazon-braket-default-simulator>=1.21.2",
"oqpy~=0.3.5",
"setuptools",
"backoff",
"boltons",
"boto3>=1.28.53",
Expand All @@ -41,6 +40,7 @@
"openpulse",
"openqasm3",
"sympy",
"backports.entry-points-selectable",
],
extras_require={
"test": [
Expand Down
2 changes: 1 addition & 1 deletion src/braket/_sdk/_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.76.2.dev0"
__version__ = "1.76.4.dev0"
8 changes: 6 additions & 2 deletions src/braket/circuits/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ class GPhase(AngledGate):
Unitary matrix:
.. math:: \mathtt{gphase}(\gamma) = e^(i \gamma) I_1.
.. math:: \mathtt{gphase}(\gamma) = e^{i \gamma} I = \begin{bmatrix}
e^{i \gamma} & 0 \\
0 & e^{i \gamma} \end{bmatrix}.
Args:
angle (Union[FreeParameterExpression, float]): angle in radians.
Expand Down Expand Up @@ -277,7 +279,9 @@ def gphase(
Unitary matrix:
.. math:: \mathtt{gphase}(\gamma) = e^(i \gamma) I_1.
.. math:: \mathtt{gphase}(\gamma) = e^{i \gamma} I = \begin{bmatrix}
e^{i \gamma} & 0 \\
0 & e^{i \gamma} \end{bmatrix}.
Args:
angle (Union[FreeParameterExpression, float]): Phase in radians.
Expand Down
12 changes: 7 additions & 5 deletions src/braket/devices/local_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@

from __future__ import annotations

import sys
from functools import singledispatchmethod
from itertools import repeat
from multiprocessing import Pool
from os import cpu_count
from typing import Any, Optional, Union

import pkg_resources

from braket.ahs.analog_hamiltonian_simulation import AnalogHamiltonianSimulation
from braket.annealing.problem import Problem
from braket.circuits import Circuit
Expand All @@ -39,9 +38,12 @@
from braket.tasks.local_quantum_task import LocalQuantumTask
from braket.tasks.local_quantum_task_batch import LocalQuantumTaskBatch

_simulator_devices = {
entry.name: entry for entry in pkg_resources.iter_entry_points("braket.simulators")
}
if sys.version_info.minor == 9:
from backports.entry_points_selectable import entry_points
else:
from importlib.metadata import entry_points

_simulator_devices = {entry.name: entry for entry in entry_points(group="braket.simulators")}


class LocalSimulator(Device):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ def test_discretize(register, driving_field, shifting_field):
"values": ["-125664000.0", "-125664000.0", "125664000.0", "125664000.0"],
},
}
assert discretized_json["hamiltonian"]["shiftingFields"][0]["magnitude"] == {
local_detuning = (
discretized_json["hamiltonian"]["shiftingFields"][0]["magnitude"]
if "shiftingFields" in discretized_json["hamiltonian"].keys()
else discretized_json["hamiltonian"]["localDetuning"][0]["magnitude"]
)
assert local_detuning == {
"pattern": ["0.50", "1.00", "0.50", "0.50", "0.50", "0.50"],
"time_series": {
"times": ["0E-9", "0.000003000"],
Expand Down

0 comments on commit 9a4d841

Please sign in to comment.