mindquantum.simulator.inner_product
- mindquantum.simulator.inner_product(bra_simulator: Simulator, ket_simulator: Simulator)[source]
Calculate the inner product of two state that in the given simulator.
- Parameters
- Returns
numbers.Number, the inner product of two quantum state.
Examples
>>> 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)