rqutils.qprint.qprint¶
- rqutils.qprint.qprint(qobj, fmt='braket', amp_norm=None, phase_norm=(np.pi, 'π'), global_phase=None, terms_per_row=0, amp_format='.3f', phase_format='.2f', amp_cutoff=1.e-6, lhs_label=None, dim=None, binary=False, symbol=None, delimiter='', output=None)¶
Pretty-print a quantum object.
Available output formats are
‘braket’: For a column vector, row vector, or matrix input. Prints out the mathematical expression of the linear combination of bras, kets, or ket-bras.
‘pauli’: For an input representing a square matrix (shape (d1*d2*…, d1*d2*…)) or a components array (shape (d1**2, d2**2, …)). Argument dim is required for the matrix interpretation.
Three printing formats are supported:
‘text’: Print text to stdout.
‘latex’: Return an object processable by IPython into a typeset LaTeX expression.
‘mpl’: Return a matplotlib figure.
- Parameters
qobj (
Any) – Input quantum object.fmt (
str) – Print format (‘braket’ or ‘pauli’).amp_norm (
Union[Number,Tuple[Number,str],None]) – Specification of the normalization of amplitudes by (numeric devisor, unit in LaTeX).phase_norm (
Optional[Tuple[Number,str]]) – Specification of the normalization of phases by (numeric devisor, unit in LaTeX).global_phase (
Union[Number,str,None]) – Specification of the phase to factor out. Give a numeric offset or ‘mean’.terms_per_row (
int) – Number of terms to show per row.amp_format (
str) – Format for the numerical value of the amplitude absolute values.phase_format (
str) – Format for the numerical value of the phases.amp_cutoff (
float) – Ignore terms with absolute amplitudes less thanmax(abs(amplitudes))times this value.lhs_label (
Optional[str]) – If not None, prepend ‘label = ‘ to the printout.dim (
Union[Number,Sequence[Number],numpy.ndarray,None]) – Specification of the dimensions of the subsystems. For fmt=’pauli’, used only when qobj is a square matrix or a 1D array.binary (
bool) – Show bra and ket indices in binary. Only for fmt=’braket’.symbol (
Union[str,Sequence[str],None]) – Pauli matrix symbols. Only for fmt=’pauli’.delimiter (
str) – Pauli product delimiter. Only for fmt=’pauli’.output (
Optional[str]) – Output method (‘text’, ‘latex’, or ‘mpl’).
- Return type
Union[str,Figure]- Returns
Object to be printed.