Skip to content

Commit

Permalink
Multiple changes after throughout testing (#308)
Browse files Browse the repository at this point in the history
- Improved code readability by auto-indenting core functions and reworking 'setup' and 'Examples' functions, including adding necessary files for separation from core functions.
- Renamed functions for clarity and fixed multiple small bugs; changes are compatible with OpenEarthTools but distinct. 

---------

Co-authored-by: Keith Roberts <kroberts@baird.com>
  • Loading branch information
omouraenko and krober10nd authored Feb 23, 2024
1 parent 5154562 commit 7660c30
Show file tree
Hide file tree
Showing 97 changed files with 3,749 additions and 3,497 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ datasets/
fort.*
Examples/*
!Examples/Example_*
!Examples/runall.m
*/*.mat
*.15
*.14
Expand Down
16 changes: 8 additions & 8 deletions @ann/ann.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function anno = ann(data)
%
% ANN class
%
% ANN class
%
% Usage:
% anno = ann(pts)
%
Expand All @@ -15,7 +15,7 @@
% ksearch:
% k-nn search
% [idx dst] = ksearch(anno, pt, k, eps, [asm])
%
%
% idx - indices of matching points: (k)x(#points)
% dst - square distance of the points
%
Expand All @@ -42,11 +42,11 @@
% anno - active ann object handle
% pt - query point (only one this time, (d)x1 vector)
% r - search radius (_not_ squared)
% k - required k aprox. nearest neighbors. Will return at most k nieghbors
% k - required k aprox. nearest neighbors. Will return at most k nieghbors
% of distance at most r.
% eps - accuracy multiplicative factor
% asm - allow self match flag (optional, default: true)
%
%
% note that numel(idx) and numel(dst) = min(k, inr)
% inr might be larger than k reflecting how many points are actually
% in the search radius.
Expand Down Expand Up @@ -86,10 +86,10 @@
% algorithm for approximate nearest neighbor searching,''
% 5th Ann. ACM-SIAM Symposium on Discrete Algorithms,
% 1994, 573-582.
%
% This software is provided under the provisions of the
%
% This software is provided under the provisions of the
% Lesser GNU Public License (LGPL).
% This software can be used only for research purposes, you should cite
% This software can be used only for research purposes, you should cite
% the aforementioned papers in any resulting publication.
%
%
Expand Down
2 changes: 1 addition & 1 deletion @ann/close.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
% if isfield(anno,'working_flag') && anno.working_flag
if anno.working_flag
annmex(anno.modes.CLOSE, anno.kd_ptr);
% anno.kd_ptr = annmex(anno.modes.CLOSE, anno.kd_ptr);
% anno.kd_ptr = annmex(anno.modes.CLOSE, anno.kd_ptr);
end
anno = [];
8 changes: 4 additions & 4 deletions @ann/frsearch.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [idx dst inr] = frsearch(ann, query, r, k, epsl, asm)
%
%
% kNN FR search
% Usage:
% [idx dst inr] = frsearch(ann, query, rad, k, asm, eps)
Expand All @@ -9,8 +9,8 @@
% query - (d)x(N) query points
% k - number of nearest nieghbors (if points in ann < k than less than k
% points are returned)
% epsl - epsilon search precision
% asm - allow self match flag, if false points with dst = 0 are ignored
% epsl - epsilon search precision
% asm - allow self match flag, if false points with dst = 0 are ignored
% (defualt is true)
%
if nargin == 5
Expand All @@ -27,7 +27,7 @@

[idx dst inr] = annmex(ann.modes.FRSEARCH, ann.kd_ptr, query, k, epsl, r);

if ~asm
if ~asm
if dst(1) == 0
dst(1) = [];
idx(1) = [];
Expand Down
6 changes: 3 additions & 3 deletions @ann/ksearch.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [idx dst] = ksearch(ann, query, k, epsl, asm)
%
%
% kNN search
% Usage:
% [idx dst] = ksearch(ann, query, k, epsl, [asm])
Expand All @@ -9,8 +9,8 @@
% query - (d)x(N) query points
% k - number of nearest nieghbors (if points in ann < k than less than k
% points are returned)
% epsl - epsilon search precision
% asm - allow self match flag, if false points with dst = 0 are ignored
% epsl - epsilon search precision
% asm - allow self match flag, if false points with dst = 0 are ignored
% (default is true)
%
if nargin == 4
Expand Down
6 changes: 3 additions & 3 deletions @ann/prisearch.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [idx dst] = prisearch(ann, query, k, epsl, asm)
%
%
% kNN search
% Usage:
% [idx dst] = prisearch(ann, query, k, asm, eps)
Expand All @@ -9,8 +9,8 @@
% query - (d)x(N) query points
% k - number of nearest nieghbors (if points in ann < k than less than k
% points are returned)
% epsl - epsilon search precision
% asm - allow self match flag, if false points with dst = 0 are ignored
% epsl - epsilon search precision
% asm - allow self match flag, if false points with dst = 0 are ignored
% (defualt is true)
%
if nargin == 4
Expand Down
2 changes: 1 addition & 1 deletion @ann/private/get_data_class.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [ccls cfun] = get_data_class()
% get class supported by ann
% get class supported by ann
d = annmex();
ccls = class(d);

Expand Down
4 changes: 2 additions & 2 deletions @ann/private/modes.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
m.OPEN = 1;
m.CLOSE = 2;
m.KSEARCH = 3;
m.PRISEARCH=4;
m.FRSEARCH=5;
m.PRISEARCH = 4;
m.FRSEARCH = 5;
Loading

0 comments on commit 7660c30

Please sign in to comment.