Qx.Behaviours.QuantumState behaviour (Qx - Quantum Computing Simulator v0.6.0)
View SourceBehaviour for quantum state manipulation.
This behaviour ensures consistent API across Circuit and Calculation modes. Any module implementing this behaviour must provide a complete set of quantum gate operations and state inspection functions.
Example
defmodule MyQuantumState do
@behaviour Qx.Behaviours.QuantumState
@impl true
def h(state, qubit), do: # ... implementation
@impl true
def state_vector(state), do: # ... implementation
# ... other required callbacks
end
Summary
Types
Callbacks
@callback ccx(state(), qubit_index(), qubit_index(), qubit_index()) :: state()
@callback cx(state(), qubit_index(), qubit_index()) :: state()
@callback cz(state(), qubit_index(), qubit_index()) :: state()
@callback h(state(), qubit_index()) :: state()
@callback phase(state(), qubit_index(), angle()) :: state()
@callback rx(state(), qubit_index(), angle()) :: state()
@callback ry(state(), qubit_index(), angle()) :: state()
@callback rz(state(), qubit_index(), angle()) :: state()
@callback s(state(), qubit_index()) :: state()
@callback state_vector(state()) :: Nx.Tensor.t()
@callback t(state(), qubit_index()) :: state()
@callback x(state(), qubit_index()) :: state()
@callback y(state(), qubit_index()) :: state()
@callback z(state(), qubit_index()) :: state()