rtkpos ddidx restamb: rewrite for clarity #516
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.
Trying to follow these functions was a challenge, for me anyway, the indexing strides over the state vector, sats are referenced by differences like j-k (aka sat1), and restamb() was brittle and broke if the double diffs order produced by ddidx() changed at all. This should not change the function of these at all, it's just an attempt to clarify the code and make it less brittle.
For ddidx(), replace the baked in striding over the state vector with the use of the IB() macro. This makes the code less fragile if the state vector layout changes and make it easier to explore alternative double difference orderings.
Rewrite restamb() to use the index produced by ddidx() which it must match, rather than striding over the state vector in the same manner as ddidx(). Now many changes to the double difference indexing in ddidx() do not necessarily require matching chances to restamb().
There remains some code in holdamb() striding over the state vector, and that might need to match the indexing in ddidx(), and that is still brittle to changes in ddidx().