Skip to content

Releases: Agony5757/QPanda-lite

qpandalite 0.1.5

26 Sep 12:25
Compare
Choose a tag to compare

What's New

Multiple-task support in OriginQ

QPanda-lite can automatically handle multiple tasks in OriginQ task submission.

Examples:

import qpandalite
import qpandalite.task.originq as originq

# On step 1

#generate 200 circuits, allowing submitting 200 in single task
circuits = _make_many_circuits(1000) 

# >>> taskid: ['ID1', 'ID2', ..'ID5'] where each id represents 200 tasks, 5 total.
taskid = originq.submit_task(circuits)

# On step 2

results = originq.query_by_taskid(taskid)

# results contains 1000 independent tasks when all finished.
if results['status'] == 'success' : results = results['result']

# if one task failed, then status is failed. Otherwise, if one task is running, then status is running
else: print(results['status'])

Dummy server

Dummy server is a fake-backend which simulates task_submit, query_by_taskid, ...
It generates dummy taskid and classically simulates the circuit, producing ideal results.

Usage: replacing

import qpandalite.task.originq as originq

by

import qpandalite.task.dummy as originq

and vice versa!

qpandalite 0.1.4

25 Sep 14:58
Compare
Choose a tag to compare

What's New

Add convert_originq_result and calculate_expectation

Example

result = {'key': ['001','010','100'], 'value': [10, 20, 9970]}
kvresult = convert_originq_result(result, 
                                style='keyvalue', 
                                prob_or_shots='prob', 
                                reverse_key=False)

print(calculate_expectation(kvresult, ['IIZ', 'IZI', 'ZII', 'ZZZ']))

listresult = convert_originq_result(result, 
                                style='list', 
                                prob_or_shots='prob', 
                                reverse_key=False)
print(calculate_expectation(listresult, ['IIZ', 'IZI', 'ZII', 'ZZZ']))

Full Changelog 0.1.3 to 0.1.4: 0.1.3...0.1.4
Full Changelog 0.1.2 to 0.1.4: 0.1.2...0.1.4

qpandalite 0.1.3

25 Sep 12:44
Compare
Choose a tag to compare

What's New

OriginIR_Simulator now supports re-simulate a new originir.
OriginIR_Simulator.state can read the internal quantum state.

Full Changelog: 0.1.2...0.1.3

qpandalite 0.1.2

25 Sep 12:30
Compare
Choose a tag to compare

What's New

Add qpandalite.simulator.OriginIR_Simulator

A simple example for this simulator

import qpandalite.simulator as qsim

sim = qsim.OriginIR_Simulator(reverse_key=False)

originir = '''
QINIT 72
CREG 2
RY q[45],(0.9424777960769379)
RY q[46],(0.9424777960769379)
CZ q[45],q[46]
RY q[45],(-0.25521154)
RY q[46],(0.26327053)
X q[46]
MEASURE q[45],c[0]
MEASURE q[46],c[2]
MEASURE q[52],c[1]
'''

res = sim.simulate(originir)
print(res)

New Contributors

Full Changelog: https://github.com/Agony5757/QPanda-lite/commits/0.1.2