Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QcmpCompressionLibrary
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioinformaticDataCompression
QcmpCompressionLibrary
Commits
1e08f03b
Commit
1e08f03b
authored
4 years ago
by
Vojtech Moravec
Browse files
Options
Downloads
Patches
Plain Diff
Modify the BBF search to use vector index only.
parent
b5b92ced
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/azgracompress/kdtree/KDTree.java
+13
-13
13 additions, 13 deletions
src/main/java/azgracompress/kdtree/KDTree.java
src/main/java/azgracompress/kdtree/TerminalKDNode.java
+2
-2
2 additions, 2 deletions
src/main/java/azgracompress/kdtree/TerminalKDNode.java
with
15 additions
and
15 deletions
src/main/java/azgracompress/kdtree/KDTree.java
+
13
−
13
View file @
1e08f03b
...
...
@@ -22,30 +22,30 @@ public class KDTree {
public
static
class
BBFSearchInfo
{
private
final
int
[][]
featureVectors
;
private
double
nearest
R
ecor
d
Distance
;
private
int
[]
nearest
R
ecor
d
;
private
double
nearest
V
ec
t
orDistance
;
private
int
nearest
V
ec
t
or
Index
;
public
BBFSearchInfo
(
final
int
[][]
featureVectors
)
{
this
.
featureVectors
=
featureVectors
;
nearest
R
ecor
d
=
null
;
nearest
R
ecor
d
Distance
=
Double
.
POSITIVE_INFINITY
;
nearest
V
ec
t
or
Index
=
-
1
;
nearest
V
ec
t
orDistance
=
Double
.
POSITIVE_INFINITY
;
}
public
int
[][]
getFeatureVectors
()
{
return
featureVectors
;
}
public
double
getNearest
R
ecor
d
Distance
()
{
return
nearest
R
ecor
d
Distance
;
public
double
getNearest
V
ec
t
orDistance
()
{
return
nearest
V
ec
t
orDistance
;
}
public
int
[]
getNearest
R
ecor
d
()
{
return
nearest
R
ecor
d
;
public
int
getNearest
V
ec
t
or
Index
()
{
return
nearest
V
ec
t
or
Index
;
}
public
void
setNearestRecord
(
final
int
[]
r
ecor
d
,
final
double
recordDistance
)
{
this
.
nearest
R
ecor
d
=
r
ecor
d
;
this
.
nearest
R
ecor
d
Distance
=
recordDistance
;
public
void
setNearestRecord
(
final
int
v
ec
t
or
Index
,
final
double
recordDistance
)
{
this
.
nearest
V
ec
t
or
Index
=
v
ec
t
or
Index
;
this
.
nearest
V
ec
t
orDistance
=
recordDistance
;
}
}
...
...
@@ -85,7 +85,7 @@ public class KDTree {
this
.
terminalNodeCount
=
terminalNodeCount
;
}
public
int
[]
findNearestBBF
(
final
int
[]
queryVector
,
final
int
maxE
)
{
public
int
findNearestBBF
(
final
int
[]
queryVector
,
final
int
maxE
)
{
PriorityQueue
<
NodeWithDistance
>
priorityQueue
=
new
PriorityQueue
<>();
priorityQueue
.
add
(
new
NodeWithDistance
(
root
,
0.0
));
...
...
@@ -114,7 +114,7 @@ public class KDTree {
}
}
}
return
searchInfo
.
getNearest
R
ecor
d
();
return
searchInfo
.
getNearest
V
ec
t
or
Index
();
}
public
int
getTotalNodeCount
()
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/azgracompress/kdtree/TerminalKDNode.java
+
2
−
2
View file @
1e08f03b
...
...
@@ -24,8 +24,8 @@ public class TerminalKDNode extends KDNode {
double
recordDistance
;
for
(
final
int
index
:
bucketIndices
)
{
recordDistance
=
Utils
.
calculateEuclideanDistance
(
queryRecord
,
searchInfo
.
getFeatureVectors
()[
index
]);
if
(
recordDistance
<
searchInfo
.
getNearest
R
ecor
d
Distance
())
{
searchInfo
.
setNearestRecord
(
searchInfo
.
getFeatureVectors
()[
index
]
,
recordDistance
);
if
(
recordDistance
<
searchInfo
.
getNearest
V
ec
t
orDistance
())
{
searchInfo
.
setNearestRecord
(
index
,
recordDistance
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment