Skip to content

Release 0.8.1

Choose a tag to compare

@github-actions github-actions released this 28 Jun 21:48

What's Changed

Added

  • Qx.draw_histogram/2, replacing Qx.histogram/2. The new name
    matches the rest of the Qx.draw* family (Qx.draw/2,
    Qx.draw_counts/2, Qx.draw_bloch/2, Qx.draw_state/2).

  • Qx.StateInit.bell_state_vector/2 and Qx.StateInit.ghz_state_vector/2,
    the canonically-named state-vector constructors. The _vector suffix
    names the return type, disambiguating these from the circuit-returning
    Qx.bell_state/1 and Qx.ghz_state/0.

Deprecated

  • Qx.StateInit.bell_state/2 and Qx.StateInit.ghz_state/2 in 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/1 and Qx.Patterns.ghz_state_circuit/1 are
    now @doc false. The documented entry points for these circuits are the
    Qx.bell_state/1 and Qx.ghz_state/1 facades, 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-declared Qx, Qx.QuantumCircuit,
    Qx.Operations, Qx.Simulation, Qx.SimulationResult, Qx.Behaviours.*).
    Internal helpers no longer appear in the published docs — Qx.Validation,
    the Qx.Draw.SVG.* and Qx.Export.OpenQASM.* sub-modules, and
    Qx.Hardware.Ibm / Qx.Hardware.Portal are now @moduledoc false. Every
    function stays callable; the typed Qx.*Error exceptions remain part of the
    public contract.

  • Typed errors for the last raw ArgumentErrors in Qx.Validation
    (plan: iron-law-7-followon).
    Completes the Iron Law #7 pass begun
    in 0.8.0. Qx.Validation now 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.Operations equivalents): a non-numeric angle now raises
    Qx.ParameterError rather than ArgumentError. Code rescuing the
    old ArgumentError must be updated.

  • Typed errors across the rest of the public surface
    (plan: iron-law-7-sweep).
    Clears the remaining raw ArgumentErrors
    and one stray FunctionClauseError from 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 /
    FunctionClauseError must be updated:

    • Qx.Register.new/1 and Qx.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/1Qx.BasisError;
    • Qx.Draw.* plots and Qx.Draw.Tables.render/2 with an invalid
      :formatQx.OptionError; a non-register input →
      Qx.RegisterError;
    • Qx.Export.OpenQASM.to_qasm/2 with an invalid :version
      Qx.OptionError;
    • Qx.Draw.circuit/2 on a malformed circuit →
      Qx.QubitCountError / Qx.GateError / Qx.QubitIndexError /
      Qx.ClassicalBitError;
    • Qx.u/5 with an out-of-range qubit now raises
      Qx.QubitIndexError instead of FunctionClauseError, matching
      rx/ry/rz/cp.

Deprecated

  • Qx.histogram/2 is deprecated. Use Qx.draw_histogram/2 instead.
    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

Documentation