Skip to content

Commit

Permalink
delete more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp committed Oct 16, 2024
1 parent 753363a commit f7eb162
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 91 deletions.
12 changes: 0 additions & 12 deletions crates/polars-arrow/src/legacy/kernels/atan2.rs

This file was deleted.

54 changes: 0 additions & 54 deletions crates/polars-arrow/src/legacy/kernels/float.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/polars-arrow/src/legacy/kernels/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ use std::iter::Enumerate;

use crate::array::BooleanArray;
use crate::bitmap::utils::BitChunks;
pub mod atan2;
pub mod concatenate;
pub mod ewm;
#[cfg(feature = "compute_take")]
pub mod fixed_size_list;
pub mod float;
#[cfg(feature = "compute_take")]
pub mod list;
pub mod pow;
Expand Down
9 changes: 4 additions & 5 deletions crates/polars-core/src/chunked_array/float.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use arrow::legacy::kernels::float::*;
use arrow::legacy::kernels::set::set_at_nulls;
use num_traits::Float;
use polars_utils::total_ord::{canonical_f32, canonical_f64};
Expand All @@ -12,16 +11,16 @@ where
T::Native: Float,
{
pub fn is_nan(&self) -> BooleanChunked {
self.apply_kernel_cast(&is_nan::<T::Native>)
unary_elementwise_values(self, |x| x.is_nan())
}
pub fn is_not_nan(&self) -> BooleanChunked {
self.apply_kernel_cast(&is_not_nan::<T::Native>)
unary_elementwise_values(self, |x| !x.is_nan())
}
pub fn is_finite(&self) -> BooleanChunked {
self.apply_kernel_cast(&is_finite)
unary_elementwise_values(self, |x| x.is_finite())
}
pub fn is_infinite(&self) -> BooleanChunked {
self.apply_kernel_cast(&is_infinite)
unary_elementwise_values(self, |x| x.is_infinite())
}

#[must_use]
Expand Down
22 changes: 4 additions & 18 deletions crates/polars-plan/src/dsl/function_expr/trigonometry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use arrow::legacy::kernels::atan2::atan2 as atan2_kernel;
use num::Float;
use polars_core::chunked_array::ops::arity::broadcast_binary_elementwise;
use polars_core::export::num;

use super::*;
Expand Down Expand Up @@ -117,23 +117,9 @@ where
.unpack_series_matching_type(x.as_materialized_series())
.unwrap();

if x.len() == 1 {
let x_value = x
.get(0)
.ok_or_else(|| polars_err!(ComputeError: "arctan2 x value is null"))?;

Ok(Some(y.apply_values(|v| v.atan2(x_value)).into_column()))
} else if y.len() == 1 {
let y_value = y
.get(0)
.ok_or_else(|| polars_err!(ComputeError: "arctan2 y value is null"))?;

Ok(Some(x.apply_values(|v| y_value.atan2(v)).into_column()))
} else {
Ok(Some(
polars_core::prelude::arity::binary(y, x, atan2_kernel).into_column(),
))
}
Ok(Some(
broadcast_binary_elementwise(y, x, |yv, xv| Some(yv?.atan2(xv?))).into_column(),
))
}

fn apply_trigonometric_function_to_float<T>(
Expand Down

0 comments on commit f7eb162

Please sign in to comment.