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

bh.linalg.eigh is broken #590

Open
jamesavery opened this issue Feb 2, 2019 · 0 comments
Open

bh.linalg.eigh is broken #590

jamesavery opened this issue Feb 2, 2019 · 0 comments

Comments

@jamesavery
Copy link
Contributor

jamesavery commented Feb 2, 2019

The standard NumPy eigensolver bohrium.linalg.eigh isn't implemented, and it tries to use numpy. This is not the problem. However, instead of handing it gracefully off to NumPy, it crashes:

import bohrium as bh;

# Symmetric real matrix
A = bh.array([[1.,2.,3.],
              [2.,4.,5.],
              [3.,5.,6.]]);

lam,eig = bh.linalg.eigh(A)

blows up with

/home/avery/.local/lib/python3.6/site-packages/numpy/linalg/linalg.py:1456: UserWarning: Bohrium does not support ufunc `eigh_lo` it will be handled by the original NumPy.
  w, vt = gufunc(a, signature=signature, extobj=extobj)

AttributeError                            Traceback (most recent call last)
<ipython-input-28-1bc70c82985b> in <module>
     10 
     11 
---> 12 bh.linalg.eigh(Us[4])

~/.local/lib/python3.6/site-packages/numpy/linalg/linalg.py in eigh(a, UPLO)
   1454 
   1455     signature = 'D->dD' if isComplexType(t) else 'd->dd'
-> 1456     w, vt = gufunc(a, signature=signature, extobj=extobj)
   1457     w = w.astype(_realType(result_t), copy=False)
   1458     vt = vt.astype(result_t, copy=False)

bohrium/ufuncs.pyx in bohrium.ufuncs._handle__array_ufunc__()

AttributeError: module 'numpy' has no attribute 'eigh_lo'

However, just using NumPy works fine:

import numpy as np;

# Symmetric real matrix
A = np.array([[1.,2.,3.],
              [2.,4.,5.],
              [3.,5.,6.]]);

lam,eig = np.linalg.eigh(A)

and if you do a copy2numpy() first, everything also works fine:

import bohrium as bh;

# Symmetric real matrix
A = bh.array([[1.,2.,3.],
              [2.,4.,5.],
              [3.,5.,6.]]);

lam,eig = bh.linalg.eigh(A.copy2numpy())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant