Skip to content

Commit

Permalink
Remove powf_scalar kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed May 9, 2023
1 parent 575a199 commit 8b635c5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
25 changes: 0 additions & 25 deletions arrow-arith/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use arrow_array::*;
use arrow_buffer::i256;
use arrow_buffer::ArrowNativeType;
use arrow_schema::*;
use num::traits::Pow;
use std::cmp::min;
use std::sync::Arc;

Expand Down Expand Up @@ -1342,18 +1341,6 @@ pub fn negate_checked<T: ArrowNumericType>(
try_unary(array, |value| value.neg_checked())
}

/// Raise array with floating point values to the power of a scalar.
pub fn powf_scalar<T>(
array: &PrimitiveArray<T>,
raise: T::Native,
) -> Result<PrimitiveArray<T>, ArrowError>
where
T: ArrowFloatNumericType,
T::Native: Pow<T::Native, Output = T::Native>,
{
Ok(unary(array, |x| x.pow(raise)))
}

/// Perform `left * right` operation on two arrays. If either left or right value is null
/// then the result is also null.
///
Expand Down Expand Up @@ -3217,18 +3204,6 @@ mod tests {
assert_eq!(expected, actual);
}

#[test]
fn test_primitive_array_raise_power_scalar() {
let a = Float64Array::from(vec![1.0, 2.0, 3.0]);
let actual = powf_scalar(&a, 2.0).unwrap();
let expected = Float64Array::from(vec![1.0, 4.0, 9.0]);
assert_eq!(expected, actual);
let a = Float64Array::from(vec![Some(1.0), None, Some(3.0)]);
let actual = powf_scalar(&a, 2.0).unwrap();
let expected = Float64Array::from(vec![Some(1.0), None, Some(9.0)]);
assert_eq!(expected, actual);
}

#[test]
fn test_primitive_add_wrapping_overflow() {
let a = Int32Array::from(vec![i32::MAX, i32::MIN]);
Expand Down
29 changes: 0 additions & 29 deletions arrow-array/src/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,35 +558,6 @@ impl ArrowNumericType for Decimal256Type {
}
}

/// A subtype of primitive type that represents numeric float values
#[cfg(feature = "simd")]
pub trait ArrowFloatNumericType: ArrowNumericType {
/// SIMD version of pow
fn pow(base: Self::Simd, raise: Self::Simd) -> Self::Simd;
}

/// A subtype of primitive type that represents numeric float values
#[cfg(not(feature = "simd"))]
pub trait ArrowFloatNumericType: ArrowNumericType {}

macro_rules! make_float_numeric_type {
($impl_ty:ty, $simd_ty:ident) => {
#[cfg(feature = "simd")]
impl ArrowFloatNumericType for $impl_ty {
#[inline]
fn pow(base: Self::Simd, raise: Self::Simd) -> Self::Simd {
base.powf(raise)
}
}

#[cfg(not(feature = "simd"))]
impl ArrowFloatNumericType for $impl_ty {}
};
}

make_float_numeric_type!(Float32Type, f32x16);
make_float_numeric_type!(Float64Type, f64x8);

#[cfg(all(test, feature = "simd"))]
mod tests {
use super::*;
Expand Down

0 comments on commit 8b635c5

Please sign in to comment.