Release 0.8.1
What's Changed
Added
-
Qx.draw_histogram/2, replacingQx.histogram/2. The new name
matches the rest of theQx.draw*family (Qx.draw/2,
Qx.draw_counts/2,Qx.draw_bloch/2,Qx.draw_state/2). -
Qx.StateInit.bell_state_vector/2andQx.StateInit.ghz_state_vector/2,
the canonically-named state-vector constructors. The_vectorsuffix
names the return type, disambiguating these from the circuit-returning
Qx.bell_state/1andQx.ghz_state/0.
Deprecated
Qx.StateInit.bell_state/2andQx.StateInit.ghz_state/2in favour of
the_vector-suffixed names above. Both keep working through 0.8.x —
they delegate verbatim to the new functions — and are scheduled for
removal in v0.9.
Changed
-
Qx.Patterns.bell_state_circuit/1andQx.Patterns.ghz_state_circuit/1are
now@doc false. The documented entry points for these circuits are the
Qx.bell_state/1andQx.ghz_state/1facades, which delegate to them; the
Patterns functions remain callable (no API change), they just no longer
appear as separate HexDocs pages. -
Public API surface is now declared explicitly (no API change). Iron
Law #6 now guards the modules README and the tutorials actually treat as
primary surface:Qx.Qubit,Qx.Register,Qx.StateInit,Qx.Patterns,
Qx.Math,Qx.Hardware,Qx.Hardware.Config,Qx.Export.OpenQASM, and
Qx.Draw(alongside the previously-declaredQx,Qx.QuantumCircuit,
Qx.Operations,Qx.Simulation,Qx.SimulationResult,Qx.Behaviours.*).
Internal helpers no longer appear in the published docs —Qx.Validation,
theQx.Draw.SVG.*andQx.Export.OpenQASM.*sub-modules, and
Qx.Hardware.Ibm/Qx.Hardware.Portalare now@moduledoc false. Every
function stays callable; the typedQx.*Errorexceptions remain part of the
public contract. -
Typed errors for the last raw
ArgumentErrors inQx.Validation
(plan: iron-law-7-followon). Completes the Iron Law #7 pass begun
in 0.8.0.Qx.Validationnow raises typed exceptions instead of
ArgumentError:- a non-numeric gate parameter raises the new
Qx.ParameterError
(carries the offending:value); - duplicate qubit indices raise
Qx.QubitIndexError; - a state-vector shape mismatch raises
Qx.StateShapeError.
Observable on the public rotation/phase gates
Qx.rx/3,ry/3,
rz/3,u/5,cp/4,crx/4,cry/4,crz/4(and their
Qx.Operationsequivalents): a non-numeric angle now raises
Qx.ParameterErrorrather thanArgumentError. Code rescuing the
oldArgumentErrormust be updated. - a non-numeric gate parameter raises the new
-
Typed errors across the rest of the public surface
(plan: iron-law-7-sweep). Clears the remaining rawArgumentErrors
and one strayFunctionClauseErrorfrom the public API, finishing the
Iron Law #7 work begun in 0.8.0. Two new exceptions:Qx.RegisterError— register construction input (an empty list, a
malformed qubit, or a renderer handed a non-register); carries a
:reason.Qx.BasisError— a computational basis value that is not 0 or 1;
carries the offending:value.
Retyped surfaces — code rescuing the old
ArgumentError/
FunctionClauseErrormust be updated:Qx.Register.new/1andQx.Register.from_basis_states/1→
Qx.RegisterError/Qx.BasisError;- the register two-qubit distinctness gates (
cx,cz,cy,
ccx,swap,iswap,cswap, and the controlled-target gates)
→Qx.QubitIndexError; Qx.Qubit.from_basis/1→Qx.BasisError;Qx.Draw.*plots andQx.Draw.Tables.render/2with an invalid
:format→Qx.OptionError; a non-register input →
Qx.RegisterError;Qx.Export.OpenQASM.to_qasm/2with an invalid:version→
Qx.OptionError;Qx.Draw.circuit/2on a malformed circuit →
Qx.QubitCountError/Qx.GateError/Qx.QubitIndexError/
Qx.ClassicalBitError;Qx.u/5with an out-of-range qubit now raises
Qx.QubitIndexErrorinstead ofFunctionClauseError, matching
rx/ry/rz/cp.
Deprecated
Qx.histogram/2is deprecated. UseQx.draw_histogram/2instead.
Emits a compile-time warning and is hidden from ExDoc. Scheduled
for removal in v1.0.
Installation
Add to your mix.exs:
def deps do
[
{:qx_sim, "~> 0.8.1"}
]
end