qr

tenpy.linalg.np_conserved.qr(a, mode='reduced', inner_labels=[None, None], cutoff=None)[source]

Q-R decomposition of a matrix.

Decomposition such that A == npc.tensordot(q, r, axes=1) up to numerical rounding errors.

Parameters
  • a (Array) – A square matrix to be exponentiated, shape (M,N).

  • mode ('reduced', 'complete') – ‘reduced’: return q and r with shapes (M,K) and (K,N), where K=min(M,N) ‘complete’: return q with shape (M,M).

  • inner_labels ([{str|None}, {str|None}]) – The first label is used for Q.legs[1], the second for R.legs[0].

  • cutoff (None or float) – If not None, discard linearly dependent vectors to given precision, which might reduce K of the ‘reduced’ mode even further.

Returns

  • q (Array) – If mode is ‘complete’, a unitary matrix. For mode ‘reduced’ such thatOtherwise such that \(q^{*}_{j,i} q_{j,k} = \delta_{i,k}\)

  • r (Array) – Upper triangular matrix if both legs of A are sorted by charges; Otherwise a simple transposition (performed when sorting by charges) brings it to upper triangular form.