-
Notifications
You must be signed in to change notification settings - Fork 155
[FEAT] Add reinterpretation utilities and polynomial vector operations #954
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
Conversation
let from_size = size_of::<From>(); | ||
let to_size = size_of::<To>(); | ||
|
||
assert!(from_size > 0 && to_size > 0, "Invalid zero-sized types"); |
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.
maybe use Result here instead of assertion?
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.
It's a good point, I will make the reinterpret return a Result
} | ||
|
||
fn memset(&mut self, _: u8, _: usize) -> Result<(), eIcicleError> { | ||
panic!("Cannot memset immutable UnifiedSlice"); |
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.
Result here is returned, but panic is used inside
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.
will fix
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.
everything is fine, but maybe it is better to remove panics where it's possible
Great observation. I refactored and return Results now so errors returned to used instead of panic |
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.
Nice
TODO add more error types in eIcicileError
reinterpret_slice
andreinterpret_slice_mut
for view castingHostOrDeviceSlice
between any two typesflatten_polyring_slice
andflatten_polyring_slice_mut
to abstract flattening ofHostOrDeviceSlice<P>
toHostOrDeviceSlice<P::Base>
polyvec_add
,polyvec_sub
,polyvec_mul
,polyvec_mul_by_scalar
, andpolyvec_sum_reduce
overHostOrDeviceSlice<PolynomialRing>
cuda-backend-branch: main
metal-backend-branch: main