Hello! I’ve been using the QHO script in this chapter of the dimensionality reduction guide, but I’ve run into an error - when I input [1,2] (as well as other scalar multiples of it) as my alphaVals, I end up with a negative Reduced Basis Method result. After some troubleshooting (and after being pushed a bit in the right direction by my wonderful research mentor Pablo), I found that the issue seems to be that I end up with a negative eigenvector.

I am new to python, and so I’m not quite sure how to do what I’m trying to do, but is there any way to check if an eigenvector has negative components and multiply it by -1 if so? The code to find eigenvectors and eigenvalues currently looks like this:

To answer the question you asked, if you just want something that is positive definite, you can always just take the absolute value of the object.

But to get at the deeper question, in the code snippet what is coming out as negative that shouldn’t? If it’s the coefficients of the reduced basis, that might be ok and the expected solution. You can point to the section of the book that is giving trouble and we can take a peak, pinging @pablo as well

The problem seems to be that occasionally eigenvectors will turn up negative, rather than the eigenvalues. I’d prefer not to use a simple absolute value because I know that it can have strange behaviors if it drops below zero, but I may have to just bite the bullet.

I do appreciate the feedback, though! I’m not exactly sure where the problem is located, being very new to coding (which is what made this more difficult ), but in my trials, having it print eigenvectors showed that they ended up negative with positive eigenvalues.