Commit d8b7db20 authored by Davis King's avatar Davis King

Changed the reciprocal() function so that it can work with

complex numbers.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402843
parent 4470e29c
......@@ -233,7 +233,7 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
static type apply ( const M& m, long r, long c)
{
const type temp = m(r,c);
if (temp != 0)
if (temp != static_cast<type>(0))
return static_cast<type>(1.0/temp);
else
return 0;
......@@ -252,7 +252,10 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
COMPILE_TIME_ASSERT((
is_same_type<typename EXP::type,float>::value == true ||
is_same_type<typename EXP::type,double>::value == true ||
is_same_type<typename EXP::type,long double>::value == true
is_same_type<typename EXP::type,long double>::value == true ||
is_same_type<typename EXP::type,std::complex<float> >::value == true ||
is_same_type<typename EXP::type,std::complex<double> >::value == true ||
is_same_type<typename EXP::type,std::complex<long double> >::value == true
));
return matrix_unary_exp<EXP,op_reciprocal>(m.ref());
}
......
......@@ -153,7 +153,8 @@ namespace dlib
);
/*!
requires
- matrix_exp::type == float, double, or long double
- matrix_exp::type == float, double, long double, std::complex<float>,
std::complex<double>, or std::complex<long double>
ensures
- returns a matrix R such that:
- R::type == the same type that was in m
......
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