• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

qiskit-community / qiskit-aqt-provider / 7567300363

18 Jan 2024 08:32AM UTC coverage: 99.83%. Remained the same
7567300363

push

github

web-flow
Prepare for release 1.1.0 (#120)

2353 of 2357 relevant lines covered (99.83%)

3.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/examples/example.py
1
# This code is part of Qiskit.
2
#
3
# (C) Copyright Alpine Quantum Technologies GmbH 2023
4
#
5
# This code is licensed under the Apache License, Version 2.0. You may
6
# obtain a copy of this license in the LICENSE.txt file in the root directory
7
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8
#
9
# Any modifications or derivative works of this code must retain this
10
# copyright notice, and modified files need to carry a notice indicating
11
# that they have been altered from the originals.
12

13
"""Basic example with the Qiskit AQT provider. Creates a 4-qubit GHZ state."""
4✔
14

15

16
import qiskit
4✔
17
from qiskit import QuantumCircuit
4✔
18

19
from qiskit_aqt_provider.aqt_provider import AQTProvider
4✔
20

21
if __name__ == "__main__":
4✔
22
    # Ways to specify an access token (in precedence order):
23
    # - as argument to the AQTProvider initializer
24
    # - in the AQT_TOKEN environment variable
25
    # - if none of the above exists, default to an empty string, which restricts access
26
    #   to the default workspace only.
27
    provider = AQTProvider("token")
4✔
28

29
    # The backends() method lists all available computing backends. Printing it
30
    # renders it as a table that shows each backend's containing workspace.
31
    print(provider.backends())
4✔
32

33
    # Retrieve a backend by providing search criteria. The search must have a single
34
    # match. For example:
35
    backend = provider.get_backend("offline_simulator_no_noise", workspace="default")
4✔
36

37
    # Create a 4-qubit GHZ state
38
    qc = QuantumCircuit(4)
4✔
39
    qc.h(0)
4✔
40
    qc.cx(0, 1)
4✔
41
    qc.cx(0, 2)
4✔
42
    qc.cx(0, 3)
4✔
43
    qc.measure_all()
4✔
44

45
    result = qiskit.execute(qc, backend, shots=200).result()
4✔
46

47
    if result.success:
4✔
48
        print(result.get_counts())
4✔
49
    else:  # pragma: no cover
50
        print(result.to_dict()["error"])
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc