qalgebra.printing.asciiprinter module

ASCII Printer

Summary

Classes:

QalgebraAsciiDefaultPrinter

Printer for an ASCII representation that accepts no settings.

QalgebraAsciiPrinter

Printer for a string (ASCII) representation.

Reference

class qalgebra.printing.asciiprinter.QalgebraAsciiPrinter(cache=None, settings=None)[source]

Bases: qalgebra.printing.base.QalgebraBasePrinter

Printer for a string (ASCII) representation.

Attributes
  • _parenth_left (str) – String to use for a left parenthesis (e.g. ‘left(‘ in LaTeX).

  • _parenth_left (str) – String to use for a right parenthesis

  • _dagger_sym (str) – Symbol that indicates the complex conjugate of an operator.

  • _tensor_sym (str) – Symbol to use for tensor products.

sympy_printer_cls

alias of qalgebra.printing.sympy.SympyStrPrinter

printmethod: str = '_ascii'
parenthesize(expr, level, *args, strict=False, **kwargs)[source]

Render expr and wrap the result in parentheses if the precedence of expr is below the given level (or at the given level if strict is True. Extra args and kwargs are passed to the internal doit renderer

class qalgebra.printing.asciiprinter.QalgebraAsciiDefaultPrinter[source]

Bases: qalgebra.printing.asciiprinter.QalgebraAsciiPrinter

Printer for an ASCII representation that accepts no settings. This can be used internally when a well-defined, static representation is needed (e.g. as a sort key)