Added overloads of mat() that convert a single scalar into a matrix.

This commit is contained in:
Davis King 2014-05-04 19:45:57 -04:00
parent eb08ae92a8
commit 8c797ae9b3
2 changed files with 40 additions and 0 deletions

View File

@ -469,6 +469,35 @@ namespace dlib
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
inline matrix<double,1,1> mat (
double value
)
{
matrix<double,1,1> temp;
temp(0) = value;
return temp;
}
inline matrix<float,1,1> mat (
float value
)
{
matrix<float,1,1> temp;
temp(0) = value;
return temp;
}
inline matrix<long double,1,1> mat (
long double value
)
{
matrix<long double,1,1> temp;
temp(0) = value;
return temp;
}
// ----------------------------------------------------------------------------------------
}

View File

@ -188,6 +188,17 @@ namespace dlib
R(r,c) == m(r,c)
!*/
// ----------------------------------------------------------------------------------------
matrix<double,1,1> mat (double value);
matrix<float,1,1> mat (float value);
matrix<long double,1,1> mat (long double value);
/*!
ensures
- Converts a scalar into a matrix containing just that scalar and returns the
results.
!*/
// ----------------------------------------------------------------------------------------
}