Skip to content

Commit

Permalink
🩹Fix matrix provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnel committed Nov 28, 2022
1 parent e12fadc commit d19d7e6
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions glotaran/optimization/matrix_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,20 @@ def calculate_aligned_matrices(self):
# old: reduce_matrix(MatrixContainers, index) -> MatrixContainers
full_clp_labels = self.align_full_clp_labels()
for i, global_index_value in enumerate(self._data_provider.aligned_global_axis):
matrix_containers = []
group_label = self._data_provider.get_aligned_group_label(i)
matrix_containers = [
self._matrix_containers[label]
for label in self._data_provider.group_definitions[group_label]
]
for label, index in zip(
self._data_provider.group_definitions[group_label],
self._data_provider.get_aligned_dataset_indices(i),
):
temp = self._matrix_containers[label]
if temp.is_index_dependent:
matrix_containers.append(
MatrixContainer(clp_labels=temp.clp_labels, matrix=temp.matrix[index])
)
else:
matrix_containers.append(temp)

matrix_scales = [
self.group.dataset_models[label].scale
if self.group.dataset_models[label].scale is not None
Expand All @@ -670,10 +679,9 @@ def calculate_aligned_matrices(self):
)

self._aligned_full_clp_labels[i] = full_clp_labels[group_label]
group_matrix_for_all = self.reduce_matrix(
group_matrix, self._data_provider.aligned_global_axis
)
group_matrix_single = group_matrix_for_all[i]
group_matrix_single = self.reduce_matrix(
group_matrix, np.array([self._data_provider.aligned_global_axis[i]])
)[0]

weight = self._data_provider.get_aligned_weight(i)
if weight is not None:
Expand Down

0 comments on commit d19d7e6

Please sign in to comment.