Repository navigation
Vectorized precision in gh_encode + doc/build cleanups - #47
Merged
Merged
Conversation
- gh_encode() now accepts a per-coordinate precision vector (length 1 or length(coords)), encoding different points at different zoom levels in one call. Length-1 precision still applies to all coordinates as before, so the change is backward compatible. The C encoder sizes its buffer to the largest requested precision and reads each coordinate's precision in the main loop. - Fix gh_encode docs: maximum precision is 25 (GH_MAX_PRECISION), not 28. - Add .claude to .Rbuildignore to silence the R CMD check hidden-files NOTE. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| } | ||
| \details{ | ||
| \code{precision} is limited to at most 28. This level of precision encodes locations on the globe at a nanometer scale and is already more than enough for basically all applications. | ||
| \code{precision} is limited to at most 25. This level of precision encodes locations on the globe at a nanometer scale and is already more than enough for basically all applications. |
| // size the working buffer to the largest requested precision | ||
| int kmax = 0; | ||
| for (int j=0; j<nk; j++) if (kp[j] > kmax) kmax = kp[j]; | ||
| char gh_elt[kmax+1]; |
Owner
There was a problem hiding this comment.
This will throw -Wvla:
Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
Owner
|
Thanks! |
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.
QOL improvements (independent of the
gh_coveringperformance work in #44).gh_encode()accepts a vector of precisionsgh_encode()previously errored on anyprecisionof length > 1 ("precision is fixed on input (for now)"). It now accepts either:precision(applied to all coordinates, as before), orprecisionvector the same length as the coordinates, giving a per-coordinate zoom level.Backward compatible — length-1 precision behaves exactly as before. The C encoder sizes its working buffer to the largest requested precision and reads each coordinate's precision inside the main loop. New tests verify the vector path equals element-wise scalar calls, prefix behaviour,
NA/Infhandling, per-element truncation warnings, and the length/validity error paths.Doc & build cleanups
?gh_encodeclaimed a maximum precision of 28; the actual cap is 25 (GH_MAX_PRECISION). Corrected..claudeto.Rbuildignoreto silence theR CMD check"hidden files and directories"NOTE.Notes
man/*.Rdare hand-maintained (not roxygen-generated), soRoxygenNote: 7.2.3inDESCRIPTIONis vestigial — bumping it would falsely imply roxygen manages the docs. Left as-is; flagging in case you'd prefer to remove the field.🤖 Generated with Claude Code