polars_compute/
lib.rs

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