Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
542d9920
Commit
542d9920
authored
Oct 29, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched the sample_pair object to use double to store its distance
value instead of float.
parent
cfb0d477
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
29 deletions
+29
-29
graph_creation.h
dlib/manifold_regularization/graph_creation.h
+12
-12
graph_creation_abstract.h
dlib/manifold_regularization/graph_creation_abstract.h
+5
-5
linear_manifold_regularizer.h
dlib/manifold_regularization/linear_manifold_regularizer.h
+3
-3
sample_pair.h
dlib/manifold_regularization/sample_pair.h
+5
-5
sample_pair_abstract.h
dlib/manifold_regularization/sample_pair_abstract.h
+4
-4
No files found.
dlib/manifold_regularization/graph_creation.h
View file @
542d9920
...
...
@@ -29,7 +29,7 @@ namespace dlib
that has the biggest distance
!*/
{
float
dist
=
begin
->
distance
();
double
dist
=
begin
->
distance
();
iterator
worst
=
begin
;
for
(;
begin
!=
end
;
++
begin
)
{
...
...
@@ -92,8 +92,8 @@ namespace dlib
const
unsigned
long
idx2
=
rnd
.
get_random_32bit_number
()
%
samples
.
size
();
if
(
idx1
!=
idx2
)
{
const
float
dist
=
dist_funct
(
samples
[
idx1
],
samples
[
idx2
]);
if
(
dist
<
std
::
numeric_limits
<
float
>::
infinity
())
const
double
dist
=
dist_funct
(
samples
[
idx1
],
samples
[
idx2
]);
if
(
dist
<
std
::
numeric_limits
<
double
>::
infinity
())
{
edges
.
push_back
(
sample_pair
(
idx1
,
idx2
,
dist
));
}
...
...
@@ -140,7 +140,7 @@ namespace dlib
helper
(
unsigned
long
idx1
,
unsigned
long
idx2
,
float
dist
double
dist
)
:
index1
(
idx1
),
index2
(
idx2
),
...
...
@@ -149,7 +149,7 @@ namespace dlib
unsigned
long
index1
;
unsigned
long
index2
;
float
distance
;
double
distance
;
};
inline
bool
order_by_index
(
...
...
@@ -221,8 +221,8 @@ namespace dlib
const
unsigned
long
idx2
=
rnd
.
get_random_32bit_number
()
%
samples
.
size
();
if
(
idx1
!=
idx2
)
{
const
float
dist
=
dist_funct
(
samples
[
idx1
],
samples
[
idx2
]);
if
(
dist
<
std
::
numeric_limits
<
float
>::
infinity
())
const
double
dist
=
dist_funct
(
samples
[
idx1
],
samples
[
idx2
]);
if
(
dist
<
std
::
numeric_limits
<
double
>::
infinity
())
{
edges
.
push_back
(
impl2
::
helper
(
idx1
,
idx2
,
dist
));
edges
.
push_back
(
impl2
::
helper
(
idx2
,
idx1
,
dist
));
...
...
@@ -320,10 +320,10 @@ namespace dlib
// Initialize all the edges to an edge with an invalid index
edges
.
resize
(
samples
.
size
()
*
k
,
sample_pair
(
samples
.
size
(),
samples
.
size
(),
std
::
numeric_limits
<
float
>::
infinity
()));
sample_pair
(
samples
.
size
(),
samples
.
size
(),
std
::
numeric_limits
<
double
>::
infinity
()));
// Hold the length for the longest edge for each node. Initially they are all infinity.
std
::
vector
<
float
>
worst_dists
(
samples
.
size
(),
std
::
numeric_limits
<
float
>::
infinity
());
std
::
vector
<
double
>
worst_dists
(
samples
.
size
(),
std
::
numeric_limits
<
double
>::
infinity
());
std
::
vector
<
sample_pair
>::
iterator
begin_i
,
end_i
,
begin_j
,
end_j
,
itr
;
begin_i
=
edges
.
begin
();
...
...
@@ -343,7 +343,7 @@ namespace dlib
begin_j
+=
k
;
end_j
+=
k
;
const
float
dist
=
dist_funct
(
samples
[
i
],
samples
[
j
]);
const
double
dist
=
dist_funct
(
samples
[
i
],
samples
[
j
]);
if
(
dist
<
worst_dists
[
i
])
{
...
...
@@ -446,7 +446,7 @@ namespace dlib
>
void
remove_long_edges
(
vector_type
&
pairs
,
float
distance_threshold
double
distance_threshold
)
{
vector_type
temp
;
...
...
@@ -470,7 +470,7 @@ namespace dlib
>
void
remove_short_edges
(
vector_type
&
pairs
,
float
distance_threshold
double
distance_threshold
)
{
vector_type
temp
;
...
...
dlib/manifold_regularization/graph_creation_abstract.h
View file @
542d9920
...
...
@@ -45,7 +45,7 @@ namespace dlib
- contains_duplicate_pairs(#out) == false
- for all valid i:
- #out[i].distance() == dist_funct(samples[#out[i].index1()], samples[#out[i].index2()])
- #out[i].distance() < std::numeric_limits<
float
>::infinity()
- #out[i].distance() < std::numeric_limits<
double
>::infinity()
- random_seed is used to seed the random number generator used by this
function.
!*/
...
...
@@ -88,7 +88,7 @@ namespace dlib
- contains_duplicate_pairs(#out) == false
- for all valid i:
- #out[i].distance() == dist_funct(samples[#out[i].index1()], samples[#out[i].index2()])
- #out[i].distance() < std::numeric_limits<
float
>::infinity()
- #out[i].distance() < std::numeric_limits<
double
>::infinity()
- random_seed is used to seed the random number generator used by this
function.
!*/
...
...
@@ -118,7 +118,7 @@ namespace dlib
be not connected at all.
- for all valid i:
- #out[i].distance() == dist_funct(samples[#out[i].index1()], samples[#out[i].index2()])
- #out[i].distance() < std::numeric_limits<
float
>::infinity()
- #out[i].distance() < std::numeric_limits<
double
>::infinity()
- contains_duplicate_pairs(#out) == false
!*/
...
...
@@ -169,7 +169,7 @@ namespace dlib
>
void
remove_long_edges
(
vector_type
&
pairs
,
float
distance_threshold
double
distance_threshold
);
/*!
requires
...
...
@@ -188,7 +188,7 @@ namespace dlib
>
void
remove_short_edges
(
vector_type
&
pairs
,
float
distance_threshold
double
distance_threshold
);
/*!
requires
...
...
dlib/manifold_regularization/linear_manifold_regularizer.h
View file @
542d9920
...
...
@@ -31,11 +31,11 @@ namespace dlib
struct
neighbor
{
neighbor
(
unsigned
long
idx
,
float
w
)
:
index
(
idx
),
weight
(
w
)
{}
neighbor
(
unsigned
long
idx
,
double
w
)
:
index
(
idx
),
weight
(
w
)
{}
neighbor
()
:
index
(
0
),
weight
(
0
)
{}
unsigned
long
index
;
float
weight
;
double
weight
;
};
typedef
std
::
vector
<
neighbor
>::
const_iterator
const_iterator
;
...
...
@@ -137,7 +137,7 @@ namespace dlib
// finally, put the edges into data
for
(
unsigned
long
i
=
0
;
i
<
edges
.
size
();
++
i
)
{
const
float
weight
=
weight_funct
(
edges
[
i
]);
const
double
weight
=
weight_funct
(
edges
[
i
]);
sum_edge_weights
+=
weight
;
// make sure requires clause is not broken
...
...
dlib/manifold_regularization/sample_pair.h
View file @
542d9920
...
...
@@ -20,13 +20,13 @@ namespace dlib
_index1
(
0
),
_index2
(
0
)
{
_distance
=
std
::
numeric_limits
<
float
>::
infinity
();
_distance
=
std
::
numeric_limits
<
double
>::
infinity
();
}
sample_pair
(
const
unsigned
long
idx1
,
const
unsigned
long
idx2
,
const
float
dist
const
double
dist
)
{
_distance
=
dist
;
...
...
@@ -48,13 +48,13 @@ namespace dlib
const
unsigned
long
&
index2
(
)
const
{
return
_index2
;
}
const
float
&
distance
(
const
double
&
distance
(
)
const
{
return
_distance
;
}
private
:
unsigned
long
_index1
;
unsigned
long
_index2
;
float
_distance
;
double
_distance
;
};
// ----------------------------------------------------------------------------------------
...
...
@@ -120,7 +120,7 @@ namespace dlib
try
{
unsigned
long
idx1
,
idx2
;
float
dist
;
double
dist
;
deserialize
(
idx1
,
in
);
deserialize
(
idx2
,
in
);
...
...
dlib/manifold_regularization/sample_pair_abstract.h
View file @
542d9920
...
...
@@ -24,7 +24,7 @@ namespace dlib
of representing a single edge in more than one way. That is,
sample_pair(i,j) == sample_pair(j,i) for any value of i and j.
This object also contains a
float
which can be used for any purpose.
This object also contains a
double
which can be used for any purpose.
!*/
public
:
...
...
@@ -34,13 +34,13 @@ namespace dlib
ensures
- #index1() == 0
- #index2() == 0
- #distance() == std::numeric_limits<
float
>::infinity()
- #distance() == std::numeric_limits<
double
>::infinity()
!*/
sample_pair
(
const
unsigned
long
idx1
,
const
unsigned
long
idx2
,
const
float
dist
const
double
dist
);
/*!
ensures
...
...
@@ -63,7 +63,7 @@ namespace dlib
- returns the second index value stored in this object
!*/
const
float
&
distance
(
const
double
&
distance
(
)
const
;
/*!
ensures
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment