Function smartnoise_runtime::components::filter::filter[][src]

pub fn filter<T: Clone + Default>(
    data: ArrayD<T>,
    mask: ArrayD<bool>
) -> Result<ArrayD<T>>

Filters data down into only the desired rows.

Arguments

Return

Data with only the desired rows.

Example

use ndarray::{ArrayD, arr1, arr2};
use smartnoise_runtime::components::filter::filter;

let data = arr2(&[ [1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12] ]).into_dyn();
let mask = arr1(&[true, false, true, false]).into_dyn();
let filtered = filter(data, mask).unwrap();
assert_eq!(filtered, arr2(&[ [1, 2, 3], [7, 8, 9] ]).into_dyn());