|
| Statevector | num::quantum::zero_state (int n_qubits) |
| | Returns |0...0> computational basis state for n_qubits qubits.
|
| |
| Statevector | num::quantum::basis_state (int n_qubits, int k) |
| | Returns the computational basis state |k> for an n_qubits system.
|
| |
| Gate | num::quantum::gate_x () |
| | Pauli-X (NOT)
|
| |
| Gate | num::quantum::gate_y () |
| | Pauli-Y.
|
| |
| Gate | num::quantum::gate_z () |
| | Pauli-Z.
|
| |
| Gate | num::quantum::gate_h () |
| | Hadamard.
|
| |
| Gate | num::quantum::gate_s () |
| | Phase gate S = diag(1, i)
|
| |
| Gate | num::quantum::gate_sdg () |
| | S† = diag(1, -i)
|
| |
| Gate | num::quantum::gate_t () |
| | T gate = diag(1, e^{ipi/4})
|
| |
| Gate | num::quantum::gate_tdg () |
| | T† gate.
|
| |
| Gate | num::quantum::gate_rx (real theta) |
| | Rotation about X: R_x(theta) = exp(-ithetaX/2)
|
| |
| Gate | num::quantum::gate_ry (real theta) |
| | Rotation about Y: R_y(theta) = exp(-ithetaY/2)
|
| |
| Gate | num::quantum::gate_rz (real theta) |
| | Rotation about Z: R_z(theta) = exp(-ithetaZ/2)
|
| |
| Gate | num::quantum::gate_p (real lambda) |
| | Phase gate: diag(1, e^{ilambda})
|
| |
| Gate | num::quantum::gate_u (real theta, real phi, real lambda) |
| | General SU(2) gate.
|
| |
| Gate2Q | num::quantum::gate2q_cnot () |
| | CNOT (qubit 0 = control, qubit 1 = target in subspace)
|
| |
| Gate2Q | num::quantum::gate2q_cz () |
| | Controlled-Z.
|
| |
| Gate2Q | num::quantum::gate2q_swap () |
| | SWAP.
|
| |
| void | num::quantum::apply_1q (Statevector &sv, int n_qubits, const Gate &G, int target) |
| | Apply a 2x2 gate to a single qubit in-place.
|
| |
| void | num::quantum::apply_2q (Statevector &sv, int n_qubits, const Gate2Q &G, int q0, int q1) |
| | Apply a general 4x4 two-qubit gate to qubits q0, q1.
|
| |
| void | num::quantum::apply_cnot (Statevector &sv, int n_qubits, int control, int target) |
| | CNOT with explicit control and target qubits.
|
| |
| void | num::quantum::apply_cz (Statevector &sv, int n_qubits, int control, int target) |
| | Controlled-Z.
|
| |
| void | num::quantum::apply_swap (Statevector &sv, int n_qubits, int q0, int q1) |
| | SWAP two qubits.
|
| |
| void | num::quantum::apply_toffoli (Statevector &sv, int n_qubits, int c0, int c1, int target) |
| | Toffoli (CCX) gate.
|
| |
| real | num::quantum::norm (const Statevector &sv) |
| | L2 norm of the statevector (should be 1 for a valid quantum state)
|
| |
| void | num::quantum::normalize (Statevector &sv) |
| | Normalize statevector in-place.
|
| |
| std::vector< real > | num::quantum::probabilities (const Statevector &sv) |
| | Measurement probability for each basis state: p_i = |a_i|^2.
|
| |
| real | num::quantum::expectation (const Statevector &sv, std::function< void(const Statevector &, Statevector &)> op) |
| | Expectation value <psi|O|psi> for a Hermitian operator given as matrix-free matvec.
|
| |
| real | num::quantum::expectation_z (const Statevector &sv, int qubit) |
| | <Z_q> = P(q=0) - P(q=1) for qubit q
|
| |
| real | num::quantum::expectation_x (const Statevector &sv, int n_qubits, int qubit) |
| | <X_q> for qubit q
|
| |
| real | num::quantum::expectation_y (const Statevector &sv, int n_qubits, int qubit) |
| | <Y_q> for qubit q
|
| |
| std::array< std::complex< real >, 4 > | num::quantum::reduced_density_matrix (const Statevector &sv, int n_qubits, int qubit) |
| | Reduced density matrix for a single qubit (2x2, returned row-major)
|
| |
| real | num::quantum::entanglement_entropy (const Statevector &sv, int n_qubits, int qubit) |
| | Von Neumann entropy of a single qubit's reduced density matrix.
|
| |
| void | num::quantum::apply_cy (Statevector &sv, int n_qubits, int control, int target) |
| | Controlled-Y.
|
| |
| void | num::quantum::apply_cp (Statevector &sv, int n_qubits, real lambda, int control, int target) |
| | Controlled phase: applies phase e^{ilambda} when both control=1 and target=1.
|
| |
| void | num::quantum::apply_cswap (Statevector &sv, int n_qubits, int ctrl, int q0, int q1) |
| | Fredkin (CSWAP): swaps q0 and q1 when ctrl=1.
|
| |