📄 vsvd.dat
字号:
./vsvdTesting Singular Value Decompositions of rectangular matricesRotated by PI/2 Matrix Diag(1,4,9)SVD-decompose matrix A and check if we can compose it backoriginal matrix follows Matrix 1:3x1:3 is not engaged | 1 | 2 | 3 |------------------------------------------------------------------------------- 1 | 0 -4 0 2 | 1 0 0 3 | 0 0 9 Doneleft factor U follows Matrix 1:3x1:3 is not engaged | 1 | 2 | 3 |------------------------------------------------------------------------------- 1 | 0 -1 0 2 | 1 0 0 3 | 0 0 -1 DoneVector of Singular values follows Matrix 1:3x1:1 is not engaged | 1 |------------------------------------------------------------------------------- 1 | 1 2 | 4 3 | 9 Doneright factor V follows Matrix 1:3x1:3 is not engaged | 1 | 2 | 3 |------------------------------------------------------------------------------- 1 | 1 0 0 2 | 0 1 0 3 | 0 0 -1 Done checking that U is orthogonal indeed, i.e., U'U=E and UU'=E checking that V is orthogonal indeed, i.e., V'V=E and VV'=E checking that U*Sig*V' is indeed AComparison of two Matrices: Original A and composed USigV'Matrix 1:3x1:3 is not engagedMatrix 1:3x1:3 is not engagedMaximal discrepancy 0 occured at the point (1,1) Matrix 1 element is 0 Matrix 2 element is 0 Absolute error v2[i]-v1[i] 0 Relative error 0||Matrix 1|| 14||Matrix 2|| 14||Matrix1-Matrix2|| 0||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||) 0DoneExample from the Forsythe, Malcolm, Moler's bookSVD-decompose matrix A and check if we can compose it backoriginal matrix follows Matrix 1:5x1:3 is not engaged | 1 | 2 | 3 |------------------------------------------------------------------------------- 1 | 1 6 11 2 | 2 7 12 3 | 3 8 13 4 | 4 9 14 5 | 5 10 15 Doneleft factor U follows Matrix 1:5x1:5 is not engaged | 1 | 2 | 3 | 4 | 5 |------------------------------------------------------------------------------- 1 | -0.3546 -0.6887 0.6166 0.1053 0.09335 2 | -0.3987 -0.3756 -0.719 0.0332 0.4266 3 | -0.4428 -0.06242 -0.1225 -0.6264 -0.6266 4 | -0.487 0.2507 -0.06442 0.732 -0.4 5 | -0.5311 0.5638 0.2893 -0.2441 0.5066 DoneVector of Singular values follows Matrix 1:3x1:1 is not engaged | 1 |------------------------------------------------------------------------------- 1 | 35.13 2 | 2.465 3 | 9.384e-07 Doneright factor V follows Matrix 1:3x1:3 is not engaged | 1 | 2 | 3 |------------------------------------------------------------------------------- 1 | -0.2017 0.8903 0.4082 2 | -0.5168 0.2573 -0.8165 3 | -0.832 -0.3757 0.4082 Done checking that U is orthogonal indeed, i.e., U'U=E and UU'=ETwo (3,3) elements of matrices with values 1 and 1differ the most, although the deviation 3.57628e-07 is smallTwo (1,1) elements of matrices with values 1 and 1differ the most, although the deviation 2.98023e-07 is small checking that V is orthogonal indeed, i.e., V'V=E and VV'=ETwo (3,3) elements of matrices with values 1 and 1differ the most, although the deviation 2.38419e-07 is smallTwo (2,2) elements of matrices with values 1 and 1differ the most, although the deviation 2.38419e-07 is small checking that U*Sig*V' is indeed AComparison of two Matrices: Original A and composed USigV'Matrix 1:5x1:3 is not engagedMatrix 1:5x1:3 is not engagedMaximal discrepancy 2.86102e-06 occured at the point (3,3) Matrix 1 element is 13 Matrix 2 element is 13 Absolute error v2[i]-v1[i] 2.86102e-06 Relative error 2.20079e-07||Matrix 1|| 120||Matrix 2|| 120||Matrix1-Matrix2|| 1.75238e-05||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||) 1.46031e-07DoneExample from the Wilkinson, Reinsch's bookSingular numbers are 0, 19.5959, 20, 0, 35.3270SVD-decompose matrix A and check if we can compose it backoriginal matrix follows Matrix 1:8x1:5 is not engaged | 1 | 2 | 3 | 4 | 5 |------------------------------------------------------------------------------- 1 | 22 10 2 3 7 2 | 14 7 10 0 8 3 | -1 13 -1 -11 3 4 | -3 -2 13 -2 4 5 | 9 8 1 -2 4 6 | 9 1 -7 5 -1 7 | 2 -6 6 5 1 8 | 4 5 0 -2 2 Doneleft factor U follows Matrix 1:8x1:8 is not engaged | 1 | 2 | 3 | 4 | 5 | 6 |------------------------------------------------------------------------------- 1 | -0.7071 -0.03947 -0.1581 -0.1768 -0.6103 -0.2525 2 | -0.5303 -0.06776 -0.1581 0.3536 0.6684 -0.2045 3 | -0.1768 0.5427 0.7906 0.1768 -0.04694 -0.06163 4 | 1.311e-08 0.01841 -0.1581 0.7071 -0.3594 0.4664 5 | -0.3536 -0.2384 0.1581 -1.454e-06 0.1153 0.6245 6 | -0.1768 0.4018 -0.1581 -0.5303 0.1656 0.5169 7 | 1.508e-08 0.6851 -0.4743 0.1768 0.03423 -0.09679 8 | -0.1768 -0.1064 0.1581 -1.467e-06 0.08647 -0.08057 | 7 | 8 |------------------------------------------------------------------------------- 1 | -0.02099 -0.07445 2 | -0.2291 -0.1517 3 | -0.03788 -0.1029 4 | -0.3412 0.1073 5 | 0.6179 -0.08938 6 | -0.4479 0.07655 7 | 0.4963 0.1322 8 | 0.02121 0.9581 DoneVector of Singular values follows Matrix 1:5x1:1 is not engaged | 1 |------------------------------------------------------------------------------- 1 | 35.33 2 | 1.68e-06 3 | 20 4 | 19.6 5 | 9.104e-07 Doneright factor V follows Matrix 1:5x1:5 is not engaged | 1 | 2 | 3 | 4 | 5 |------------------------------------------------------------------------------- 1 | -0.8006 0.4191 -0.3162 -0.2887 0 2 | -0.4804 -0.4405 0.6325 -5.918e-06 -0.4185 3 | -0.1601 0.052 -0.3162 0.866 -0.3488 4 | -1.965e-08 -0.6761 -0.6325 -0.2887 -0.2442 5 | -0.3203 -0.413 2.661e-06 0.2887 0.8022 Done checking that U is orthogonal indeed, i.e., U'U=E and UU'=ETwo (1,1) elements of matrices with values 1 and 1differ the most, although the deviation 2.38419e-07 is smallTwo (1,1) elements of matrices with values 1 and 1differ the most, although the deviation 3.57628e-07 is small checking that V is orthogonal indeed, i.e., V'V=E and VV'=E
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -