Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermutationMatrix swap_rows() may be misleading #148

Open
Andlon opened this issue Feb 11, 2017 · 0 comments
Open

PermutationMatrix swap_rows() may be misleading #148

Andlon opened this issue Feb 11, 2017 · 0 comments

Comments

@Andlon
Copy link
Collaborator

Andlon commented Feb 11, 2017

The docs for swap_rows() currently say:

Swaps rows i and j in the permutation matrix.

If one thinks of a permutation matrix as a full matrix of 1's and 0's, then this statement is not correct. What it does is swap the rows of the permuted matrix when the permutation matrix is applied from the left. This actually corresponds to swapping the columns in the matrix representation of the permutation matrix, and so can be interpreted to mean the exact opposite of what it does.

At the very least, the documentation should be updated to make it clear exactly what the function does. However, the name swap_rows() itself can very easily be misinterpreted, as it does not work quite the same way as e.g. BaseMatrix::swap_rows(). Therefore I propose the following:

Remove swap_rows altogether in favor of simply swap, whose name is somewhat intentionally ambiguous. This way users are more inclined to look up in the documentation what it actually does. It is of course paramount that the documentation is very clear on this point. Since I believe PermutationMatrix has not yet made it into any release yet, I think this can be safely done without worrying about backwards compatibility.

Thoughts?

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

No branches or pull requests

1 participant