pub fn child_knn<M: Metric>(
        &self,
        dist_to_center: Option<f32>,
        point: &[f32],
        point_cloud: &PointCloud<M>,
        query_heap: &mut KnnQueryHeap,
    ) -> MalwareBrotResult<()> {
        let dist_to_center =
            dist_to_center.unwrap_or(point_cloud.distances_to_point(point, &[self.address.1])?[0]);

        if let Some(children) = &self.children {
            query_heap.push_nodes(
                &[(children.nested_scale, self.address.1)],
                &[dist_to_center],
                None,
            );
            let children_indexes: Vec<PointIndex> =
                children.addresses.iter().map(|(_si, pi)| *pi).collect();
            let distances = point_cloud.distances_to_point(point, &children_indexes[..])?;
            query_heap.push_nodes(&children.addresses[..], &distances, Some(self.address));
        }
        Ok(())
    }
/// Performs a brute force knn against the children of the node with a provided query heap. Does nothing if this is a leaf node.
/// If you have the distance from the query point to this you can pass it to save a distance calculation.
Performs a brute force knn against the children of the node with a provided query heap. Does nothing if this is a leaf node.
If you have the distance from the query point to this you can pass it to save a distance calculation.
Performs a brute force knn against the children of the node with a provided query heap . Does nothing if this is a leaf node . If you have the distance from the query point to this you can pass it to save a distance calculation .
pub fn child_knn<M: Metric>(
        &self,
        dist_to_center: Option<f32>,
        point: &[f32],
        point_cloud: &PointCloud<M>,
        query_heap: &mut KnnQueryHeap,
    ) -> MalwareBrotResult<()> {
        let dist_to_center =
            dist_to_center.unwrap_or(point_cloud.distances_to_point(point, &[self.address.1])?[0]);
        if let Some(children) = &self.children {
            query_heap.push_nodes(
                &[(children.nested_scale, self.address.1)],
                &[dist_to_center],
                None,
            );
            let children_indexes: Vec<PointIndex> =
                children.addresses.iter().map(|(_si, pi)| *pi).collect();
            let distances = point_cloud.distances_to_point(point, &children_indexes[..])?;
            query_heap.push_nodes(&children.addresses[..], &distances, Some(self.address));
        }
        Ok(())
    }
pub fn child_knn < M : Metric > ( & self , dist_to_center : Option < f32 > , point : & [ f32 ] , point_cloud : & PointCloud < M > , query_heap : & mut KnnQueryHeap , ) -> MalwareBrotResult < ( ) > { let dist_to_center = dist_to_center . unwrap_or ( point_cloud . distances_to_point ( point , & [ self . address . 1 ] ) ? [ 0 ] ) ; if let Some ( children ) = & self . children { query_heap . push_nodes ( & [ ( children . nested_scale , self . address . 1 ) ] , & [ dist_to_center ] , None , ) ; let children_indexes : Vec < PointIndex > = children . addresses . iter ( ) . map ( | ( _si , pi ) | * pi ) . collect ( ) ; let distances = point_cloud . distances_to_point ( point , & children_indexes [ .. ] ) ? ; query_heap . push_nodes ( & children . addresses [ .. ] , & distances , Some ( self . address ) ) ; } Ok ( ( ) ) }
Performs a brute force knn against the children of the node with a provided query heap.
Performs a brute force knn against the children of the node with a provided query heap .
&self
dist_to_center
Option<f32>
point
&[f32]
point_cloud
&PointCloud<M>
query_heap
&mut KnnQueryHeap
&self
dist_to_center
Option<f32>
point
&[f32]
point_cloud
&PointCloud<M>
query_heap
&mut KnnQueryHeap