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
9fa63ad8
"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "cb342b745aa57798b759c0ba5b80c045a5dafbad"
Commit
9fa63ad8
authored
May 21, 2014
by
Davis King
Browse files
Added unit test for the new dot() overloads.
parent
422223ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
dlib/test/sparse_vector.cpp
dlib/test/sparse_vector.cpp
+19
-0
No files found.
dlib/test/sparse_vector.cpp
View file @
9fa63ad8
...
@@ -271,6 +271,25 @@ namespace
...
@@ -271,6 +271,25 @@ namespace
test_sparse_matrix_vector_multiply1
();
test_sparse_matrix_vector_multiply1
();
test_sparse_matrix_vector_multiply2
();
test_sparse_matrix_vector_multiply2
();
{
matrix
<
double
,
0
,
1
>
a
,
b
;
a
=
gaussian_randm
(
6
,
1
,
0
);
b
=
gaussian_randm
(
6
,
1
,
1
);
std
::
vector
<
std
::
pair
<
unsigned
long
,
double
>
>
aa
,
bb
;
assign
(
aa
,
a
);
assign
(
bb
,
b
);
// dot() does something special when the sparse vectors have entries for
// each dimension, which is what happens when they are copied from dense
// vectors. So the point of the tests in this block is to make sure dot()
// works right in this case.
DLIB_TEST
(
std
::
abs
(
dot
(
a
,
b
)
-
dot
(
aa
,
bb
))
<
1e-14
);
a
(
3
)
=
0
;
assign
(
aa
,
a
);
DLIB_TEST
(
std
::
abs
(
dot
(
a
,
b
)
-
dot
(
aa
,
bb
))
<
1e-14
);
}
}
}
};
};
...
...
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