parameters: (A)
return_statement: return Q
docstring: Assume that A is a tall matrix.
      Compute the Q factor s.t. A = QR (A may be complex) and diag(R) is real and non-negative
docstring_summary: Assume that A is a tall matrix.
      Compute the Q factor s.t. A = QR (A may be complex) and diag(R) is real and non-negative
docstring_tokens: Assume that A is a tall matrix . Compute the Q factor s . t . A = QR ( A may be complex ) and diag ( R ) is real and non - negative
function: def _make_orthogonal(A):
      """ Assume that A is a tall matrix.
      Compute the Q factor s.t. A = QR (A may be complex) and diag(R) is real and non-negative
      """
      X, tau = torch.geqrf(A)
      Q = torch.linalg.householder_product(X, tau)
      # The diagonal of X is the diagonal of R (which is always real) so we normalise by its signs
      Q *= X.diagonal(dim1=-2, dim2=-1).sgn().unsqueeze(-2)
      return Q
function_tokens: def _make_orthogonal ( A ) : X , tau = torch . geqrf ( A ) Q = torch . linalg . householder_product ( X , tau ) # The diagonal of X is the diagonal of R (which is always real) so we normalise by its signs Q *= X . diagonal ( dim1 = - 2 , dim2 = - 1 ) . sgn ( ) . unsqueeze ( - 2 ) return Q