# 进行奇异值分解
svd <- svd ( df_center )
svd $ d
#> [1] 11.024148 6.964086 4.179904 2.915146
svd $ u
#> [,1] [,2] [,3] [,4]
#> [1,] -0.088502119 -0.16111249 0.105218608 0.0530665011
#> [2,] -0.175119011 -0.15255799 -0.483145153 -0.1489378244
#> [3,] -0.158329049 0.10603826 -0.012974042 -0.2834384049
#> [4,] 0.012699298 -0.15917987 -0.027135114 -0.0620804497
#> [5,] -0.226649068 0.21932910 -0.141759482 -0.1161380178
#> [6,] -0.136005136 0.14038162 -0.259336498 0.0004974586
#> [7,] 0.122004202 0.15479183 0.152346210 -0.0402308322
#> [8,] -0.004284214 0.04624999 0.170197773 -0.2995093258
#> [9,] -0.270566006 -0.00557636 0.136613685 -0.0326971796
#> [10,] -0.147204794 -0.18180252 0.081106695 0.3656676469
#> [11,] 0.081955040 0.22324195 -0.012026954 0.3065826885
#> [12,] 0.147251202 -0.02998994 -0.061530174 -0.1694899353
#> [13,] -0.123823808 0.09692418 0.160455000 -0.0414370084
#> [14,] 0.045389560 0.02154472 -0.054011475 0.1442115222
#> [15,] 0.202373535 0.01479136 -0.038974667 0.0059617844
#> [16,] 0.071558552 0.03840409 -0.006051930 0.0701237800
#> [17,] 0.067425851 -0.13624293 0.006718884 0.2277132300
#> [18,] -0.140517959 -0.12382100 0.185555941 0.1544203417
#> [19,] 0.215231159 -0.05350432 0.015555919 -0.1122203023
#> [20,] -0.158347534 -0.06079147 0.037242408 -0.1898534932
#> [21,] 0.043656895 0.20960067 0.144350623 -0.0609897144
#> [22,] -0.189334383 0.02208976 -0.091150533 0.0347643443
#> [23,] 0.151999911 0.08987636 -0.036252509 0.0228600295
#> [24,] -0.089483486 -0.34027971 0.175449706 0.0731840095
#> [25,] -0.062570302 0.03743606 -0.089392087 0.0766873549
#> [26,] 0.106451539 -0.07631705 -0.058472149 0.0420214180
#> [27,] 0.113651981 0.02757065 -0.041582129 0.0053970395
#> [28,] -0.258115678 0.11025209 -0.275529769 0.1068057898
#> [29,] 0.214071497 0.00257041 -0.008728664 -0.0112530536
#> [30,] -0.016304324 0.20604821 0.181049718 0.0826499280
#> [31,] -0.177802722 -0.02030605 -0.043504824 -0.1153016522
#> [32,] -0.151092550 0.11701618 0.152302994 -0.0045791345
#> [33,] -0.100877464 -0.31671218 0.204524432 -0.3240968906
#> [34,] 0.268696706 -0.08516514 -0.071353148 -0.0862511360
#> [35,] 0.020291306 0.10550966 0.007374849 0.1609363198
#> [36,] 0.027997563 0.04091867 0.003625902 0.0035087357
#> [37,] -0.005309061 0.07696200 -0.222585787 -0.0807475502
#> [38,] 0.079778211 0.08118230 0.094883089 0.1219329726
#> [39,] 0.077565243 0.21208574 0.324451737 -0.2083610270
#> [40,] -0.118598723 -0.27483477 0.071178009 -0.0446445538
#> [41,] 0.178498756 -0.11703880 -0.092198470 -0.0372092940
#> [42,] -0.089775081 -0.12228530 -0.044544714 0.2217051038
#> [43,] -0.121689077 0.05863443 0.116539361 0.2184216921
#> [44,] 0.049439812 0.20917537 -0.069565218 -0.0279528910
#> [45,] 0.251561949 -0.19933619 -0.199240942 -0.0492029259
#> [46,] 0.008650709 -0.02839251 -0.002773945 0.0717790646
#> [47,] 0.019477550 0.13790380 -0.147991604 -0.0749973365
#> [48,] 0.189347337 -0.20254292 -0.024814359 0.0447947015
#> [49,] 0.186754750 0.08689225 0.032888157 0.0625194853
#> [50,] 0.056521430 -0.04563221 0.056996643 -0.0565930091
svd $ v
#> [,1] [,2] [,3] [,4]
#> [1,] -0.5358995 -0.4181809 0.3412327 0.64922780
#> [2,] -0.5831836 -0.1879856 0.2681484 -0.74340748
#> [3,] -0.2781909 0.8728062 0.3780158 0.13387773
#> [4,] -0.5434321 0.1673186 -0.8177779 0.08902432
# 奇异值的平方和
sum ( svd $ d ^ 2 )
#> [1] 196
# 奇异值的对角矩阵
D <- diag ( svd $ d )
# df_center X = U D V'
X <- svd $ u %*% D %*% t ( svd $ v )
# D = U' X V
t ( svd $ u ) %*% X %*% svd $ v
#> [,1] [,2] [,3] [,4]
#> [1,] 1.102415e+01 1.110223e-15 8.881784e-16 3.219647e-15
#> [2,] 2.220446e-16 6.964086e+00 6.661338e-16 1.318390e-15
#> [3,] -2.220446e-16 4.440892e-16 4.179904e+00 -8.881784e-16
#> [4,] -4.440892e-16 1.436351e-15 -9.436896e-16 2.915146e+00