k=matrix(c(4,0,0,0,3,1,0,1,3),3,3)
eigen(k)
V=matrix(c(eigen(k)$vectors[,2],eigen(k)$vectors[,3],eigen(k)$vectors[,1]),3,3)
V=t(V)
library("pracma", lib.loc="C:/Users/123456/Documents/R/win-library/3.0")
Λ=inv(V)%*%k%*%V
Λ
φx1=sqrt(diag(Λ))*V[1,] #对所有输入样本做映射
φx1
φx2=sqrt(diag(Λ))*V[2,] #对所有输入样本做映射
φx2
φx3=sqrt(diag(Λ))*V[3,] #对所有输入样本做映射
φx3
dot(φx1,φx3) #做内积<φx1,φx3>=2*0+0*sqrt(2)+0*1=0=k(x1,x2)
dot(φx2,φx3) #做内积<φx2,φx3>=0*0+sqrt(2)*sqrt(2)+(-1)*1=1=k(x1,x2)
dot(φx1,φx2) #做内积<φx1,φx2>=2*0+0*sqrt(2)+0*1=0=k(x1,x2)
相应理论部分可参考:http://www.cnblogs.com/vivounicorn/archive/2010/12/13/1904720.html