Skip to content

Commit

Permalink
typing + version fixes (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhill1 authored Aug 8, 2024
1 parent c79810a commit 1fe2b15
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest]
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.1.0-alpha"
authors = [{name = "qBraid Development Team"}, {email = "contact@qbraid.com"}]
description = "Python package for building, simulating, and benchmarking hybrid quantum-classical algorithms."
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
keywords = ["qbraid", "quantum", "algorithms", "qml"]
license = {text = "GNU General Public License v3.0"}
classifiers = [
Expand All @@ -18,14 +18,13 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics"
]
dependencies = ["torch>=2.3.0,<3.0", "numpy>=1.17,<2.1", "scipy~=1.13.1", "bloqade>=0.15.12,<0.16", "scikit-learn"]
dependencies = ["torch>=2.3,<3.0", "numpy>=1.17,<2.1", "scipy>=1.13.1,<1.15", "bloqade>=0.15.12,<0.16", "scikit-learn>=1.5.0,<1.6.0"]

[project.urls]
Homepage = "https://github.com/qBraid/qbraid-algorithms"
Expand Down Expand Up @@ -53,7 +52,7 @@ line_length = 100

[tool.black]
line-length = 100
target-version = ['py39', 'py310', 'py311', 'py312']
target-version = ['py310', 'py311']
include = '\.pyi?$'
exclude = '''
/(
Expand Down
1 change: 0 additions & 1 deletion qbraid_algorithms/qrc/qrc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
Module for assembling QRC model components and computing prediction.
"""

from dataclasses import dataclass
from decimal import Decimal

Expand Down
13 changes: 9 additions & 4 deletions qbraid_algorithms/qrc/time_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
Module for quantum time evolution using emulator or QPU.
"""
from __future__ import annotations

from collections import OrderedDict
from decimal import Decimal
from typing import Optional

import numpy as np
from bloqade.atom_arrangement import Chain
from bloqade.builder.field import Detuning
from bloqade.builder.field import Detuning, RabiAmplitude
from bloqade.emulate.ir.state_vector import StateVector


Expand Down Expand Up @@ -82,9 +84,12 @@ def compute_rydberg_probs(num_sites: int, counts: OrderedDict) -> np.ndarray:

def evolve(self, backend: str, state: Optional[StateVector] = None) -> np.ndarray:
"""Evolves program over discrete list of time steps"""
detuning: Detuning = self.atoms.rydberg.rabi.amplitude
amp_waveform = detuning.uniform.constant(max(self.amplitudes), sum(self.durations))
program = amp_waveform.detuning.uniform.piecewise_linear(self.durations, self.amplitudes)
rabi_amp: RabiAmplitude = self.atoms.rydberg.rabi.amplitude

value = max(self.amplitudes)
duration = sum(self.durations)
detuning: Detuning = rabi_amp.uniform.constant(value, duration).detuning
program = detuning.uniform.piecewise_linear(self.durations, self.amplitudes)

if backend == "emulator":
[emulation] = program.bloqade.python().hamiltonian()
Expand Down

0 comments on commit 1fe2b15

Please sign in to comment.