polars_compute/
lib.rs

1#![cfg_attr(feature = "simd", feature(portable_simd))]
2#![cfg_attr(feature = "simd", feature(avx512_target_feature))]
3#![cfg_attr(
4    all(feature = "simd", target_arch = "x86_64"),
5    feature(stdarch_x86_avx512)
6)]
7
8use arrow::types::NativeType;
9
10pub mod arithmetic;
11pub mod arity;
12pub mod bitwise;
13#[cfg(feature = "approx_unique")]
14pub mod cardinality;
15#[cfg(feature = "cast")]
16pub mod cast;
17pub mod comparisons;
18pub mod filter;
19pub mod float_sum;
20#[cfg(feature = "gather")]
21pub mod gather;
22pub mod horizontal_flatten;
23#[cfg(feature = "approx_unique")]
24pub mod hyperloglogplus;
25pub mod if_then_else;
26pub mod min_max;
27pub mod propagate_dictionary;
28pub mod size;
29pub mod sum;
30pub mod unique;
31pub mod var_cov;
32
33// Trait to enable the scalar blanket implementation.
34pub trait NotSimdPrimitive: NativeType {}
35
36#[cfg(not(feature = "simd"))]
37impl<T: NativeType> NotSimdPrimitive for T {}
38
39#[cfg(feature = "simd")]
40impl NotSimdPrimitive for u128 {}
41#[cfg(feature = "simd")]
42impl NotSimdPrimitive for i128 {}
43
44// Trait to allow blanket impl for all SIMD types when simd is enabled.
45#[cfg(feature = "simd")]
46mod _simd_primitive {
47    use std::simd::SimdElement;
48    pub trait SimdPrimitive: SimdElement {}
49    impl SimdPrimitive for u8 {}
50    impl SimdPrimitive for u16 {}
51    impl SimdPrimitive for u32 {}
52    impl SimdPrimitive for u64 {}
53    impl SimdPrimitive for usize {}
54    impl SimdPrimitive for i8 {}
55    impl SimdPrimitive for i16 {}
56    impl SimdPrimitive for i32 {}
57    impl SimdPrimitive for i64 {}
58    impl SimdPrimitive for isize {}
59    impl SimdPrimitive for f32 {}
60    impl SimdPrimitive for f64 {}
61}
62
63#[cfg(feature = "simd")]
64pub use _simd_primitive::SimdPrimitive;