Skip to content

fix(rust): make matrix formulation bijective#41

Merged
Neclow merged 1 commit intosbhattlab:mainfrom
Neclow:bijective_matrix
May 22, 2025
Merged

fix(rust): make matrix formulation bijective#41
Neclow merged 1 commit intosbhattlab:mainfrom
Neclow:bijective_matrix

Conversation

@Neclow
Copy link
Collaborator

@Neclow Neclow commented May 22, 2025

  • rust: make matrix formulation bijective:
  • python: add tests for cherry permutations and ladderization
  • python: other minor fixes (in opt and pairwise)

Fixes #40

…s for cherry permutations and ladderization + minor fixes
@Neclow Neclow requested a review from Copilot May 22, 2025 10:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the bijectivity of the matrix formulation in Rust and enhances unit test coverage in Python by adding tests for cherry permutations and ladderization while also updating documentation and import paths.

  • Updated tests: Refactored and renamed tests to separate vector and matrix validations.
  • Rust changes: Modified cherry ordering functions to support branch length swapping for bijectivity.
  • Other: Adjusted import paths and minor docstring updates.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
py-phylo2vec/tests/test_base.py Updated tests for cherry permutations and ladderization; improved docstrings.
py-phylo2vec/phylo2vec/opt/_hc_losses.py Updated import path to newick module.
py-phylo2vec/phylo2vec/metrics/pairwise.py Revised docstring formatting.
py-phylo2vec/phylo2vec/base/newick.py Minor docstring wording fix.
phylo2vec/src/tree_vec/ops/vector.rs Modified cherry ordering functions to return tuple with swap indices.
phylo2vec/src/tree_vec/ops/matrix/mod.rs Adjusted to incorporate branch length swaps based on new order functions.
phylo2vec/Cargo.toml Incremented version number.
Comments suppressed due to low confidence (1)

phylo2vec/src/tree_vec/ops/vector.rs:261

  • The variable 'row_idxs' is referenced but not defined within the current scope of the function 'order_cherries'. Please ensure that 'row_idxs' is properly initialized before it is used to avoid potential runtime errors.
bl_rows_to_swap.push(row_idxs[i]);

@Neclow Neclow merged commit 03d3014 into sbhattlab:main May 22, 2025
7 checks passed
@Neclow Neclow deleted the bijective_matrix branch October 16, 2025 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: test that the matrix format is robust to ladderization and cherry permutations

2 participants