Skip to content

fixes and stronger tests for Tridiagonal setindex! #20892

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

Merged
merged 1 commit into from
Mar 6, 2017

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Mar 4, 2017

Ref. discussion in #20886. This pull request makes Tridiagonal setindex! support zero-assignment off the main, sub, and super diagonals, and expands and strengthens tests for Tridiagonal setindex!. Best!

@Sacha0 Sacha0 added bugfix This change fixes an existing bug linear algebra Linear algebra labels Mar 4, 2017
@Sacha0 Sacha0 added this to the 0.6.x milestone Mar 4, 2017
@inbounds A.du[i] = x
elseif !iszero(x)
throw(ArgumentError(string("cannot set entry ($i, $j) off the ",
"main, sub, and super diagonals to a nonzero value ($x)")))
Copy link
Contributor

@tkelman tkelman Mar 4, 2017

Choose a reason for hiding this comment

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

"or" was more correct sounds better IMO

Copy link
Member Author

@Sacha0 Sacha0 Mar 4, 2017

Choose a reason for hiding this comment

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

Will change to "or". (For my benefit, could you explain why "or" strikes you as more correct? Present understanding: "or" seems more correct in e.g. "entry not on a, b, or c", but "and" more correct in "entry off a, b, and c", as an "entry off a, b, or c" could be e.g. off a but on b and c (edit: or just off a but on b, in the mutually exclusive case)? Thanks!)

Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure the word you guys are looking for is nor, as in "cannot set the entry off the main, sub, nor super diagonals"

Copy link
Member Author

@Sacha0 Sacha0 Mar 4, 2017

Choose a reason for hiding this comment

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

Lacking an explicit preceding negative, "nor" does not seem correct? ("off" being the relevant preceding word, not "cannot".)

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's a scalar entry, then it's only going to be in one of the diagonals, not multiple. There's an argument for multiple ways of saying this, guess it's more what sounds better. The condition for it working is that it has to be in one of the 3, the condition that caused the error was that it wasn't in any of the 3.

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps sidestepping this wording conundrum altogether is best: "cannot set entry (1, 2) off the tridiagonal band to a nonzero value (3)". Thoughts? Thanks!

Makes Tridiagonal setindex! support assigning zero off the main, sub, and super diagonals.
Strengthens tests for Tridiagonal setindex!.
@Sacha0
Copy link
Member Author

Sacha0 commented Mar 6, 2017

Thanks all!

@Sacha0 Sacha0 deleted the tridiagsetind branch March 6, 2017 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants