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
Add orth interface function #2227
Draft
sdrave
wants to merge
23
commits into
main
Choose a base branch
from
qr-orth-interface
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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.
This PR can be seen as an alternative approach to #2211. It adds an
orth
interface function that orthonormalizes aVectorArray
by dispatching to various orthonormalization algorithms.Main characteristics:
pad=False
(which is the default), the spans ofV
and the computedbasis
are supposed to agree. Thus,len(basis) <= len(V)
. By settingpad=True
, it is ensured thatlen(basis) == len(V)
, potentially by adding random vectors to the span.hierarchical
isTrue
, the span of the first k vectors inV
agrees with the span of the first k vectors inbasis
. I.e., we obtain a QR decomposition. Sinceorth
returns the coefficients ofV
in the new basis as expected bylincomb
, the returned array has to be transposed in order to get a QR decomposition.The approach is based on the general observation that (more or less) everywhere in pyMOR, where
qr
(orgram_schmidt
) is called, we actually want to orthonormalize a basis and do not care so much about the actual algorithm. Also, I think thatorth
fits better with the notion of aVectorArrray
then QR decomposition. As such, I have replaced all calls toqr
withorth
. I wasn't always sure, of the resulting basis were needed. I see it as a feature of this approach that this has to be made explicit inorth
calls. I also believe that aqr
function would not really be needed in this case, or would act as an alias fororth
.This is meant as a basis for discussion. The implementation is ad-hoc and not fully tested. Argument names or their precise semantics, as well as the name of the function itself could be changed.