pub fn saturating_mul_scalar<T>(
    lhs: &PrimitiveArray<T>,
    rhs: &T
) -> PrimitiveArray<T> where
    T: NativeArithmetics + SaturatingMul<Output = T>, 
Available on crate feature compute_arithmetics only.
Expand description

Saturated multiplication of a scalar T to a primitive array of type T. If the result from the mul overflows for this type, then the result will be saturated

Examples

use arrow2::compute::arithmetics::basic::saturating_mul_scalar;
use arrow2::array::Int8Array;

let a = Int8Array::from(&[Some(-100i8)]);
let result = saturating_mul_scalar(&a, &100i8);
let expected = Int8Array::from(&[Some(-128i8)]);
assert_eq!(result, expected);