Matlab 的 eig() 和 eigs() 函数的 numpy 等价物 [英] numpy equivalents of eig() and eigs() functions of Matlab

查看:159
本文介绍了Matlab 的 eig() 和 eigs() 函数的 numpy 等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是 numpy 或 scipy 等价物

What is the numpy or scipy equivalent of

[V, D]= eig(A,-B)

还有

[V, D]= eigs(A,-B, 60, ‘SM’)

推荐答案

看看 scipy.linalg.eigscipy.sparse.linalg.eigs.

import scipy.linalg as la
import scipy.sparse.linalg as sla

# Matlab: [V, D] = eig(A, -B)
D, V = la.eig(A, -B)

# Matlab: [V, D]= eigs(A, -B, 60, ‘SM')
D, V = sla.eigs(A, 60, -B, which='SM')

请注意,一般情况下,您不会得到完全相同的结果.特征值可能有不同的顺序,特征向量可能有不同的缩放比例(特征向量不是唯一的).

Note that you will not, in general, get exactly the same results. The eigenvalues might be in a different order, and the eigenvectors might have a different scaling (eigenvectors are not unique).

这篇关于Matlab 的 eig() 和 eigs() 函数的 numpy 等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆