Commit 97759301 authored by Davis King's avatar Davis King

Added a missing type cast to the reciprocal() function to fix a compile

time error you get when you use it with complex<float> type matrices.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403023
parent d9fb6199
......@@ -266,7 +266,7 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{
const type temp = m(r,c);
if (temp != static_cast<type>(0))
return static_cast<type>(1.0/temp);
return static_cast<type>((type)1.0/temp);
else
return 0;
}
......
......@@ -851,6 +851,23 @@ namespace
DLIB_TEST(complex_matrix(a,b)(2,1) == std::complex<double>(0,0));
}
{
matrix<complex<double> > m(2,2), m2(2,2);
complex<double> val1(1,2), val2(1.0/complex<double>(1,2));
m = val1;
m2 = val2;
DLIB_TEST(reciprocal(m) == m2);
}
{
matrix<complex<float> > m(2,2), m2(2,2);
complex<float> val1(1,2), val2(1.0f/complex<float>(1,2));
m = val1;
m2 = val2;
DLIB_TEST(reciprocal(m) == m2);
}
{
matrix<float,3,1> m1, m2;
set_all_elements(m1,2.0);
......
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