Qx.Draw.StateTable (Qx - Quantum Computing Simulator v0.10.1)

View Source

A quantum-state table artifact produced by Qx.draw_state/2: every basis state with its amplitude and probability, pre-rendered in three encodings.

The struct is plain data with one static shape in every environment (see spec/api-design-principles.md §6): Livebook renders the markdown through the Kino.Render protocol, IEx prints the text table via Inspect, and a standalone application picks the field it needs (to_string/1 gives the text form).

Fields

  • :text - monospaced plain-text table
  • :markdown - markdown table
  • :html - HTML <table>

Examples

iex> table = Qx.create_circuit(1) |> Qx.h(0) |> Qx.get_state() |> Qx.draw_state()
iex> table.text =~ "Basis State"
true
iex> table.markdown =~ "Probability"
true

Summary

Types

t()

@type t() :: %Qx.Draw.StateTable{
  html: String.t(),
  markdown: String.t(),
  text: String.t()
}