MAINT: clean up views/strides/dtypes utilities in cluster.hierarcy
#18858
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The utility functions cleaned up here (
_copy_arrays_if_base_present
,_convert_to_bool
,_convert_to_double
) were the cause of a couple of open review comments in gh-18668, where it wasn't clear whether or not changing them was preserving the existing semantics. In the process of looking into that, I also discovered some spurious double checks, weird conversion logic (float32
arrays were converted tofloat64
, but only if they weren't views;float16
input remained unconverted) and some other code oddities.The key thing for removal of
_copy_arrays_if_base_present
was checking which input arrays for_hierarchy.pyx
functions were being modified in-place, so I added some docs for that.