Skip to content

Commit

Permalink
Raise error if print_matrix is called outside of notebook mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlyongemallo committed Apr 17, 2024
1 parent 579bfa7 commit 76b4361
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyzx/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ def print_matrix(m: Union[np.ndarray,BaseGraph,Circuit]) -> None:
"""Display a Label() Jupyter widget with a pretty LaTeX representation of the given matrix.
Instead of a matrix, can also give a Circuit or Graph.
"""
if get_mode() != "notebook":
raise TypeError("Unsupported mode for print_matrix: '{}'".format(get_mode()))
display(get_matrix_label(m))


Expand Down

0 comments on commit 76b4361

Please sign in to comment.