Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LSMTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
LSMTool
Commits
afae9316
Commit
afae9316
authored
4 years ago
by
Arend G. Dijkstra
Browse files
Options
Downloads
Patches
Plain Diff
performance improvements
parent
a152b2e0
No related branches found
No related tags found
1 merge request
!18
Add c++ version of mean shift algorithm
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
meanshift.cpp
+5
-5
5 additions, 5 deletions
meanshift.cpp
with
5 additions
and
5 deletions
meanshift.cpp
+
5
−
5
View file @
afae9316
...
...
@@ -58,7 +58,7 @@ void Grouper::readCoordinates(py::array_t<cdt> array, py::array_t<cdt> farray){
}
static
double
euclid_distance
(
std
::
pair
<
cdt
,
cdt
>
coordinate1
,
std
::
pair
<
cdt
,
cdt
>
coordinate2
){
static
double
euclid_distance
(
const
std
::
pair
<
cdt
,
cdt
>
&
coordinate1
,
const
std
::
pair
<
cdt
,
cdt
>
&
coordinate2
){
// Euclidian distance between two points
double
result
=
0.0
;
double
distx
=
coordinate1
.
first
-
coordinate2
.
first
;
...
...
@@ -66,7 +66,7 @@ static double euclid_distance(std::pair<cdt, cdt> coordinate1, std::pair<cdt,cdt
return
sqrt
(
distx
*
distx
+
disty
*
disty
);
}
static
std
::
vector
<
unsigned
>
neighbourhood_points
(
std
::
pair
<
cdt
,
cdt
>
centroid
,
ctype
coordinates
,
double
max_distance
){
static
std
::
vector
<
unsigned
>
neighbourhood_points
(
const
std
::
pair
<
cdt
,
cdt
>
&
centroid
,
const
ctype
&
coordinates
,
double
max_distance
){
std
::
vector
<
unsigned
>
result
;
for
(
unsigned
n
=
0
;
n
<
coordinates
.
size
();
++
n
){
double
distance
=
euclid_distance
(
centroid
,
coordinates
[
n
]);
...
...
@@ -114,7 +114,7 @@ void Grouper::run(){
}
double
maxdiff
=
0.0
;
unsigned
n
=
0
;
for
(
auto
coordinate
:
_coordinates
){
for
(
auto
&
coordinate
:
_coordinates
){
double
diff
=
euclid_distance
(
coordinate
,
newcoords
[
n
]);
if
(
diff
>
maxdiff
){
maxdiff
=
diff
;
...
...
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