-
Notifications
You must be signed in to change notification settings - Fork 5
Use TestSuite for eig #130
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
lkdvos
left a 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.
Except for the comment about the copy and the === tests I think this is also good for me
|
Previously all our tests were checking that that D, V you get out of the !
methods is the same D, V that went in, in terms of memory location. That
might be worth holding on to in case people are eg passing in a SubArray
for D and V?
…On Tue, Dec 23, 2025 at 5:56 PM Lukas Devos ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In ext/MatrixAlgebraKitGenericSchurExt.jl
<#130 (comment)>
:
> + if !isnothing(D)
+ copyto!(D, Diagonal(D_))
+ else
+ D = D_
+ end
+ if !isnothing(V)
+ copyto!(V, V_)
+ else
+ V = V_
+ end
I'm still not sure how I feel about this. I would still think our
interface specifies that we "may" use the input arrays, and since the D_,
V_ is already allocated anyways we might just return that and not use the
extra copy?
If this is to make the tests work, then the previous tests were relying on
behavior that is not required by the interface and so that should
definitely not be tested.
—
Reply to this email directly, view it on GitHub
<#130 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGKJYYL5FCX4QM22J2QGJD4DFX5HAVCNFSM6AAAAACP3B7D7KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMMBYG4ZDENBQGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
fb9ef70 to
ea4a723
Compare
|
While I agree that we do not commit to actually using the given output arguments in our current interface specification, I am starting to wonder if that was a mistake. It becomes very hard to draw a line. There are various I do think type stability is a good reason. In that case, it would be fairly obvious that that the two approaches yield different output types. But indeed, as pointed out by @kshyatt , also in the more subtle cases that do not involve an I don't think including non-mutable types in that discussion is really valid; if something like |
|
I guess the problem partially stems from the |
|
I think it would indeed be a good idea to rethink our interface and re-evaluate what we want to do with that. This being said, the current state is pretty clear, all our docstrings explicitly state that we do not guarantee that the provided memory will be used, which is reflected by the GenericLinearAlgebra implementations not having this. To repeat, I'm not saying that this is necessarily the best solution, and we really should have a proper discussion about the interface after the holidays. One detail I want to mention too is that the current design isn't only because of Q, R = qr_compact(A)
# some intermediate steps
# ...
# Wrong: reusing Q and R here, assuming result will be stored in `Q` and `R`
qr_compact!(A, (Q, R), ...)
return Q, R
# Correct: reusing Q and R here but not assuming where the result is stored:
Q, R = qr_compact!(A, (Q, R), ...)
return Q, RIn that sense, I somewhat like that this isn't just a bug that would only show up when performing AD, and rather already is wrong behavior with some of the algorithms. Similar arguments hold for Mooncake too in principle, as we can greatly simplify some of these implementations just by allowing them to be not in-place, avoiding the need to store the intermediates etc. |
|
I also think if we want to modify these guarantees, it's a bit of a separate issue from this PR (e.g. we can always modify things later to enforce the guarantee and update the tests if/when we do so) |
Made some changes to the
GenericSchurwrappers so that inputDVtoeig_full!actually does get modified, for example.