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
5ff051c5
Commit
5ff051c5
authored
Jan 27, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added negative_dot_product_distance and also clarified spec regarding thread
safety.
parent
dc9527be
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
2 deletions
+66
-2
function_objects.h
dlib/graph_utils/function_objects.h
+14
-0
function_objects_abstract.h
dlib/graph_utils/function_objects_abstract.h
+52
-2
No files found.
dlib/graph_utils/function_objects.h
View file @
5ff051c5
...
@@ -65,6 +65,20 @@ namespace dlib
...
@@ -65,6 +65,20 @@ namespace dlib
}
}
};
};
// ----------------------------------------------------------------------------------------
struct
negative_dot_product_distance
{
template
<
typename
sample_type
>
double
operator
()
(
const
sample_type
&
a
,
const
sample_type
&
b
)
const
{
return
-
dot
(
a
,
b
);
}
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
struct
use_weights_of_one
struct
use_weights_of_one
...
...
dlib/graph_utils/function_objects_abstract.h
View file @
5ff051c5
...
@@ -18,6 +18,11 @@ namespace dlib
...
@@ -18,6 +18,11 @@ namespace dlib
WHAT THIS OBJECT REPRESENTS
WHAT THIS OBJECT REPRESENTS
This is a simple function object that computes squared euclidean distance
This is a simple function object that computes squared euclidean distance
between two dlib::matrix objects.
between two dlib::matrix objects.
THREAD SAFETY
This object has no mutable members. Therefore, it is safe to call
operator() on a single instance of this object simultaneously from multiple
threads.
!*/
!*/
squared_euclidean_distance
(
squared_euclidean_distance
(
...
@@ -64,9 +69,14 @@ namespace dlib
...
@@ -64,9 +69,14 @@ namespace dlib
{
{
/*!
/*!
WHAT THIS OBJECT REPRESENTS
WHAT THIS OBJECT REPRESENTS
This is a simple function object that
the cosine of the angle between
This is a simple function object that
computes the cosine of the angle
two vectors and returns 1 - this quantity. Moreover, this object
between
two vectors and returns 1 - this quantity. Moreover, this object
works for both sparse and dense vectors.
works for both sparse and dense vectors.
THREAD SAFETY
This object has no mutable members. Therefore, it is safe to call
operator() on a single instance of this object simultaneously from multiple
threads.
!*/
!*/
template
<
typename
sample_type
>
template
<
typename
sample_type
>
...
@@ -89,6 +99,36 @@ namespace dlib
...
@@ -89,6 +99,36 @@ namespace dlib
!*/
!*/
};
};
// ----------------------------------------------------------------------------------------
struct
negative_dot_product_distance
{
/*!
WHAT THIS OBJECT REPRESENTS
This is a simple function object that computes the dot product between two
vectors and returns the negation of this value. Moreover, this object
works for both sparse and dense vectors.
THREAD SAFETY
This object has no mutable members. Therefore, it is safe to call
operator() on a single instance of this object simultaneously from multiple
threads.
!*/
template
<
typename
sample_type
>
double
operator
()
(
const
sample_type
&
a
,
const
sample_type
&
b
)
const
;
/*!
requires
- sample_type is a dense vector (e.g. a dlib::matrix) or a sparse
vector as defined at the top of dlib/svm/sparse_vector_abstract.h
ensures
- returns -dot(a,b)
!*/
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
struct
use_weights_of_one
struct
use_weights_of_one
...
@@ -97,6 +137,11 @@ namespace dlib
...
@@ -97,6 +137,11 @@ namespace dlib
WHAT THIS OBJECT REPRESENTS
WHAT THIS OBJECT REPRESENTS
This is a simple function object that takes a single argument
This is a simple function object that takes a single argument
and always returns 1
and always returns 1
THREAD SAFETY
This object has no mutable members. Therefore, it is safe to call
operator() on a single instance of this object simultaneously from multiple
threads.
!*/
!*/
template
<
typename
edge_type
>
template
<
typename
edge_type
>
...
@@ -117,6 +162,11 @@ namespace dlib
...
@@ -117,6 +162,11 @@ namespace dlib
WHAT THIS OBJECT REPRESENTS
WHAT THIS OBJECT REPRESENTS
This is a simple function object that takes a single argument
This is a simple function object that takes a single argument
which should be an object similar to dlib::sample_pair.
which should be an object similar to dlib::sample_pair.
THREAD SAFETY
This object has no mutable members. Therefore, it is safe to call
operator() on a single instance of this object simultaneously from multiple
threads.
!*/
!*/
use_gaussian_weights
(
use_gaussian_weights
(
...
...
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