Quantum Processing Unit

Snowflurry.AnyonYukonQPUType
AnyonYukonQPU <: AbstractQPU

A data structure to represent an Anyon System's Yukon generation QPU, consisting of 6 qubits in a linear arrangement (see LineConnectivity).

Fields

  • client ::Client – Client to the QPU server.
  • status_request_throttle ::Function – Used to rate-limit job status requests.
  • project_id ::String – Used to identify which project the jobs sent to this QPU belong to.
  • realm ::String – Optional: used to identify to which realm on the host server requests are sent to.

Example

julia>  qpu = AnyonYukonQPU(host = "http://example.anyonsys.com", user = "test_user", access_token = "not_a_real_access_token", project_id = "test-project", realm = "test-realm")
Quantum Processing Unit:
   manufacturer:  Anyon Systems Inc.
   generation:    Yukon
   serial_number: ANYK202201
   project_id:    test-project
   qubit_count:   6 
   connectivity_type:  linear
   realm:         test-realm
source
Snowflurry.AnyonYamaskaQPUType
AnyonYamaskaQPU <: AbstractQPU

A data structure to represent an Anyon System's Yamaska generation QPU, consisting of 24 qubits in a 2D lattice arrangement (see LatticeConnectivity).

Fields

  • client ::Client – Client to the QPU server.
  • status_request_throttle ::Function – Used to rate-limit job status requests.
  • project_id ::String – Used to identify which project the jobs sent to this QPU belong to.
  • realm ::String – Optional: used to identify to which realm on the host server requests are sent to.

Example

julia>  qpu = AnyonYamaskaQPU(host = "http://example.anyonsys.com", user = "test_user", access_token = "not_a_real_access_token", project_id = "test-project", realm = "test-realm")
Quantum Processing Unit:
   manufacturer:  Anyon Systems Inc.
   generation:    Yamaska
   serial_number: ANYK202301
   project_id:    test-project
   qubit_count:   24 
   connectivity_type:  2D-lattice
   realm:         test-realm
source
Snowflurry.VirtualQPUType
VirtualQPU

A data structure to represent a Quantum Simulator.

Example

julia> qpu = VirtualQPU()
Quantum Simulator:
   developers:  Anyon Systems Inc.
   package:     Snowflurry.jl

source
Snowflurry.ClientType
Client

A data structure to represent a Client to a QPU service.

Fields

  • host::String – URL of the QPU server.
  • user::String – Username.
  • access_token::String – User access token.
  • realm::String – Optional: realm on the host to which the submitted jobs are sent to.

Example

julia> c = Client(host = "http://example.anyonsys.com", user = "test_user", access_token = "not_a_real_access_token", realm = "test_realm")
Client for QPU service:
   host:         http://example.anyonsys.com
   user:         test_user 
   realm:        test_realm 
 
source
Snowflurry.get_hostFunction
get_host(Client)

Returns host URL of a Client to a QPU service.

Example

julia> c = Client(host = "http://example.anyonsys.com", user = "test_user", access_token = "not_a_real_access_token");

julia> get_host(c)
"http://example.anyonsys.com"
source
Snowflurry.submit_jobFunction
submit_job(client::Client, circuit::QuantumCircuit, shot_count::Integer, project_id::String, machine_name::String)

Submit a circuit to a Client of QPU service, requesting a particular machine (machine_name), a number of repetitions (shot_count). Returns circuitID.

Example

julia> submit_job(client, QuantumCircuit(qubit_count = 3, instructions = [sigma_x(3), control_z(2, 1), readout(1, 1)]), 100, "project_id", "yukon")
"8050e1ed-5e4c-4089-ab53-cccda1658cd0"
source
Snowflurry.get_statusFunction
get_status(client::Client,circuitID::String)::Tuple{Status,Dict{String,Int}}

Obtain the status of a circuit computation through a Client of a QPU service. Returns status::Dict containing status["type"]: -"QUEUED" : Computation in queue -"RUNNING" : Computation being processed -"FAILED" : QPU service has returned an error message -"SUCCEEDED": Computation is completed, result is available.

In the case of status["type"]=="FAILED", the server error is contained in status["message"].

In the case of status["type"]=="SUCCEEDED", the second element in the return Tuple is the histogram of the job results, as computed on the QPU, and the third element is the job's execution time on the QPU, in milliseconds.

Example

julia> jobID = submit_job(submit_job_client, QuantumCircuit(qubit_count = 3, instructions = [sigma_x(3), control_z(2, 1), readout(1, 1)]), 100, "project_id", "yukon")
"8050e1ed-5e4c-4089-ab53-cccda1658cd0"

julia> get_status(submit_job_client, jobID)
(Status: SUCCEEDED
, Dict("001" => 100), 542)
source
Snowflurry.run_jobFunction
run_job(qpu::VirtualQPU, circuit::QuantumCircuit, shot_count::Integer)

Run a circuit computation on a QPU simulator, repeatedly for the specified number of repetitions (shot_count). Returns the histogram of the completed circuit measurements, as prescribed by the Readouts present.

Example

julia> qpu = VirtualQPU();

julia> run_job(qpu, QuantumCircuit(qubit_count = 3, instructions = [sigma_x(3), control_z(2, 1), readout(1, 1), readout(2, 2), readout(3, 3)]), 100)
(Dict("001" => 100), 147)
source
run_job(qpu::AnyonYukonQPU, circuit::QuantumCircuit, shot_count::Integer)

Run a circuit computation on a QPU service, repeatedly for the specified number of repetitions (shot_count). Returns the histogram of the completed circuit calculations, along with the simulation's execution time (in milliseconds) or an error message. If the circuit received in invalid - for instance, it is missing a Readout - it is not sent to the host, and an error is throw.

Example

julia> qpu = AnyonYukonQPU(client, "project_id")
Quantum Processing Unit:
   manufacturer:  Anyon Systems Inc.
   generation:    Yukon
   serial_number: ANYK202201
   project_id:    project_id
   qubit_count:   6 
   connectivity_type:  linear
   realm:         test-realm

julia> run_job(qpu, QuantumCircuit(qubit_count = 3, instructions = [sigma_x(3), control_z(2, 1), readout(1, 1)]), 100)
(Dict("001" => 100), 542)
source
Snowflurry.transpile_and_run_jobFunction
transpile_and_run_job(qpu::VirtualQPU, circuit::QuantumCircuit,shot_count::Integer; transpiler::Transpiler = get_transpiler(qpu))

This method first transpiles the input circuit using either the default transpiler, or any other transpiler passed as a key-word argument. The transpiled circuit is then run on a QPU simulator, repeatedly for the specified number of repetitions (shot_count). Returns the histogram of the completed circuit calculations, or an error message.

Example

julia> qpu=VirtualQPU();

julia> transpile_and_run_job(qpu, QuantumCircuit(qubit_count = 3, instructions = [sigma_x(3), control_z(2, 1), readout(1, 1), readout(2, 2), readout(3, 3)]) ,100)
(Dict("001" => 100), 132)
source
transpile_and_run_job(qpu::AnyonYukonQPU, circuit::QuantumCircuit, shot_count::Integer; transpiler::Transpiler = get_transpiler(qpu))

This method first transpiles the input circuit using either the default transpiler, or any other transpiler passed as a key-word argument. The transpiled circuit is then run on the AnyonYukonQPU, repeatedly for the specified number of repetitions (shot_count).

Returns the histogram of the completed circuit calculations, along with the job's execution time on the QPU (in milliseconds), or an error message.

Example

julia> qpu = AnyonYukonQPU(client_anyon, "project_id");

julia> transpile_and_run_job(qpu, QuantumCircuit(qubit_count = 3, instructions = [sigma_x(3), control_z(2, 1), readout(3, 3)]), 100)
(Dict("001" => 100), 542)
source
Snowflurry.get_transpilerFunction
get_transpiler(qpu::AbstractQPU)::Transpiler

Returns the transpiler associated with this QPU.

Example

julia> qpu = AnyonYukonQPU(client, "project_id");

julia> get_transpiler(qpu)
SequentialTranspiler(Transpiler[CircuitContainsAReadoutTranspiler(), ReadoutsDoNotConflictTranspiler(), UnsupportedGatesTranspiler(), DecomposeSingleTargetSingleControlGatesTranspiler(), CastToffoliToCXGateTranspiler(), CastCXToCZGateTranspiler(), CastISwapToCZGateTranspiler(), CastRootZZToZ90AndCZGateTranspiler(), SwapQubitsForAdjacencyTranspiler(LineConnectivity{6}
1──2──3──4──5──6
), CastSwapToCZGateTranspiler(), CompressSingleQubitGatesTranspiler(), SimplifyTrivialGatesTranspiler(1.0e-6), CastUniversalToRzRxRzTranspiler(), SimplifyRxGatesTranspiler(1.0e-6), CastRxToRzAndHalfRotationXTranspiler(), CompressRzGatesTranspiler(), SimplifyRzGatesTranspiler(1.0e-6), ReadoutsAreFinalInstructionsTranspiler(), RejectNonNativeInstructionsTranspiler(LineConnectivity{6}
1──2──3──4──5──6
)])
source
Snowflurry.SequentialTranspilerType
SequentialTranspiler(Vector{<:Transpiler})

Composite transpiler object which is constructed from an array of Transpiler stages. Calling transpile(::SequentialTranspiler,::QuantumCircuit) will apply each stage in sequence to the input circuit and return a transpiled output circuit. The result of the input and output circuit on any arbitrary state Ket is unchanged (up to a global phase).

Examples

julia> transpiler = SequentialTranspiler([CompressSingleQubitGatesTranspiler(), CastToPhaseShiftAndHalfRotationXTranspiler()]);

julia> circuit = QuantumCircuit(qubit_count = 2, instructions = [sigma_x(1), hadamard(1)])
Quantum Circuit Object:
   qubit_count: 2 
   bit_count: 2 
q[1]:──X────H──
               
q[2]:──────────
               



julia> transpile(transpiler,circuit)
Quantum Circuit Object:
   qubit_count: 2 
   bit_count: 2 
q[1]:──Z────X_90────Z_90────X_m90────Z──
                                                              
q[2]:───────────────────────────────────
                                                              



julia> circuit = QuantumCircuit(qubit_count = 3, instructions = [sigma_x(1),sigma_y(1),control_x(2,3),phase_shift(1,π/3)])
Quantum Circuit Object:
   qubit_count: 3 
   bit_count: 3 
q[1]:──X────Y─────────P(1.0472)──

q[2]:────────────*───────────────
                 |               
q[3]:────────────X───────────────
                                 



julia> transpile(transpiler,circuit)
Quantum Circuit Object:
   qubit_count: 3 
   bit_count: 3 
q[1]:──P(-2.0944)───────
                        
q[2]:────────────────*──
                     |  
q[3]:────────────────X──
                        


source
Snowflurry.AllToAllConnectivityType
AllToAllConnectivity <:AbstractConnectivity

A data structure to represent all-to-all qubit connectivity in an Anyon System's QPU. This connectivity type is encountered in simulated QPUs, such as the VirtualQPU

Example

julia> connectivity = AllToAllConnectivity()
AllToAllConnectivity()
source
Snowflurry.LineConnectivityType
LineConnectivity <:AbstractConnectivity

A data structure to represent linear qubit connectivity in an Anyon System's QPU. This connectivity type is encountered in QPUs such as the AnyonYukonQPU

Fields

  • dimension ::Int – Qubit count in this connectivity.
  • excluded_positions::Vector{Int} – Optional: List of qubits on the connectivity which are disabled, and cannot be interacted with. Elements in Vector must be unique.

Example

julia> connectivity = LineConnectivity(6)
LineConnectivity{6}
1──2──3──4──5──6

julia> connectivity = LineConnectivity(6, [1,2,3])
LineConnectivity{6}
1──2──3──4──5──6
excluded positions: [1, 2, 3]
source
Snowflurry.LatticeConnectivityType
LatticeConnectivity <:AbstractConnectivity

A data structure to represent 2D-lattice qubit connectivity in an Anyon System's QPU. This connectivity type is encountered in QPUs such as the AnyonYamaskaQPU

Fields

  • qubits_per_row ::Vector{Int} – number of qubits in each line, when constructing the printout.
  • dimensions ::Vector{Int} – number of rows and columns (turned 45° in the printout).
  • excluded_positions::Vector{Int} – Optional: List of qubits on the connectivity which are disabled, and cannot be interacted with. Elements in Vector must be unique.

Example

The following lattice has 4 rows, made of qubits [1, 5, 9], [2, 6, 10], [3, 7, 11] and [8, 4, 12], with each of those rows having 3 elements.

The corresponding qubits_per_row field is [2, 3, 3, 3, 1], the number of qubits in each line in the printed representation.

julia> connectivity = LatticeConnectivity(3, 4)
LatticeConnectivity{3,4}
  5 ──  1
  |     |
  9 ──  6 ──  2
        |     |
       10 ──  7 ──  3
              |     |
             11 ──  8 ──  4
                    |
                   12 

Lattices of arbitrary dimensions can be built:

julia> connectivity = LatticeConnectivity(6, 4)
LatticeConnectivity{6,4}
              5 ──  1
              |     |
       13 ──  9 ──  6 ──  2
        |     |     |     |
 21 ── 17 ── 14 ── 10 ──  7 ──  3
        |     |     |     |     |
       22 ── 18 ── 15 ── 11 ──  8 ──  4
              |     |     |     |
             23 ── 19 ── 16 ── 12
                    |     |
                   24 ── 20 

Optionally, lattices with excluded positions can be defined:

julia> connectivity = LatticeConnectivity(3, 4, [1, 5, 9])
LatticeConnectivity{3,4}
  5 ──  1 
  |     | 
  9 ──  6 ──  2 
        |     | 
       10 ──  7 ──  3 
              |     | 
             11 ──  8 ──  4 
                    | 
                   12 

excluded positions: [1, 5, 9]
Note

To match the qubit numbering used in the hardware implementation of AnyonYamaskaQPU, the LatticeConnectivity must be built using: LatticeConnectivity([1, 3, 5, 6, 5, 3, 1]), which is provided as the package const Snowflurry.AnyonYamaskaConnectivity.

source
Snowflurry.path_searchFunction
path_search(origin::Int, target::Int, connectivity::AbstractConnectivity, excluded::Vector{Int} = Vector{Int}([]))

Find the shortest path between origin and target qubits in terms of Manhattan distance, using the Breadth-First Search algorithm, on any connectivity::AbstractConnectivity, avoiding positions defined in the excluded optional argument. If no path exists, returns an empty Vector{Int}.

Example

julia> connectivity = LineConnectivity(6)
LineConnectivity{6}
1──2──3──4──5──6


julia> path = path_search(2, 5, connectivity)
4-element Vector{Int64}:
 5
 4
 3
 2

On LatticeConnectivity, the print_connectivity() method is used to visualize the path. The qubits along the path between origin and target are marker with ( )

julia> connectivity = LatticeConnectivity(6, 4)
LatticeConnectivity{6,4}
              5 ──  1
              |     |
       13 ──  9 ──  6 ──  2
        |     |     |     |
 21 ── 17 ── 14 ── 10 ──  7 ──  3
        |     |     |     |     |
       22 ── 18 ── 15 ── 11 ──  8 ──  4
              |     |     |     |
             23 ── 19 ── 16 ── 12
                    |     |
                   24 ── 20 


julia> path = path_search(3, 24, connectivity)
6-element Vector{Int64}:
 24
 20
 16
 12
  8
  3
source
Snowflurry.get_adjacency_listFunction
get_adjacency_list(connectivity::AbstractConnectivity)::Dict{Int,Vector{Int}}

Given an object of type AbstractConnectivity, get_adjacency_list returns a Dict where key => value pairs are each qubit number => an Vector of the qubits that are adjacent (neighbors) to it on this particular connectivity.

Example

julia> connectivity = LineConnectivity(6)
LineConnectivity{6}
1──2──3──4──5──6


julia> get_adjacency_list(connectivity)
Dict{Int64, Vector{Int64}} with 6 entries:
  5 => [4, 6]
  4 => [3, 5]
  6 => [5]
  2 => [1, 3]
  3 => [2, 4]
  1 => [2]

julia> connectivity = LatticeConnectivity(3, 4)
LatticeConnectivity{3,4}
  5 ──  1
  |     |
  9 ──  6 ──  2
        |     |
       10 ──  7 ──  3
              |     |
             11 ──  8 ──  4
                    |
                   12 
  
julia> get_adjacency_list(connectivity)
Dict{Int64, Vector{Int64}} with 12 entries:
  5  => [9, 1]
  12 => [8]
  8  => [3, 12, 11, 4]
  1  => [6, 5]
  6  => [1, 10, 9, 2]
  11 => [7, 8]
  9  => [5, 6]
  3  => [8, 7]
  7  => [2, 11, 10, 3]
  4  => [8]
  2  => [7, 6]
  10 => [6, 7]
Note

get_adjacency_list cannot be performed for AllToAllConnectivity, as in such a connectivity, all qubits are adjacent, with no upper bound on the number of qubits. A finite list of adjacent qubits thus cannot be constructed.

source
Snowflurry.get_qubits_distanceFunction
get_qubits_distance(target_1::Int, target_2::Int, ::AbstractConnectivity)

Find the length of the shortest path between target qubits in terms of Manhattan distance, using the Breadth-First Search algorithm, on any connectivity::AbstractConnectivity.

Example

julia>  connectivity = LineConnectivity(6)
LineConnectivity{6}
1──2──3──4──5──6


julia> get_qubits_distance(2, 5, connectivity)
3

julia> connectivity = LatticeConnectivity(6, 4)
LatticeConnectivity{6,4}
              5 ──  1
              |     |
       13 ──  9 ──  6 ──  2
        |     |     |     |
 21 ── 17 ── 14 ── 10 ──  7 ──  3
        |     |     |     |     |
       22 ── 18 ── 15 ── 11 ──  8 ──  4
              |     |     |     |
             23 ── 19 ── 16 ── 12
                    |     |
                   24 ── 20 


julia> get_qubits_distance(3, 24, connectivity)
5
source