Array Formatter

This module handles formatting of arrays. Everything in here is for internal use only, except for the set_qitensor_printoptions() and get_qitensor_printoptions() functions.

class qitensor.arrayformatter.HilbertArrayFormatter

Bases: object


Format array in HTML. Used for IPython.

array_latex_block_table(arr, use_hline=False)

Formats array in Latex. Used by both Sage and IPython.


Creates repr for HilbertArray.


Creates string for HilbertArray.


Gets the current qitensor formatting options.

See also: set_qitensor_printoptions()

py_scalar_latex_formatter(data, dollar_if_tex)

Formats python scalar for latex.

sage_scalar_latex_formatter(data, dollar_if_tex)

Formats Sage scalar for latex.

set_printoptions(str_use_sage=None, zero_color_latex=None, zero_color_html=None, use_latex_label_in_html=None, ipy_table_format_mode=None, ipy_space_format_mode=None)

Sets print options for qitensor.

Any options passed the None value won’t be changed.

  • str_use_sage (bool) – If true, use Sage’s matrix formatting functions when available (this is prettier).
  • zero_color_latex (string) – Color to use for drawing the number zero in latex.
  • zero_color_html (string) – Color to use for drawing the number zero in HTML.
  • use_latex_label_in_html (bool) – If true, HilbertSpace labels will be shown in latex form when rendering an array in HTML. Works good with the IPython notebook, but not with qtconsole.
  • ipy_table_format_mode (string (‘html’, ‘latex’, ‘png’, ‘plain’)) – Which mode to use for formatting arrays in the IPython notebook.
  • ipy_space_format_mode (string (‘latex’, ‘png’, ‘plain’)) – Which mode to use for formatting HilbertSpace labels in the IPython notebook.

qitensor also makes use of the suppress and precision options from numpy.set_printoptions.

See also: get_qitensor_printoptions()


Sets good printing options for IPython QTconsole.

sympy_scalar_latex_formatter(data, dollar_if_tex)

Formats Sympy scalar for latex.

Previous topic


Next topic

Sympy Basefield

This Page