Algorithm-KNN-XS

 view release on metacpan or  search on metacpan

lib/Algorithm/KNN/XS.pm  view on Meta::CPAN

=cut

sub annCntNeighbours {
    my ($self, %args) = @_;

    return $self->tree->annCntNeighbours($args{query_point}, $args{epsilon} || 0, $args{radius} || 0);
}

=over 4

=item * $knn->theDim()

Returns the dimension that the points in the current tree have.

    my $dimension = $knn->theDim();

=over 8

=item * Return value

Dimension of the tree points.

=back

=back

=cut

sub theDim {
    return shift->tree->theDim();
}

=over 4

=item * $knn->nPoints()

Returns the number of points in the current tree.

    my $n_points = $knn->nPoints();

=over 8

=item * Return value

Number of points in the tree.

=back

=back

=cut

sub nPoints {
    return shift->tree->nPoints();
}

=over 4

=item * $knn->Print( ... )

Prints the current tree. Normally useful for debugging.

    my $output = $knn->Print(
        points => 1,
    );

=over 8

=item * points

If set to 1 all points will be printed at the top of the output.

The default value is 1.

=item * Return value

A string of the printed tree.

=back

=back

=cut

sub Print {
    my ($self, %args) = @_;
    $args{points}     = 1 if !defined $args{points};

    return $self->tree->Print($args{points});
}

=over 4

=item * $knn->Dump( ... )

Dumps the current tree. The dump can be passed into the new method to
initialize a new tree or to visualize it via the external programm ann2fig.

    my $output = $knn->Dump(
        points => 1,
    );

=over 8

=item * points

If set to 1 all points will be printed at the top of the output. The new
methods only accepts a tree that got dumped with points set to 1.

The default value is 1.

=item * Return value

A string of the dumped tree.

=back

=back

=cut



( run in 0.459 second using v1.01-cache-2.11-cpan-0bd6704ced7 )