Commit bd863f3f authored by Davis King's avatar Davis King

Made it so you can pass a dlib::matrix to the array_to_matrix

and vector_to_matrix functions.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402374
parent a5036437
......@@ -1382,7 +1382,21 @@ namespace dlib
template <
typename array_type
>
const matrix_exp<matrix_array_exp<array_type> > array_to_matrix (
const typename enable_if<is_matrix<array_type>,array_type>::type&
array_to_matrix (
const array_type& array
)
{
return array;
}
// ----------------------------------------------------------------------------------------
template <
typename array_type
>
const typename disable_if<is_matrix<array_type>,matrix_exp<matrix_array_exp<array_type> > >::type
array_to_matrix (
const array_type& array
)
{
......@@ -1395,7 +1409,8 @@ namespace dlib
template <
typename vector_type
>
const matrix_exp<matrix_vector_exp<vector_type> > vector_to_matrix (
const typename disable_if<is_matrix<vector_type>,matrix_exp<matrix_vector_exp<vector_type> > >::type
vector_to_matrix (
const vector_type& vector
)
{
......@@ -1403,6 +1418,18 @@ namespace dlib
return matrix_exp<exp>(exp(vector));
}
// ----------------------------------------------------------------------------------------
template <
typename vector_type
>
const typename enable_if<is_matrix<vector_type>,vector_type>::type& vector_to_matrix (
const vector_type& vector
)
{
return vector;
}
// ----------------------------------------------------------------------------------------
template <
......
......@@ -152,8 +152,11 @@ namespace dlib
/*!
requires
- vector_type is an implementation of array/array_kernel_abstract.h or
std::vector or dlib::std_vector_c
std::vector or dlib::std_vector_c or dlib::matrix
ensures
- if (vector_type is a dlib::matrix) then
- returns a reference to vector
- else
- returns a matrix R such that:
- R.nr() == vector.size()
- R.nc() == 1
......@@ -172,7 +175,11 @@ namespace dlib
/*!
requires
- array_type is an implementation of array2d/array2d_kernel_abstract.h
or dlib::matrix
ensures
- if (array_type is a dlib::matrix) then
- returns a reference to array
- else
- returns a matrix R such that:
- R.nr() == array.nr()
- R.nc() == array.nc()
......
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