为了使得A收敛到一个对角矩阵,其非对角元素必须趋向于0. 秦 记o(A)为所有非对角元素的平方和,即 oiA=∑a喝=A呢-∑ 我们的目标就是使得of(A)尽快趋向于0. 引理设A=[aijnxn∈Rnxm是对称矩阵,A=[liilnxn=JTAJ,J= G(i,j,),其中0的选取使得a=ai=0,则 of(A)=ofA)-2a喝 (板书) http://math.ecnu.edu.cn/~jypan 6/77
为了使得 A(k) 收敛到一个对角矩阵, 其非对角元素必须趋向于 0. 记 off(A) 为所有非对角元素的平方和, 即 off(A) = X i̸=j a 2 ij = ∥A∥ 2 F − Xn i=1 a 2 ii , 我们的目标就是使得 off(A) 尽快趋向于 0. 引理 设 A = [aij ]n×n ∈ R n×n 是对称矩阵, Aˆ = [ˆaij ]n×n = J ⊺AJ, J = G(i, j, θ), 其中 θ 的选取使得 aˆij = ˆaji = 0, 则 off(Aˆ) = off(A) − 2a 2 ij (板书) http://math.ecnu.edu.cn/~jypan 6/77
算法1.1 Jacobi迭代算法 1:Given a symmetric matrix AE Rnxn 2:if eigenvectors are desired then set J=I and shift=1 4:end if 5:while not converge do 6: choose an index pair (i,j)such that aij 7: T=(aii-ajj)/(2aij) 8: t=sign(T)/(+v1+T2) %计算tan0 9: c=l/W1+tz,s=c~t%计算Givens变换 10: A=G(i,j,0)AG(i,j,0) %实际计算时不需要做矩阵乘积 1: if shift =1 then 12: J=J·G(i,j,) 13: end if 14:end while
算法 1.1 Jacobi 迭代算法 1: Given a symmetric matrix A ∈ R n×n 2: if eigenvectors are desired then 3: set J = I and shif t = 1 4: end if 5: while not converge do 6: choose an index pair (i, j) such that aij ̸= 0 7: τ = (aii − ajj )/(2aij ) 8: t = sign(τ )/(|τ | + √ 1 + τ 2) % 计算 tan θ 9: c = 1/√ 1 + t 2, s = c · t % 计算 Givens 变换 10: A = G(i, j, θ) ⊺AG(i, j, θ) % 实际计算时不需要做矩阵乘积 11: if shif t = 1 then 12: J = J · G(i, j, θ) 13: end if 14: end while