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

Fix infinite recursion and off-by-one error in triu/tril #1418

Merged
merged 6 commits into from
Aug 11, 2024

Conversation

akern40
Copy link
Collaborator

@akern40 akern40 commented Aug 7, 2024

Also makes the documentation a little nicer to read, since these are such visual methods.

Closes #1415

@akern40 akern40 self-assigned this Aug 7, 2024
src/tri.rs Show resolved Hide resolved
src/tri.rs Outdated

res
}
if is_layout_f(&self.dim, &self.strides) && !is_layout_c(&self.dim, &self.strides) {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the work on this.

Why is there a conditional on memory layout? This purely a performance optimization right? Great place to have a comment to say what it's doing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it is - I've added a comment detailing the purpose and the point of the two other && conditions.

src/tri.rs Show resolved Hide resolved
src/tri.rs Show resolved Hide resolved
src/tri.rs Show resolved Hide resolved
@bluss bluss added this to the 0.16.x milestone Aug 7, 2024
@bluss bluss changed the title Fixes infinite recursion and off-by-one error Fix infinite recursion and off-by-one error Aug 7, 2024
src/tri.rs Show resolved Hide resolved
@bluss bluss changed the title Fix infinite recursion and off-by-one error Fix infinite recursion and off-by-one error in triu/tril Aug 8, 2024
Copy link
Member

@bluss bluss left a comment

Choose a reason for hiding this comment

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

Nice improvements and fixes, lgtm if you don't want to make further changes.

Would you like to squash it down into separate clean commits? Otherwise I can integrate it with a squash merge, same thing, and that also works.

@akern40
Copy link
Collaborator Author

akern40 commented Aug 8, 2024

Give me one minute to rebase so my commits are signed (switched computers and forgot to turn signing on) and then you can go ahead and squash merge.

@bluss
Copy link
Member

bluss commented Aug 9, 2024

I'm not sure why it said it was out of sync with master, maybe because of ci.yaml changes in master. Rebased.

@akern40 akern40 merged commit 1df6c32 into rust-ndarray:master Aug 11, 2024
12 checks passed
@akern40 akern40 deleted the fix-1415 branch August 11, 2024 15:15
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.

tril and triu fail on 1×1 matrices
2 participants