From b25d303e6d0bd3c5f16f31fa38a29abb24407ced Mon Sep 17 00:00:00 2001 From: Davis King Date: Sun, 1 Feb 2009 20:36:59 +0000 Subject: [PATCH] fixed some compiler warnings and errors in visual studio --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402847 --- dlib/algs.h | 4 ++++ dlib/matrix/matrix_cholesky.h | 10 +++------- dlib/matrix/matrix_eigenvalue.h | 4 ++-- dlib/matrix/matrix_lu.h | 4 ++-- dlib/test/matrix_la.cpp | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dlib/algs.h b/dlib/algs.h index 7bb1cc65b..591346be0 100644 --- a/dlib/algs.h +++ b/dlib/algs.h @@ -35,6 +35,10 @@ // Disable warnings about conversion from size_t to unsigned long and long. #pragma warning(disable : 4267) +// Disable warnings about conversion from double to float +#pragma warning(disable : 4244) +#pragma warning(disable : 4305) + #endif #ifdef __BORLANDC__ diff --git a/dlib/matrix/matrix_cholesky.h b/dlib/matrix/matrix_cholesky.h index b44311351..fa2ac7294 100644 --- a/dlib/matrix/matrix_cholesky.h +++ b/dlib/matrix/matrix_cholesky.h @@ -27,7 +27,7 @@ namespace dlib typedef typename matrix_exp_type::mem_manager_type mem_manager_type; typedef typename matrix_exp_type::layout_type layout_type; - typedef typename matrix_exp_type::matrix_type matrix_type; + typedef matrix matrix_type; typedef matrix column_vector_type; // You have supplied an invalid type of matrix_exp_type. You have @@ -49,7 +49,7 @@ namespace dlib ) const; template - const matrix solve ( + const typename EXP::matrix_type solve ( const matrix_exp& B ) const; @@ -159,11 +159,7 @@ namespace dlib template template - const matrix cholesky_decomposition:: + const typename EXP::matrix_type cholesky_decomposition:: solve( const matrix_exp& B ) const diff --git a/dlib/matrix/matrix_eigenvalue.h b/dlib/matrix/matrix_eigenvalue.h index 1867fb6da..3883ed520 100644 --- a/dlib/matrix/matrix_eigenvalue.h +++ b/dlib/matrix/matrix_eigenvalue.h @@ -478,7 +478,7 @@ namespace dlib type f = 0.0; type tst1 = 0.0; - type eps = pow(2.0,-52.0); + const type eps = std::numeric_limits::epsilon(); for (int l = 0; l < n; l++) { @@ -747,7 +747,7 @@ namespace dlib int n = nn-1; int low = 0; int high = nn-1; - type eps = pow(2.0,-52.0); + const type eps = std::numeric_limits::epsilon(); type exshift = 0.0; type p=0,q=0,r=0,s=0,z=0,t,w,x,y; diff --git a/dlib/matrix/matrix_lu.h b/dlib/matrix/matrix_lu.h index ec02a0051..a539efd65 100644 --- a/dlib/matrix/matrix_lu.h +++ b/dlib/matrix/matrix_lu.h @@ -128,7 +128,7 @@ namespace dlib { // Most of the time is spent in the following dot product. const long kmax = std::min(i,j); - const double s = rowm(LU,i, kmax)*colm(LUcolj,0,kmax); + const type s = rowm(LU,i, kmax)*colm(LUcolj,0,kmax); LU(i,j) = LUcolj(i) -= s; } @@ -147,7 +147,7 @@ namespace dlib long k=0; for (k = 0; k < n; k++) { - double t = LU(p,k); + type t = LU(p,k); LU(p,k) = LU(j,k); LU(j,k) = t; } diff --git a/dlib/test/matrix_la.cpp b/dlib/test/matrix_la.cpp index 5a2f8f3a0..e364afae4 100644 --- a/dlib/test/matrix_la.cpp +++ b/dlib/test/matrix_la.cpp @@ -28,8 +28,8 @@ namespace // ---------------------------------------------------------------------------------------- - template - const typename matrix_type::matrix_type symm(const matrix_type& m) { return m*trans(m); } + template + const matrix symm(const mat_type& m) { return m*trans(m); } // ----------------------------------------------------------------------------------------