mirror of https://github.com/davisking/dlib.git
Made some of this code a little more general.
This commit is contained in:
parent
04f8d80361
commit
6391a03440
|
@ -30,11 +30,12 @@ namespace
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::map<unsigned long, double> > mat_to_sparse (
|
template <typename T>
|
||||||
const matrix<double>& A
|
std::vector<std::map<unsigned long, T> > mat_to_sparse (
|
||||||
|
const matrix<T>& A
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::map<unsigned long,double> > temp(A.nr());
|
std::vector<std::map<unsigned long,T> > temp(A.nr());
|
||||||
for (long r = 0; r < A.nr(); ++r)
|
for (long r = 0; r < A.nr(); ++r)
|
||||||
{
|
{
|
||||||
for (long c = 0; c < A.nc(); ++c)
|
for (long c = 0; c < A.nc(); ++c)
|
||||||
|
@ -47,8 +48,9 @@ namespace
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
matrix<double> rm_zeros (
|
template <typename EXP>
|
||||||
const matrix<double>& m
|
matrix<typename EXP::type> rm_zeros (
|
||||||
|
const matrix_exp<EXP>& m
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Do this to avoid trying to correlate super small numbers that are really just
|
// Do this to avoid trying to correlate super small numbers that are really just
|
||||||
|
|
Loading…
Reference in New Issue