qilisdk.utils.visualization.qtensor_renderers

Attributes

AXIS_TYPE

Classes

MatplotlibQTensorRenderer

Render a QTensor using matplotlib.

Module Contents

AXIS_TYPE[source]
class MatplotlibQTensorRenderer(qtensor: qilisdk.core.QTensor, ax: AXIS_TYPE | None = None, *, style: qilisdk.utils.visualization.style.QTensorStyle = QTensorStyle())[source]

Render a QTensor using matplotlib.

qtensor[source]
style[source]
property axes: AXIS_TYPE[source]
plot() → None[source]

Render the QTensor on the current axes.

State vectors (kets and bras) are converted to their density matrix before being drawn, so that pure and mixed states follow the same code path. Mixed states, such as those obtained from partial_trace(), sit strictly inside the Bloch sphere.

Raises:
  • ValueError – If the QTensor does not represent a single qubit.

  • ValueError – If the QTensor is neither a state vector (ket or bra) nor a density matrix.

save(filename: str) → None[source]

Save current figure to disk.

Parameters:

filename – Path to save the figure (e.g., ‘circuit.png’).

show() → None[source]

Show the current figure.