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
aee36c3d
Commit
aee36c3d
authored
Nov 24, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added overloads of sparse_matrix_vector_multiply() that return their result
like normal rather than passing it back by reference.
parent
2bd7f123
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
sparse_vector.h
dlib/svm/sparse_vector.h
+26
-0
sparse_vector_abstract.h
dlib/svm/sparse_vector_abstract.h
+40
-0
No files found.
dlib/svm/sparse_vector.h
View file @
aee36c3d
...
...
@@ -942,6 +942,19 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
EXP
>
matrix
<
typename
EXP
::
type
,
0
,
1
>
sparse_matrix_vector_multiply
(
const
std
::
vector
<
sample_pair
>&
edges
,
const
matrix_exp
<
EXP
>&
v
)
{
matrix
<
typename
EXP
::
type
,
0
,
1
>
result
;
sparse_matrix_vector_multiply
(
edges
,
v
,
result
);
return
result
;
}
// ----------------------------------------------------------------------------------------
template
<
typename
EXP
,
typename
T
,
long
NR
,
long
NC
,
typename
MM
,
typename
L
>
...
...
@@ -975,6 +988,19 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
EXP
>
matrix
<
typename
EXP
::
type
,
0
,
1
>
sparse_matrix_vector_multiply
(
const
std
::
vector
<
ordered_sample_pair
>&
edges
,
const
matrix_exp
<
EXP
>&
v
)
{
matrix
<
typename
EXP
::
type
,
0
,
1
>
result
;
sparse_matrix_vector_multiply
(
edges
,
v
,
result
);
return
result
;
}
// ----------------------------------------------------------------------------------------
}
...
...
dlib/svm/sparse_vector_abstract.h
View file @
aee36c3d
...
...
@@ -576,6 +576,46 @@ namespace dlib
(i.e. result will have the same dimensions as v)
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
EXP
>
matrix
<
typename
EXP
::
type
,
0
,
1
>
sparse_matrix_vector_multiply
(
const
std
::
vector
<
sample_pair
>&
edges
,
const
matrix_exp
<
EXP
>&
v
);
/*!
requires
- is_col_vector(v) == true
- max_index_plus_one(edges) <= v.size()
ensures
- This is just a convenience routine for invoking the above
sparse_matrix_vector_multiply() routine. In particular, it just calls
sparse_matrix_vector_multiply() with a temporary result matrix and then
returns the result.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
EXP
>
matrix
<
typename
EXP
::
type
,
0
,
1
>
sparse_matrix_vector_multiply
(
const
std
::
vector
<
ordered_sample_pair
>&
edges
,
const
matrix_exp
<
EXP
>&
v
);
/*!
requires
- is_col_vector(v) == true
- max_index_plus_one(edges) <= v.size()
ensures
- This is just a convenience routine for invoking the above
sparse_matrix_vector_multiply() routine. In particular, it just calls
sparse_matrix_vector_multiply() with a temporary result matrix and then
returns the result.
!*/
// ----------------------------------------------------------------------------------------
}
...
...
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