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
Add portable_simd support #45
base: master
Are you sure you want to change the base?
Conversation
|
||
#[inline(always)] | ||
unsafe fn extract_unchecked(&self, i: usize) -> Self::Element { | ||
self.0[i] |
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.
There's no unchecked version from what I've seen
|
||
#[inline(always)] | ||
unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element) { | ||
self.0[i] = val; |
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.
Same here?
}; | ||
use approx::AbsDiffEq; | ||
#[cfg(feature = "decimal")] | ||
use decimal::d128; |
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.
Have not tested with this feature, TODO
#[inline(always)] | ||
fn sample<R: rand::Rng + ?Sized>(&self, rng: &mut R) -> $wrapped { | ||
<$wrapped>::new($( | ||
ignore_snd!([self.sample(rng)], [$i]) |
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.
There's a nicer specialization for packed_simd
vectors in the rand
crate, not sure if it's faster or by how much. It uses fill_bytes loaded into an int vector and then shuffled to fit into a float vector.
Fixes #33
Does not have acceleration for trigonometric functions due to rust-lang/portable-simd#6
Follows the
packed_simd
implementation closely, but masks are calledmask<$elt>x<$lanes>
notm<$elt>x<$lanes>
Has a few more things than packed_simd like native
recip
,floor
,ceil
,trunc
, but crucially it's missing trigonometry accelration.