Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-compute/src/lib.rs
8420 views
1
#![cfg_attr(feature = "simd", feature(portable_simd))]
2
3
use arrow::types::NativeType;
4
5
pub mod arithmetic;
6
pub mod arity;
7
pub mod binview_index_map;
8
pub mod bitwise;
9
#[cfg(feature = "approx_unique")]
10
pub mod cardinality;
11
#[cfg(feature = "cast")]
12
pub mod cast;
13
pub mod comparisons;
14
#[cfg(feature = "dtype-decimal")]
15
pub mod decimal;
16
pub mod ewm;
17
pub mod filter;
18
#[cfg(feature = "cast")]
19
pub mod find_validity_mismatch;
20
pub mod float_sum;
21
#[cfg(feature = "gather")]
22
pub mod gather;
23
pub mod horizontal_flatten;
24
#[cfg(feature = "approx_unique")]
25
pub mod hyperloglogplus;
26
pub mod if_then_else;
27
pub mod min_max;
28
pub mod moment;
29
pub mod nan;
30
pub mod propagate_dictionary;
31
pub mod propagate_nulls;
32
pub mod rolling;
33
pub mod size;
34
pub mod sum;
35
pub mod trim_lists_to_normalized_offsets;
36
pub mod unique;
37
38
// Trait to enable the scalar blanket implementation.
39
pub trait NotSimdPrimitive: NativeType {}
40
41
#[cfg(not(feature = "simd"))]
42
impl<T: NativeType> NotSimdPrimitive for T {}
43
44
#[cfg(feature = "simd")]
45
impl NotSimdPrimitive for u128 {}
46
#[cfg(feature = "simd")]
47
impl NotSimdPrimitive for i128 {}
48
#[cfg(feature = "simd")]
49
impl NotSimdPrimitive for pf16 {}
50
51
// Trait to allow blanket impl for all SIMD types when simd is enabled.
52
#[cfg(feature = "simd")]
53
mod _simd_primitive {
54
use std::simd::SimdElement;
55
pub trait SimdPrimitive: SimdElement {}
56
impl SimdPrimitive for u8 {}
57
impl SimdPrimitive for u16 {}
58
impl SimdPrimitive for u32 {}
59
impl SimdPrimitive for u64 {}
60
impl SimdPrimitive for usize {}
61
impl SimdPrimitive for i8 {}
62
impl SimdPrimitive for i16 {}
63
impl SimdPrimitive for i32 {}
64
impl SimdPrimitive for i64 {}
65
impl SimdPrimitive for isize {}
66
impl SimdPrimitive for f32 {}
67
impl SimdPrimitive for f64 {}
68
}
69
70
#[cfg(feature = "simd")]
71
pub use _simd_primitive::SimdPrimitive;
72
#[cfg(feature = "simd")]
73
use polars_utils::float16::pf16;
74
75