eigenvalue

How can I find the joint eigenvalues of two matrices in MATLAB?

十年热恋 提交于 2020-03-04 03:43:30
问题 If the joint eigenvalues of matrices A and B are defined as the roots of the equation det(lambda * A - B ) = 0, how can I solve this in MATLAB? In particular, I am not sure how exactly lambda is defined - it obviously needs to be a matrix or vector, as otherwise there would only be one joint eigenvalue. Also, I am not sure if there is any in-built function, or if, say, fzero for finding the roots of nonlinear functions needs to be used. 回答1: There is a built-in function for this. http://www

dangerous behavior of lapack routin zheev [duplicate]

有些话、适合烂在心里 提交于 2020-01-24 21:27:28
问题 This question already has answers here : Incorrect/inconsistent results from zgeev() LAPACK (2 answers) Closed 2 years ago . I stumbled upon an odd behavior when using the lapack routine zheev() . There are two issues which I do not understand 1) One of my global variables seems to be overwritten by zheev() . The following small program shows it: [compiled with gfortran -o test test.f90 -llapack -lblas ] program test implicit none integer, parameter :: dp = 8 integer, parameter :: dim = 3

accessing eigenvalues in RSSA package in R

狂风中的少年 提交于 2020-01-16 11:27:40
问题 I am using RSSA package in R and I need to access the eigenvalues. using the following code I can plot the components. However, I need to access all eigenvalues as numbers. require(Rssa) t=ssa(co2) plot(t) 回答1: I know almost nothing about this package. I'm taking from context that you want the values that are plotted on the y-axis of that graphic. Lacking a reproducible example, I turn to the ?ssa help page and use the first example: > s <- ssa(co2) > > plot(s) So that looks like your plot:

accessing eigenvalues in RSSA package in R

我与影子孤独终老i 提交于 2020-01-16 11:26:28
问题 I am using RSSA package in R and I need to access the eigenvalues. using the following code I can plot the components. However, I need to access all eigenvalues as numbers. require(Rssa) t=ssa(co2) plot(t) 回答1: I know almost nothing about this package. I'm taking from context that you want the values that are plotted on the y-axis of that graphic. Lacking a reproducible example, I turn to the ?ssa help page and use the first example: > s <- ssa(co2) > > plot(s) So that looks like your plot:

How to use eig with the nobalance option as in MATLAB?

南楼画角 提交于 2020-01-14 08:49:21
问题 In MATLAB I can issue the command: [X,L] = eig(A,'nobalance'); In order to compute the eigenvalues without the balance option. What is the equivalent command in NumPy? When I run the NumPy version of eig, it does not produce the same result as the MATLAB result with nobalance turned on. 回答1: NumPy can't currently do this. As horchler said, there has been an open ticket open for this for a while now. It is, however, possible to do it using external libraries. Here I write up how to do it using

Mapping array back to an existing Eigen matrix

允我心安 提交于 2019-12-28 16:06:29
问题 I want to map an array of double to an existing MatrixXd structure. So far I've managed to map the Eigen matrix to a simple array, but I can't find the way to do it back. void foo(MatrixXd matrix, int n){ double arrayd = new double[n*n]; // map the input matrix to an array Map<MatrixXd>(arrayd, n, n) = matrix; //do something with the array ....... // map array back to the existing matrix } 回答1: I'm not sure what you want, but I'll try to explain. You're mixing double and float in your code (a

Does Matlab eig always returns sorted values?

試著忘記壹切 提交于 2019-12-28 02:56:05
问题 I use a function at Matlab: [V,D] = eig(C); I see that V and D are always sorted ascending order. Does it always like that or should I sort them after I get V and D values? 回答1: V is NOT sorted in any order, except to correspond to the order of the associated eigenvalues. But perhaps you did not mean that. The eigenvalues TEND to be in descending order, but this is not assured at all. They tend to be in order because the largest tend to trickle out of the algorithm on top. Eig has no sort at

In Julia, The eigs() function for large sparse matrix went wrong

て烟熏妆下的殇ゞ 提交于 2019-12-25 16:48:37
问题 With Julia, I created a sparse matrix with the spzeros() function, initialized the matrix with some sentences, and tried to calculate the eigenvalue of it. However, the function works well only for small sparse matrix(n<800), for a little bit larger matrix, i got some error. The code: ns = 400 # 800 H = spzeros(Complex128, ns, ns) #... initialization E, x = eigs(H) The error message after the last sentence: LoadError: Base.LinAlg.ARPACKException("unspecified ARPACK error: 1") while loading In

Sort complex vectors in specific order

放肆的年华 提交于 2019-12-25 09:34:00
问题 I have vector with eigenvalues: e = -0.4094 + 3.9387i -0.4094 - 3.9387i -0.0156 + 0.5645i -0.0156 - 0.5645i And I would like to sort this vector like that: e_sort = -0.0156 + 0.5645i -0.4094 + 3.9387i -0.0156 - 0.5645i -0.4094 - 3.9387i The rule is: First must be: -a+b*i and then: -a-b*i We can say, that: 0 < b_1 < b_2 < ... < b_n Thanks, 回答1: e1 = e(imag(e) >= 0); e2 = e(imag(e) < 0); newe = cat(1,sort(e1),sort(e2)) newe = -0.0156 + 0.5645i -0.4094 + 3.9387i -0.0156 - 0.5645i -0.4094 - 3

Inaccurate zheev eigen values and vectors

☆樱花仙子☆ 提交于 2019-12-25 01:58:52
问题 I use the LAPACK zheev routine in a Fortran scientific code to compute both eigenvalues and vectors of a matrix not too big (likely to never exceed size 1000). Since this step happens at the beginning of the computation I have to achieve a great accuracy to avoid important error propagation. The problem is that the accuracy of the computation is only about 1e-9 in my test case (with a 12x12 matrix only) and that is not enough at all. I compared with numpy.linalg.eigh which give ridiculously