Consolidate beam calc functions with generics#16
Open
cjordan wants to merge 5 commits into
Open
Conversation
Some examples were unintentionally using integer division, causing multiple coordinate pairs to have the same values.
The useless conversion warning only happens when GpuFloat is f64; it wouldn't happen if it's f32. I wondered why this wasn't triggering in the past. Some constants were referenced in doc strings that didn't exist. I must've ripped out the constants after writing the docs. Anyway, this commit adds them back in and makes them public.
This commit removes superfluous functions by allowing a single function for each beam type to use generics.
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.
Note that only the last commit in this PR is a breaking change; let me know if you want me to split it.
The last commit allows users to call the "calc beam" functions with anything we recognise as a "direction". Before this commit, there were two functions to allow (1) an AzEl or (2) a tuple of floats. With the generic approach, only a single function is needed; this is much tidier and could possibly be extended in the future.
I freely admit that I needed help with understanding the generics. You can see the discussion here: https://users.rust-lang.org/t/make-a-new-iterator-trait-to-replace-d-or-f64-f64/126644
Also, don't feel like this work has to be merged; I'm mostly doing this because I felt like this approach should've been there from the start, but I wasn't good enough/didn't have time to implement it. And now I'm a little bored and find myself missing Rust 🥲