[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60273] Wrong result in GSVD
From: |
Nicholas Jankowski |
Subject: |
[Octave-bug-tracker] [bug #60273] Wrong result in GSVD |
Date: |
Fri, 20 Aug 2021 10:23:23 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 |
Follow-up Comment #14, bug #60273 (project octave):
Appears to be in a holding pattern for the moment.
Regarding expected output, here's a current comparison with Matlab 2021:
Docs example 1:
>> A = reshape(1:15,5,3)
A =
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
>> B = magic(3)
B =
8 1 6
3 5 7
4 9 2
>> [U,V,X,C,S] = gsvd(A,B)
U =
0.5618 0.6457 -0.4279 -0.0735 0.2810
-0.8005 0.3296 -0.4375 0.1240 0.2094
-0.0219 0.0135 -0.4470 -0.4343 -0.7816
0.1979 -0.3026 -0.4566 0.7906 -0.1889
0.0626 -0.6187 -0.4661 -0.4068 0.4802
V =
-0.7071 -0.6946 0.1325
0.0000 -0.1874 -0.9823
0.7071 -0.6946 0.1325
X =
-2.8284 -9.3761 -6.9346
5.6569 -8.3071 -18.3301
-2.8284 -7.2381 -29.7256
C =
0.0000 0 0
0 0.3155 0
0 0 0.9807
0 0 0
0 0 0
S =
1.0000 0 0
0 0.9489 0
0 0 0.1957
Octave 6.3.0:
>> A = reshape(1:15,5,3)
A =
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
>> B = magic(3)
B =
8 1 6
3 5 7
4 9 2
>> [U,V,X,C,S,R] = gsvd(A,B)
U =
-0.427930 -0.645660 0.620200 0.120196 0.030090
-0.437470 -0.329576 -0.678075 0.048816 0.487680
-0.447010 -0.013492 -0.165583 -0.665944 -0.573674
-0.456550 0.302592 -0.115408 0.704656 -0.436052
-0.466091 0.618676 0.338866 -0.207724 0.491956
V =
1.3251e-01 6.9458e-01 -7.0711e-01
-9.8229e-01 1.8739e-01 2.4980e-16
1.3251e-01 6.9458e-01 7.0711e-01
X =
0.642906 0.648078 0.408248
-0.060330 0.574190 -0.816497
-0.763565 0.500301 0.408248
C =
Diagonal Matrix
9.8067e-01 0 0
0 3.1553e-01 0
0 0 2.5093e-16
S =
Diagonal Matrix
0.1957 0 0
0 0.9489 0
0 0 1.0000
R =
19.3450 -29.8908 0.0000
0 14.4676 -0.0000
0 0 -6.9282
example 2:
Matlab 2021a
>> A = reshape(1:15,3,5)
A =
1 4 7 10 13
2 5 8 11 14
3 6 9 12 15
>> B = magic(5)
B =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
>> [U,V,X,C,S] = gsvd(A,B)
U =
0.4082 0.7178 -0.5639
-0.8165 0.0109 -0.5772
0.4082 -0.6961 -0.5906
V =
-0.2725 0.7746 0.3339 -0.4552 -0.0843
-0.6610 -0.4058 -0.3111 -0.5408 0.0956
-0.0078 -0.0524 -0.1701 -0.0271 -0.9836
0.6218 0.1439 -0.5395 -0.5408 0.0956
0.3195 -0.4603 0.6868 -0.4552 -0.0843
X =
-10.1340 0 0.0000 -30.7287 -4.6958
3.3206 9.6882 11.3264 -28.5003 -11.6858
14.8016 -11.5196 2.8654 -26.2720 -18.6758
2.1067 1.5695 -15.0424 -24.0436 -25.6657
-10.0949 0.2619 0.8506 -21.8152 -32.6557
C =
0 0 0.0000 0 0
0 0 0 0.0439 0
0 0 0 0 0.7432
S =
1.0000 0 0 0 0
0 1.0000 0 0 0
0 0 1.0000 0 0
0 0 0 0.9990 0
0 0 0 0 0.6690
Octave 6.3.0
>> A = reshape(1:15,3,5)
A =
1 4 7 10 13
2 5 8 11 14
3 6 9 12 15
>> B = magic(5)
B =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
>> [U,V,X,C,S,R] = gsvd(A,B)
U =
-0.563938 0.717849 0.408248
-0.577248 0.010868 -0.816497
-0.590558 -0.696114 0.408248
V =
-0.084305 -0.455168 0.239134 0.747904 0.411301
0.095559 -0.540792 -0.813938 0.043357 -0.184492
-0.983627 -0.027052 -0.060572 -0.016259 -0.166771
0.095559 -0.540792 0.511078 -0.124651 -0.649365
-0.084305 -0.455168 0.124299 -0.650352 0.589327
X =
0.654138 -0.521137 0.476156 0.248539 0.109654
-0.025779 -0.447052 -0.669616 0.161852 0.569999
-0.048443 -0.444582 0.053606 -0.892150 -0.034576
-0.071106 -0.442113 -0.325192 0.235599 -0.798889
-0.751023 -0.368028 0.465045 0.246160 0.153812
C =
Diagonal Matrix
7.4324e-01 0 0
0 4.3892e-02 0
0 0 1.0474e-16
S =
Diagonal Matrix
0.6690 0 0
0 0.9990 0
0 0 1.0000
R =
24.4845 39.3396 -2.2522 -0.4822 8.9512
0 59.0936 0.7180 0.1537 -2.8536
0 0 -14.0044 -8.3199 2.8868
0 0 0 19.8246 2.9090
0 0 0 0 18.8836
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60273>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/