Skip to content

Commit

Permalink
🩹 Fix ordering bug in MatrixProvider class (#1512)
Browse files Browse the repository at this point in the history
* 🩹 Fix bug in matrix provider
Fix ordering issue in the case of multiple types of different megacomplexes were combined in the MatrixProvider class.
* 📚 Updated changelog
  • Loading branch information
jsnel authored Aug 18, 2024
1 parent 3b06016 commit e53fcd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

- ✨ Add official Python 3.12 support (#1437)

### 🩹 Bug fixes

- 🩹 Fix ordering bug in MatrixProvider class (#1512)

### 🚧 Maintenance

-🧹🚇 Remove asv benchmarks and binder integration
Expand Down
7 changes: 4 additions & 3 deletions glotaran/optimization/matrix_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,15 @@ def combine_megacomplex_matrices(
tuple[list[str], ArrayLike]:
The combined clp labels and matrix.
"""
if len(matrix_left.shape) < len(matrix_right.shape):
matrix_left, matrix_right = matrix_right, matrix_left
clp_labels_left, clp_labels_right = clp_labels_right, clp_labels_left

result_clp_labels = clp_labels_left + [
c for c in clp_labels_right if c not in clp_labels_left
]
result_clp_size = len(result_clp_labels)

if len(matrix_left.shape) < len(matrix_right.shape):
matrix_left, matrix_right = matrix_right, matrix_left

left_index_dependent = len(matrix_left.shape) == 3
right_index_dependent = len(matrix_right.shape) == 3

Expand Down

0 comments on commit e53fcd5

Please sign in to comment.