Commit 80bcc728 authored by Davis King's avatar Davis King

Changed a few things to avoid compiler warnings and errors in visual studio 7.1

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402780
parent 5acf84a6
......@@ -851,7 +851,8 @@ namespace dlib
const S& s
)
{
return matrix_mul_scal_exp<EXP>(m.ref(),s);
typedef typename EXP::type type;
return matrix_mul_scal_exp<EXP>(m.ref(),static_cast<type>(s));
}
template <
......@@ -864,7 +865,8 @@ namespace dlib
const S& s
)
{
return matrix_mul_scal_exp<EXP>(m.m,s*m.s);
typedef typename EXP::type type;
return matrix_mul_scal_exp<EXP>(m.m,static_cast<type>(s)*m.s);
}
template <
......@@ -876,7 +878,8 @@ namespace dlib
const matrix_exp<EXP>& m
)
{
return matrix_mul_scal_exp<EXP>(m.ref(),s);
typedef typename EXP::type type;
return matrix_mul_scal_exp<EXP>(m.ref(),static_cast<type>(s));
}
template <
......@@ -889,7 +892,8 @@ namespace dlib
const matrix_mul_scal_exp<EXP,B>& m
)
{
return matrix_mul_scal_exp<EXP>(m.m,s*m.s);
typedef typename EXP::type type;
return matrix_mul_scal_exp<EXP>(m.m,static_cast<type>(s)*m.s);
}
template <
......
......@@ -28,7 +28,7 @@ namespace dlib
struct is_small_matrix { static const bool value = false; };
template < typename EXP >
struct is_small_matrix<EXP, typename enable_if_c<EXP::NR>=1 && EXP::NC>=1 &&
EXP::NR<=30 && EXP::NC<=30 && (EXP::cost < 70)>::type> { static const bool value = true; };
EXP::NR<=30 && EXP::NC<=30 && (EXP::cost <= 70)>::type> { static const bool value = true; };
}
// ----------------------------------------------------------------------------------------
......@@ -93,7 +93,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
template <typename EXP1, typename EXP2>
inline typename enable_if<is_same_type<typename EXP1::layout_type, row_major_layout> >::type
inline void //inline typename enable_if<is_same_type<typename EXP1::layout_type, row_major_layout> >::type
matrix_assign_default (
EXP1& dest,
const EXP2& src,
......@@ -172,6 +172,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
#if 0
template <typename EXP1, typename EXP2>
inline typename enable_if<is_same_type<typename EXP1::layout_type, column_major_layout> >::type
matrix_assign_default (
......@@ -249,6 +250,7 @@ namespace dlib
}
}
}
#endif
// ----------------------------------------------------------------------------------------
......
......@@ -86,6 +86,12 @@ namespace
}
}
template <typename type>
type rnd_num (dlib::rand::float_1a& rnd)
{
return static_cast<type>(10*rnd.get_random_double());
}
template <typename type>
void test_blas( long rows, long cols)
{
......@@ -103,7 +109,7 @@ namespace
{
for (long c = 0; c < a.nc(); ++c)
{
a(r,c) = static_cast<type>(10*rnd.get_random_double());
a(r,c) = rnd_num<type>(rnd);
}
}
matrix<type> at;
......@@ -114,7 +120,7 @@ namespace
{
for (long c = 0; c < a.nc(); ++c)
{
c_a(r,c) = complex<type>(10*rnd.get_random_double(),10*rnd.get_random_double());
c_a(r,c) = complex<type>(rnd_num<type>(rnd),rnd_num<type>(rnd));
}
}
c_at = trans(c_a);
......@@ -124,43 +130,43 @@ namespace
const type one = 1;
const type two = 1;
const type num1 = 3.6;
const type num2 = 6.6;
const type num3 = 8.6;
const type num1 = static_cast<type>(3.6);
const type num2 = static_cast<type>(6.6);
const type num3 = static_cast<type>(8.6);
matrix<complex<type>,0,1> c_cv4(cols), c_cv3(rows);
matrix<complex<type>,1,0> c_rv4(cols), c_rv3(rows);
matrix<type,0,1> cv4(cols);
for (long i = 0; i < cv4.size(); ++i)
cv4(i) = 10*rnd.get_random_double();
for (long idx = 0; idx < cv4.size(); ++idx)
cv4(idx) = rnd_num<type>(rnd);
for (long i = 0; i < c_cv4.size(); ++i)
c_cv4(i) = complex<type>(10*rnd.get_random_double(),10*rnd.get_random_double());
for (long idx = 0; idx < c_cv4.size(); ++idx)
c_cv4(idx) = complex<type>(rnd_num<type>(rnd),rnd_num<type>(rnd));
matrix<type,1,0> rv3(rows);
for (long i = 0; i < rv3.size(); ++i)
rv3(i) = 10*rnd.get_random_double();
for (long idx = 0; idx < rv3.size(); ++idx)
rv3(idx) = rnd_num<type>(rnd);
for (long i = 0; i < c_rv3.size(); ++i)
c_rv3(i) = complex<type>(10*rnd.get_random_double(),10*rnd.get_random_double());
for (long idx = 0; idx < c_rv3.size(); ++idx)
c_rv3(idx) = complex<type>(rnd_num<type>(rnd),rnd_num<type>(rnd));
matrix<type,0,1> cv3(rows);
for (long i = 0; i < cv3.size(); ++i)
cv3(i) = 10*rnd.get_random_double();
for (long idx = 0; idx < cv3.size(); ++idx)
cv3(idx) = rnd_num<type>(rnd);
for (long i = 0; i < c_cv3.size(); ++i)
c_cv3(i) = complex<type>(10*rnd.get_random_double(),10*rnd.get_random_double());
for (long idx = 0; idx < c_cv3.size(); ++idx)
c_cv3(idx) = complex<type>(rnd_num<type>(rnd),rnd_num<type>(rnd));
matrix<type,1,0> rv4(cols);
for (long i = 0; i < rv4.size(); ++i)
rv4(i) = 10*rnd.get_random_double();
for (long idx = 0; idx < rv4.size(); ++idx)
rv4(idx) = rnd_num<type>(rnd);
for (long i = 0; i < c_rv4.size(); ++i)
c_rv4(i) = complex<type>(10*rnd.get_random_double(),10*rnd.get_random_double());
for (long idx = 0; idx < c_rv4.size(); ++idx)
c_rv4(idx) = complex<type>(rnd_num<type>(rnd),rnd_num<type>(rnd));
......
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