-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
base/linalg/tridiag.jl
Outdated
@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)"))) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!)
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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".)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!.
Thanks all! |
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 forTridiagonal
setindex!
. Best!