# Iteration of SVD factorization

**URL:** <https://discourse.julialang.org/t/iteration-of-svd-factorization/24445>\
**Category:** General Usage\
**Tags:** linearalgebra\
**Created:** [May 21, 2019, 6:22pm UTC](https://discourse.julialang.org/t/iteration-of-svd-factorization/24445 "2019-05-21T18:22:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [May 21, 2019, 6:22pm UTC](https://discourse.julialang.org/t/iteration-of-svd-factorization/24445/1 "2019-05-21T18:22:58Z")

</div>

I was suprised to see that iterating a `SVD` gives `U`, `S`, and `V` instead of `U`, `S`, and `Vt`. After all it is `U * Diagonal(S) * Vt` which restores the factorized matrix.

Returning `Vt` would also make more sense to me from a technical point of view as the algorithm produces `Vt` whereas `V` has to be (lazily) calculated.

Note that because of this, one unfortunately can’t unpack a SVD like so

```julia
U, S, Vt = svd(M)

```

Is there any deeper reason behind this choice or would it make sense to change this? However, It’d be a breaking change, wouldn’t it?

---

<div class="post-metadata">

**Author:** ![zgornel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zgornel/32/217487_2.png) [@zgornel](https://discourse.julialang.org/u/zgornel)\
**Post date:** [May 21, 2019, 6:31pm UTC](https://discourse.julialang.org/t/iteration-of-svd-factorization/24445/2 "2019-05-21T18:31:00Z")

</div>

If it makes any difference, there is no performance penalty in the reconstruction if `V` is returned insteat of `V'`. As to the choice of returning `V`, I suppose it may be just simplicity: the canonical reconstruction formula is `USV'` if `U,S,V = svd(X)`

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [May 21, 2019, 6:37pm UTC](https://discourse.julialang.org/t/iteration-of-svd-factorization/24445/3 "2019-05-21T18:37:17Z")

</div>

This is true, but maybe I don’t want to reconstruct but perform operations on `Vt`.

I fail to see why `USV'` is better or more canonical than `USVt`. I’d say it’s more natural to expect `svd(X)` to unfold to the components which when recombined give back the original matrix. But maybe that’s a matter of taste.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 21, 2019, 7:38pm UTC](https://discourse.julialang.org/t/iteration-of-svd-factorization/24445/4 "2019-05-21T19:38:27Z")

</div>

> [@carstenbauer](#):
>
> I fail to see why `USV'` is better or more canonical than `USVt` .

You might as well ask why Hemitian eigenvector decompositions `A = QΛQ'` return the matrix `Q` whose columns are the eigenvectors rather than `Q'`. Of course, `Q` and `Q'` contain exactly the same information, but when thinking about vectors that form a basis it is conventional to put the basis vectors as the columns. With column-major storage, this also means that accessing a particular basis vector `Q[:,k]` involves contiguous memory access.

In the same way, the both the `U` and `V` vectors of the SVD are basis vectors (and are in fact eigenvectors of `AA'` and `A'A` respectively), and one of the main ways in which you use the SVD is to examine the singular vectors corresponding to large singular values, so it is conventional to access them by columns. Moreover, the basis vectors `U` and `V` play analogous roles, so it would be odd to transpose one and not the other.
