-
Notifications
You must be signed in to change notification settings - Fork 16
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
Argument to have GramSchmidt return matrix having same dimension as input #48
Comments
I don't remember writing this code but I wouldn't be surprised if I did.
I agree that it would be desirable to optionally retrain the 0 columns,
and arguably to make that the default, although it do so might break
existing code and so might not be a good idea.
AFAICS, the documentation for the function doesn't mention removing
linearly dependent columns and indeed implies the contrary. Also,
silently removing the columns is probably not desirable; printing a
warning could break existing code but a message is probably in order.
I can make these changes if people agree.
Thoughts?
John
…On 2023-03-06 8:12 a.m., ggrothendieck wrote:
Currently |GramSchmidt| contains the line below which removes the
redundant columns
|B <- B[, !apply(B, 2, function(b) all(b == 0))] |
however, that makes it hard to relate the result to the input matrix.
Suggest that there be an argument to skip over that line so that the
output columns directly correspond to the input columns in the same
position.
—
Reply to this email directly, view it on GitHub
<#48>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLSAQRDH62CHRKGFCWTBVLW2XPFNANCNFSM6AAAAAAVRDLSTM>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I agree that optionally allowing to retain the 0 columns is desireable, and I think the suggestion to make the quoted line conditional would do that. An argument could be made either way for what should be the default, but at least it would be documented. Perhaps review the examples / vignettes to see how GramSchmidt() is currently used in the package? |
On 2023-03-07 5:48 p.m., Michael Friendly wrote:
I agree that optionally allowing to retain the 0 columns is desireable,
and I think the suggestion to make the quoted line conditional would do
that.
As it turns out, not quite, because it's necessary to account for
retained 0 columns if the matrix is normalized. I've done that and also
added a message when 0 columns are suppressed.
An argument could be made either way for what should be the default, but
at least it would be documented.
Perhaps review the examples / vignettes to see how GramSchmidt() is
currently used in the package?
Please feel free to change the default if you think that's best.
My changes are in the issue42 branch.
John
…
—
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLSAQUHA6OJ42HCE4SFJ3DW263MZANCNFSM6AAAAAAVRDLSTM>.
You are receiving this because you commented.Message ID:
***@***.***>
|
Accepted John's changes, now in master. I've bumped the pkg version to 0.8-7, but will wait to release this. @ggrothendieck You can (after this settles down) install the github version to test this. |
Seems to work when I tried it. Since the output is now the same shape as the input one could retain the column names to make it easier to relate the output to the input -- actually it could be done even if zero columns were omitted.
|
Preserving the column names makes sense to me (and is easily done). Shall I make this change? |
@ggrothendieck @john-d-fox |
The names of the nonzero columns are retained. Yes, the change works if there are row/column names. Row names always worked, and retaining column names is the point. Shall I commit the change? If you don’t like it, you can always revert it (though I doubt you’ll want to). |
The example shown in my earlier post using |
Right. I'm waiting to hear from Michael before committing the fix, which displays the column names if they're defined. |
FWIW, here's the code:
|
Looks good. Go ahead and commit to master. |
That's apparently easier said than done. When I tried to push the change, I got
I suggest that you take the code from my previous "comment" to update GramSchmidt() in the master branch since I apparently am not allowed to do it. |
Ugh! This is some new github feature regarding permission I don't quite understand. Evidently, new additions to master must be via a pull request from another branch, or a pull request to the master branch that someone else (me) has to approve. In any case, it has to be via a pull request. I don't think I can just copy/paste your code in the comment into the I created a new branch,
|
OK, I pushed the change to GramSchmidt() to the |
Currently
GramSchmidt
contains the line below which removes the zero columnshowever, that makes it hard to relate the result to the input matrix. Suggest that there be an argument to skip over that line so that the output columns directly correspond to the input columns in the same position.
The text was updated successfully, but these errors were encountered: