CMU-MS-DAS-Modern-Programming-Mini / ClassAssignmentNo3

Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Eigenvector flipping signs #7

Open hwankyusong opened 2 years ago

hwankyusong commented 2 years ago

One of the entries in my mo_c[0, :], specifically the 6th one, is positive (4.82226067e-02) when I test SCF.py (python main.py SCF.py), but negative (-4.82226067e-02) when I pytest, which causes the assert to fail. All other entries retain their signs, so I'm not sure why this is happening.

epiechow commented 2 years ago

I am also having this issue as well, except on my mo_coeff[0, 1] entry. I get (2.33624458e-01) when just running the program as you have, but negative (-2.33624458e-01) when I pytest. All my other entries, including the 6th entry, have the correct signs.

shots47s commented 2 years ago

It is a typo. All of the values should be negative.

On Tue, Oct 5, 2021, 7:27 PM epiechow @.***> wrote:

I am also having this issue as well, except on my mo_coeff[0, 1] entry. I get (2.33624458e-01) when just running the program as you have, but negative (-2.33624458e-01) when I pytest. All my other entries, including the 6th entry, have the correct signs.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CMU-MS-DAS-Modern-Programming-Mini/ClassAssignmentNo3/issues/7#issuecomment-935062089, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACL5YOHL5OP5AM7RMCDKDUFOCWZANCNFSM5FM4TQNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

hwankyusong commented 2 years ago

Is that a typo on our part?

Also, do you mean all values within mo_c[0,:] should be negative?

shots47s commented 2 years ago

I mean it is a typo on my part and that the correct answer would that element being negative.

On Tue, Oct 5, 2021, 7:58 PM hwankyusong @.***> wrote:

Is that a typo on our part?

Also, do you mean all values within mo_c[0,:] should be negative?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CMU-MS-DAS-Modern-Programming-Mini/ClassAssignmentNo3/issues/7#issuecomment-935106176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACL53ZN2SCQYSJ5BP7JS3UFOGKRANCNFSM5FM4TQNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

epiechow commented 2 years ago

After rerunning the code, my pytest eigenvalues are all negative except for the [0,5] entry. That value is positive, and checking my (py main.py scf.py), the eigenvector on that is positive as well. Is that an error on my part? All other eigenvectors are correct, all other tests pass, and the final answer is correct. This is the only area I have any differences.

shots47s commented 2 years ago

Yes, I misspoke before due to a very long day.

On Tue, Oct 5, 2021, 8:08 PM epiechow @.***> wrote:

After rerunning the code, my pytest eigenvalues are all negative except for the [0,5] entry. That value is positive, and checking my (py main.py scf.py), the eigenvector on that is positive as well. Is that an error on my part? All other eigenvectors are correct, all other tests pass, and the final answer is correct. This is the only area I have any differences.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CMU-MS-DAS-Modern-Programming-Mini/ClassAssignmentNo3/issues/7#issuecomment-935118304, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACL54BQLCTNOSBYZZXRRTUFOHOTANCNFSM5FM4TQNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

epiechow commented 2 years ago

So would the correction be to fix that part of my SCF.py code, or is this a small enough error not to have to fix? Apologies for the confusion. I am unsure how this one number is off but everything else is correct.

shots47s commented 2 years ago

In about 20 minutes, I will be at my computer, and I will validate the answer in the Readme and better be able to help.

On Tue, Oct 5, 2021, 8:13 PM epiechow @.***> wrote:

So would the correction be to fix that part of my SCF.py code, or is this a small enough error not to have to fix? Apologies for the confusion. I am unsure how this one number is off but everything else is correct.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CMU-MS-DAS-Modern-Programming-Mini/ClassAssignmentNo3/issues/7#issuecomment-935124512, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACL5Z4MHV2XHOPJ725JY3UFOIBFANCNFSM5FM4TQNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

hwankyusong commented 2 years ago

My pytest eigenvalues are all negative except for the 5th entry as well.

For the fist eigenvector mo_e[0,:], among the significant numbers, [0,1] is positive while the rest are negative.

shots47s commented 2 years ago

The eigenvalues are:

[-32.57830292  -8.08153571  -7.55008599  -7.36396923  -7.34714487 -4.00229867  -3.98111115]
mol_c[0,:] = [-1.00154358e+00 -2.33624458e-01  1.04925886e-15 -8.56842145e-02  3.73887929e-29  4.82226067e-02 -1.31848274e-15]

Note the elements [2,4,6] are all really zero, and their sign and value are essentially insignificant.

hwankyusong commented 2 years ago

Thank you, but my original problem of getting different signs when running main.py versus pytesting still remains. The signs of my elements [1,5] of mol_c differ, where it's correct in the former (-,+) and incorrect (+,-) in the latter.

All other tests I wrote for the other functions pass.

shots47s commented 2 years ago

@hwankyusong don't worry about the sign, I am not sure why it is different, but both responses are correct. I would just test to make sure the eigenvalues are correct.

hwankyusong commented 2 years ago

Thank you. My eigenvalues are correct.

shots47s commented 2 years ago

I have tested both of your codes explicitly, they are correct.