quantumA high-performance quantum computing simulator in Dinfio. This module lets you programme and simulate quantum algorithms, quantum information, and quantum machine learning.
bra_0 — This constant represents bra \(\bra{0}\)bra_1 — This constant represents bra \(\bra{1}\)e — Mathematical \(e\) constantgate_h — The matrix representation of \(H\) gategate_i — The matrix representation of \(I\) gategate_x — The matrix representation of \(X\) gategate_y — The matrix representation of \(Y\) gategate_z — The matrix representation of \(Z\) gateket_0 — This constant represents state \(\ket{0}\)ket_1 — This constant represents state \(\ket{1}\)negative_i — Negative \(i\) number (\(-\sqrt{-1}\))pi — Mathematical \(\pi\) constantpositive_i — Positive \(i\) number (\(\sqrt{-1}\))
fidelity() — Calculate the fidelity of two states \(\ket{\psi}\) and \(\ket{\phi}\)from_binary() — Convert a binary string to numberplot() — Plot data to the output window
quantum_circuit — This class models a quantum circuit, providing gate operations, quantum states, probabilities, quantum phases, expectation values, measurements, etc.
construct() — The constructor. Create an instance of class quantum_circuit apply_controlled_gate() — Apply controlled-Hermitian gate to the circuit apply_gate() — Apply Hermitian gate to the circuit barrier() — Add a barrier to the circuit bits() — Get total number of classical bits of the circuit ccx() — Apply \(CCX\) (also known as Toffoli) gate to the circuit classical_bits() — Get the measured classical bits The documentation for matrix and complex number operations (e.g. transpose(), conjugate(), matrix multiplication) can be found here: https://dinfio.org/docs/reference/neural.
import quantum
qc = quantum_circuit(2)
qc.h(0)
qc.cx(0, 1)
qc.print_statevector()
qc.print_probability()
qc.draw()
' Example output:
'
' [ 0.707107 + 0i
' 0 + 0i
' 0 + 0i
' 0.707107 + 0i ]
' [ 0.5
' 0
' 0
' 0.5 ]
' ╭───╮
' q0 ─┤ H ├───●───
' ╰───╯ │
' ╭─┴─╮
' q1 ───────┤ X ├─
' ╰───╯
This module is only available on Dinfio version 3.2.01 or later