pygsti.tools.matrixtools.mx_to_string

Contents

pygsti.tools.matrixtools.mx_to_string#

mx_to_string(m, width=9, prec=4, withbrackets=False)#

Generate a “pretty-format” string for a matrix.

Will generate strings for real or complex matrices with a desired precision and “cell” width.

Parameters:
  • m (numpy.ndarray) – array to print.

  • width (int, optional) – the width (in characters) of each converted element

  • prec (int optional) – the precision (in characters) of each converted element

  • withbrackets (bool, optional) – whether to print brackets and commas to make the result something that Python can read back in.

Returns:

matrix m as a pretty formatted string.

Return type:

string