Qx.BasisError exception (Qx - Quantum Computing Simulator v0.11.0)
View SourceRaised for two related computational-basis misuses:
- a single-qubit basis value that is not 0 or 1 (carried in
:value), and - an invalid
Qx.StateInit.basis_state/2,3argument — a non-integer or negative index, an index ≥ the dimension, or a dimension < 1. These carry a:reason(:not_an_integer|:negative|:out_of_range|:invalid_dimension) plus:value/:dimensionso callers can pattern-match on the cause rather than parsing the message.
Like Qx.ParameterError, the bare-value clause omits an
exception(message) when is_binary fallback: a basis value may be any
term — a binary included — so every non-tuple value is captured in :value,
never treated as a pre-formatted message.