Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
2c67ebd2
Commit
2c67ebd2
authored
Dec 31, 2011
by
Davis King
Browse files
Made this code a little more flexible with regard to input matrix type.
parent
3714ff54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
dlib/lsh/create_random_projection_hash.h
dlib/lsh/create_random_projection_hash.h
+6
-2
No files found.
dlib/lsh/create_random_projection_hash.h
View file @
2c67ebd2
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "projection_hash.h"
#include "projection_hash.h"
#include "../matrix.h"
#include "../matrix.h"
#include "../rand.h"
#include "../rand.h"
#include "../statistics.h"
#include <vector>
#include <vector>
namespace
dlib
namespace
dlib
...
@@ -44,9 +45,12 @@ namespace dlib
...
@@ -44,9 +45,12 @@ namespace dlib
}
}
#endif
#endif
running_covariance
<
matrix
<
double
>
>
rc
;
for
(
unsigned
long
i
=
0
;
i
<
v
.
size
();
++
i
)
rc
.
add
(
matrix_cast
<
double
>
(
v
[
i
]));
// compute a whitening matrix
// compute a whitening matrix
matrix
<
double
>
whiten
=
trans
(
chol
(
pinv
(
covariance
(
vector_to_matrix
(
v
)
))));
matrix
<
double
>
whiten
=
trans
(
chol
(
pinv
(
rc
.
covariance
())));
// hashes
// hashes
...
@@ -88,7 +92,7 @@ namespace dlib
...
@@ -88,7 +92,7 @@ namespace dlib
temp
.
clear
();
temp
.
clear
();
for
(
unsigned
long
i
=
0
;
i
<
v
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
v
.
size
();
++
i
)
{
{
vals
[
i
]
=
dot
(
rowm
(
proj
,
itr
),
v
[
i
]);
vals
[
i
]
=
dot
(
rowm
(
proj
,
itr
),
matrix_cast
<
double
>
(
v
[
i
])
)
;
if
(
h
[
i
]
==
max_h
)
if
(
h
[
i
]
==
max_h
)
temp
.
push_back
(
vals
[
i
]);
temp
.
push_back
(
vals
[
i
]);
}
}
...
...
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