gate : Num a => (1 _ : Matrix r1 c1 a) -> (1 _ : Matrix c1 n a) -> Matrix r1 n a Apply a quantum gate to a quantum system via matrix multiplication.
Example: `gate (H >< ID) myVec`
Note: Both inputs to `gate` are linear.
Visibility: export(|>) : Num a => (1 _ : Matrix c1 n a) -> (1 _ : Matrix r1 c1 a) -> Matrix r1 n a An infix operator for `gate`.
m |> g = gate g m
This is useful for chaining gates together.
Visibility: export
Fixity Declaration: infixl operator, level 4ID : Matrix 2 2 Double The Identity gate. This gate does nothing.
Visibility: public exportIDN : (n : Nat) -> Matrix n n Double The Identity gate of size `n`. where `n` is the rows and cols of the matrix.
Visibility: public exportX : Matrix 2 2 Double The Pauli-X gate. This gate flips the state of a qubit.
This is equivalent to the classical NOT gate.
Visibility: public exportH : Matrix 2 2 Double The Hadamard Gate.
This gate acts upon a single qubit and puts it into a superposition.
Visibility: public exportCNOT : Matrix 4 4 Double Controlled Not Gate.
This gate flips the second qubit if the first qubit is in the state |1>.
NOTE: This gate is only defined for 2 qubits that are adjacent to each other.
Use `CNOTN` for non adjacent qubits.
Visibility: public exportpow2 : Num a => Nat -> a A helper function to calculate the powers of 2.
Visibility: public exportCOND : (n : Nat) -> Matrix (pow2 (minus n 1)) (pow2 (minus n 1)) Double -> Matrix (2 * pow2 (minus n 1)) (2 * pow2 (minus n 1)) Double Conditional gate. Applies a gate to a system if the control bit is |1>
n is the number of qbits in the system (including the control bit)
See https://quantumcomputing.stackexchange.com/questions/4252/how-to-derive-the-cnot-matrix-for-a-3-qubit-system-where-the-control-target-qu
Visibility: public exportmeasurePure : Double -> (1 _ : QSystem n) -> QSystem n Deterministically measure a quantum system
Visibility: exportmeasure : (1 _ : QSystem n) -> Q (QSystem n) Non-deterministically measure a quantum system
Visibility: export