Menu
  • HOME
  • TAGS

Why some eigen vector signs from C++ Armadillo are different from Python and R

python,c++,r,armadillo,eigenvector

That is answered by help(eigen) in R: Value: The spectral decomposition of ‘x’ is returned as components of a list with components values: a vector containing the p eigenvalues of ‘x’, sorted in _decreasing_ order, according to ‘Mod(values)’ in the asymmetric case when they might be complex (even for real...

How to find more than six eigenvectors of a large matrix in matlab?

matlab,pca,eigenvector

Pass the second, optional parameter to eigs, which controls how many eigenvectors are returned.

Eigenvector. Implementing Jacobi algorithm

algorithm,matrix,eigenvector,wolframalpha

Eigenvectors of a matrix are not unique, and there are multiple possible decompositions; in fact, only eigenspaces can be defined uniquely. Both results that you are receiving are valid. You can easily see that by asking Wolfram Alpha to orthogonalize the second matrix. Run the following query: Orthogonalize[{{1.13168, 0.969831, 1.},...

On entry to DGEEV parameter number 9 had an illegal value

c,lapack,eigenvalue,eigenvector

You can not port directly from zgeev to dgeev. The zgeev gets a complex matrix and computes complex eigenvalues. While dgeev gets a real matrix and computes complex eigenvalues. In order to be consistent LAPACK uses WR and WI which is used for the real and imaginary part of each...

Eigen Vector Calculations for OBB crashing on second pass through “Assertion Failed”

c++,opengl,matrix,pca,eigenvector

I believe I found your problem. You need to check again the theory! As I may recall, you have the covariance defined in the theory as: C=1/M \Sum ( (p-pmean)*(p-pmean)^t ) Well, you may notice that C is a 3x3 matrix, NOT a value. Therefore, when you call Compute_EigenV and...

What is the recognition rate of PCA eigenfaces?

eigen,face-recognition,pca,eigenvector

The accuracy would depend on the classifier you are using once you have the data in the PCA projected space. In the original Turk/Pentland eigenface paper http://www.face-rec.org/algorithms/PCA/jcn.pdf they just use kNN / Euclidean distance but a modern implementation might use SVMs e.g. with an rbf kernel as the classifier in...

Finding the Associated Eigenvector in Matlab

matlab,eigenvector,eigenvalue

This behaviour is correct. To understand the reason, we need to look at the definition of eigenvectors (source: wikipedia): An eigenvector or characteristic vector of a square matrix A is a non-zero vector v that, when multiplied with A, yields a scalar multiple of itself. [...] That is: Av =...

How to drop a perpendicular line from each point in a scatterplot to an (Eigen)vector?

r,ggplot2,pca,eigenvector

Adapting a previous answer, you can do perp.segment.coord <- function(x0, y0, a=0,b=1){ #finds endpoint for a perpendicular segment from the point (x0,y0) to the line # defined by lm.mod as y=a+b*x x1 <- (x0+b*y0-a*b)/(1+b^2) y1 <- a + b*x1 list(x0=x0, y0=y0, x1=x1, y1=y1) } ss<-perp.segment.coord(df$Person1, df$Person2,0,eigen$vectors.scaled[1,1]) g + geom_segment(data=as.data.frame(ss), aes(x...

Python numpy/scipy eigenvectors seemingly not correct for markov chain model

python,numpy,linear-algebra,eigenvector,markov-chains

Is the transition matrix symmetric? If not, consider checking for T.T (the transpose), because you need to make sure you're looking at the right state transitions: you need the left eigenvector of your stochastic matrix, but almost all out-of-the-box scientific packages (numpy included) default to computing the right eigenvectors (this...

Java JAMA Incompatible Cannot be Converted Error

java,matrix,eigenvector,eigenvalue,jama

Note the return type of PopulateMatrix(): public void PopulateMatrix() { ... } You say it returns nothing, by making it void so when you try to return a Matrix you get an error message saying this is an unexpected return type. If you want to return a Matrix from PopulateMatrix(),...

calculating the eigenvector from a complex eigenvalue in opencv

c++,opencv,complex-numbers,eigenvector,eigenvalue

So I solved the problem using the 'ComplexEigenSolver' from the Eigen library. //create a multichannel matrix Mat a_com = Mat::zeros(4,4,CV_32FC2); for(int i = 0; i<4; i++) { for(int j = 0; j<4; j++) { a_com.at<Vec2f>(i,j)[0] = a.at<double>(i,j); a_com.at<Vec2f>(i,j)[1] = 0; } } MatrixXcf eigenA; cv2eigen(a_com,eigenA); //convert OpenCV to Eigen ComplexEigenSolver<MatrixXcf>...

eigenvalue and eigenvector calculation with cusolver from cuda 7.0 RC

c++,cuda,eigenvalue,eigenvector,cusolver

It appears (to me) that the cuSolver documentation may be incorrect with respect to the mu parameter. The documentation appears to indicate that this is in the host memory space, i.e. the 2nd to last parameter should be a host pointer. If I change it to be a device pointer:...

Trouble with the Accelerate framework in Swift

swift,matrix,lapack,eigenvector,accelerate-framework

The problem’s with your lwork variable. This is supposed to be the size of the workspace you supply, with -1 meaning you’re performing a “workspace query”: LWORK (input) INTEGER The dimension of the array WORK. LWORK >= max(1,3*N), and if JOBVL = 'V' or JOBVR = 'V', LWORK >= 4*N....

finding the real eigenvectors of a real symmetric matrix in numpy or scipy

python,numpy,eigenvector

Use numpy.linalg.eigh or scipy.linalg.eigh. These functions are designed for symmetric (or Hermitian) matrices, and with a real symmetric matrix, they should always return real eigenvalues and eigenvectors. For example, In [62]: from numpy.linalg import eigh In [63]: a Out[63]: array([[ 2., 1., 0., 0.], [ 1., 2., 0., 0.], [...

Eigenvectors computed with numpy's eigh and svd do not match

python,numpy,svd,eigenvector

Just play with small numbers to debug your problem. Start with A=np.random.randn(3,2) instead of your much larger matrix with size (50,20) In my random case, I find that v1 = array([[-0.33872745, 0.94088454], [-0.94088454, -0.33872745]]) and for v2: v2 = array([[ 0.33872745, -0.94088454], [ 0.94088454, 0.33872745]]) they only differ for a...

Spectral clustering with Similarity matrix constructed by jaccard coefficient

machine-learning,cluster-analysis,pca,eigenvalue,eigenvector

As far as I can tell, you have mixed and shuffled aa number of approaches. No wonder it doesn't work... you could simply use jaccard distance (a simple inversion of jaccard similarity) + hierachical clustering you could do MDS to project you data, then k-means (probably what you are trying...