Commit 031e5af3 authored by Davis King's avatar Davis King

Fixed compiler warnings in visual studio

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403433
parent 8557e674
...@@ -95,7 +95,7 @@ namespace dlib ...@@ -95,7 +95,7 @@ namespace dlib
typedef matrix<type,NR,NC,mem_manager_type,layout_type> matrix_type; typedef matrix<type,NR,NC,mem_manager_type,layout_type> matrix_type;
typedef EXP exp_type; typedef EXP exp_type;
inline const const_ret_type operator() ( inline const_ret_type operator() (
long r, long r,
long c long c
) const ) const
...@@ -112,7 +112,7 @@ namespace dlib ...@@ -112,7 +112,7 @@ namespace dlib
return ref()(r,c); return ref()(r,c);
} }
const const_ret_type operator() ( const_ret_type operator() (
long i long i
) const ) const
{ {
...@@ -1768,12 +1768,12 @@ namespace dlib ...@@ -1768,12 +1768,12 @@ namespace dlib
ref_(item) ref_(item)
{} {}
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return ref_(r,c); } ) const { return ref_(r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return ref_(i); } { return ref_(i); }
template <typename U> template <typename U>
......
...@@ -54,7 +54,9 @@ namespace dlib ...@@ -54,7 +54,9 @@ namespace dlib
const_ret_type typedef (defined below) const_ret_type typedef (defined below)
The purpose of the const_ret_type typedef is to allow matrix expressions The purpose of the const_ret_type typedef is to allow matrix expressions
to return their elements by reference when appropriate. So const_ret_type to return their elements by reference when appropriate. So const_ret_type
should either be of the same type as "type" or be of type "const type&". should be one of the following types:
- const type
- const type&
!*/ !*/
public: public:
...@@ -68,7 +70,7 @@ namespace dlib ...@@ -68,7 +70,7 @@ namespace dlib
typedef matrix<type,NR,NC, mem_manager_type,layout_type> matrix_type; typedef matrix<type,NR,NC, mem_manager_type,layout_type> matrix_type;
typedef EXP exp_type; typedef EXP exp_type;
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const; ) const;
...@@ -82,7 +84,7 @@ namespace dlib ...@@ -82,7 +84,7 @@ namespace dlib
the matrix represented by this matrix expression) the matrix represented by this matrix expression)
!*/ !*/
const const_ret_type operator() ( const_ret_type operator() (
long i long i
) const; ) const;
/*! /*!
......
...@@ -255,12 +255,12 @@ namespace dlib ...@@ -255,12 +255,12 @@ namespace dlib
m(m_) m(m_)
{} {}
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(m,r,c); } ) const { return OP::apply(m,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_unary_exp>::operator()(i); } { return matrix_exp<matrix_unary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -339,12 +339,12 @@ namespace dlib ...@@ -339,12 +339,12 @@ namespace dlib
COMPILE_TIME_ASSERT(is_matrix<S>::value == false); COMPILE_TIME_ASSERT(is_matrix<S>::value == false);
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(m,s,r,c); } ) const { return OP::apply(m,s,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_scalar_binary_exp>::operator()(i); } { return matrix_exp<matrix_scalar_binary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -426,12 +426,12 @@ namespace dlib ...@@ -426,12 +426,12 @@ namespace dlib
COMPILE_TIME_ASSERT(is_matrix<S>::value == false); COMPILE_TIME_ASSERT(is_matrix<S>::value == false);
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(m,s1,s2,r,c); } ) const { return OP::apply(m,s1,s2,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_scalar_ternary_exp>::operator()(i); } { return matrix_exp<matrix_scalar_ternary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -510,12 +510,12 @@ namespace dlib ...@@ -510,12 +510,12 @@ namespace dlib
m2(m2_) m2(m2_)
{} {}
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(m1,m2,r,c); } ) const { return OP::apply(m1,m2,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_binary_exp>::operator()(i); } { return matrix_exp<matrix_binary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -597,12 +597,12 @@ namespace dlib ...@@ -597,12 +597,12 @@ namespace dlib
m3(m3_) m3(m3_)
{} {}
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(m1,m2,m3,r,c); } ) const { return OP::apply(m1,m2,m3,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_ternary_exp>::operator()(i); } { return matrix_exp<matrix_ternary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -688,12 +688,12 @@ namespace dlib ...@@ -688,12 +688,12 @@ namespace dlib
m4(m4_) m4(m4_)
{} {}
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(m1,m2,m3,m4,r,c); } ) const { return OP::apply(m1,m2,m3,m4,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_fourary_exp>::operator()(i); } { return matrix_exp<matrix_fourary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -769,12 +769,12 @@ namespace dlib ...@@ -769,12 +769,12 @@ namespace dlib
COMPILE_TIME_ASSERT(is_matrix<S>::value == false); COMPILE_TIME_ASSERT(is_matrix<S>::value == false);
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(s,r,c); } ) const { return OP::apply(s,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<dynamic_matrix_scalar_unary_exp>::operator()(i); } { return matrix_exp<dynamic_matrix_scalar_unary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -845,12 +845,12 @@ namespace dlib ...@@ -845,12 +845,12 @@ namespace dlib
COMPILE_TIME_ASSERT(is_matrix<S>::value == false); COMPILE_TIME_ASSERT(is_matrix<S>::value == false);
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(s,r,c); } ) const { return OP::apply(s,r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_scalar_unary_exp>::operator()(i); } { return matrix_exp<matrix_scalar_unary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -909,12 +909,12 @@ namespace dlib ...@@ -909,12 +909,12 @@ namespace dlib
matrix_zeroary_exp ( matrix_zeroary_exp (
) {} ) {}
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return OP::apply(r,c); } ) const { return OP::apply(r,c); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_zeroary_exp>::operator()(i); } { return matrix_exp<matrix_zeroary_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -993,12 +993,12 @@ namespace dlib ...@@ -993,12 +993,12 @@ namespace dlib
{ {
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return m(rows(r),cols(c)); } ) const { return m(rows(r),cols(c)); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_sub_range_exp>::operator()(i); } { return matrix_exp<matrix_sub_range_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -1073,12 +1073,12 @@ namespace dlib ...@@ -1073,12 +1073,12 @@ namespace dlib
{ {
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long long
) const { return m[r]; } ) const { return m[r]; }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return m[i]; } { return m[i]; }
template <typename U> template <typename U>
...@@ -1150,12 +1150,12 @@ namespace dlib ...@@ -1150,12 +1150,12 @@ namespace dlib
{ {
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long long
) const { return m[r]; } ) const { return m[r]; }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return m[i]; } { return m[i]; }
template <typename U> template <typename U>
...@@ -1227,12 +1227,12 @@ namespace dlib ...@@ -1227,12 +1227,12 @@ namespace dlib
{ {
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return m[r][c]; } ) const { return m[r][c]; }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_array2d_exp>::operator()(i); } { return matrix_exp<matrix_array2d_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -1311,12 +1311,12 @@ namespace dlib ...@@ -1311,12 +1311,12 @@ namespace dlib
{ {
} }
const const_ret_type operator() ( const_ret_type operator() (
long r, long r,
long c long c
) const { return m(r+r_,c+c_); } ) const { return m(r+r_,c+c_); }
const const_ret_type operator() ( long i ) const const_ret_type operator() ( long i ) const
{ return matrix_exp<matrix_sub_exp>::operator()(i); } { return matrix_exp<matrix_sub_exp>::operator()(i); }
template <typename U> template <typename U>
...@@ -1349,7 +1349,7 @@ namespace dlib ...@@ -1349,7 +1349,7 @@ namespace dlib
struct matrix_traits<matrix_range_exp<T> > struct matrix_traits<matrix_range_exp<T> >
{ {
typedef T type; typedef T type;
typedef T const_ret_type; typedef const T const_ret_type;
typedef memory_manager<char>::kernel_1a mem_manager_type; typedef memory_manager<char>::kernel_1a mem_manager_type;
typedef row_major_layout layout_type; typedef row_major_layout layout_type;
const static long NR = 1; const static long NR = 1;
...@@ -1417,12 +1417,12 @@ namespace dlib ...@@ -1417,12 +1417,12 @@ namespace dlib
} }
const const_ret_type operator() ( const_ret_type operator() (
long, long,
long c long c
) const { return start + c*inc; } ) const { return start + c*inc; }
const const_ret_type operator() ( const_ret_type operator() (
long c long c
) const { return start + c*inc; } ) const { return start + c*inc; }
...@@ -1456,7 +1456,7 @@ namespace dlib ...@@ -1456,7 +1456,7 @@ namespace dlib
struct matrix_traits<matrix_log_range_exp<T> > struct matrix_traits<matrix_log_range_exp<T> >
{ {
typedef T type; typedef T type;
typedef T const_ret_type; typedef const T const_ret_type;
typedef memory_manager<char>::kernel_1a mem_manager_type; typedef memory_manager<char>::kernel_1a mem_manager_type;
typedef row_major_layout layout_type; typedef row_major_layout layout_type;
const static long NR = 1; const static long NR = 1;
...@@ -1497,12 +1497,12 @@ namespace dlib ...@@ -1497,12 +1497,12 @@ namespace dlib
} }
const const_ret_type operator() ( const_ret_type operator() (
long, long,
long c long c
) const { return std::pow((T)10,start + c*inc); } ) const { return std::pow((T)10,start + c*inc); }
const const_ret_type operator() ( const_ret_type operator() (
long c long c
) const { return std::pow(10,start + c*inc); } ) const { return std::pow(10,start + c*inc); }
...@@ -1536,7 +1536,7 @@ namespace dlib ...@@ -1536,7 +1536,7 @@ namespace dlib
struct matrix_traits<matrix_range_static_exp<start,inc_,end> > struct matrix_traits<matrix_range_static_exp<start,inc_,end> >
{ {
typedef long type; typedef long type;
typedef long const_ret_type; typedef const long const_ret_type;
typedef memory_manager<char>::kernel_1a mem_manager_type; typedef memory_manager<char>::kernel_1a mem_manager_type;
const static long NR = 1; const static long NR = 1;
const static long NC = tabs<(end - start)>::value/inc_ + 1; const static long NC = tabs<(end - start)>::value/inc_ + 1;
...@@ -1562,12 +1562,12 @@ namespace dlib ...@@ -1562,12 +1562,12 @@ namespace dlib
matrix_range_static_exp ( matrix_range_static_exp (
) {} ) {}
const const_ret_type operator() ( const_ret_type operator() (
long , long ,
long c long c
) const { return start + c*inc; } ) const { return start + c*inc; }
const const_ret_type operator() ( const_ret_type operator() (
long c long c
) const { return start + c*inc; } ) const { return start + c*inc; }
......
...@@ -23,9 +23,9 @@ namespace dlib ...@@ -23,9 +23,9 @@ namespace dlib
{ \ { \
const static long cost = EXP::cost+(extra_cost); \ const static long cost = EXP::cost+(extra_cost); \
typedef typename EXP::type type; \ typedef typename EXP::type type; \
typedef typename EXP::type const_ret_type; \ typedef const typename EXP::type const_ret_type; \
template <typename M> \ template <typename M> \
static const const_ret_type apply ( const M& m, long r, long c) \ static const_ret_type apply ( const M& m, long r, long c) \
{ return static_cast<type>(std::name(m(r,c))); } \ { return static_cast<type>(std::name(m(r,c))); } \
};}; \ };}; \
template < typename EXP > \ template < typename EXP > \
...@@ -66,9 +66,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -66,9 +66,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+7; const static long cost = EXP::cost+7;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
return static_cast<type>(1/(1 + std::exp(-m(r,c)))); return static_cast<type>(1/(1 + std::exp(-m(r,c))));
} }
...@@ -94,9 +94,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -94,9 +94,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+7; const static long cost = EXP::cost+7;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename T> template <typename M, typename T>
static const const_ret_type apply ( const M& m, const T& eps, long r, long c) static const_ret_type apply ( const M& m, const T& eps, long r, long c)
{ {
const type temp = m(r,c); const type temp = m(r,c);
if (temp >= eps || temp <= -eps) if (temp >= eps || temp <= -eps)
...@@ -142,9 +142,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -142,9 +142,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+7; const static long cost = EXP::cost+7;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
const type temp = m(r,c); const type temp = m(r,c);
return temp*temp*temp; return temp*temp*temp;
...@@ -171,9 +171,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -171,9 +171,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+6; const static long cost = EXP::cost+6;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
const type temp = m(r,c); const type temp = m(r,c);
return temp*temp; return temp*temp;
...@@ -200,9 +200,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -200,9 +200,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+7; const static long cost = EXP::cost+7;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ return static_cast<type>(std::pow(m(r,c),s)); } { return static_cast<type>(std::pow(m(r,c),s)); }
}; };
}; };
...@@ -234,9 +234,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -234,9 +234,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+7; const static long cost = EXP::cost+7;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ return static_cast<type>(std::pow(s,m(r,c))); } { return static_cast<type>(std::pow(s,m(r,c))); }
}; };
}; };
...@@ -268,9 +268,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -268,9 +268,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+6; const static long cost = EXP::cost+6;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
const type temp = m(r,c); const type temp = m(r,c);
if (temp != static_cast<type>(0)) if (temp != static_cast<type>(0))
...@@ -309,9 +309,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -309,9 +309,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+6; const static long cost = EXP::cost+6;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
const type temp = m(r,c); const type temp = m(r,c);
if (temp != static_cast<type>(0)) if (temp != static_cast<type>(0))
...@@ -347,9 +347,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -347,9 +347,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+5; const static long cost = EXP::cost+5;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, const type& s, long r, long c) static const_ret_type apply ( const M& m, const type& s, long r, long c)
{ {
return m(r,c)*s; return m(r,c)*s;
} }
...@@ -387,9 +387,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -387,9 +387,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+7; const static long cost = EXP::cost+7;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
return static_cast<type>(std::floor(m(r,c)+0.5)); return static_cast<type>(std::floor(m(r,c)+0.5));
} }
...@@ -403,7 +403,7 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -403,7 +403,7 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
return m(r,c); return m(r,c);
} }
...@@ -432,9 +432,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -432,9 +432,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+7; const static long cost = EXP::cost+7;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
return static_cast<type>(std::abs(m(r,c))); return static_cast<type>(std::abs(m(r,c)));
} }
...@@ -445,9 +445,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -445,9 +445,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost; const static long cost = EXP::cost;
typedef T type; typedef T type;
typedef T const_ret_type; typedef const T const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
return static_cast<type>(std::abs(m(r,c))); return static_cast<type>(std::abs(m(r,c)));
} }
...@@ -474,9 +474,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -474,9 +474,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef std::complex<typename EXP::type> type; typedef std::complex<typename EXP::type> type;
typedef std::complex<typename EXP::type> const_ret_type; typedef const std::complex<typename EXP::type> const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
return type(m(r,c)); return type(m(r,c));
} }
...@@ -502,10 +502,10 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -502,10 +502,10 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP1::cost+EXP2::cost+1; const static long cost = EXP1::cost+EXP2::cost+1;
typedef std::complex<typename EXP1::type> type; typedef std::complex<typename EXP1::type> type;
typedef std::complex<typename EXP1::type> const_ret_type; typedef const std::complex<typename EXP1::type> const_ret_type;
template <typename M1, typename M2> template <typename M1, typename M2>
static const const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c) static const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c)
{ return type(m1(r,c),m2(r,c)); } { return type(m1(r,c),m2(r,c)); }
}; };
}; };
...@@ -545,9 +545,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -545,9 +545,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost+6; const static long cost = EXP::cost+6;
typedef typename EXP::type::value_type type; typedef typename EXP::type::value_type type;
typedef typename EXP::type::value_type const_ret_type; typedef const typename EXP::type::value_type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ return std::norm(m(r,c)); } { return std::norm(m(r,c)); }
}; };
}; };
...@@ -572,9 +572,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -572,9 +572,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost; const static long cost = EXP::cost;
typedef typename EXP::type::value_type type; typedef typename EXP::type::value_type type;
typedef typename EXP::type::value_type const_ret_type; typedef const typename EXP::type::value_type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ return std::real(m(r,c)); } { return std::real(m(r,c)); }
}; };
}; };
...@@ -599,9 +599,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7) ...@@ -599,9 +599,9 @@ DLIB_MATRIX_SIMPLE_STD_FUNCTION(atan,7)
{ {
const static long cost = EXP::cost; const static long cost = EXP::cost;
typedef typename EXP::type::value_type type; typedef typename EXP::type::value_type type;
typedef typename EXP::type::value_type const_ret_type; typedef const typename EXP::type::value_type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ return std::imag(m(r,c)); } { return std::imag(m(r,c)); }
}; };
}; };
......
...@@ -161,7 +161,7 @@ namespace dlib ...@@ -161,7 +161,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long row, long, long c) static const_ret_type apply ( const M& m, long row, long, long c)
{ return m(row,c); } { return m(row,c); }
template <typename M> template <typename M>
...@@ -205,7 +205,7 @@ namespace dlib ...@@ -205,7 +205,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long row, long , long , long c) static const_ret_type apply ( const M& m, long row, long , long , long c)
{ return m(row,c); } { return m(row,c); }
template <typename M> template <typename M>
...@@ -253,7 +253,7 @@ namespace dlib ...@@ -253,7 +253,7 @@ namespace dlib
const static long NC = EXP1::NC; const static long NC = EXP1::NC;
template <typename M1, typename M2> template <typename M1, typename M2>
static const const_ret_type apply ( const M1& m1, const M2& rows , long r, long c) static const_ret_type apply ( const M1& m1, const M2& rows , long r, long c)
{ return m1(rows(r),c); } { return m1(rows(r),c); }
template <typename M1, typename M2> template <typename M1, typename M2>
...@@ -304,7 +304,7 @@ namespace dlib ...@@ -304,7 +304,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long col, long r, long) static const_ret_type apply ( const M& m, long col, long r, long)
{ return m(r,col); } { return m(r,col); }
template <typename M> template <typename M>
...@@ -348,7 +348,7 @@ namespace dlib ...@@ -348,7 +348,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long col, long , long r, long ) static const_ret_type apply ( const M& m, long col, long , long r, long )
{ return m(r,col); } { return m(r,col); }
template <typename M> template <typename M>
...@@ -396,7 +396,7 @@ namespace dlib ...@@ -396,7 +396,7 @@ namespace dlib
const static long cost = EXP1::cost+EXP2::cost; const static long cost = EXP1::cost+EXP2::cost;
template <typename M1, typename M2> template <typename M1, typename M2>
static const const_ret_type apply ( const M1& m1, const M2& cols , long r, long c) static const_ret_type apply ( const M1& m1, const M2& cols , long r, long c)
{ return m1(r,cols(c)); } { return m1(r,cols(c)); }
template <typename M1, typename M2> template <typename M1, typename M2>
......
...@@ -349,7 +349,7 @@ namespace dlib ...@@ -349,7 +349,7 @@ namespace dlib
typedef typename memory_manager<char>::kernel_1a mem_manager_type; typedef typename memory_manager<char>::kernel_1a mem_manager_type;
typedef T type; typedef T type;
typedef const T& const_ret_type; typedef const T& const_ret_type;
static const const_ret_type apply (const T* val, long r, long ) static const_ret_type apply (const T* val, long r, long )
{ return val[r]; } { return val[r]; }
}; };
...@@ -384,7 +384,7 @@ namespace dlib ...@@ -384,7 +384,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ return m(c,r); } { return m(c,r); }
template <typename M> template <typename M>
...@@ -516,7 +516,7 @@ namespace dlib ...@@ -516,7 +516,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
if (r < R) if (r < R)
{ {
...@@ -553,7 +553,7 @@ namespace dlib ...@@ -553,7 +553,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long R, long C, long r, long c) static const_ret_type apply ( const M& m, long R, long C, long r, long c)
{ {
if (r < R) if (r < R)
{ {
...@@ -639,7 +639,7 @@ namespace dlib ...@@ -639,7 +639,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
if (c < C) if (c < C)
{ {
...@@ -670,7 +670,7 @@ namespace dlib ...@@ -670,7 +670,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long C, long r, long c) static const_ret_type apply ( const M& m, long C, long r, long c)
{ {
if (c < C) if (c < C)
{ {
...@@ -745,7 +745,7 @@ namespace dlib ...@@ -745,7 +745,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
if (r < R) if (r < R)
{ {
...@@ -776,7 +776,7 @@ namespace dlib ...@@ -776,7 +776,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long R, long r, long c) static const_ret_type apply ( const M& m, long R, long r, long c)
{ {
if (r < R) if (r < R)
{ {
...@@ -848,10 +848,10 @@ namespace dlib ...@@ -848,10 +848,10 @@ namespace dlib
const static long NR = N; const static long NR = N;
const static long NC = N; const static long NC = N;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
if (r==c) if (r==c)
return m(r); return m(r);
...@@ -899,7 +899,7 @@ namespace dlib ...@@ -899,7 +899,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long ) static const_ret_type apply ( const M& m, long r, long )
{ return m(r,r); } { return m(r,r); }
template <typename M> template <typename M>
...@@ -930,9 +930,9 @@ namespace dlib ...@@ -930,9 +930,9 @@ namespace dlib
{ {
const static long cost = EXP::cost; const static long cost = EXP::cost;
typedef target_type type; typedef target_type type;
typedef target_type const_ret_type; typedef const target_type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ return static_cast<target_type>(m(r,c)); } { return static_cast<target_type>(m(r,c)); }
}; };
}; };
...@@ -960,9 +960,9 @@ namespace dlib ...@@ -960,9 +960,9 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ {
if (m(r,c) < s) if (m(r,c) < s)
return 1; return 1;
...@@ -1013,9 +1013,9 @@ namespace dlib ...@@ -1013,9 +1013,9 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ {
if (m(r,c) <= s) if (m(r,c) <= s)
return 1; return 1;
...@@ -1066,9 +1066,9 @@ namespace dlib ...@@ -1066,9 +1066,9 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ {
if (m(r,c) > s) if (m(r,c) > s)
return 1; return 1;
...@@ -1119,9 +1119,9 @@ namespace dlib ...@@ -1119,9 +1119,9 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ {
if (m(r,c) >= s) if (m(r,c) >= s)
return 1; return 1;
...@@ -1172,9 +1172,9 @@ namespace dlib ...@@ -1172,9 +1172,9 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ {
if (m(r,c) == s) if (m(r,c) == s)
return 1; return 1;
...@@ -1225,9 +1225,9 @@ namespace dlib ...@@ -1225,9 +1225,9 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M, typename S> template <typename M, typename S>
static const const_ret_type apply ( const M& m, const S& s, long r, long c) static const_ret_type apply ( const M& m, const S& s, long r, long c)
{ {
if (m(r,c) != s) if (m(r,c) != s)
return 1; return 1;
...@@ -1545,7 +1545,7 @@ namespace dlib ...@@ -1545,7 +1545,7 @@ namespace dlib
typedef typename memory_manager<char>::kernel_1a mem_manager_type; typedef typename memory_manager<char>::kernel_1a mem_manager_type;
typedef T type; typedef T type;
typedef const T& const_ret_type; typedef const T& const_ret_type;
static const const_ret_type apply (const T& val, long , long ) static const_ret_type apply (const T& val, long , long )
{ return val; } { return val; }
}; };
...@@ -1623,7 +1623,7 @@ namespace dlib ...@@ -1623,7 +1623,7 @@ namespace dlib
typedef typename memory_manager<char>::kernel_1a mem_manager_type; typedef typename memory_manager<char>::kernel_1a mem_manager_type;
typedef T type; typedef T type;
typedef const T& const_ret_type; typedef const T& const_ret_type;
static const const_ret_type apply (const T& val, long , long ) static const_ret_type apply (const T& val, long , long )
{ return val; } { return val; }
}; };
...@@ -1657,8 +1657,8 @@ namespace dlib ...@@ -1657,8 +1657,8 @@ namespace dlib
const static long NC = NC_; const static long NC = NC_;
typedef typename memory_manager<char>::kernel_1a mem_manager_type; typedef typename memory_manager<char>::kernel_1a mem_manager_type;
typedef T type; typedef T type;
typedef T const_ret_type; typedef const T const_ret_type;
static const const_ret_type apply ( long , long ) static const_ret_type apply ( long , long )
{ return val; } { return val; }
}; };
...@@ -1688,8 +1688,8 @@ namespace dlib ...@@ -1688,8 +1688,8 @@ namespace dlib
const static long NC = 0; const static long NC = 0;
typedef typename memory_manager<char>::kernel_1a mem_manager_type; typedef typename memory_manager<char>::kernel_1a mem_manager_type;
typedef T type; typedef T type;
typedef T const_ret_type; typedef const T const_ret_type;
static const const_ret_type apply (const T&, long r, long c) static const_ret_type apply (const T&, long r, long c)
{ return static_cast<type>(r == c); } { return static_cast<type>(r == c); }
}; };
...@@ -1724,8 +1724,8 @@ namespace dlib ...@@ -1724,8 +1724,8 @@ namespace dlib
const static long NC = N; const static long NC = N;
typedef typename memory_manager<char>::kernel_1a mem_manager_type; typedef typename memory_manager<char>::kernel_1a mem_manager_type;
typedef T type; typedef T type;
typedef T const_ret_type; typedef const T const_ret_type;
static const const_ret_type apply ( long r, long c) static const_ret_type apply ( long r, long c)
{ return static_cast<type>(r == c); } { return static_cast<type>(r == c); }
template <typename M> template <typename M>
...@@ -1759,7 +1759,7 @@ namespace dlib ...@@ -1759,7 +1759,7 @@ namespace dlib
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ return m((r+R)%m.nr(),(c+C)%m.nc()); } { return m((r+R)%m.nr(),(c+C)%m.nc()); }
}; };
}; };
...@@ -1793,11 +1793,11 @@ namespace dlib ...@@ -1793,11 +1793,11 @@ namespace dlib
struct op : public has_nondestructive_aliasing, public preserves_dimensions<EXP1,EXP2> struct op : public has_nondestructive_aliasing, public preserves_dimensions<EXP1,EXP2>
{ {
typedef typename compatible<typename EXP1::type, typename EXP2::type>::type type; typedef typename compatible<typename EXP1::type, typename EXP2::type>::type type;
typedef type const_ret_type; typedef const type const_ret_type;
const static long cost = EXP1::cost + EXP2::cost + 1; const static long cost = EXP1::cost + EXP2::cost + 1;
template <typename M1, typename M2> template <typename M1, typename M2>
static const const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c) static const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c)
{ return m1(r,c)*m2(r,c); } { return m1(r,c)*m2(r,c); }
}; };
}; };
...@@ -1835,11 +1835,11 @@ namespace dlib ...@@ -1835,11 +1835,11 @@ namespace dlib
struct op : public has_nondestructive_aliasing, public preserves_dimensions<EXP1,EXP2,EXP3> struct op : public has_nondestructive_aliasing, public preserves_dimensions<EXP1,EXP2,EXP3>
{ {
typedef typename EXP1::type type; typedef typename EXP1::type type;
typedef typename EXP1::type const_ret_type; typedef const typename EXP1::type const_ret_type;
const static long cost = EXP1::cost + EXP2::cost + EXP3::cost + 2; const static long cost = EXP1::cost + EXP2::cost + EXP3::cost + 2;
template <typename M1, typename M2, typename M3> template <typename M1, typename M2, typename M3>
static const const_ret_type apply ( const M1& m1, const M2& m2, const M3& m3 , long r, long c) static const_ret_type apply ( const M1& m1, const M2& m2, const M3& m3 , long r, long c)
{ return m1(r,c)*m2(r,c)*m3(r,c); } { return m1(r,c)*m2(r,c)*m3(r,c); }
}; };
}; };
...@@ -1888,11 +1888,11 @@ namespace dlib ...@@ -1888,11 +1888,11 @@ namespace dlib
struct op : public has_nondestructive_aliasing, public preserves_dimensions<EXP1,EXP2,EXP3,EXP4> struct op : public has_nondestructive_aliasing, public preserves_dimensions<EXP1,EXP2,EXP3,EXP4>
{ {
typedef typename EXP1::type type; typedef typename EXP1::type type;
typedef typename EXP1::type const_ret_type; typedef const typename EXP1::type const_ret_type;
const static long cost = EXP1::cost + EXP2::cost + EXP3::cost + EXP4::cost + 3; const static long cost = EXP1::cost + EXP2::cost + EXP3::cost + EXP4::cost + 3;
template <typename M1, typename M2, typename M3, typename M4> template <typename M1, typename M2, typename M3, typename M4>
static const const_ret_type apply ( const M1& m1, const M2& m2, const M3& m3, const M4& m4 , long r, long c) static const_ret_type apply ( const M1& m1, const M2& m2, const M3& m3, const M4& m4 , long r, long c)
{ return m1(r,c)*m2(r,c)*m3(r,c)*m4(r,c); } { return m1(r,c)*m2(r,c)*m3(r,c)*m4(r,c); }
}; };
}; };
...@@ -2123,11 +2123,11 @@ namespace dlib ...@@ -2123,11 +2123,11 @@ namespace dlib
struct op : has_nondestructive_aliasing, preserves_dimensions<EXP> struct op : has_nondestructive_aliasing, preserves_dimensions<EXP>
{ {
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
const static long cost = EXP::cost + 1; const static long cost = EXP::cost + 1;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
const type temp = m(r,c); const type temp = m(r,c);
if (temp > static_cast<type>(upper)) if (temp > static_cast<type>(upper))
...@@ -2161,11 +2161,11 @@ namespace dlib ...@@ -2161,11 +2161,11 @@ namespace dlib
struct op : has_nondestructive_aliasing, preserves_dimensions<EXP> struct op : has_nondestructive_aliasing, preserves_dimensions<EXP>
{ {
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
const static long cost = EXP::cost + 2; const static long cost = EXP::cost + 2;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, const type& lower, const type& upper, long r, long c) static const_ret_type apply ( const M& m, const type& lower, const type& upper, long r, long c)
{ {
const type temp = m(r,c); const type temp = m(r,c);
if (temp > upper) if (temp > upper)
...@@ -2257,13 +2257,13 @@ namespace dlib ...@@ -2257,13 +2257,13 @@ namespace dlib
{ {
const static long cost = EXP1::cost + EXP2::cost + 1; const static long cost = EXP1::cost + EXP2::cost + 1;
typedef typename EXP1::type type; typedef typename EXP1::type type;
typedef typename EXP1::type const_ret_type; typedef const typename EXP1::type const_ret_type;
typedef typename EXP1::mem_manager_type mem_manager_type; typedef typename EXP1::mem_manager_type mem_manager_type;
const static long NR = EXP1::NR; const static long NR = EXP1::NR;
const static long NC = EXP1::NC; const static long NC = EXP1::NC;
template <typename M1, typename M2> template <typename M1, typename M2>
static const const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c) static const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c)
{ return m1(r,c)*m2(c); } { return m1(r,c)*m2(c); }
template <typename M1, typename M2> template <typename M1, typename M2>
...@@ -2415,11 +2415,11 @@ namespace dlib ...@@ -2415,11 +2415,11 @@ namespace dlib
const static long NR = EXP1::NR*EXP2::NR; const static long NR = EXP1::NR*EXP2::NR;
const static long NC = EXP1::NC*EXP2::NC; const static long NC = EXP1::NC*EXP2::NC;
typedef typename EXP1::type type; typedef typename EXP1::type type;
typedef typename EXP1::type const_ret_type; typedef const typename EXP1::type const_ret_type;
typedef typename EXP1::mem_manager_type mem_manager_type; typedef typename EXP1::mem_manager_type mem_manager_type;
template <typename M1, typename M2> template <typename M1, typename M2>
static const const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c) static const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c)
{ {
return m1(r/m2.nr(),c/m2.nc())*m2(r%m2.nr(),c%m2.nc()); return m1(r/m2.nr(),c/m2.nc())*m2(r%m2.nr(),c%m2.nc());
} }
...@@ -2456,9 +2456,9 @@ namespace dlib ...@@ -2456,9 +2456,9 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
if (r >= c) if (r >= c)
return m(r,c); return m(r,c);
...@@ -2467,7 +2467,7 @@ namespace dlib ...@@ -2467,7 +2467,7 @@ namespace dlib
} }
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, const type& s, long r, long c) static const_ret_type apply ( const M& m, const type& s, long r, long c)
{ {
if (r > c) if (r > c)
return m(r,c); return m(r,c);
...@@ -2511,10 +2511,10 @@ namespace dlib ...@@ -2511,10 +2511,10 @@ namespace dlib
{ {
const static long cost = EXP::cost+1; const static long cost = EXP::cost+1;
typedef typename EXP::type type; typedef typename EXP::type type;
typedef typename EXP::type const_ret_type; typedef const typename EXP::type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long c) static const_ret_type apply ( const M& m, long r, long c)
{ {
if (r <= c) if (r <= c)
return m(r,c); return m(r,c);
...@@ -2523,7 +2523,7 @@ namespace dlib ...@@ -2523,7 +2523,7 @@ namespace dlib
} }
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, const type& s, long r, long c) static const_ret_type apply ( const M& m, const type& s, long r, long c)
{ {
if (r < c) if (r < c)
return m(r,c); return m(r,c);
...@@ -2665,14 +2665,14 @@ namespace dlib ...@@ -2665,14 +2665,14 @@ namespace dlib
{ {
const static long cost = EXP1::cost+EXP2::cost+1; const static long cost = EXP1::cost+EXP2::cost+1;
typedef typename EXP1::type type; typedef typename EXP1::type type;
typedef typename EXP1::const_ret_type const_ret_type; typedef const typename EXP1::const_ret_type const_ret_type;
typedef typename EXP1::mem_manager_type mem_manager_type; typedef typename EXP1::mem_manager_type mem_manager_type;
const static long NR = EXP1::NR+EXP2::NR; const static long NR = EXP1::NR+EXP2::NR;
const static long NC = EXP1::NC*EXP2::NC; const static long NC = EXP1::NC*EXP2::NC;
template <typename M1, typename M2> template <typename M1, typename M2>
static const const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c) static const_ret_type apply ( const M1& m1, const M2& m2 , long r, long c)
{ {
if (r < m1.nr()) if (r < m1.nr())
return m1(r, c/m2.nc()); return m1(r, c/m2.nc());
...@@ -2716,7 +2716,7 @@ namespace dlib ...@@ -2716,7 +2716,7 @@ namespace dlib
typedef typename EXP::const_ret_type const_ret_type; typedef typename EXP::const_ret_type const_ret_type;
typedef typename EXP::mem_manager_type mem_manager_type; typedef typename EXP::mem_manager_type mem_manager_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, long r, long ) static const_ret_type apply ( const M& m, long r, long )
{ return m(r/m.nc(), r%m.nc()); } { return m(r/m.nc(), r%m.nc()); }
template <typename M> template <typename M>
......
...@@ -22,7 +22,7 @@ namespace dlib ...@@ -22,7 +22,7 @@ namespace dlib
struct matrix_traits<kernel_matrix_exp<kernel_type,alloc> > struct matrix_traits<kernel_matrix_exp<kernel_type,alloc> >
{ {
typedef typename kernel_type::scalar_type type; typedef typename kernel_type::scalar_type type;
typedef typename kernel_type::scalar_type const_ret_type; typedef const type const_ret_type;
typedef typename kernel_type::mem_manager_type mem_manager_type; typedef typename kernel_type::mem_manager_type mem_manager_type;
typedef row_major_layout layout_type; typedef row_major_layout layout_type;
const static long NR = 0; const static long NR = 0;
...@@ -116,7 +116,7 @@ namespace dlib ...@@ -116,7 +116,7 @@ namespace dlib
const static long cost = EXP::cost+100; const static long cost = EXP::cost+100;
typedef typename kernel_type::scalar_type type; typedef typename kernel_type::scalar_type type;
typedef typename kernel_type::scalar_type const_ret_type; typedef const type const_ret_type;
template <typename M> template <typename M>
static const const_ret_type apply ( const M& m, const kernel_type& kern, const long r, long c) static const const_ret_type apply ( const M& m, const kernel_type& kern, const long r, long c)
{ {
...@@ -164,7 +164,7 @@ namespace dlib ...@@ -164,7 +164,7 @@ namespace dlib
struct matrix_traits<kernel_matrix_exp1<kernel_type,lhs_type> > struct matrix_traits<kernel_matrix_exp1<kernel_type,lhs_type> >
{ {
typedef typename kernel_type::scalar_type type; typedef typename kernel_type::scalar_type type;
typedef typename kernel_type::scalar_type const_ret_type; typedef const type const_ret_type;
typedef typename kernel_type::mem_manager_type mem_manager_type; typedef typename kernel_type::mem_manager_type mem_manager_type;
typedef row_major_layout layout_type; typedef row_major_layout layout_type;
const static long NR = 0; const static long NR = 0;
...@@ -281,7 +281,7 @@ namespace dlib ...@@ -281,7 +281,7 @@ namespace dlib
struct matrix_traits<kernel_matrix_exp2<kernel_type,lhs_type> > struct matrix_traits<kernel_matrix_exp2<kernel_type,lhs_type> >
{ {
typedef typename kernel_type::scalar_type type; typedef typename kernel_type::scalar_type type;
typedef typename kernel_type::scalar_type const_ret_type; typedef const type const_ret_type;
typedef typename kernel_type::mem_manager_type mem_manager_type; typedef typename kernel_type::mem_manager_type mem_manager_type;
typedef row_major_layout layout_type; typedef row_major_layout layout_type;
const static long NR = 1; const static long NR = 1;
...@@ -398,7 +398,7 @@ namespace dlib ...@@ -398,7 +398,7 @@ namespace dlib
struct matrix_traits<kernel_matrix_exp3<kernel_type,lhs_type,rhs_type> > struct matrix_traits<kernel_matrix_exp3<kernel_type,lhs_type,rhs_type> >
{ {
typedef typename kernel_type::scalar_type type; typedef typename kernel_type::scalar_type type;
typedef typename kernel_type::scalar_type const_ret_type; typedef const type const_ret_type;
typedef typename kernel_type::mem_manager_type mem_manager_type; typedef typename kernel_type::mem_manager_type mem_manager_type;
typedef row_major_layout layout_type; typedef row_major_layout layout_type;
const static long NR = 0; const static long NR = 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