-
Notifications
You must be signed in to change notification settings - Fork 480
Fix some typos in comments #582
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
… transpose (**H) This commit completes changes made in: * Reference-LAPACK/lapack@457afcf 2021-06-03
This commit completes changes made in: * Reference-LAPACK/lapack@2f9f42b 2021-06-03
This reverts commit 0277cd9.
Codecov Report
@@ Coverage Diff @@
## master #582 +/- ##
=======================================
Coverage 82.37% 82.37%
=======================================
Files 1894 1894
Lines 190679 190679
=======================================
Hits 157065 157065
Misses 33614 33614 Continue to review full report at Codecov.
|
| *> triangular system of linear equations op(A)*X = B, when A is a | ||
| *> triangular band matrix. The test ratio is the maximum over the | ||
| *> number of right hand sides of | ||
| *> norm(op(A)*X - B) / ( norm(op(A)) * norm(X) * EPS ), |
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 think this is still incorrect. The expression norm(op(A)*X - B) / ( norm(op(A)) * norm(X) * EPS ) is a number, so it does not have right-hand sides. I suggest something like:
The test ratio is the maximum over
norm(b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS )
for every column b of B,
where op(A) = A, A**T, or A**H, x is the solution vector, and EPS is the machine epsilon.
What do you think?
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.
Yes, this looks better. Two adjoining "where" sections (the first one - "for every column b of B" - is implicit, and the second one is explicit) could be merged:
The test ratio is the maximum over
norm(b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS ),
where op(A) = A, A**T, or A**H, b is the column of B, x is
the solution vector, and EPS is the machine epsilon.
but this is a matter of taste.
I believe this variant is incorrect, too. The original comment states "x and b are N by NRHS matrices". So will be the residual R := b - op(A)*x. The code computes taxicab-based norm || R(j) || for each j-th column R(j) from R. Then it takes a max(j) || R(j) || which means in toto a computing of kinda 1-norm, but based on taxicab-based norm |Re(z)| + |Im(z)|, not magnitude-based norm |z|. So, the phrase "the maximum over" is excessive.
And this variant may be improved further:
- Since x and b are matrices not vectors here, capital letters X and B are used.
- I'm using
norm(op(A)*X - B)notnorm(B - op(A)*X)since the first is the exact expression which is computed. I know they give identical results. I don't insist on this summands swapping here.
So, the result may look like this:
The test ratio is set to
norm(op(A)*X - B) / ( norm(op(A)) * norm(X) * EPS ),
where op(A) = A, A**T, or A**H, B is the N by NRHS matrix of
right-hand sides, X is the N by NRHS matrix of solution vectors, and
EPS is the machine epsilon.
When "kinda 1-norms" in both norm(op(A)*X - B) and norm(X) will be replaced by "true 1-norm", then the following statement could be added: "The norm used is the 1-norm.".
I'm ready to update this PR with any of variants discussed above.
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.
Yes, this looks better. Two adjoining "where" sections (the first one - "for every column b of B" - is implicit, and the second one is explicit) could be merged:
The test ratio is the maximum over norm(b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS ), where op(A) = A, A**T, or A**H, b is the column of B, x is the solution vector, and EPS is the machine epsilon.but this is a matter of taste.
I would go with either this one or the version I proposed. Maybe you can modify it a bit:
The test ratio is the maximum over
norm(b - op(A)*x) / ( ||op(A)||_1 * norm(x) * EPS ),
where op(A) = A, A**T, or A**H, b is the column of B, x is
the solution vector, and EPS is the machine epsilon.
As you pointed out, the norm operator is that "kinda 1-norm" for vectors of size N, in which |Re(z)| + |Im(z)| replaces the magnitude |z| for all complex scalars z. This is what the subroutine computes if I understand the algorithm correctly.
I believe this variant is incorrect, too. The original comment states "x and b are N by NRHS matrices". So will be the residual
R := b - op(A)*x. The code computes taxicab-based norm|| R(j) ||for each j-th column R(j) from R. Then it takes amax(j) || R(j) ||which means in toto a computing of kinda 1-norm, but based on taxicab-based norm|Re(z)| + |Im(z)|, not magnitude-based norm|z|. So, the phrase "the maximum over" is excessive.And this variant may be improved further:
1. Since x and b are matrices not vectors here, capital letters X and B are used. 2. I'm using `norm(op(A)*X - B)` not `norm(B - op(A)*X)` since the first is the exact expression which is computed. I know they give identical results. I don't insist on this summands swapping here.So, the result may look like this:
The test ratio is set to norm(op(A)*X - B) / ( norm(op(A)) * norm(X) * EPS ), where op(A) = A, A**T, or A**H, B is the N by NRHS matrix of right-hand sides, X is the N by NRHS matrix of solution vectors, and EPS is the machine epsilon.
I don't agree with this proposal. The algorithm does not compute norm(X), where "capital" X is the original input matrix. Maybe I am missing something, please correct me if I am wrong.
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.
(Sorry for delayed answer)
I think you are right. I'll use the last variant you've proposed:
I would go with either this one or the version I proposed. Maybe you can modify it a bit:
The test ratio is the maximum over norm(b - op(A)*x) / ( ||op(A)||_1 * norm(x) * EPS ), where op(A) = A, A**T, or A**H, b is the column of B, x is the solution vector, and EPS is the machine epsilon.
I'll try either to update this PR or to create a new one.
|
I just noticed another thing that is not related to your changes, but maybe you can help me. Is there a bug here? Lines 231 to 235 in 2eeed4b
I think so. Suppose that the last column of I can propose a PR to solve this (if this is actually a bug). |
I don't see any problems here. If any column of X is full of zeros, then the RESID takes a maximal value, and the rest columns of X doesn't matter. IMHO. |
This resolves discussion in PR Reference-LAPACK#582.
These typos were overlooked while working on the PR #581. I hope they are the last.