-
Notifications
You must be signed in to change notification settings - Fork 11
feat: impl densitysketch #62
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Chojan Shang <psiace@apache.org>
|
|
||
| /// Density sketch for streaming density estimation. | ||
| pub struct DensitySketch<T: DensityValue> { | ||
| kernel: Box<dyn DensityKernel<T>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the any reasons not to keep the kernel as a generic argument of type K: DensityKernel<T>?
| } | ||
| } | ||
|
|
||
| fn check_k(k: u16) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this directly where it's called. I think having asserts inline really helps with the readability when people are exploring code.
| } | ||
|
|
||
| thread_local! { | ||
| static RNG_STATE: Cell<u64> = Cell::new(seed_rng()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love not to have thread local variables declared statically in the library. Is this really something we cannot store in another struct and pass it to the sketch when needed, delegating lifecycle decisions to the user?
Density sketch implementation for density estimation from streaming data.
Ref https://github.com/apache/datasketches-cpp/tree/master/density