svd¶
full name: tenpy.linalg.np_conserved.svd
parent module:
tenpy.linalg.np_conserved
type: function
-
tenpy.linalg.np_conserved.
svd
(a, full_matrices=False, compute_uv=True, cutoff=None, qtotal_LR=[None, None], inner_labels=[None, None], inner_qconj=1)[source]¶ Singualar value decomposition of an Array a.
Factorizes
U, S, VH = svd(a)
, such thata = U*diag(S)*VH
(where*
stands for atensordot()
and diag creates an correctly shaped Array with S on the diagonal). For a non-zero cutoff this holds only approximately.There is a gauge freedom regarding the charges, see also
Array.gauge_total_charge()
. We ensure contractibility by settingU.legs[1] = VH.legs[0].conj()
. Further, we gauge the LegCharge such that U and V have the desired qtotal_LR.- Parameters
- a
Array
, shape(M, N)
The matrix to be decomposed.
- full_matricesbool
If
False
(default), U and V have shapes(M, K)
and(K, N)
, whereK=len(S)
. IfTrue
, U and V are full square unitary matrices with shapes(M, M)
and(N, N)
. Note that the arrays are not directly contractible in that case;diag(S)
would need to be a rectangluar(M, N)
matrix.- compute_uvbool
Whether to compute and return U and V.
- cutoff
None
| float Keep only singular values which are (strictly) greater than cutoff. (Then the factorization holds only approximately). If
None
(default), ignored.- qtotal_LR[{charges|None}, {charges|None}]
The desired qtotal for U and VH, respectively.
[None, None]
(Default) is equivalent to[None, a.qtotal]
. A single None entry is replaced the unique charge satisfying the requirementU.qtotal + VH.qtotal = a.qtotal (modulo qmod)
.- inner_labels_LR: [{str|None}, {str|None}]
The first label corresponds to
U.legs[1]
, the second toVH.legs[0]
.- inner_qconj{+1, -1}
Direction of the charges for the new leg. Default +1. The new LegCharge is constructed such that
VH.legs[0].qconj = qconj
.
- a
- Returns