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 binview_index_map;
13pub mod bitwise;
14#[cfg(feature = "approx_unique")]
15pub mod cardinality;
16#[cfg(feature = "cast")]
17pub mod cast;
18pub mod comparisons;
19pub mod filter;
20#[cfg(feature = "cast")]
21pub mod find_validity_mismatch;
22pub mod float_sum;
23#[cfg(feature = "gather")]
24pub mod gather;
25pub mod horizontal_flatten;
26#[cfg(feature = "approx_unique")]
27pub mod hyperloglogplus;
28pub mod if_then_else;
29pub mod min_max;
30pub mod moment;
31pub mod propagate_dictionary;
32pub mod propagate_nulls;
33pub mod rolling;
34pub mod size;
35pub mod sum;
36pub mod trim_lists_to_normalized_offsets;
37pub mod unique;
38
39// Trait to enable the scalar blanket implementation.
40pub trait NotSimdPrimitive: NativeType {}
41
42#[cfg(not(feature = "simd"))]
43impl<T: NativeType> NotSimdPrimitive for T {}
44
45#[cfg(feature = "simd")]
46impl NotSimdPrimitive for u128 {}
47#[cfg(feature = "simd")]
48impl NotSimdPrimitive for i128 {}
49
50// Trait to allow blanket impl for all SIMD types when simd is enabled.
51#[cfg(feature = "simd")]
52mod _simd_primitive {
53    use std::simd::SimdElement;
54    pub trait SimdPrimitive: SimdElement {}
55    impl SimdPrimitive for u8 {}
56    impl SimdPrimitive for u16 {}
57    impl SimdPrimitive for u32 {}
58    impl SimdPrimitive for u64 {}
59    impl SimdPrimitive for usize {}
60    impl SimdPrimitive for i8 {}
61    impl SimdPrimitive for i16 {}
62    impl SimdPrimitive for i32 {}
63    impl SimdPrimitive for i64 {}
64    impl SimdPrimitive for isize {}
65    impl SimdPrimitive for f32 {}
66    impl SimdPrimitive for f64 {}
67}
68
69#[cfg(feature = "simd")]
70pub use _simd_primitive::SimdPrimitive;