Ask Your Question

Revision history [back]

Just make the product !

See the documentation of SDV of complex matrices:

sage: m = random_matrix(CDF,3)
sage: m.SVD?

You will read:

OUTPUT:

* U, S, V -- immutable matrices such that A =
  U*S*V.conj().transpose() where U and V are orthogonal and S is
  zero off of the diagonal.

So:

sage: m
[  0.3310137301437883 + 0.5895210280973311*I 0.7988060507482333 + 0.001845004960518093*I     0.55953531271306 - 0.4157959932143387*I]
[ 0.31728704666930097 + 0.5252900028355088*I   -0.8037722831442571 + 0.748001134324078*I   0.7570395959647946 + 0.8725543726416196*I]
[  0.5889022178823824 + 0.8257326198637103*I -0.6730668617375402 - 0.17790861779943956*I  -0.5589487514702225 - 0.4466254251771886*I]

sage: U, S, V = m.SVD()

sage: U
[  -0.284121544687194 + 0.39939285686891435*I   0.09804396065119658 + 0.4371298831463562*I    0.5260128510587949 + 0.5313902721050954*I]
[ -0.47799684194289516 - 0.6394302833691484*I    0.0839847095503589 + 0.3326361102951883*I    0.3181936443645485 - 0.3790785184872727*I]
[  0.31925731509669564 - 0.1431188047985596*I    0.5908610195338464 + 0.5766176283510003*I -0.42684312329846164 + 0.11743972425625948*I]

sage: S
[ 2.014692905047209                0.0                0.0]
[               0.0 1.4672457517786448                0.0]
[               0.0                0.0 0.5578468204334117]

sage: V
[                         -0.1371487984082707                           0.8966597362597599                          0.42094123635698283]
[  -0.2530085556355167 + 0.6671921582633321*I -0.16346409265449802 - 0.18004222519028812*I    0.2657659576982525 + 0.6008943651067534*I]
[   -0.674728237753376 + 0.1295118025530403*I  -0.24594930656467023 + 0.2763594462509048*I   0.30406779436784737 - 0.5464848302324682*I]

sage: U*S*V.conjugate().transpose() == m
False

BUT, this is only because of numerical noise:

sage: (U*S*V.conjugate().transpose() - m).norm()
7.714272089062928e-16

Just make the product !

See the documentation of SDV SVD of complex matrices:

sage: m = random_matrix(CDF,3)
sage: m.SVD?

You will read:

OUTPUT:

* U, S, V -- immutable matrices such that A =
  U*S*V.conj().transpose() where U and V are orthogonal and S is
  zero off of the diagonal.

So:

sage: m
[  0.3310137301437883 + 0.5895210280973311*I 0.7988060507482333 + 0.001845004960518093*I     0.55953531271306 - 0.4157959932143387*I]
[ 0.31728704666930097 + 0.5252900028355088*I   -0.8037722831442571 + 0.748001134324078*I   0.7570395959647946 + 0.8725543726416196*I]
[  0.5889022178823824 + 0.8257326198637103*I -0.6730668617375402 - 0.17790861779943956*I  -0.5589487514702225 - 0.4466254251771886*I]

sage: U, S, V = m.SVD()

sage: U
[  -0.284121544687194 + 0.39939285686891435*I   0.09804396065119658 + 0.4371298831463562*I    0.5260128510587949 + 0.5313902721050954*I]
[ -0.47799684194289516 - 0.6394302833691484*I    0.0839847095503589 + 0.3326361102951883*I    0.3181936443645485 - 0.3790785184872727*I]
[  0.31925731509669564 - 0.1431188047985596*I    0.5908610195338464 + 0.5766176283510003*I -0.42684312329846164 + 0.11743972425625948*I]

sage: S
[ 2.014692905047209                0.0                0.0]
[               0.0 1.4672457517786448                0.0]
[               0.0                0.0 0.5578468204334117]

sage: V
[                         -0.1371487984082707                           0.8966597362597599                          0.42094123635698283]
[  -0.2530085556355167 + 0.6671921582633321*I -0.16346409265449802 - 0.18004222519028812*I    0.2657659576982525 + 0.6008943651067534*I]
[   -0.674728237753376 + 0.1295118025530403*I  -0.24594930656467023 + 0.2763594462509048*I   0.30406779436784737 - 0.5464848302324682*I]

sage: U*S*V.conjugate().transpose() == m
False

BUT, this is only because of numerical noise:

sage: (U*S*V.conjugate().transpose() - m).norm()
7.714272089062928e-16