pygsti.tools.matrixtools.sign_fix_qr#
- sign_fix_qr(q, r, tol=1e-06)#
Change the signs of the columns of Q and rows of R to follow a convention.
Flips the signs of Q-columns and R-rows from a QR decomposition so that the largest absolute element in each Q-column is positive. This is an arbitrary but consistent convention that resolves sign-ambiguity in the output of a QR decomposition.
- Parameters:
q (numpy.ndarray) – Input Q and R matrices from QR decomposition.
r (numpy.ndarray) – Input Q and R matrices from QR decomposition.
tol (float, optional) – Tolerance for computing the maximum element, i.e., anything within tol of the true max is counted as a maximal element, the first of which is set positive by the convention.
- Returns:
qq, rr – Updated versions of q and r.
- Return type:
numpy.ndarray