Quantum Processing Unit

Snowflurry.AnyonYukonQPUType
AnyonYukonQPU <: AbstractQPU

A data structure that describes an Anyon System QPU of the Yukon generation. The QPU contains 6 qubits in a linear arrangement (see LineConnectivity).

Fields

  • client ::Client – Client to the QPU server.
  • status_request_throttle ::Function – Used to limit the rate of job status requests.
  • project_id ::String – Used to identify the project for the jobs that are sent to the QPU.
  • realm ::String – Optional: Used to identify the host server realm for the submission of requests.

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 that describes an Anyon System QPU of the Yamaska generation. The QPU contains 24 qubits in a 2D lattice arrangement (see LatticeConnectivity).

Fields

  • client ::Client – Client to the QPU server.
  • status_request_throttle ::Function – Used to limit the rate of job status requests.
  • project_id ::String – Used to identify the project for the jobs that are sent to the QPU.
  • realm ::String – Optional: Used to identify the host server realm for the submission of requests.

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

The data structure for a quantum simulator.

Example

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

source
Snowflurry.ClientType
Client

A data structure that represents a client for connection to a QPU service.

Fields

  • host::String – URL of the QPU server.
  • user::String – Username.
  • access_token::String – User access token.
  • realm::String – Optional: Used to identify the host server realm for the submission of requests.

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_clientFunction
get_client(qpu_service::UnionAnyonQPU)

Returns the client that is associated with the qpu_service.

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


julia> get_client(qpu)
Client for QPU service:
   host:         http://example.anyonsys.com
   user:         test_user 
   realm:        test-realm 

source
Snowflurry.get_project_idFunction
get_project_id(qpu_service::UnionAnyonQPU)

Returns the project ID that is associated with the qpu_service.

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


julia> get_project_id(qpu)
"test-project"
source
Snowflurry.get_hostFunction
get_host(Client)

Returns the host URL of a Client for connection 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
)

Use a client to submit a circuit to a QPU service on the host server. The QPU service is specified by the machine_name. The number of circuit executions is specified by shot_count.

Returns the circuit ID, which can then be used when calling get_status.

Example

julia> circuit = QuantumCircuit(
            qubit_count = 3,
            instructions = [sigma_x(3), control_z(2, 1),
            readout(1, 1)]
        );

julia> submit_job(client, circuit, 100, "project_id", "yukon")
"8050e1ed-5e4c-4089-ab53-cccda1658cd0"
source
Snowflurry.StatusType
Status

A data structure that stores the status of a quantum computation.

Fields

  • type::String – One of the declared types, e.g.:
    • "QUEUED" : Computation in the queue.
    • "RUNNING" : Computation being processed.
    • "FAILED" : QPU service has returned an error message.
    • "SUCCEEDED": Computation has succeeded, results are available.
    • "CANCELLED": Computation was terminated before completion.
  • message::String – Optional: Message providing additional details about the computation status.
source
Snowflurry.get_status_typeFunction
get_status_type(s::Status)::String

Returns the type associated with the Status of a quantum computation.

See Status for more details about possible type strings.

Examples

julia> get_status_type(Status(type = "SUCCEEDED"))
"SUCCEEDED"
source
Snowflurry.get_status_messageFunction
get_status_message(s::Status)::String

Returns the message associated with the Status of a quantum computation.

Examples

julia> get_status_message(Status(type = "FAILED", message = "something failed"))
"something failed"
source
Snowflurry.get_statusFunction
get_status(client::Client,circuitID::String)::Tuple{Status,Dict{String,Int}}

Obtain the status of a circuit computation which uses a client for connection to a QPU service. See Status for more details about possible statuses.

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> circuit = QuantumCircuit(
            qubit_count = 3,
            instructions = [sigma_x(3), control_z(2, 1),
            readout(1, 1)]
        );

julia> jobID = submit_job(submit_job_client, circuit, 100, "project_id", "yukon")
"8050e1ed-5e4c-4089-ab53-cccda1658cd0"

julia> get_status(submit_job_client, jobID)
(Status: SUCCEEDED
, Dict("001" => 100), 542)
source
Snowflurry.read_response_bodyFunction
read_response_body(body::Base.CodeUnits{UInt8,String})::String

Returns a String from Unicode code units.

See the Julia documentation for more details about code units.

Example

julia> string = "my string"
"my string"

julia> body = codeunits(string)
9-element Base.CodeUnits{UInt8, String}:
 0x6d
 0x79
 0x20
 0x73
 0x74
 0x72
 0x69
 0x6e
 0x67

julia> read_response_body(body)
"my string"
source
Snowflurry.run_jobFunction
run_job(qpu::VirtualQPU, circuit::QuantumCircuit, shot_count::Integer)

Execute a circuit on a QPU simulator. The number of circuit executions is specified by shot_count.

Returns a histogram of the circuit measurement outcomes as prescribed by the Readout instructions in the circuit.

Example

julia> qpu = VirtualQPU();

julia> circuit = QuantumCircuit(
            qubit_count = 3,
            instructions = [
                sigma_x(3),
                control_z(2, 1),
                readout(1, 1),
                readout(2, 2),
                readout(3, 3)
            ]
        );

julia> run_job(qpu, circuit, 100)
(Dict("001" => 100), 147)
source
run_job(qpu::AnyonYukonQPU, circuit::QuantumCircuit, shot_count::Integer)

Submit a circuit to a QPU service for execution. The function does not perform the standard transpilation as in transpile_and_run_job. The number of circuit executions is specified by shot_count.

Returns a histogram of the circuit measurement outcomes along with the simulation's execution time (in milliseconds) or an error message.

If the circuit is invalid, it is not sent to the host and an error is thrown. The circuit can be invalid for the following reasons:

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> circuit = QuantumCircuit(
            qubit_count = 3,
            instructions = [sigma_x(3), control_z(2, 1), readout(1, 1)]
        );

julia> run_job(qpu, circuit, 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 keyword argument. The transpiled circuit is then executed on a QPU simulator, where the number of circuit executions is specified by shot_count.

Returns the histogram of the circuit measurement outcomes, or an error message.

Example

julia> qpu = VirtualQPU();

julia> circuit = QuantumCircuit(
                    qubit_count = 3,
                    instructions = [
                        sigma_x(3),
                        control_z(2, 1),
                        readout(1, 1),
                        readout(2, 2),
                        readout(3, 3)
                    ]);

julia> transpile_and_run_job(qpu, circuit,100)
(Dict("001" => 100), 132)
source
transpile_and_run_job(
    qpu::UnionAnyonQPU,
    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 keyword argument. The transpiled circuit is then submitted for execution on an Anyon QPU. The number of circuit executions is specified by shot_count.

Returns the histogram of the circuit measurement outcomes 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> circuit = QuantumCircuit(
                    qubit_count = 3,
                    instructions = [
                        sigma_x(3),
                        control_z(2, 1),
                        readout(3, 3)
                    ]);

julia> transpile_and_run_job(qpu, circuit, 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()  …  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
, DataType[Snowflurry.Identity, Snowflurry.PhaseShift, Snowflurry.Pi8, Snowflurry.Pi8Dagger, Snowflurry.SigmaX, Snowflurry.SigmaY, Snowflurry.SigmaZ, Snowflurry.X90, Snowflurry.XM90, Snowflurry.Y90, Snowflurry.YM90, Snowflurry.Z90, Snowflurry.ZM90, Snowflurry.ControlZ]), RejectGatesOnExcludedPositionsTranspiler(LineConnectivity{6}
1──2──3──4──5──6
), RejectGatesOnExcludedConnectionsTranspiler(LineConnectivity{6}
1──2──3──4──5──6
)])
source
Snowflurry.AllToAllConnectivityType
AllToAllConnectivity <:AbstractConnectivity

A data structure which describes the all-to-all qubit connectivity of an Anyon Systems 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 which describes the linear qubit connectivity of an Anyon System's QPU. This connectivity type is encountered in QPUs such as the AnyonYukonQPU.

Fields

  • dimension ::Int – Number of qubits for this connectivity.
  • excluded_positions::Vector{Int} – Optional: List of qubits on the connectivity which are disabled and cannot perform operations. Elements in Vector must be unique.
  • excluded_connections::Vector{Tuple{Int, Int}} – Optional: List of connections between qubits which are disabled and cannot perform 2-qubit gates. Elements in Vector must be unique. Each connection is provided as a Tuple of qubit indices.
Note

Every excluded connection is sorted in ascending order (i.e. connection (2, 1) will be changed to (1, 2)).

Example

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

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

A data structure which describes the two-dimensional lattice qubit connectivity of an Anyon System's QPU. This connectivity type is encountered in QPUs such as the AnyonYamaskaQPU.

Fields

  • qubits_per_printout_line::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 perform operations. Elements in Vector must be unique.
  • excluded_connections::Vector{Tuple{Int, Int}} – Optional: List of connections between qubits which are disabled and cannot perform 2-qubit gates. Elements in Vector must be unique. Each connection is provided as a Tuple of qubit indices.

Example

The following lattice has 3 rows, where each row has 4 elements. The rows contain qubits [1, 2, 3, 4], [ 5, 6, 7, 8], and [9, 10, 11, 12].

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

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

Lattices of arbitrary dimensions can be built:

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

Optionally, lattices with excluded positions can be defined:

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

excluded positions: [1, 5, 9]
source
Snowflurry.get_excluded_connectionsFunction
get_excluded_connections(
    connectivity::Union{LineConnectivity,LatticeConnectivity}
)::ExcludedConnections

Returns the list of excluded_connections for the connectivity.

source
get_excluded_connections(connectivity::AbstractConnectivity)::Vector{Tuple{Int, Int}}

Throws a NotImplementedError.

source
Snowflurry.get_excluded_positionsFunction
get_excluded_positions(
    c::Union{LineConnectivity,LatticeConnectivity}
)::Vector{Tuple{Int, Int}}

Returns the list of excluded_positions for the connectivity.

Example

julia> get_excluded_positions(LatticeConnectivity(3, 4, [1, 3]))
2-element Vector{Int64}:
 1
 3
source
get_excluded_positions(connectivity::AbstractConnectivity)::Vector{Tuple{Int, Int}}

Throws a NotImplementedError.

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

Find the shortest path between origin and target qubits in terms of Manhattan distance. The path is found for any connectivity::AbstractConnectivity using the Breadth-first search algorithm. Positions that are specified in the excluded optional argument are avoided. 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

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

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


julia> path = path_search(3, 24, connectivity)
6-element Vector{Int64}:
 24
 20
 16
 12
  7
  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 each key is a qubit index. Every dictionary value is a Vector that lists all the qubits which are adjacent on the connectivity to the qubit key. Positions in connectivity.excluded_positions are not included as keys nor values.

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

The get_adjacency_list function cannot be used for AllToAllConnectivity since this type of connectivity places no upper bound on the number of qubits and all qubits connect to each other by definition. 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 the Manhattan distance. The function uses the Breadth-first search algorithm to determine the path length for 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}
              1 
              | 
        9 ──  5 ──  2 
        |     |     | 
 17 ── 13 ── 10 ──  6 ──  3 
  |     |     |     |     | 
 21 ── 18 ── 14 ── 11 ──  7 ──  4 
        |     |     |     |     | 
       22 ── 19 ── 15 ── 12 ──  8 
              |     |     | 
             23 ── 20 ── 16 
                    | 
                   24 


julia> get_qubits_distance(3, 24, connectivity)
5
source
Snowflurry.is_native_instructionFunction
is_native_instruction(
    gate::Union{Gate},
    connectivity::Union{LineConnectivity,LatticeConnectivity},
    native_gates::Vector{DataType} = set_of_native_gates,
)::Bool

Returns true if the gate is a native instruction for the connectivity and the list of possible native_gates. The native gates for the Anyon QPUs are used by default.

A native instruction is defined as an instruction that is in native_gates and that satisifies the connectivity. It does not check to determine if the gate is placed at the excluded_positions or excluded_connections of the connectivity. The gate must operate on less than three qubits.

Example

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


julia> is_native_instruction(control_z(1, 2), connectivity)
true

julia> is_native_instruction(control_z(1, 3), connectivity)
false

julia> is_native_instruction(control_x(1, 2), connectivity)
false

julia> is_native_instruction(control_x(1, 2), connectivity, [Snowflurry.ControlX])
true

julia> is_native_instruction(toffoli(1, 2, 3), connectivity, [Snowflurry.Toffoli])
false
source
is_native_instruction(
    readout::Readout,
    connectivity::Union{LineConnectivity,LatticeConnectivity},
    native_gates::Vector{DataType} = set_of_native_gates,
)::Bool

Returns true if the readout satisfies the connectivity.

It does not check to determine if the gate is placed at the excluded_positions of the connectivity.

Example

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


julia> is_native_instruction(readout(2, 2), connectivity)
true

julia> is_native_instruction(readout(4, 4), connectivity)
false
source
Snowflurry.is_native_circuitFunction
is_native_circuit(
    circuit::QuantumCircuit,
    connectivity::GeometricConnectivity,
    native_gates::Vector{DataType} = set_of_native_gates,
)::Tuple{Bool,String}

Returns (true, "") if the circuit only contains native instructions for the connectivity and the list of possible native_gates. It returns (false, "error_message") otherwise. The native gates for the Anyon QPUs are used by default.

See is_native_instruction for more details about the identification of native instructions.

Example

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


julia> native_circuit = QuantumCircuit(
           qubit_count = 3,
           instructions = [sigma_x(1), control_z(2, 3)]
       )
Quantum Circuit Object:
   qubit_count: 3 
   bit_count: 3 
q[1]:──X───────
               
q[2]:───────*──
            |  
q[3]:───────Z──
               

julia> is_native_circuit(native_circuit, connectivity)
(true, "")

julia> foreign_circuit = QuantumCircuit(
                  qubit_count = 3,
                  instructions = [sigma_x(1), control_x(2, 3)]
              )
Quantum Circuit Object:
   qubit_count: 3 
   bit_count: 3 
q[1]:──X───────
               
q[2]:───────*──
            |  
q[3]:───────X──
               

julia> is_native_circuit(foreign_circuit, connectivity)
(false, "Instruction type Gate{Snowflurry.ControlX} with targets [2, 3] is not native on the connectivity")

julia> is_native_circuit(
            foreign_circuit,
            connectivity,
            [Snowflurry.ControlX, Snowflurry.SigmaX]
        )
(true, "")

The folowing circuit is not native because the Toffoli gate is applied to more than two qubits:

julia> foreign_circuit = QuantumCircuit(
           qubit_count = 3,
           instructions = [sigma_x(1), toffoli(1, 2, 3)]
       )
Quantum Circuit Object:
   qubit_count: 3 
   bit_count: 3 
q[1]:──X────*──
            |  
q[2]:───────*──
            |  
q[3]:───────X──
               

julia> is_native_circuit(
            foreign_circuit,
            connectivity,
            [Snowflurry.Toffoli, Snowflurry.SigmaX]
        )
(false, "Instruction type Gate{Snowflurry.Toffoli} with targets [1, 2, 3] is not native on the connectivity")
source
Snowflurry.print_connectivityFunction
print_connectivity(
    connectivity::LineConnectivity,
    ::Vector{Int} = Int[],
    io::IO = stdout
)

Prints the connectivity to io.

Qubits with their index in path are highlighted.

Example

julia> print_connectivity(LineConnectivity(3))
1──2──3
source
print_connectivity(
    connectivity::LatticeConnectivity,
    path::Vector{Int} = Vector{Int}(),
    io::IO = stdout,
)

Prints the connectivity to io.

Qubits with their index in path are highlighted.

Example

julia> connectivity=LatticeConnectivity(3,3);

julia> path = path_search(1, 3, connectivity);

julia> print_connectivity(connectivity, path)
     (1)
      | 
 7 ──(4)── 2 
      |    | 
     (8)──(5)──(3)
           |    | 
           9 ── 6 
source
print_connectivity(qpu::AbstractQPU, io::IO = stdout)

Prints the qubit connectivity of the qpu to io.

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


julia> print_connectivity(qpu)
1──2──3──4──5──6
source
Snowflurry.get_connectivityFunction
get_connectivity(qpu::AbstractQPU)

Returns the qubit connectivity of a qpu.

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


julia> get_connectivity(qpu)
LineConnectivity{6}
1──2──3──4──5──6
source
Snowflurry.get_connectivity_labelFunction
get_connectivity_label(connectivity::AbstractConnectivity)

Returns the label of the connectivity.

Example

julia> get_connectivity_label(LineConnectivity(6))
"linear"
source