Commit 1b992baa authored by Davis King's avatar Davis King

Added some MATLAB style thresholding relational operators.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403288
parent 4f8ff2c3
This diff is collapsed.
This diff is collapsed.
......@@ -698,6 +698,47 @@ namespace
DLIB_TEST(pointer_to_column_vector(&v2[0], v.size()) != vector_to_matrix(v));
}
{
matrix<double> a(3,3), b(3,3);
a = 1, 2.5, 1,
3, 4, 5,
0.5, 2.2, 3;
b = 0, 1, 0,
1, 1, 1,
0, 1, 1;
DLIB_TEST((a>1) == b);
DLIB_TEST((1<a) == b);
b = 1, 1, 1,
1, 1, 1,
0, 1, 1;
DLIB_TEST((a>=1) == b);
DLIB_TEST((1<=a) == b);
b = 0, 0, 0,
0, 0, 0,
0, 1, 0;
DLIB_TEST((a==2.2) == b);
DLIB_TEST((a!=2.2) == (b==0));
DLIB_TEST((2.2==a) == b);
DLIB_TEST((2.2!=a) == (0==b));
b = 0, 0, 0,
0, 0, 0,
1, 0, 0;
DLIB_TEST((a<1) == b);
DLIB_TEST((1>a) == b);
b = 1, 0, 1,
0, 0, 0,
1, 0, 0;
DLIB_TEST((a<=1) == b);
DLIB_TEST((1>=a) == b);
}
}
......
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