Add option to skip SO2 re-normalization#559
Open
DmitriyKorchemkin wants to merge 1 commit intostrasdat:mainfrom
Open
Add option to skip SO2 re-normalization#559DmitriyKorchemkin wants to merge 1 commit intostrasdat:mainfrom
DmitriyKorchemkin wants to merge 1 commit intostrasdat:mainfrom
Conversation
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.
This patch adds control over re-normalization for SO2/SE2 groups.
Rationale
For short sequences of operations (5..10 group products) the norm of the unit complex number representing the group element typically does not drift significantly.
In those cases, re-normalization can be omitted, avoiding extra cost of square roots and divisions for basic group operations.
For my problem (closed-form steering control computations) switching to unnormalized group operations yields ~3..4x increase in speed.
Implemented behavior
Normalization behavior is controlled by
PreserveInvariantflag of the type.Default is to keep normalization (current behavior), except
SO2::inverse()andSO2::exp():inverse()only changes the sign of the imaginary part, thus the norm is preserved automaticallyexp()skips normalization under assumption thatsinandcosvalues are consistent with each otherConversions between (un-)normalized types are possible via
operator()andSO2(SO2Base<OtherDerived> const&)constructors.Group operation always returns unnormalized product if either of factors is unnormalized.
Implementation in the
mainbranch performed normalization twice inoperator*:I have added a switch that checks if norm is exactly 1,0 after series-based approximation, but this might need to be relaxed.