我可以轻松添加使用 Qiskit 创建的任何单一门,但是当我尝试将这些旋转门添加到噪声模型基础门时,它会发出警告。这可能是标签的问题(我使用了“rx”和“ry”)或其他一些我无法弄清楚的问题。
问题是噪音不会影响这些门,除非我将它们添加到基础门中。
noise_model = NoiseModel()
error_1 = depolarizing_error(prob_1, 1)
error_2 = depolarizing_error(prob_2, 2)
noise_model.add_all_qubit_quantum_error(phase_damping_error(0.1), ['Z1','Z2','rx','ry','h'])
noise_model.add_all_qubit_quantum_error(phase_damping_error(0.1),['CZϕA','CZϕB'])
noise_model.add_basis_gates(['unitary','rx','ry'])
basis_gates = noise_model.basis_gates
circs = transpile([qc1, qc2, qc3], basis_gates=basis_gates)
result_error = execute(circs,
QasmSimulator(),
shots=10,
noise_model=noise_model,
basis_gates=basis_gates).result()
print(noise_model)
Warning: Adding a gate "rx" to basis_gates which is not in QasmSimulator basis_gates.
Warning: Adding a gate "ry" to basis_gates which is not in QasmSimulator basis_gates.
NoiseModel:
Basis gates: ['cx', 'h', 'id', 'u3', 'unitary']
Instructions with noise: ['CZϕB', 'Z2', 'CZϕA', 'rx', 'h', 'ry', 'Z1']
All-qubits errors: ['Z1', 'Z2', 'rx', 'ry', 'h', 'CZϕA', 'CZϕB']