From fe6a7e935db6c2f1cf669d0a0e5c0e73a4a1d8ab Mon Sep 17 00:00:00 2001 From: Alex Leontiev Date: Thu, 11 Jul 2013 09:52:13 +0300 Subject: [PATCH] Fix qualifiers on aux functions for solveLP() Change qualifiers on auxiliary functions (for solveLP() procedure) from const (that does not have much sense) to static (that makes them invisible for outside world and hopefully exacerbates optimization). --- modules/optim/src/lpsolver.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/optim/src/lpsolver.cpp b/modules/optim/src/lpsolver.cpp index a0bece3..7dc9f27 100644 --- a/modules/optim/src/lpsolver.cpp +++ b/modules/optim/src/lpsolver.cpp @@ -7,7 +7,7 @@ namespace cv{namespace optim{ using std::vector; -const void dprintf(const char* format,...){ +static void dprintf(const char* format,...){ #ifdef ALEX_DEBUG va_list args; va_start (args,format); @@ -16,7 +16,7 @@ const void dprintf(const char* format,...){ #endif } -void const print_matrix(const Mat& X){ +static void print_matrix(const Mat& X){ #ifdef ALEX_DEBUG dprintf("\ttype:%d vs %d,\tsize: %d-on-%d\n",X.type(),CV_64FC1,X.rows,X.cols); for(int i=0;i& N,const vector& B){ +static void print_simplex_state(const Mat& c,const Mat&b,double v,const vector& N,const vector& B){ #ifdef ALEX_DEBUG dprintf("\tprint simplex state\n"); @@ -61,12 +61,12 @@ void const print_simplex_state(const Mat& c,const Mat&b,double v,const vector& c, Mat_& b,double& v,vector& N,vector& B); -const inline void pivot(Mat_& c,Mat_& b,double& v,vector& N,vector& B, int leaving_index,int entering_index); +static int initialize_simplex(Mat_& c, Mat_& b,double& v,vector& N,vector& B); +static inline void pivot(Mat_& c,Mat_& b,double& v,vector& N,vector& B, int leaving_index,int entering_index); /**@return SOLVELP_UNBOUNDED means the problem is unbdd, SOLVELP_MULTI means multiple solutions, SOLVELP_SINGLE means one solution. */ -const int inner_simplex(Mat_& c, Mat_& b,double& v,vector& N,vector& B); -const void swap_columns(Mat_& A,int col1,int col2); +static int inner_simplex(Mat_& c, Mat_& b,double& v,vector& N,vector& B); +static void swap_columns(Mat_& A,int col1,int col2); //return codes:-2 (no_sol - unbdd),-1(no_sol - unfsbl), 0(single_sol), 1(multiple_sol=>least_l2_norm) int solveLP(const Mat& Func, const Mat& Constr, Mat& z){ @@ -113,7 +113,7 @@ int solveLP(const Mat& Func, const Mat& Constr, Mat& z){ return res; } -const int initialize_simplex(Mat_& c, Mat_& b,double& v,vector& N,vector& B){ +static int initialize_simplex(Mat_& c, Mat_& b,double& v,vector& N,vector& B){ N.resize(c.cols); N[0]=0; for (std::vector::iterator it = N.begin()+1 ; it != N.end(); ++it){ @@ -207,7 +207,7 @@ const int initialize_simplex(Mat_& c, Mat_& b,double& v,vector& c, Mat_& b,double& v,vector& N,vector& B){ +static int inner_simplex(Mat_& c, Mat_& b,double& v,vector& N,vector& B){ int count=0; while(1){ dprintf("iteration #%d\n",count++); @@ -279,7 +279,7 @@ const int inner_simplex(Mat_& c, Mat_& b,double& v,vector& } } -const inline void pivot(Mat_& c,Mat_& b,double& v,vector& N,vector& B, int leaving_index,int entering_index){ +static inline void pivot(Mat_& c,Mat_& b,double& v,vector& N,vector& B, int leaving_index,int entering_index){ double coef=b(leaving_index,entering_index); for(int i=0;i& c,Mat_& b,double& v,vector& N B[leaving_index]=tmp; } -const inline void swap_columns(Mat_& A,int col1,int col2){ +static inline void swap_columns(Mat_& A,int col1,int col2){ for(int i=0;i