Skip to content

Commit

Permalink
[QI2-1289] Qiskit hybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythir committed Jan 20, 2025
1 parent ee4e7cf commit 9f7e74c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "qi-compute-api-client"
version = "0.43.0"
version = "0.44.0"
description = "An API client for the Compute Job Manager of Quantum Inspire."
license = "Apache-2.0"
authors = ["Quantum Inspire <support@quantum-inspire.eu>"]
Expand Down Expand Up @@ -29,7 +29,7 @@ pydantic = "^2.10.4"
python = "^3.8"
python-dateutil = "^2.8.2"
urllib3 = "^2.0.0"
requests = "^2.32.3"
requests = "^2.31.0"

[tool.poetry.group.dev.dependencies]
pytest = {extras = ["toml"], version = "^8.0.0"}
Expand Down
Empty file added qi2_shared/hybrid/__init__.py
Empty file.
44 changes: 44 additions & 0 deletions qi2_shared/hybrid/quantum_interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""Quantum Inspire SDK.
Copyright 2022 QuTech Delft
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.
"""

from abc import ABC, abstractmethod
from typing import Any, Dict, List

from compute_api_client.models.backend_type import BackendType
from pydantic import BaseModel


class ExecuteCircuitResult(BaseModel):
"""Result of executing a quantum circuit."""

results: Dict[str, float]
shots_requested: int
shots_done: int


class QuantumInterface(ABC):
"""Interface for running quantum circuits from hybrid algorithms."""

# pylint: disable = R0903
# Too few public methods (1/2) (too-few-public-methods)

results: List[Dict[str, Any]]
backend_type: BackendType

@abstractmethod
def execute_circuit(
self, circuit: str, number_of_shots: int
) -> ExecuteCircuitResult:
"""Execute a quantum circuit."""
raise NotImplementedError

0 comments on commit 9f7e74c

Please sign in to comment.