#11248: SVD matrix decomposition may return a non-invertible "unitary" matrix
------------------------------+---------------------------------------------
Reporter: rbeezer | Owner: jason, was
Type: defect | Status: new
Priority: major | Milestone: sage-4.7
Component: linear algebra | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
------------------------------+---------------------------------------------
On one particular configuration (Mac, gcc 4.2.1) it appears the `NumPy`
SVD matrix decomposition is returning a matrix that is not unitary,
contrary to what the documentation says (and the properties the
decomposition should have). Note Sage does a conjugate-transpose on the
`NumPy` version of V, but since this is the inverse of a unitary matrix,
it has no bearing on the check below. The fault with V below is a column
of zeros. Rephrasing the previous comment, a row of zeros would be
equally bad (not invertible, for starters).
Configuration info and example below from Samuel Lelievre, and a repeat of
the matrix from the failing doctest introduced at #10863. Note V has a
final column of all zeros.
Documentation of wrapped SVD:
http://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.svd.html#scipy.linalg.svd
Semi-related, semi-confusing documentation discussion: #9011
{{{
$ date -u "+Date: %F %T Z"
Date: 2011-04-24 11:04:00 Z
$ uname -a
Darwin U 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009;
root:xnu-1228.15.4~1/RELEASE_I386 i386
$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc_42/gcc_42-5577~1/src/configure --disable-
checking --enable-werror --prefix=/usr --mandir=/usr/share/man --enable-
languages=c,objc,c++,obj-c++ --program-transform-
name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-
darwin9 --with-gxx-include-dir=/usr/include/c++/4.0.0 --host=i686-apple-
darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5577)
$ cd /Applications/sage-4.7.alpha5
$ ./sage
----------------------------------------------------------------------
| Sage Version 4.7.alpha5, Release Date: 2011-04-19 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
**********************************************************************
* *
* Warning: this is a prerelease version, and it may be unstable. *
* *
**********************************************************************
sage: sage: A = matrix(CDF, [[ 1 - I, -3*I, -2 + I, 1, -2 +
3*I],
....: ... [ 1 - I, -2 + I, 1 + 4*I, 0, 2 +
I],
....: ... [ -1, -5 + I, -2 + I, 1 + I, -5 -
4*I],
....: ... [-2 + 4*I, 2 - I, 8 - 4*I, 1 - 8*I, 3 -
2*I]])
sage: sage: U, S, V = A.SVD()
sage: sage: U
[ -0.19814141337
-0.308971396837 -0.660350071544
-0.65514459416]
[ -0.101309655406 + 0.221246759763*I 0.0281679782559 +
0.228038474533*I 0.21409853948 + 0.537850297688*I -0.198443898186
- 0.71658226052*I]
[ -0.269917087381 - 0.133290918508*I 0.854014906857 -
0.285615383107*I -0.257796142317 + 0.167969516429*I -0.0612822342421 +
0.00570675954826*I]
[ 0.891629724122 + 0.12609891898*I 0.117076865049 -
0.16467268911*I -0.330988290968 + 0.15681453211*I 0.00874000243566 -
0.118536816828*I]
sage: sage: S
[14.7392195065 0 0 0 0]
[ 0 8.03673751296 0 0 0]
[ 0 0 5.55372875787 0 0]
[ 0 0 0 2.07902750599 0]
sage: sage: V
[ -0.103780564012 - 0.255347993379*I -0.280673753855 + 0.0116823968595*I
0.10136055387 + 0.168166900035*I -0.272892623178 - 0.660772348871*I
0]
[ 0.223710700338 + 0.0776561565738*I -0.495868002873 - 0.130571095626*I
0.134650496144 - 0.696875952139*I 0.0617790230965 - 0.254643364*I
0]
[ 0.557366391081 + 0.402764608049*I 0.144327862917 - 0.0880357525471*I
0.197092307875 + 0.0349722541821*I -0.520505493072 - 0.063071740502*I
0]
[-0.0487482425143 + 0.501774390263*I 0.210767926924 - 0.0457509105016*I
-0.420560914497 - 0.371880987879*I 0.118475810204 + 0.00883691841234*I
0]
[ 0.320257848046 + 0.195842789503*I -0.192207323094 + 0.73899332378*I
0.287600691016 + 0.140461871207*I 0.357713836525 + 0.0571998104689*I
0]
sage: sage: U.conjugate().transpose()*U
[ 1.0 - 1.38777878078e-17*I 1.38777878078e-17 +
2.94902990916e-17*I -1.11022302463e-16*I
1.32055824609e-16*I]
[ 1.38777878078e-17 - 2.77555756156e-17*I 1.0 -
1.04083408559e-17*I 4.85722573274e-17 + 3.46944695195e-17*I
2.32236105346e-16 + 4.92227786308e-17*I]
[ 1.11022302463e-16*I 4.85722573274e-17 -
1.38777878078e-17*I 1.0 - 6.93889390391e-18*I
-4.38017677684e-17 + 6.17995238317e-17*I]
[ -1.2490009027e-16*I 2.32236105346e-16 -
4.85722573274e-17*I -4.38017677684e-17 - 5.55111512313e-17*I
1.0 - 1.17093834628e-17*I]
sage: sage: V.conjugate().transpose()*V
[ 1.0 + 1.38777878078e-17*I -8.32667268469e-17 +
2.8449465006e-16*I 1.38777878078e-16 - 1.45716771982e-16*I
-1.94289029309e-16 + 1.38777878078e-17*I
0]
[-8.32667268469e-17 - 2.77555756156e-16*I
1.0 -7.56339435526e-16 + 1.38777878078e-16*I 5.55111512313e-17 -
1.66533453694e-16*I 0]
[ 1.38777878078e-16 + 1.17961196366e-16*I -7.56339435526e-16 -
1.28369537222e-16*I 1.0 + 6.93889390391e-18*I
-3.88578058619e-16 + 4.16333634234e-17*I
0]
[-1.94289029309e-16 - 1.04083408559e-17*I 5.55111512313e-17 +
1.99493199737e-16*I -3.88578058619e-16 - 2.08166817117e-17*I
1.0 - 6.93889390391e-18*I 0]
[ 0
0 0
0 0]
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11248>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.