-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Unexpected transposition when combining convert() and copy() for adjoints #26294
Comments
I think this is a "don't do that" and the copying constructor should be function Woodbury(V::AbstractMatrix)
cV = copy(V)
Woodbury{typeof(cV)}(cV)
end |
That is indeed the fix I went with. Thanks! |
I think this |
JeffBezanson
added a commit
that referenced
this issue
Mar 5, 2018
JeffBezanson
added a commit
that referenced
this issue
Mar 6, 2018
JeffBezanson
added a commit
that referenced
this issue
Mar 6, 2018
JeffBezanson
added a commit
that referenced
this issue
Mar 7, 2018
JeffBezanson
added a commit
that referenced
this issue
Mar 8, 2018
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just noticed this while trying to fix WoodburyMatrices.jl for v0.7. Here's a reduced example of the behavior:
Previously, this worked fine. However, something interesting happens if
V
happens to be an Adjoint:Note that even though we constructed
Woodbury
with the2x3
Vprime, we got a3x2
matrix in theV
field. What's happening is:Woodbury(Vprime::Adjoint)
typeof(Vprime)
isAdjoint
copy(Vprime)
returns a plainMatrix
Woodbury{Adjoint{...}}(vprime_copy::Matrix)
convert(Adjoint, vprime_copy::Matrix)
...vprime_copy
, yielding a matrix which is transposed from the originalVprime
In essence, this is a case where
convert(typeof(V), copy(V))
returns the adjoint of V, not something of the same shape as V.This is all perfectly correct given the currently defined behaviors, but it seems like an edge case that might be worth fixing. For example, if
copy(Vprime)
returned anotherAdjoint
, then I believe this particular problem would go away (but I imagine it's not as easy as that).Of course, the answer may just be "don't do that". It's easy to fix this particular case now that I understand what's going on, but it may be a trap that others fall into.
The text was updated successfully, but these errors were encountered: