QPanda3
Supported by OriginQ
Loading...
Searching...
No Matches
QPilotService.QPilotService Class Reference

This class can submit Quantum Program to PilotOS. More...

Inheritance diagram for QPilotService.QPilotService:
[legend]

Public Member Functions

None __init__ (self, str name)
 Create QPilotOSMMachine object.
 
list get_expectation_result (self, str task_id)
 get expectation task result
 
list get_qst_result (self, str task_id)
 get qst task result through task_id
 
None set_config (self, int max_qubit=None, int max_cbit=None)
 set Quantum Machine max Qubit and Cbit number function.
 
None init (self, str url=None, bool log_cout=False, str api_key=None)
 Init Quantum Machine and connect to PilotOS.
 
list run (self, Union[List[str], List[QProg], str, QProg] prog, shot=1000, chip_id=None, is_amend=True, is_mapping=True, is_optimization=True, specified_block=[], describe='', point_label=0, priority=0)
 Using sync way to compute your Quantum Program .
 
list real_chip_measure_proto (self, Union[List[str], List[QProg], str, QProg] prog, shot=1000, chip_id=None, is_amend=True, is_mapping=True, is_optimization=True, specified_block=[], describe='', point_label=0, priority=0)
 Using sync way to compute your Quantum Program.
 
str async_run (self, Union[List[str], List[QProg], str, QProg] prog, shot=1000, chip_id=None, is_amend=True, is_mapping=True, is_optimization=True, specified_block=[], describe='', point_label=0, priority=0)
 Using async way to compute your Quantum Program, then you need to query task result from task_id.
 
str async_real_chip_measure_proto (self, Union[List[str], List[QProg], str, QProg] prog, shot=1000, chip_id=None, is_amend=True, is_mapping=True, is_optimization=True, specified_block=[], describe='', point_label=0, priority=0)
 Using async way to compute your Quantum Program, then you need to query task result from task_id.
 
float real_chip_expectation (self, Union[QProg, str] prog, str hamiltonian, List[int] qubits=None, int shot=None, str chip_id=None, bool is_amend=True, bool is_mapping=True, bool is_optimization=True, List[int] specified_block=[], str task_describe='')
 submit Quantum expectation task, and get the expectation result.
 
str async_real_chip_expectation (self, Union[QProg, str] prog, str hamiltonian, List[int] qubits=None, int shot=None, int chip_id=None, bool is_amend=True, bool is_mapping=True, bool is_optimization=True, List[int] specified_block=[], str task_describe='')
 async submit Quantum expectation task, and return the task id.
 
list async_real_chip_qst (self, Union[str, QProg] prog, shot=1000, chip_id=None, is_amend=True, is_mapping=True, is_optimization=True, specified_block=[], describe='')
 Using async way to compute QST task, then you need to query task result from task_id.
 
dict query_result (self, str task_id, str file_path=None)
 Query task result from task_id.
 
list get_task_list_result (self, list task_id, str file_path=None)
 Get task result through task id list.
 
list parse_probability_result (self, list result_str)
 Parse async task probability result to a list contains dict.
 
str quantum_chip_config_query (self, str chip_ids)
 Get quantum chip config.
 

Public Attributes

str PilotURL = ''
 
str PilotIp = ''
 
str PilotPort = ''
 
str APIKey = ''
 
str LogCout = ''
 

Protected Member Functions

str _build_task_msg (self, List[QProg] prog=None, int shot=None, str chip_id=None, bool is_amend=True, bool is_mapping=True, bool is_optimization=True, List[int] specified_block=[], str task_describe='', point_label=0, priority=0)
 Build submit Quantum compute task request json str, however this is a private method.
 
str _build_task_proto_msg (self, int shot=None, str chip_id=None, bool is_amend=True, bool is_mapping=True, bool is_optimization=True, List[int] specified_block=[], str task_describe='', point_label=0, priority=0)
 Build submit Quantum compute task request json str, however this is a private method.
 
str _build_expectation_task_msg (self, Union[QProg, str] prog, str hamiltonian, List[int] qubits=None, int shot=None, str chip_id=None, bool is_amend=True, bool is_mapping=True, bool is_optimization=True, List[int] specified_block=[], str task_describe='')
 call C++ function to build expectation task message
 
str _build_qst_task_msg (self, QProg prog, int shot=None, int chip_id=None, bool is_amend=True, bool is_mapping=True, bool is_optimization=True, List[int] specified_block=[], str task_describe='')
 call C++ function to build qst task message
 
str _build_query_msg (self, str task_id)
 Build Query Quantum compute task result request json str, however this is a private method.
 
list _retry_get_measure_result (self, task_id)
 if tcp connection is closed, use query_result to get measure result
 
float _retry_get_expectation_result (self, task_id)
 if tcp connection is closed, use query_result to get expextion result
 
list _tcp_recv (self, str ip, int port, str task_id)
 Receive task result message, if success, use tcp protocol, otherwise retry with http protocol.
 
list _parser_sync_result (self, json_str)
 Parse sync compute task result to list, however this is a private method.
 
float _parser_expectation_result (self, json_str)
 Parse expectation result, however this is a private method.
 
bool _send_request (self, str str_url=None, str req=None, list resp=None)
 Send request to PilotOS, however this is a private method.
 
bool _send_proto_request (self, str str_url=None, str config=None, str proto_data=None, list resp=None)
 Send request to PilotOS, however this is a private method.
 
list _get_prog (self, Union[List[str], List[QProg], str, QProg] prog)
 Get QProg list from user input, however this is a private method.
 

Detailed Description

This class can submit Quantum Program to PilotOS.

Version: 1.0.0

Args

PilotURL : str Connect to the target PilotOS address. PilotIp : str PilotOS IP address. PilotPort : str PilotOS port.

Constructor & Destructor Documentation

◆ __init__()

None QPilotService.QPilotService.__init__ ( self,
str name )

Create QPilotOSMMachine object.

Note

Do not include the self parameter in the Args section.

Args

name : str Quantum Machine type name.

Returns

QuantumMachine Always return a Quantum Machine.

Examples

qm = QPilotService('Pilot')

Member Function Documentation

◆ _build_expectation_task_msg()

str QPilotService.QPilotService._build_expectation_task_msg ( self,
Union[QProg, str] prog,
str hamiltonian,
List[int] qubits = None,
int shot = None,
str chip_id = None,
bool is_amend = True,
bool is_mapping = True,
bool is_optimization = True,
List[int] specified_block = [],
str task_describe = '' )
protected

call C++ function to build expectation task message

Args

prog : QProg The quantum program you want to compute. hamiltonian : Hamiltonian Args. qubits : measurement qubit. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . task_describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute.

Returns

string if success, return expectation task message.

◆ _build_qst_task_msg()

str QPilotService.QPilotService._build_qst_task_msg ( self,
QProg prog,
int shot = None,
int chip_id = None,
bool is_amend = True,
bool is_mapping = True,
bool is_optimization = True,
List[int] specified_block = [],
str task_describe = '' )
protected

call C++ function to build qst task message

Args

prog : QProg The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . task_describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute.

Returns

string if success, return qst task message.

◆ _build_query_msg()

str QPilotService.QPilotService._build_query_msg ( self,
str task_id )
protected

Build Query Quantum compute task result request json str, however this is a private method.

Args

task_id : str The task id of your task.

Returns

str

◆ _build_task_msg()

str QPilotService.QPilotService._build_task_msg ( self,
List[QProg] prog = None,
int shot = None,
str chip_id = None,
bool is_amend = True,
bool is_mapping = True,
bool is_optimization = True,
List[int] specified_block = [],
str task_describe = '',
point_label = 0,
priority = 0 )
protected

Build submit Quantum compute task request json str, however this is a private method.

Args

prog : List[QProg] The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . task_describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute. point_label : int Describe the operating point label mode of the chip. priority : int Describe the priority of chip computing tasks, ranging from 0 to 10.

Returns

str

◆ _build_task_proto_msg()

str QPilotService.QPilotService._build_task_proto_msg ( self,
int shot = None,
str chip_id = None,
bool is_amend = True,
bool is_mapping = True,
bool is_optimization = True,
List[int] specified_block = [],
str task_describe = '',
point_label = 0,
priority = 0 )
protected

Build submit Quantum compute task request json str, however this is a private method.

Args

prog : List[QProg] The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . task_describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute. point_label : int Describe the operating point label mode of the chip. priority : int Describe the priority of chip computing tasks, ranging from 0 to 10.

Returns

str

◆ _get_prog()

list QPilotService.QPilotService._get_prog ( self,
Union[List[str], List[QProg], str, QProg] prog )
protected

Get QProg list from user input, however this is a private method.

Args

prog : Union[List[str], List[QProg], str, QProg] The QProg or OriginIR, Is or not in list.

Returns

List[QProg]

◆ _parser_expectation_result()

float QPilotService.QPilotService._parser_expectation_result ( self,
json_str )
protected

Parse expectation result, however this is a private method.

Args

json_str : str The json str contains expectation task result.

Returns

float if success, return expectation result, else print error info and return none

◆ _parser_sync_result()

list QPilotService.QPilotService._parser_sync_result ( self,
json_str )
protected

Parse sync compute task result to list, however this is a private method.

Args

json_str : str The json str contains task result key and value.

Returns

list

◆ _retry_get_expectation_result()

float QPilotService.QPilotService._retry_get_expectation_result ( self,
task_id )
protected

if tcp connection is closed, use query_result to get expextion result

Parameters

task_id : str your task id

Returns
----------
float

expectation result

◆ _retry_get_measure_result()

list QPilotService.QPilotService._retry_get_measure_result ( self,
task_id )
protected

if tcp connection is closed, use query_result to get measure result

Parameters

task_id : str your task id

Returns
----------
list

task result

◆ _send_proto_request()

bool QPilotService.QPilotService._send_proto_request ( self,
str str_url = None,
str config = None,
str proto_data = None,
list resp = None )
protected

Send request to PilotOS, however this is a private method.

Args

str_url : str The http function you want to request. req : str The json str contains request message. resp : list The list of response result and reply message.

Returns

bool

◆ _send_request()

bool QPilotService.QPilotService._send_request ( self,
str str_url = None,
str req = None,
list resp = None )
protected

Send request to PilotOS, however this is a private method.

Args

str_url : str The http function you want to request. req : str The json str contains request message. resp : list The list of response result and reply message.

Returns

bool

◆ _tcp_recv()

list QPilotService.QPilotService._tcp_recv ( self,
str ip,
int port,
str task_id )
protected

Receive task result message, if success, use tcp protocol, otherwise retry with http protocol.

Args

ip : str The PilotOS IP address. port : str The PilotOS port. task_id : str The task id of your task.

Returns

list

◆ async_real_chip_expectation()

str QPilotService.QPilotService.async_real_chip_expectation ( self,
Union[QProg, str] prog,
str hamiltonian,
List[int] qubits = None,
int shot = None,
int chip_id = None,
bool is_amend = True,
bool is_mapping = True,
bool is_optimization = True,
List[int] specified_block = [],
str task_describe = '' )

async submit Quantum expectation task, and return the task id.


Args

prog : Union[QProg, str] The quantum program you want to compute. hamiltonian : str Hamiltonian Args. qubits : List[int] measurement qubit shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . task_describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute.

Returns

str return expectation task id, you need query task result by using task id.

◆ async_real_chip_measure_proto()

str QPilotService.QPilotService.async_real_chip_measure_proto ( self,
Union[List[str], List[QProg], str, QProg] prog,
shot = 1000,
chip_id = None,
is_amend = True,
is_mapping = True,
is_optimization = True,
specified_block = [],
describe = '',
point_label = 0,
priority = 0 )

Using async way to compute your Quantum Program, then you need to query task result from task_id.

Args

prog : Union[List[str], List[QProg], str, QProg] The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute. point_label : int Describe the operating point label mode of the chip. priority : int Describe the priority of chip computing tasks, ranging from 0 to 10, the default is 0

Returns

str your task id which can query task result

Examples

This interface will return a string that will be used to query the results of the quantum program you just submitted.

task_id = self.async_run(prog_list, 1000, chip_id=1, is_mapping=True, describe="test1") print (task_id) 54C64205E2AF45D393FB5E6279E14984

◆ async_real_chip_qst()

list QPilotService.QPilotService.async_real_chip_qst ( self,
Union[str, QProg] prog,
shot = 1000,
chip_id = None,
is_amend = True,
is_mapping = True,
is_optimization = True,
specified_block = [],
describe = '' )

Using async way to compute QST task, then you need to query task result from task_id.

Args

prog : Union[str, QProg] The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute.

Returns

str your task id which can query task result

◆ async_run()

str QPilotService.QPilotService.async_run ( self,
Union[List[str], List[QProg], str, QProg] prog,
shot = 1000,
chip_id = None,
is_amend = True,
is_mapping = True,
is_optimization = True,
specified_block = [],
describe = '',
point_label = 0,
priority = 0 )

Using async way to compute your Quantum Program, then you need to query task result from task_id.

Args

prog : Union[List[str], List[QProg], str, QProg] The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute. point_label : int Describe the operating point label mode of the chip. priority : int Describe the priority of chip computing tasks, ranging from 0 to 10, the default is 0

Returns

str your task id which can query task result

Examples

This interface will return a string that will be used to query the results of the quantum program you just submitted.

task_id = self.async_run(prog_list, 1000, chip_id=1, is_mapping=True, describe="test1") print (task_id) 54C64205E2AF45D393FB5E6279E14984

◆ get_expectation_result()

list QPilotService.QPilotService.get_expectation_result ( self,
str task_id )

get expectation task result

Args

task_id : str expectation task id.

Returns

list expectation task result.

◆ get_qst_result()

list QPilotService.QPilotService.get_qst_result ( self,
str task_id )

get qst task result through task_id

Args

task_id : str the task_id you want to query

Returns

list The list contains the information of qst task.

◆ get_task_list_result()

list QPilotService.QPilotService.get_task_list_result ( self,
list task_id,
str file_path = None )

Get task result through task id list.

Args

task_id : list The list of task id you want to query. file_path : str If the parameter is not None, task result will be saved to target path.

Returns

list This list contasins several dicts of task id and task result.

Examples

This interface will return a list, however, this list will not necessarily contain all the tasks queried, but will only return the results of the tasks that were queried to the completion of the calculation, and if the save path is set, these results will also be saved to a file.

result_list = self.get_task_list_result(task_id_list, 'D:/python_test/result/') print(result_list) [{'task_id': '5D102BEED2714755B9B6AA082151F70E', 'task_result': ['{"key":["00","01","10","11"],"value":[0.25,0.25,0.25,0.25]}', '{"key":["00","01","10","11"],"value":[0.25,0.25,0.25,0.25]}']}, {'task_id': '18C163284EE043CAA691B201A9091891', 'task_result': ['{"key":["00","01","10","11"],"value":[0.25,0.25,0.25,0.25]}', '{"key":["00","01","10","11"],"value":[0.25,0.25,0.25,0.25]}']}, {'task_id': 'C929CE6E18374181A2E2297327CE6888', 'task_result': ['{"key":["00","01","10","11"],"value":[0.25,0.25,0.25,0.25]}', '{"key":["00","01","10","11"],"value":[0.25,0.25,0.25,0.25]}']}]

◆ init()

None QPilotService.QPilotService.init ( self,
str url = None,
bool log_cout = False,
str api_key = None )

Init Quantum Machine and connect to PilotOS.

Args

url : str The Quantum Machine address you want to connnect. log_cout : bool Whether record execute log. api_key : str The unique certificate to login PilotOS, which can get from PilotOS WebSite.

Returns

None

Examples

self.init('PilotOS_url', True, 'your_api_key')

◆ parse_probability_result()

list QPilotService.QPilotService.parse_probability_result ( self,
list result_str )

Parse async task probability result to a list contains dict.

Args

result_str : str The json str contains task result key and value.

Returns

list

Examples

result = self.parse_probability_result(query_str)

◆ quantum_chip_config_query()

str QPilotService.QPilotService.quantum_chip_config_query ( self,
str chip_ids )

Get quantum chip config.

Args

chip_ids : str the json str contains chip id, it must be int or array, -1 represents all chips

Returns

str return quantum chip configuration

Examples

chipID_1 = {"ChipID":-1} chipID_2 = {"ChipID":[5,6,7]} config_1 = self.quantum_chip_config_query(chipID_1) config_2 = self.quantum_chip_config_query(chipID_2) print(config_1) print(config_2)

◆ query_result()

dict QPilotService.QPilotService.query_result ( self,
str task_id,
str file_path = None )

Query task result from task_id.

Args

task_id : str The task id you want to query. file_path : str If the parameter is not None, task result will be saved to target path.

Returns

dict Contains task state, task error code, task error info, task result, prob count you can decide what to do with state and error code.

Examples

This interface will return a task info dict, contains: task state, error code, error info(if error code not equal to 0), probability result, collapses counts You can decide whether to save the results of the task to a file by entering the second parameter or not, in particular, if you enter an empty string, the file will be saved in the current path

result_dict = self.query_result(task_id, 'D:/Tong/python_test/result') print(result_dict['taskState']) print(result_dict['errCode']) print(result_dict['errInfo']) print(result_dict['taskResult']) print(result_dict['probCount']) ... 3 0 '' ['{"key":["0", "1"], "value":[0.5, 0.5]}'] ['{"key":["0", "1"], "value":[500, 500]}']

If you enter the second parameter a path to save task result json, the json string in file will be like: { "taskId": "2258D6B6164F4F4FA8F85D1DA2F74370", "endTime": 1700466283544, "errCode": 0, "errInfo": "", "startTime": 1700466281627, "qProg": [ "[\"QINIT 72\\nCREG 72\\nX q[0]\\nH q[1]\\nMEASURE q[0]", "c[0]\\nMEASURE q[1]", "c[1]\"", " \"QINIT 72\\nCREG 72\\nX q[0]\\nH q[1]\\nMEASURE q[0]", "c[0]\\nMEASURE q[1]", "c[1]\"]" ], "qProgLength": 6, "configuration": "{\"shot\":1000,\"amendFlag\":false,\"mappingFlag\":true,\"circuitOptimization\":true,\"IsProbCount\":false,\"specified_block\":[]}", "taskState": "3", "convertQProg": [ "[[{\"RPhi\":[2,270.0,90.0,0]},{\"RPhi\":[3,0.0,180.0,0]},{\"Measure\":[[2,3],30]}],[{\"RPhi\":[2,270.0,90.0,0]},{\"RPhi\":[3,0.0,180.0,0]},{\"Measure\":[[2,3],30]}]]" ], "mappingQProg": [ "QINIT 72\nCREG 72\nX q[0]\nH q[1]\nMEASURE q[0],c[0]\nMEASURE q[1],c[1]", "QINIT 72\nCREG 72\nX q[0]\nH q[1]\nMEASURE q[0],c[0]\nMEASURE q[1],c[1]" ], "mappingQubit": [ "{\"SrcQubits\":[0,1],\"TargetCbits\":[0,1],\"MappingQubits\":[3,2]}", "{\"SrcQubits\":[0,1],\"TargetCbits\":[0,1],\"MappingQubits\":[3,2]}" ], "aioExecuteTime": 441, "queueTime": 0, "compileTime": 608, "totalTime": 1229, "aioCompileTime": 0, "aioPendingTime": 0, "aioMeasureTime": 0, "aioPostProcessTime": 0, "requiredCore": "0", "pulseTime": 60.0, "cirExecuteTime": 200000.0, "taskType": "0", "taskResult": [ "{\"key\":[\"00\",\"01\",\"10\",\"11\"],\"value\":[0.017,0.5,0.017,0.466]}", "{\"key\":[\"00\",\"01\",\"10\",\"11\"],\"value\":[0.018,0.474,0.025,0.483]}" ] }

◆ real_chip_expectation()

float QPilotService.QPilotService.real_chip_expectation ( self,
Union[QProg, str] prog,
str hamiltonian,
List[int] qubits = None,
int shot = None,
str chip_id = None,
bool is_amend = True,
bool is_mapping = True,
bool is_optimization = True,
List[int] specified_block = [],
str task_describe = '' )

submit Quantum expectation task, and get the expectation result.


Args

prog : Union[QProg, str] The quantum program you want to compute. hamiltonian : str Hamiltonian Args. qubits : List[int] measurement qubit shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specified Qubit block . task_describe : str The detailed information to describe your quantum program, such as which kind of algorithm, what can this program compute.

Returns

float if success, return the expectation task result. Otherwise return empty.

◆ real_chip_measure_proto()

list QPilotService.QPilotService.real_chip_measure_proto ( self,
Union[List[str], List[QProg], str, QProg] prog,
shot = 1000,
chip_id = None,
is_amend = True,
is_mapping = True,
is_optimization = True,
specified_block = [],
describe = '',
point_label = 0,
priority = 0 )

Using sync way to compute your Quantum Program.

Args

prog : Union[List[str], List[QProg], str, QProg] The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute. point_label : int Describe the operating point label mode of the chip. priority : int Describe the priority of chip computing tasks, ranging from 0 to 10, the default is 0

Returns

list a list of every single quantum program

Examples

result = self.run(prog_list, 1000, chip_id=1, is_mapping=True, describe="test1") print(result) [{'00': 0.2456881582421773, '01': 0.2495193504871486, '10': 0.25044435129147546, '11': 0.25434813997919875}, {'00': 0.2456881582421773, '01': 0.2495193504871486, '10': 0.25044435129147546, '11': 0.25434813997919875}]

◆ run()

list QPilotService.QPilotService.run ( self,
Union[List[str], List[QProg], str, QProg] prog,
shot = 1000,
chip_id = None,
is_amend = True,
is_mapping = True,
is_optimization = True,
specified_block = [],
describe = '',
point_label = 0,
priority = 0 )

Using sync way to compute your Quantum Program .

Args

prog : Union[List[str], List[QProg], str, QProg] The quantum program you want to compute. shot : int Repeate run quantum program times. chip_id : str The quantum chip ID . is_amend : bool Whether amend task result. is_mapping : bool Whether mapping logical Qubit to Physical Qubit. is_optimization : bool Whether optimize your quantum program. specified_block : List[int] Your specifed Qubit block . describe : str The detailed infomation to describe your quantum program, such as which kind of algorithm, what can this program compute. point_label : int Describe the operating point label mode of the chip. priority : int Describe the priority of chip computing tasks, ranging from 0 to 10, the default is 0

Returns

list a list of every single quantum program

Examples

result = self.run(prog_list, 1000, chip_id=1, is_mapping=True, describe="test1") print(result) [{'00': 0.2456881582421773, '01': 0.2495193504871486, '10': 0.25044435129147546, '11': 0.25434813997919875}, {'00': 0.2456881582421773, '01': 0.2495193504871486, '10': 0.25044435129147546, '11': 0.25434813997919875}]

◆ set_config()

None QPilotService.QPilotService.set_config ( self,
int max_qubit = None,
int max_cbit = None )

set Quantum Machine max Qubit and Cbit number function.

Args

max_qubit : int The Quantum Machine max available qubits. max_cbit : int The Quantum Machine max available cbits.

Returns

None

Examples

self.set_config(12, 12)

Member Data Documentation

◆ APIKey

str QPilotService.QPilotService.APIKey = ''

◆ LogCout

str QPilotService.QPilotService.LogCout = ''

◆ PilotIp

str QPilotService.QPilotService.PilotIp = ''

◆ PilotPort

str QPilotService.QPilotService.PilotPort = ''

◆ PilotURL

str QPilotService.QPilotService.PilotURL = ''

The documentation for this class was generated from the following file: