Jacobi Plane rotation for a matrix A

4 次查看(过去 30 天)
Ravindra
Ravindra 2020-8-21
编辑: Ravindra 2020-8-24
How to perform the Jacobi Rotation (Jacobi Method) for given matrix
There exists a rotation (c = cos(theta) and s = sin(theta))
For example how can we estimate rotation for the following matrix
A = [-17.7147 -38.4117 30.6475
-51.3024 17.3859 -10.0354
-19.3323 -38.8931 30.3686
-51.2891 18.9043 -11.1523
-21.42 -39.2796 29.9065
-51.1701 20.7146 -12.4891
-24.2543 -39.5276 29.3515
-51.0782 22.9095 -14.1458]
Using C++ Eigen libaray the result is following: http://eigen.tuxfamily.org/dox-3.2/classEigen_1_1JacobiRotation.html
Result = [ 110.564 -7.77137 -0.308057
0 87.445 -64.7691
0 0 1.86159
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0]
Using matlab inbuilt function qr ([~,R]=qr(A)) gives me the following:
R = [ 110.5645 -7.7714 -0.3081
0 -87.4451 64.7691
0 0 -1.8616
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0]
As you can see the first row result is same in C++ and matlab.
whereas the second and third row signs are not matching.
What is the correct solution or how can it be implemented in matlab?
Thank you!!

回答(1 个)

KSSV
KSSV 2020-8-21
Define the ngle of your rotation theta:
A = [-17.7147 -38.4117 30.6475
-51.3024 17.3859 -10.0354
-19.3323 -38.8931 30.3686
-51.2891 18.9043 -11.1523
-21.42 -39.2796 29.9065
-51.1701 20.7146 -12.4891
-24.2543 -39.5276 29.3515
-51.0782 22.9095 -14.1458] ;
theta = pi/4 ;
R = [cos(theta) sin(theta) 0 ;
-sin(theta) cos(theta) 0 ;
0 0 1] ;
Ar = A*R
  1 个评论
Ravindra
Ravindra 2020-8-21
编辑:Ravindra 2020-8-21
So for Jacobi Method we start from the bottom of the matrix with values -24.2543 and -51.0782. if we correctly estimate the cos and sin angles the result should be
[c,s] = -0.4289 0.9033
The rotation matrix will be
[ -0.4289 -0.9033
0.9033 -0.4289]
The A matrix is modified using this rotation and will be:
-17.7147 -38.4117 30.6475
-51.3024 17.3859 -10.0354
-19.3323 -38.8931 30.3686
-51.2891 18.9043 -11.1523
-21.4200 -39.2796 29.9065
-51.1701 20.7146 -12.4891
56.5443 -3.7398 0.1882
0 -45.5334 32.5819
The next step will be with values -51.1701 and 56.5443
[c,s] = 0.6710 0.7415
in C++ at this step the estimated c & s both have negative signs
-0.6710 -0.7415 % in C++
The problem is the Jacobi rotation matrices from C++ are different what I calculate with my own algorithm.
This results in different answers. I am not sure which is correct.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by