Skip to content
Snippets Groups Projects
Commit 24fe587e authored by Dennis Noll's avatar Dennis Noll
Browse files

[numpy] eigvalsh_with_nans now contains nans for non-computable

parent 76b52826
No related branches found
No related tags found
No related merge requests found
......@@ -135,8 +135,9 @@ def std_excl(arr, value=0, axis=0):
return np.nanstd(value_to_nan(arr, value=value), axis=axis)
def eigvalsh_ignore_nans(matrix):
ret = np.zeros(matrix.shape[:-2] + matrix.shape[-1:])
def eigvalsh_with_nans(matrix):
ret = np.empty(matrix.shape[:-2] + matrix.shape[-1:])
ret.fill(np.nan)
nans_in_matrix = np.any(np.isnan(matrix), axis=(-2, -1))
good = ~nans_in_matrix
eig = np.linalg.eigvalsh(matrix[good])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment