Add do_vl/do_vr opt-out flags to EigenSystem#795
Open
yungyuc wants to merge 1 commit into
Open
Conversation
yungyuc
commented
May 20, 2026
| .def( | ||
| "get_vl", | ||
| &wrapped_type::vl, | ||
| py::arg("suppress_exception") = false, |
Member
Author
There was a problem hiding this comment.
New getters to allow throwing an exception and suppress it.
| array_type const & wi() const { return m_wi; } | ||
| array_type const & vl() const { return m_vl; } | ||
| array_type const & vr() const { return m_vr; } | ||
| array_type const & vl(bool suppress_exception = false) const; |
Member
Author
There was a problem hiding this comment.
Add suppression argument.
| array_type const & vr() const { return m_vr; } | ||
| array_type const & vl(bool suppress_exception = false) const; | ||
| array_type const & vr(bool suppress_exception = false) const; | ||
| bool do_vl() const { return m_do_vl; } |
Member
Author
There was a problem hiding this comment.
Add getter for do_vl/vr()
| */ | ||
| char const jobvl = 'V'; | ||
| char const jobvr = 'V'; | ||
| char const jobvl = m_do_vl ? 'V' : 'N'; |
Member
Author
There was a problem hiding this comment.
Use the calculation selector.
| */ | ||
| inline EigenSystem::array_type const & EigenSystem::vl(bool suppress_exception) const | ||
| { | ||
| if (!m_do_vl && !suppress_exception) |
Member
Author
There was a problem hiding this comment.
Throw exception if vl is not requested.
| */ | ||
| inline EigenSystem::array_type const & EigenSystem::vr(bool suppress_exception) const | ||
| { | ||
| if (!m_do_vr && !suppress_exception) |
Member
Author
There was a problem hiding this comment.
Throw exception if vr is not requested.
Collaborator
There was a problem hiding this comment.
Could you explain why there is a "suppress_exception" design? Why not always throwing?
| del A | ||
| np.testing.assert_array_equal(solver.matrix.ndarray, A_np) | ||
|
|
||
| def test_default_constructor_flags_both_true(self): |
Member
Author
There was a problem hiding this comment.
New test functions for the optional vl / vr calculation.
Allow to construct the class `EigenSystem` with `do_vl=false` and/or `do_vr=false` to skip the corresponding eigenvector computation. With the options to be off, the corresponding matrix stays empty. Calling the getters `vl()` / `vr()` throw when the matrix was not computed unless called with `suppress_exception=true`, which returns the empty placeholder. Python keeps `vl`/`vr` as read-only properties and adds `get_vl()` / `get_vr()` helpers exposing the flag. Related to issue solvcon#791.
tigercosmos
approved these changes
May 20, 2026
Collaborator
tigercosmos
left a comment
There was a problem hiding this comment.
LGTM. Raised one question.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow to construct the class
EigenSystemwithdo_vl=falseand/ordo_vr=falseto skip the corresponding eigenvector computation.With the options to be off, the corresponding matrix stays empty. Calling the getters
vl()/vr()throw when the matrix was not computed unless called withsuppress_exception=true, which returns the empty placeholder.Python keeps
vl/vras read-only properties and addsget_vl()/get_vr()helpers exposing the flag.Related to issue #791.