0
votes

С++ have a very efficient algorithm to calculate eigenvalues and eigenvectors in MKL library with function dgeev. But it calculates all Eigenvalues, and all left and rirhgt eigenvectors.

DGEEV Example Program Results

Eigenvalues ( 2.86, 10.76) ( 2.86,-10.76) ( -0.69, 4.70) ( -0.69, -4.70) -10.46

Left eigenvectors ( 0.04, 0.29) ( 0.04, -0.29) ( -0.13, -0.33) ( -0.13, 0.33) 0.04 ( 0.62, 0.00) ( 0.62, 0.00) ( 0.69, 0.00) ( 0.69, 0.00) 0.56 ( -0.04, -0.58) ( -0.04, 0.58) ( -0.39, -0.07) ( -0.39, 0.07) -0.13 ( 0.28, 0.01) ( 0.28, -0.01) ( -0.02, -0.19) ( -0.02, 0.19) -0.80 ( -0.04, 0.34) ( -0.04, -0.34) ( -0.40, 0.22) ( -0.40, -0.22) 0.18

Right eigenvectors ( 0.11, 0.17) ( 0.11, -0.17) ( 0.73, 0.00) ( 0.73, 0.00) 0.46 ( 0.41, -0.26) ( 0.41, 0.26) ( -0.03, -0.02) ( -0.03, 0.02) 0.34 ( 0.10, -0.51) ( 0.10, 0.51) ( 0.19, -0.29) ( 0.19, 0.29) 0.31 ( 0.40, -0.09) ( 0.40, 0.09) ( -0.08, -0.08) ( -0.08, 0.08) -0.74 ( 0.54, 0.00) ( 0.54, 0.00) ( -0.29, -0.49) ( -0.29, 0.49) 0.16

For large matrices it takes a lot of time. Especially if you need to calculate eigenvectors for a large number of matrices.

So the main question is how can I calculate the only one eigenvector for real matrix only for one eigenvalue lambda = 1 as fast as possible? Or how I can solve the system of linear equations A-E=0, where A is a real matrix, E - Identity matrix. The eigenvector 100% exist and it consists only real numbers.

1
This isn't really a C++ question. It is algorithms that are used to find eigenvalues and eigenvectors, and algorithms are independent of programming language. There are various algorithms to find the largest eigenvalue of a matrix, but the choice of algorithm depends on properties of the matrix. For an example of relevant discussion, have a look at scicomp.stackexchange.com/questions/1681/…Peter
I know that my max eigenvalue = 1 for all matrix. There is no question, how I can find the eigenvalues. There is a question of how I can compute one eigenvector for eigenvalue = 1 with maximum performance. If found in Eigen library EigenSolver. And it consist doComputeEigenvectors(). But it complicated to extract this function.petr

1 Answers

0
votes

You can't really solve B x = 0 with B = A - I. This equation has infinitely many solutions if A has a unit eigenvalue.

For the simplest solution, put x(n) = 1 for arbitrary n, say n = N. Then use first N-1 equations to find x(1:N-1). Effectively, you'll have to solve B' x' = r for x' = x(1:N-1), where B' = B(1:N-1, 1:N-1), and r = -B(1:N-1,N). This can easily be done using MKL/LAPACK ?gesv routine specifying appropriate values for matrix sizes and leading dimensions.

Note that depending on A, B' can also be singular. Then you'll have to fix more x_n components. In the extreme case, when A = I, all x_ns are arbitrary.