-
Notifications
You must be signed in to change notification settings - Fork 15
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
New eigen solve interface #71
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #71 +/- ##
==========================================
+ Coverage 90.17% 91.87% +1.70%
==========================================
Files 18 18
Lines 1699 1711 +12
==========================================
+ Hits 1532 1572 +40
+ Misses 167 139 -28 ☔ View full report in Codecov by Sentry. |
return ([QuantumObject(res.vectors[:, k], OperatorKet, res.dims) for k in 1:length(res.values)], Val(:vectors)) | ||
end | ||
end | ||
Base.iterate(res::EigsolveResult, ::Val{:vectors}) = (res.vectors, Val(:done)) |
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.
Should we return already a QuantumObject? In this way
E, V, U = eigenstates(H)
U is already a QuantumObject.
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 was thinking of returning U
as a Qobj
in the beginning
but I noticed that for sparse solvers: U
is usually a non-squared matrix.
if we do it in this way, it will make the return object type unstable (depends on sparse=true
or false
).
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, we can leave it like this
|
return ([QuantumObject(res.vectors[:, k], OperatorKet, res.dims) for k in 1:length(res.values)], Val(:vectors)) | ||
end | ||
end | ||
Base.iterate(res::EigsolveResult, ::Val{:vectors}) = (res.vectors, Val(:done)) |
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, we can leave it like this
close #39
Summary of this PR:
struct EigsolveResult
iterate
forEigsolveResult
show
forEigsolveResult
eigenenergies(A::QuantumObject; sparse::Bool=false, kwargs...)
eigenstates(A::QuantumObject; sparse::Bool=false, kwargs...)
Also, the fields in
EigsolveResult
likevals
andvecs
have been renamed tovalues
andvectors
, repectively. Make the variable name same asLinearAlgebra.Eigen
.