Commit aee36c3d authored by Davis King's avatar Davis King

Added overloads of sparse_matrix_vector_multiply() that return their result

like normal rather than passing it back by reference.
parent 2bd7f123
......@@ -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;
}
// ----------------------------------------------------------------------------------------
}
......
......@@ -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.
!*/
// ----------------------------------------------------------------------------------------
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment