Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PointCloud
Flann
提交
ad352b7f
F
Flann
项目概览
PointCloud
/
Flann
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flann
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ad352b7f
编写于
11月 06, 2018
作者:
M
Marius Muja
提交者:
GitHub
11月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #392 from greenbrettmichael/greenbrettmichael/fix_for_c17_support
support c++17
上级
f3a17cd3
be80cefa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
18 deletion
+18
-18
src/cpp/flann/algorithms/kdtree_index.h
src/cpp/flann/algorithms/kdtree_index.h
+4
-1
src/cpp/flann/util/heap.h
src/cpp/flann/util/heap.h
+4
-1
src/cpp/flann/util/lsh_table.h
src/cpp/flann/util/lsh_table.h
+4
-1
src/cpp/flann/util/random.h
src/cpp/flann/util/random.h
+6
-15
未找到文件。
src/cpp/flann/algorithms/kdtree_index.h
浏览文件 @
ad352b7f
...
...
@@ -37,6 +37,7 @@
#include <cstring>
#include <stdarg.h>
#include <cmath>
#include <random>
#include "flann/general.h"
#include "flann/algorithms/nn_index.h"
...
...
@@ -265,7 +266,9 @@ protected:
/* Construct the randomized trees. */
for
(
int
i
=
0
;
i
<
trees_
;
i
++
)
{
/* Randomize the order of vectors to allow for unbiased sampling. */
std
::
random_shuffle
(
ind
.
begin
(),
ind
.
end
());
std
::
random_device
rd
;
std
::
mt19937
g
(
rd
());
std
::
shuffle
(
ind
.
begin
(),
ind
.
end
(),
g
);
tree_roots_
[
i
]
=
divideTree
(
&
ind
[
0
],
int
(
size_
)
);
}
delete
[]
mean_
;
...
...
src/cpp/flann/util/heap.h
浏览文件 @
ad352b7f
...
...
@@ -105,8 +105,11 @@ public:
count
=
0
;
}
struct
CompareT
:
public
std
::
binary_function
<
T
,
T
,
bool
>
struct
CompareT
{
typedef
T
first_argument_type
;
typedef
T
second_argument_type
;
typedef
bool
result_type
;
bool
operator
()(
const
T
&
t_1
,
const
T
&
t_2
)
const
{
return
t_2
<
t_1
;
...
...
src/cpp/flann/util/lsh_table.h
浏览文件 @
ad352b7f
...
...
@@ -39,6 +39,7 @@
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <random>
// TODO as soon as we use C++0x, use the code in USE_UNORDERED_MAP
#if USE_UNORDERED_MAP
#include <unordered_map>
...
...
@@ -363,7 +364,9 @@ inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int
// A bit brutal but fast to code
std
::
vector
<
size_t
>
indices
(
feature_size
*
CHAR_BIT
);
for
(
size_t
i
=
0
;
i
<
feature_size
*
CHAR_BIT
;
++
i
)
indices
[
i
]
=
i
;
std
::
random_shuffle
(
indices
.
begin
(),
indices
.
end
());
std
::
random_device
rd
;
std
::
mt19937
g
(
rd
());
std
::
shuffle
(
indices
.
begin
(),
indices
.
end
(),
g
);
// Generate a random set of order of subsignature_size_ bits
for
(
unsigned
int
i
=
0
;
i
<
key_size_
;
++
i
)
{
...
...
src/cpp/flann/util/random.h
浏览文件 @
ad352b7f
...
...
@@ -34,6 +34,7 @@
#include <algorithm>
#include <cstdlib>
#include <cstddef>
#include <random>
#include <vector>
#include "flann/general.h"
...
...
@@ -50,9 +51,6 @@ inline void seed_random(unsigned int seed)
srand
(
seed
);
}
/*
* Generates a random double value.
*/
/**
* Generates a random double value.
* @param high Upper limit
...
...
@@ -61,7 +59,7 @@ inline void seed_random(unsigned int seed)
*/
inline
double
rand_double
(
double
high
=
1.0
,
double
low
=
0
)
{
return
low
+
((
high
-
low
)
*
(
std
::
rand
()
/
(
RAND_MAX
+
1.0
)));
return
low
+
((
high
-
low
)
*
(
std
::
rand
()
/
(
RAND_MAX
+
1.0
)));
}
/**
...
...
@@ -72,17 +70,10 @@ inline double rand_double(double high = 1.0, double low = 0)
*/
inline
int
rand_int
(
int
high
=
RAND_MAX
,
int
low
=
0
)
{
return
low
+
(
int
)
(
double
(
high
-
low
)
*
(
std
::
rand
()
/
(
RAND_MAX
+
1.0
)));
return
low
+
(
int
)(
double
(
high
-
low
)
*
(
std
::
rand
()
/
(
RAND_MAX
+
1.0
)));
}
class
RandomGenerator
{
public:
ptrdiff_t
operator
()
(
ptrdiff_t
i
)
{
return
rand_int
(
i
);
}
};
/**
* Random number generator that returns a distinct number from
* the [0,n) interval each time.
...
...
@@ -110,14 +101,14 @@ public:
*/
void
init
(
int
n
)
{
static
RandomGenerator
generator
;
// create and initialize an array of size n
vals_
.
resize
(
n
);
size_
=
n
;
for
(
int
i
=
0
;
i
<
size_
;
++
i
)
vals_
[
i
]
=
i
;
// shuffle the elements in the array
std
::
random_shuffle
(
vals_
.
begin
(),
vals_
.
end
(),
generator
);
std
::
random_device
rd
;
std
::
mt19937
g
(
rd
());
std
::
shuffle
(
vals_
.
begin
(),
vals_
.
end
(),
g
);
counter_
=
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录