热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何在R中得到矩阵的右特征向量?-HowtoobtainrighteigenvectorsofmatrixinR?

Edition:theprobleminmyquestionwasIvetriedtofindmatrixSfromequation8butthisequati

Edition : the problem in my question was I've tried to find matrix S from equation 8 but this equation have error.

版本:我的问题是,我试图从公式8中找到矩阵S,但这个方程有误差。

How to directly obtain right eigenvectors of matrix in R ? 'eigen()' gives only left eigenvectors

如何在R中直接获得矩阵的右特征向量?“特征”只给出左特征向量。

Really last edition, I've made big mess here, but this question is really important for me :

最后一版,我搞砸了,但这个问题对我来说很重要:

eigen() provides some matrix of eigenvectors, from function help :

eigen()提供了一些特征向量的矩阵,从函数帮助:

" If ‘r <- eigen(A)’, and ‘V <- r$vectors; lam <- r$values’, then

“如果r <- eigen(A)”和“V <- r$向量”;林<- r美元价值”

                      A = V Lmbd V^(-1)                         

(up to numerical fuzz), where Lmbd =diag(lam)"

(up to数值fuzz), Lmbd =diag(lam)

that is A V = V Lmbd, where V is matrix now we check it :

这是V = vlmbd, V是矩阵,我们检查一下

set.seed(1)
A<-matrix(rnorm(16),4,4)
Lmbd=diag(eigen(A)$values)
V=eigen(A)$vectors
A%*%V

> A%*%V
                      [,1]                  [,2]          [,3]           [,4]
[1,]  0.0479968+0.5065111i  0.0479968-0.5065111i  0.2000725+0i  0.30290103+0i
[2,] -0.2150354+1.1746298i -0.2150354-1.1746298i -0.4751152+0i -0.76691563+0i
[3,] -0.2536875-0.2877404i -0.2536875+0.2877404i  1.3564475+0i  0.27756026+0i
[4,]  0.9537141-0.0371259i  0.9537141+0.0371259i  0.3245555+0i -0.03050335+0i
> V%*%Lmbd
                      [,1]                  [,2]          [,3]           [,4]
[1,]  0.0479968+0.5065111i  0.0479968-0.5065111i  0.2000725+0i  0.30290103+0i
[2,] -0.2150354+1.1746298i -0.2150354-1.1746298i -0.4751152+0i -0.76691563+0i
[3,] -0.2536875-0.2877404i -0.2536875+0.2877404i  1.3564475+0i  0.27756026+0i
[4,]  0.9537141-0.0371259i  0.9537141+0.0371259i  0.3245555+0i -0.03050335+0i

and I would like to find matrix of right eigenvectors R,
equation which define matrix of left eigenvectors L is :

我想找到右特征向量的矩阵R,定义左特征向量的矩阵L是:

L A  = LambdaM L

equation which define matrix of right eigenvectors R is :

右特征向量R的定义矩阵为:

A R = LambdaM R

and eigen() provides only matrix V:

和eigen()只提供矩阵V:

A V = V Lmbd

I would like to obtain matrix R and LambdaM for real matrix A which may be negative-definite.

我想要得到矩阵R和矩阵A,这可能是负定的。

2 个解决方案

#1


7  

A worked example.

一个工作的例子。

Default (= right eigenvectors):

默认(=右特征向量):

m <- matrix(1:9,nrow=3)
e <- eigen(m)
e1 <- e$vectors
zapsmall((m %*% e1)/e1) ## right e'vec
##          [,1]      [,2] [,3]
## [1,] 16.11684 -1.116844    0
## [2,] 16.11684 -1.116844    0
## [3,] 16.11684 -1.116844    0

Left eigenvectors:

左特征向量:

eL <- eigen(t(m))    
eL1 <- eL$vectors

(We have to go to a little more effort since we need to be multiplying by row vectors on the left; if we extracted just a single eigenvector, R's ignorance of row/column vector distinctions would make it "do the right thing" (i.e. (eL1[,1] %*% m)/eL1[,1] just works).)

(我们需要做更多的努力因为我们需要乘以左边的行向量;如果我们只提取一个特征向量,那么R对行/列向量的区分就会使它“做正确的事情”(即,eL1[,1] %*% m)/eL1[,1]只是工作)。

zapsmall(t(eL1) %*% m/(t(eL1)))
##          [,1]      [,2]      [,3]
## [1,] 16.116844 16.116844 16.116844
## [2,] -1.116844 -1.116844 -1.116844
## [3,]  0.000000  0.000000  0.000000

#2


4  

This should work

这应该工作

Given a matrix A.

给定一个矩阵。

lefteigen  <-  function(A){
  return(t(eigen(t(A))$vectors))
}

Every left eigenvector is the transpose of a right eigenvector of the transpose of a matrix

每一个左特征向量就是矩阵的转置的右特征向量的转置。


推荐阅读
author-avatar
mobiledu2502936307
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有