Commit 9da5852d authored by Davis King's avatar Davis King

Changed a few things to avoid bugs in visual studio 7.1

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403100
parent 2dc2121f
...@@ -31,11 +31,16 @@ namespace dlib ...@@ -31,11 +31,16 @@ namespace dlib
struct is_small_matrix<EXP, typename enable_if_c<EXP::NR>=1 && EXP::NC>=1 && struct is_small_matrix<EXP, typename enable_if_c<EXP::NR>=1 && EXP::NC>=1 &&
EXP::NR<=17 && EXP::NC<=17 && (EXP::cost <= 70)>::type> { static const bool value = true; }; EXP::NR<=17 && EXP::NC<=17 && (EXP::cost <= 70)>::type> { static const bool value = true; };
// I wouldn't use this mul object to do the multiply but visual studio 7.1 wouldn't
// compile otherwise.
template <long a, long b>
struct mul { const static long value = a*b; };
template < typename EXP, typename enable = void > template < typename EXP, typename enable = void >
struct is_very_small_matrix { static const bool value = false; }; struct is_very_small_matrix { static const bool value = false; };
template < typename EXP > template < typename EXP >
struct is_very_small_matrix<EXP, typename enable_if_c<EXP::NR>=1 && EXP::NC>=1 && struct is_very_small_matrix<EXP, typename enable_if_c<EXP::NR>=1 && EXP::NC>=1 &&
(EXP::NR*EXP::NC<=16) && (EXP::cost <= 70)>::type> { static const bool value = true; }; (mul<EXP::NR,EXP::NC>::value <= 16) && (EXP::cost <= 70)>::type> { static const bool value = true; };
template < typename EXP, typename enable = void > template < typename EXP, typename enable = void >
......
...@@ -991,10 +991,18 @@ namespace dlib ...@@ -991,10 +991,18 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// this is a workaround for a bug in visual studio 7.1
template <typename EXP>
struct visual_studio_sucks_cov_helper
{
typedef typename EXP::type inner_type;
typedef matrix<typename inner_type::type, inner_type::NR, inner_type::NR, typename EXP::mem_manager_type> type;
};
template < template <
typename EXP typename EXP
> >
const matrix<typename EXP::type::type, EXP::type::NR, EXP::type::NR, typename EXP::mem_manager_type> covariance ( const typename visual_studio_sucks_cov_helper<EXP>::type covariance (
const matrix_exp<EXP>& m const matrix_exp<EXP>& m
) )
{ {
...@@ -1026,7 +1034,7 @@ namespace dlib ...@@ -1026,7 +1034,7 @@ namespace dlib
#endif #endif
// now perform the actual calculation of the covariance matrix. // now perform the actual calculation of the covariance matrix.
matrix<typename EXP::type::type, EXP::type::NR, EXP::type::NR, typename EXP::mem_manager_type> cov(m(0).nr(),m(0).nr()); typename visual_studio_sucks_cov_helper<EXP>::type cov(m(0).nr(),m(0).nr());
set_all_elements(cov,0); set_all_elements(cov,0);
const matrix<double,EXP::type::NR,EXP::type::NC, typename EXP::mem_manager_type> avg = mean(m); const matrix<double,EXP::type::NR,EXP::type::NC, typename EXP::mem_manager_type> avg = mean(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