eigenvector

Matlab Codgen eig() function - strange behaviour

烂漫一生 提交于 2019-12-06 11:44:32
First, don't be fooled by the long post, there is not a lot of code just an observation of results so there are few example matrices. This is a bit related to this question: Matlab Codegen Eig Function - Is this a Bug? I know that mex/C/C++ translated eig() function may not return the same eigenvectors when using the same function in MATLAB and that's fine, but i am puzzled with results I'm getting. First this simple example: Output % c = diagonal matrix of eigenvalues % b = matrix whose columns are the corresponding right eigenvectors function [ b, c ] = eig_test(a) [b, c] = eig(a); end

Eigenvector (Spectral) Decomposition

三世轮回 提交于 2019-12-06 07:14:35
I am trying to find a program in C code that will allow me to compute a eigenvalue (spectral) decomposition for a square matrix. I am specifically trying to find code where the highest eigenvalue (and therefore its associated eigenvalue) are located int the first column. The reason I need the output to be in this order is because I am trying to compute eigenvector centrality and therefore I only really need to calculate the eigenvector associated with the highest eigenvalue. Thanks in advance! In any case I would recommend to use a dedicated linear algebra package like Lapack (Fortran but can

Sorting eigenvectors by their eigenvalues (associated sorting)

主宰稳场 提交于 2019-12-06 06:16:05
问题 I have an unsorted vector of eigenvalues and a related matrix of eigenvectors. I'd like to sort the columns of the matrix with respect to the sorted set of eigenvalues. (e.g., if eigenvalue[3] moves to eigenvalue[2], I want column 3 of the eigenvector matrix to move over to column 2.) I know I can sort the eigenvalues in O(N log N) via std::sort . Without rolling my own sorting algorithm, how do I make sure the matrix's columns (the associated eigenvectors) follow along with their eigenvalues

low RAM consuming c++ eigen solver

馋奶兔 提交于 2019-12-06 05:44:17
问题 I'm newbie in C++ programming , but I have a task to compute eigenvalues and eigenvectors (standard eigenproblem Ax=lx ) for symmetric matrices (and hermitian)) for very large matrix of size: binomial(L,L/2) where L is about 18-22. Now I'm testing it on machine which has about 7.7 GB ram available, but at final I'll have access to PC with 64GB RAM. I've started with Lapack++ . At the beginning my project assume to solve this problem only for symmetrical real matrices. This library was great.

Get non normalized eigenvectors in scipy

故事扮演 提交于 2019-12-06 04:31:24
Scipy and Numpy returns eigenvectors normalized. I am trying to use the vectors for a physical application and I need them to not be normalized. For example a = np.matrix('-3, 2; -1, 0') W,V = spl.eig(a) scipy returns eigenvalues (W) of [-2,-1] and the modal matrix (V) (eigenvalues as columns) [[ 0.89442719 0.70710678][ 0.4472136 0.70710678]] I need the original modal matrix [[2 1][1 1]] According to various related threads (1) (2) (3) , there is no such thing as a "non normalized" eigenvector. Indeed, an eigenvector v corresponding to the eigenvalue l of the matrix A is defined by, A*v = l*v

Preventing scipy eigenvectors differing from computer to computer

眉间皱痕 提交于 2019-12-05 22:09:54
Following up on this question about how to find the Markov steady state, I'm now running into the problem that it works perfectly on my lab computer, but it doesn't work on any other computer. Specifically, it always finds the correct number of near-one eigenvalues, and thus which nodes are attractor nodes, but it doesn't consistently find all of them and they aren't grouped properly. For example, using the 64x64 transition matrix below, the computers in which it doesn't work it always produces one of three different wrong collections of attractors at random. On the smaller matrix M1 below,

Finding generalized eigenvectors numerically in Matlab

孤人 提交于 2019-12-05 17:24:56
问题 I have a matrix such as this example (my actual matrices can be much larger) A = [-1 -2 -0.5; 0 0.5 0; 0 0 -1]; that has only two linearly-independent eigenvalues (the eigenvalue -1 is repeated). I would like to obtain a complete basis with generalized eigenvectors. One way I know how to do this is with Matlab's jordan function in the Symbolic Math toolbox, but I'd prefer something designed for numeric inputs (indeed, with two outputs, jordan fails for large matrices: "Error in MuPAD command:

How do I find out eigenvectors corresponding to a particular eigenvalue of a matrix?

筅森魡賤 提交于 2019-12-04 23:49:45
问题 How do I find out eigenvectors corresponding to a particular eigenvalue? I have a stochastic matrix(P), one of the eigenvalues of which is 1. I need to find the eigenvector corresponding to the eigenvalue 1. The scipy function scipy.linalg.eig returns the array of eigenvalues and eigenvectors. D, V = scipy.linalg.eig(P) Here D(array of values) and V(array of vectors) are both vectors. One way is to do a search in D and extract the corresponding eigenvector in V. Is there an easier way? 回答1:

low RAM consuming c++ eigen solver

两盒软妹~` 提交于 2019-12-04 11:41:36
I'm newbie in C++ programming , but I have a task to compute eigenvalues and eigenvectors (standard eigenproblem Ax=lx ) for symmetric matrices (and hermitian)) for very large matrix of size: binomial(L,L/2) where L is about 18-22. Now I'm testing it on machine which has about 7.7 GB ram available, but at final I'll have access to PC with 64GB RAM. I've started with Lapack++ . At the beginning my project assume to solve this problem only for symmetrical real matrices. This library was great. Very quick and small RAM consuming. It has an option to compute eigenvectors and place into input

Eigen Values and Eigen Vectors Matlab

谁说我不能喝 提交于 2019-12-04 05:37:38
问题 I have a matrix A A = [ 124.6,95.3,42.7 ; 95.3,55.33,2.74 ; 42.7,2.74,33.33 ] The eigenvalues and vectors: [V,D] = eig(A) How do I show the eigenvalues are mutually perpendicular? I've tried that if the dot product of the eigenvalues are zero, this demonstrates they are mutually perpendicular, but how would you compute this in MATLAB? I tried the following code transpose(diag(D)) * diag(D) %gives 4.1523e+04 Also, how can I verify the definition of eigenvalues and vector holds: A e_i - L_i e_i