mindquantum.simulator.inner_product
- mindquantum.simulator.inner_product(bra_simulator: Simulator, ket_simulator: Simulator)[源代码]
计算给定模拟器中两种状态的内积。
- 参数:
bra_simulator (Simulator) - 提供bra态的模拟器。
ket_simulator (Simulator) - 提供ket态的模拟器。
- 返回:
numbers.Number,两个量子态的内积。
样例:
>>> from mindquantum.core.gates import RX, RY >>> from mindquantum.simulator import inner_product, Simulator >>> bra_simulator = Simulator('mqvector', 1) >>> bra_simulator.apply_gate(RY(1.2).on(0)) >>> ket_simulator = Simulator('mqvector', 1) >>> ket_simulator.apply_gate(RX(2.3).on(0)) >>> inner_product(bra_simulator, ket_simulator) (0.33713923320500694-0.5153852888544989j)