跳转至

量子软件开发工具包

简介

**量子SDK**提供开发量子应用程序的工具和库。

主流框架

1. Qiskit (IBM)

最流行

完整的量子开发生态系统

from qiskit import QuantumCircuit, Aer, execute

# 创建量子电路
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)

# 执行
backend = Aer.get_backend('qasm_simulator')
result = execute(qc, backend).result()

特点: - Terra (基础) - Aer (模拟器) - Ignis (噪声) - Aqua (算法)

2. Cirq (Google)

import cirq

# 创建量子比特
q0, q1 = cirq.LineQubit.range(2)

# 创建电路
circuit = cirq.Circuit(
    cirq.H(q0),
    cirq.CNOT(q0, q1),
    cirq.measure(q0, q1, key='result')
)

特点: - 原子级控制 - 中量子比特优化 - 噪声模型

3. PennyLane (Xanadu)

import pennylane as qml

dev = qml.device('default.qubit', wires=2)

@qml.qnode(dev)
def circuit(x):
    qml.RX(x, wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.expval(qml.PauliZ(0))

特点: - 自动微分 - 量子机器学习 - 光量子模拟


上一章: 量子编程语言 | 下一章: 量子编译器