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

transpose degree n matrices #1217

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

Alex-Jordan
Copy link
Contributor

This builds on #1216 (which builds on #1215). If #1216 is updated following feedback, I will update here too. Once #1216 is merged, this diff should be more manageable.

In addition to changes from #1216, this has:

  • a slice method for a Matrix object. This produces a degree (n-1) Matrix from a degree n Matrix. You specify an index and a value for that index, and it produces the degree (n-1) Matrix that is thereby defined. This is currently only used as a helper for the update to transpose. It is similar to row and column methods, but more general. And always produces something of the next lower degree.
  • to transpose a degree n Matrix, the word "transpose" is perhaps a misnomer. Instead you have some permutation of the index dimensions in mind. For the usual transpose of a degree 2 matrix, this is just the permutation (12). For a degree n matrix, you might want to permute the indices in a different way. Doing this once can make it more efficient to repeatedly access data in the Matrix, depending on the scenario. So now you can transpose a degree n Matrix. If you don't specify a permutation, the default is to just swap the last two indices. This will look like a regular transposition on each of the degree 2 matrices in the frontal slice. Otherwise, for the permutation you may specify a cycle in the form of an array reference, or a product of cycles in the form of an array reference of array references.

This is the last of the updates I wanted to do before adding new methods for setting elements, removing columns and rows and a submatrix that @pstaabp has in #1076. We should make sure new tools work with degree n Matrix objects as we add them. Unless it is for sure only appropriate for degree 2 matrices.

@Alex-Jordan Alex-Jordan changed the title Matrices 3 transpose degree n matrices Mar 25, 2025
@pstaabp
Copy link
Member

pstaabp commented Mar 25, 2025

Looks good, but we should bring the test suite in soon. There was one in my branch that probably works for a lot of this, but should be update.

Although I'm guessing you have a number of problems that you've been testing with, it's more efficient to have the test suite.

I can get it working with this branch and put in a PR to this if you'd like.

Copy link
Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

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

I haven't tested this at all yet, but I see some code changes that are needed. Some things that perlcritic pointed out.

@Alex-Jordan Alex-Jordan force-pushed the matrices-3 branch 3 times, most recently from e498cd1 to 86611b1 Compare March 30, 2025 01:23
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.

None yet

3 participants