Singular value decomposition: Difference between revisions
Content added Content deleted
m (→{{header|Julia}}: typo) |
(Add Python) |
||
Line 77: | Line 77: | ||
-0.707107 0.707107 |
-0.707107 0.707107 |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|Python}}== |
|||
This implementation uses "numpy" library. |
|||
<syntaxhighlight lang=python> |
|||
from numpy import * |
|||
A = matrix([[3, 0], [4, 5]]) |
|||
U, Sigma, VT = linalg.svd(A) |
|||
print(U) |
|||
print(Sigma) |
|||
print(VT) |
|||
</syntaxhighlight> |
|||
{{output}} |
|||
<pre> |
|||
[[-0.31622777 -0.9486833 ] |
|||
[-0.9486833 0.31622777]] |
|||
[6.70820393 2.23606798] |
|||
[[-0.70710678 -0.70710678] |
|||
[-0.70710678 0.70710678]] |
|||
</pre> |