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
9fa63ad8
Commit
9fa63ad8
authored
May 22, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit test for the new dot() overloads.
parent
422223ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
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
test_sparse_matrix_vector_multiply1
();
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