Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: linalg.subspace_angles gives wrong results #9020

Closed
c-meyer opened this issue Jul 11, 2018 · 1 comment
Closed

BUG: linalg.subspace_angles gives wrong results #9020

c-meyer opened this issue Jul 11, 2018 · 1 comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.linalg
Milestone

Comments

@c-meyer
Copy link
Contributor

c-meyer commented Jul 11, 2018

The function subspace_angles gives wrong results this can be shown with a simple example:
Two matrices have two vectors pointing to the same direction, but the last ones are orthogonoal to each other and are not contained in the space of the other ones. Therefore the subspace angles must be 0, 0 and pi/2.

Reproducing code example:

import numpy as np
from scipy.linalg import subspace_angles

A = np.array([[1, 0, 0],
       [0, 1, 0],
       [0, 0, 1],
       [0, 0, 0],
       [0, 0, 0]])

B = np.array([[1. , 0. , 0. ],
       [0. , 1. , 0. ],
       [0. , 0. , 0. ],
       [0. , 0., 0. ],
       [0. , 0. , 1. ]])

sangles = subspace_angles(A,B)
print(sangles) # Produces wrong angles!

Error message:

# No error message

Scipy/Numpy/Python version information:

<<Output from 'import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info)'>>
1.0.0 1.14.0 sys.version_info(major=3, minor=6, micro=4, releaselevel='final', serial=0)
@c-meyer
Copy link
Contributor Author

c-meyer commented Jul 11, 2018

I am going to send a pull request for this issue.

c-meyer added a commit to c-meyer/scipy that referenced this issue Jul 11, 2018
@ilayn ilayn added defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.linalg labels Jul 11, 2018
c-meyer added a commit to c-meyer/scipy that referenced this issue Jul 11, 2018
@ilayn ilayn added this to the 1.2.0 milestone Jul 16, 2018
ilayn pushed a commit that referenced this issue Jul 17, 2018
* BUG: Fixes #9020 issue with subspace_angles
* BUG: Fixes #9020 subspace_angles in descending order
* Fixed PEP8 linebreak in decomp_svd.py
* BUG: subspace_angles, added release-notes (1.2.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.linalg
Projects
None yet
Development

No branches or pull requests

2 participants