-
Notifications
You must be signed in to change notification settings - Fork 530
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
matrix/mat64,stat: reverse matrix extraction #28
Conversation
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.
LGTM except I would remove the To
from the signatures.
@@ -58,10 +58,15 @@ func (lq *LQ) Factorize(a Matrix) { | |||
// TODO(btracey): Add in the "Reduced" forms for extracting the m×m orthogonal | |||
// and upper triangular matrices. | |||
|
|||
// LFromLQ extracts the m×n lower trapezoidal matrix from a LQ decomposition. | |||
func (m *Dense) LFromLQ(lq *LQ) { | |||
// LTo extracts the m×n lower trapezoidal matrix from a LQ decomposition. |
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.
Do we need the To
on the function calls? It's pretty clear from the function signature alone that it produces the matrix L
, and very clear with the documentation. Seeing x := lq.L(nil)
or lq.L(x)
both feel well in line with our other signatures.
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.
Thanks for reminding me. Yes, we do - see comments gonum/matrix#436 (comment).
I will go through the other instances that are like this and change them to match. For example gonum/matrix#433 (comment).
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.
Thanks for reminding me. I still buy the argument.
Added GSVD and HOGSVD equivalents. PTAL (also some missed doc errors in previous commits) |
// UFromGSVD extracts the matrix U from the singular value decomposition, storing | ||
// the result in-place into the receiver. U is size r×r. | ||
func (m *Dense) UFromGSVD(gsvd *GSVD) { | ||
// UTo extracts the matrix U from the singular value decomposition, storing |
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.
The documentation says U is rxr, but this makes it rxc.
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.
The HOGSVD types have a "VTo will panic if the receiver does not contain a successful factorization." Should the GSVD types as well?
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.
The documentation says U is rxr, but this makes it rxc.
U is (A_r,A_c), so U_r = U_c = r.
The HOGSVD types have a "VTo will panic if the receiver does not contain a successful factorization." Should the GSVD types as well?
Will do.
// VFromGSVD extracts the matrix V from the singular value decomposition, storing | ||
// the result in-place into the receiver. V is size p×p. | ||
func (m *Dense) VFromGSVD(gsvd *GSVD) { | ||
// VTo extracts the matrix V from the singular value decomposition, storing |
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.
The documentation says V is pxp, but this makes it rxc.
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.
See above.
// QFromGSVD extracts the matrix Q from the singular value decomposition, storing | ||
// the result in-place into the receiver. Q is size c×c. | ||
func (m *Dense) QFromGSVD(gsvd *GSVD) { | ||
// QTo extracts the matrix Q from the singular value decomposition, storing |
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.
The documentation says Q is cxc, but this makes it rxc.
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.
See above.
Port of gonum/matrix#436.
@btracey Please take a look.