fetchDetails
Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
Description
Examples
Connect to a remote quantum device through AWS® by specifying the device name as "Lucy"
.
dev = quantum.backend.QuantumDeviceAWS("Lucy")
dev = QuantumDeviceAWS with properties: Name: "Lucy" DeviceARN: "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" Region: "eu-west-2" S3Path: "s3://amazon-braket-mathworks/default"
Retrieve details about the quantum device.
s = fetchDetails(dev)
s = struct with fields: deviceArn: "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" deviceCapabilities: "{"service": {"braketSchemaHeader": {"name"... " deviceName: "Lucy" deviceStatus: "ONLINE" deviceType: "QPU" providerName: "Oxford"
To parse the deviceCapabilities
field in the returned structure,
you can use the jsondecode
function to convert the description string
into another structure.
capabilities = jsondecode(s.deviceCapabilities)
capabilities = struct with fields: service: [1×1 struct] action: [1×1 struct] deviceParameters: [1×1 struct] braketSchemaHeader: [1×1 struct] paradigm: [1×1 struct] provider: [1×1 struct] standardized: [1×1 struct] pulse: [1×1 struct]
The structure returned by fetchDetails
changes from device to
device, and its content may also change over time as provided by the AWS quantum computing services.
Connect to a remote quantum device through AWS by specifying the device name as "Aspen-M-3"
.
dev = quantum.backend.QuantumDeviceAWS("Aspen-M-3")
dev = QuantumDeviceAWS with properties: Name: "Aspen-M-3" DeviceARN: "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-3" Region: "us-west-1" S3Path: "s3://amazon-braket-mathworks/default"
Create a task to run a quantum circuit on this device. Wait for the task to finish.
gates = [hGate(1); cxGate(1,2)]; c = quantumCircuit(gates); task = run(c,dev); wait(task) task
task = QuantumTaskAWS with properties: TaskARN: "arn:aws:braket:us-west-1:123456789012:quantum-task/12a34b5c-6a78-9a01-2ab3-4c56def7a890" Status: "finished"
Retrieve details about the task.
s = fetchDetails(task)
s = struct with fields: Task: [1×1 struct] Result: [1×1 struct]
Query the Task
and Result
fields of the
returned structure. These fields contain details about the task and the measurement
result of the task.
t = s.Task
t = struct with fields: createdAt: "2023-01-11T00:32:30Z' deviceArn: "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-3" deviceParameters: "{"braketSchemaHeader": {"name": ... }}" endedAt: "2023-01-11T00:32:32Z" outputS3Bucket: "amazon-braket-mathworks" outputS3Directory: "default/a1b2c3d4-56ab-7bc8-d900-e0000fa1b2c3" quantumTaskArn: "arn:aws:braket:us-west-1:123456789012:quantum-task/12a34b5c-6a78-9a01-2ab3-4c56def7a890" shots: 100 status: "COMPLETED"
r = s.Result
r = struct with fields: braketSchemaHeader: [1×1 struct] measurements: [100×2 double] resultTypes: [1×1 struct] measuredQubits: [2×1 double] taskMetadata: [1×1 struct] additionalMetadata: [1×1 struct]
Connect to a remote quantum device through the IBM®
Qiskit® Runtime Services by specifying the device name as
"ibmq_qasm_simulator"
.
dev = quantum.backend.QuantumDeviceIBM("ibmq_qasm_simulator")
dev = QuantumDeviceIBM with properties: Name: "ibmq_qasm_simulator" AccountName: "<my account name>" UseSession: 0
Retrieve details about the quantum device.
s = fetchDetails(dev)
s = struct with fields: Status: [1×1 struct] Configuration: [1×1 struct] Properties: [1×1 struct] Defaults: [1×1 struct]
To check on the content of one of the fields, you can query into that field. For
example, show the content of the Properties
field.
s.Properties
ans = struct with fields: backend_name: 'ibmq_qasm_simulator' backend_version: '1.2.11' gates: [33×1 struct] general: [8×1 struct] last_update_date: '2023-08-29T04:40:11Z' qubits: [5×8 struct]
The structure returned by fetchDetails
changes from device to
device, and its content may also change over time as provided by IBM.
Connect to a remote quantum device through IBM Qiskit Runtime Services by specifying the device name as
"ibmq_qasm_simulator"
.
dev = quantum.backend.QuantumDeviceIBM("ibmq_qasm_simulator")
dev = QuantumDeviceIBM with properties: Name: "ibmq_qasm_simulator" AccountName: "<my account name>" UseSession: 0
Create a task to run a quantum circuit on this device. Wait for the task to finish.
gates = [hGate(1); cxGate(1,2)]; c = quantumCircuit(gates); task = run(c,dev); wait(task) task
task = QuantumTaskIBM with properties: TaskID: "123abcd4efa5bcdef678" SessionID: <missing> AccountName: "<my account name>" Status: "queued"
Retrieve details about the task.
s = fetchDetails(task)
s = struct with fields: Task: [1×1 struct] Result: [1×1 struct]
Query the Task
and Result
fields of the
returned structure. These fields contain details about the task and the measurement
result of the task.
t = s.Task
t = struct with fields: id: '123abcd4efa5bcdef678' hub: 'ibm-q' group: 'open' project: 'main' backend: 'ibmq_qasm_simulator' state: [1×1 struct] params: [1×1 struct] program: [1×1 struct] created: '2023-08-24T18:00:18.6848Z' cost: 3600 remote_storage: [1×1 struct] status: 'Completed'
r = s.Result
r = struct with fields: quasi_dists: [1×1 struct] metadata: [1×1 struct]
The structure returned by fetchDetails
changes from device to
device, and its content may also change over time as provided by IBM.
Input Arguments
Quantum task or device, specified as a QuantumDeviceAWS
object, a
QuantumDeviceIBM
object, a QuantumTaskAWS
object, or a QuantumTaskIBM
object.
If
devtask
is aQuantumDeviceAWS
object, then the output structures
contains fields provided by AWS.If
devtask
is aQuantumDeviceIBM
object, then the output structures
contains fields provided by IBM.If
devtask
is aQuantumTaskAWS
object, then the output structures
contains the fieldss.Task
for the task information ands.Result
for the task result (if available). Each of these fields is also a structure containing fields provided by AWS.If
devtask
is aQuantumTaskIBM
object, then the output structures
contains the fieldss.Task
for the task information ands.Result
for the task result (if available). Each of these fields is also a structure containing fields provided by IBM.
Version History
Introduced in R2023a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)