Skip to content

Commit

Permalink
Use svd function on raw numpy arrray instead of xarray dataarray (#1520)
Browse files Browse the repository at this point in the history
This fixes an issue with numpy > 2.0.1 and is backwards compatible with numpy<2.
  • Loading branch information
jsnel authored Aug 25, 2024
1 parent ea2b638 commit f9d8984
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion glotaran/io/prepare_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def add_svd_to_dataset(
if data_array is None:
data_array = dataset[name] if name != "data" else dataset.data
if f"{name}_singular_values" not in dataset:
l, s, r = np.linalg.svd(data_array, full_matrices=False)
l, s, r = np.linalg.svd(data_array.data, full_matrices=False)
dataset[f"{name}_left_singular_vectors"] = ((lsv_dim, "left_singular_value_index"), l)
dataset[f"{name}_singular_values"] = (("singular_value_index"), s)
dataset[f"{name}_right_singular_vectors"] = ((rsv_dim, "right_singular_value_index"), r.T)

0 comments on commit f9d8984

Please sign in to comment.