Commit 9ac3a351 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

do not use Lapack anymore

parent 8a54967e
...@@ -427,25 +427,25 @@ inline size_t Mat::total() const ...@@ -427,25 +427,25 @@ inline size_t Mat::total() const
inline uchar* Mat::ptr(int y) inline uchar* Mat::ptr(int y)
{ {
CV_DbgAssert( data && dims >= 1 && (unsigned)y < (unsigned)size.p[0] ); CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
return data + step.p[0]*y; return data + step.p[0]*y;
} }
inline const uchar* Mat::ptr(int y) const inline const uchar* Mat::ptr(int y) const
{ {
CV_DbgAssert( data && dims >= 1 && (unsigned)y < (unsigned)size.p[0] ); CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
return data + step.p[0]*y; return data + step.p[0]*y;
} }
template<typename _Tp> inline _Tp* Mat::ptr(int y) template<typename _Tp> inline _Tp* Mat::ptr(int y)
{ {
CV_DbgAssert( data && dims >= 1 && (unsigned)y < (unsigned)size.p[0] ); CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
return (_Tp*)(data + step.p[0]*y); return (_Tp*)(data + step.p[0]*y);
} }
template<typename _Tp> inline const _Tp* Mat::ptr(int y) const template<typename _Tp> inline const _Tp* Mat::ptr(int y) const
{ {
CV_DbgAssert( dims >= 1 && data && (unsigned)y < (unsigned)size.p[0] ); CV_DbgAssert( y == 0 || (data && dims >= 1 && data && (unsigned)y < (unsigned)size.p[0]) );
return (const _Tp*)(data + step.p[0]*y); return (const _Tp*)(data + step.p[0]*y);
} }
......
...@@ -683,10 +683,10 @@ Matx<_Tp, m, n> Matx<_Tp, m, n>::mul(const Matx<_Tp, m, n>& a) const ...@@ -683,10 +683,10 @@ Matx<_Tp, m, n> Matx<_Tp, m, n>::mul(const Matx<_Tp, m, n>& a) const
} }
CV_EXPORTS int LU(float* A, int m, float* b, int n); CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n);
CV_EXPORTS int LU(double* A, int m, double* b, int n); CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n);
CV_EXPORTS bool Cholesky(float* A, int m, float* b, int n); CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n);
CV_EXPORTS bool Cholesky(double* A, int m, double* b, int n); CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n);
template<typename _Tp, int m> struct CV_EXPORTS Matx_DetOp template<typename _Tp, int m> struct CV_EXPORTS Matx_DetOp
...@@ -694,7 +694,7 @@ template<typename _Tp, int m> struct CV_EXPORTS Matx_DetOp ...@@ -694,7 +694,7 @@ template<typename _Tp, int m> struct CV_EXPORTS Matx_DetOp
double operator ()(const Matx<_Tp, m, m>& a) const double operator ()(const Matx<_Tp, m, m>& a) const
{ {
Matx<_Tp, m, m> temp = a; Matx<_Tp, m, m> temp = a;
double p = LU(temp.val, m, 0, 0); double p = LU(temp.val, m, m, 0, 0, 0);
if( p == 0 ) if( p == 0 )
return p; return p;
for( int i = 0; i < m; i++ ) for( int i = 0; i < m; i++ )
...@@ -767,9 +767,9 @@ template<typename _Tp, int m> struct CV_EXPORTS Matx_FastInvOp ...@@ -767,9 +767,9 @@ template<typename _Tp, int m> struct CV_EXPORTS Matx_FastInvOp
b(i, i) = (_Tp)1; b(i, i) = (_Tp)1;
if( method == DECOMP_CHOLESKY ) if( method == DECOMP_CHOLESKY )
return Cholesky(temp.val, m, b.val, m); return Cholesky(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m);
return LU(temp.val, m, b.val, m) != 0; return LU(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m) != 0;
} }
}; };
...@@ -839,9 +839,9 @@ template<typename _Tp, int m, int n> struct CV_EXPORTS Matx_FastSolveOp ...@@ -839,9 +839,9 @@ template<typename _Tp, int m, int n> struct CV_EXPORTS Matx_FastSolveOp
Matx<_Tp, m, m> temp = a; Matx<_Tp, m, m> temp = a;
x = b; x = b;
if( method == DECOMP_CHOLESKY ) if( method == DECOMP_CHOLESKY )
return Cholesky(temp.val, m, x.val, n); return Cholesky(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n);
return LU(temp.val, m, x.val, n) != 0; return LU(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n) != 0;
} }
}; };
......
This diff is collapsed.
...@@ -1595,13 +1595,13 @@ static double cvTsSVDet( CvMat* mat, double* ratio ) ...@@ -1595,13 +1595,13 @@ static double cvTsSVDet( CvMat* mat, double* ratio )
{ {
for( i = 0; i < nm; i++ ) for( i = 0; i < nm; i++ )
det *= w->data.fl[i]; det *= w->data.fl[i];
*ratio = w->data.fl[nm-1] < FLT_EPSILON ? FLT_MAX : w->data.fl[nm-1]/w->data.fl[0]; *ratio = w->data.fl[nm-1] < FLT_EPSILON ? 0 : w->data.fl[nm-1]/w->data.fl[0];
} }
else else
{ {
for( i = 0; i < nm; i++ ) for( i = 0; i < nm; i++ )
det *= w->data.db[i]; det *= w->data.db[i];
*ratio = w->data.db[nm-1] < FLT_EPSILON ? DBL_MAX : w->data.db[nm-1]/w->data.db[0]; *ratio = w->data.db[nm-1] < FLT_EPSILON ? 0 : w->data.db[nm-1]/w->data.db[0];
} }
cvReleaseMat( &w ); cvReleaseMat( &w );
...@@ -1673,6 +1673,8 @@ void Core_SolveTest::get_test_array_types_and_sizes( int test_case_idx, vector<v ...@@ -1673,6 +1673,8 @@ void Core_SolveTest::get_test_array_types_and_sizes( int test_case_idx, vector<v
int bits = cvtest::randInt(rng); int bits = cvtest::randInt(rng);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types ); Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize in_sz = sizes[INPUT][0]; CvSize in_sz = sizes[INPUT][0];
if( in_sz.width > in_sz.height )
in_sz = cvSize(in_sz.height, in_sz.width);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types ); Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
sizes[INPUT][0] = in_sz; sizes[INPUT][0] = in_sz;
int min_size = MIN( sizes[INPUT][0].width, sizes[INPUT][0].height ); int min_size = MIN( sizes[INPUT][0].width, sizes[INPUT][0].height );
...@@ -1912,7 +1914,7 @@ void Core_SVDTest::get_minmax_bounds( int /*i*/, int /*j*/, int /*type*/, Scalar ...@@ -1912,7 +1914,7 @@ void Core_SVDTest::get_minmax_bounds( int /*i*/, int /*j*/, int /*type*/, Scalar
double Core_SVDTest::get_success_error_level( int test_case_idx, int i, int j ) double Core_SVDTest::get_success_error_level( int test_case_idx, int i, int j )
{ {
int input_depth = CV_MAT_DEPTH(cvGetElemType( test_array[INPUT][0] )); int input_depth = CV_MAT_DEPTH(cvGetElemType( test_array[INPUT][0] ));
double input_precision = input_depth < CV_32F ? 0 : input_depth == CV_32F ? 5e-5 : 5e-11; double input_precision = input_depth < CV_32F ? 0 : input_depth == CV_32F ? 1e-5 : 5e-11;
double output_precision = Base::get_success_error_level( test_case_idx, i, j ); double output_precision = Base::get_success_error_level( test_case_idx, i, j );
return MAX(input_precision, output_precision); return MAX(input_precision, output_precision);
} }
...@@ -1926,7 +1928,7 @@ void Core_SVDTest::run_func() ...@@ -1926,7 +1928,7 @@ void Core_SVDTest::run_func()
} }
void Core_SVDTest::prepare_to_validation( int ) void Core_SVDTest::prepare_to_validation( int test_case_idx )
{ {
Mat& input = test_mat[INPUT][0]; Mat& input = test_mat[INPUT][0];
int depth = input.depth(); int depth = input.depth();
...@@ -2036,7 +2038,8 @@ flags(0), have_b(false), symmetric(false), compact(false), vector_w(false) ...@@ -2036,7 +2038,8 @@ flags(0), have_b(false), symmetric(false), compact(false), vector_w(false)
} }
void Core_SVBkSbTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types ) void Core_SVBkSbTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes,
vector<vector<int> >& types )
{ {
RNG& rng = ts->get_rng(); RNG& rng = ts->get_rng();
int bits = cvtest::randInt(rng); int bits = cvtest::randInt(rng);
...@@ -2150,7 +2153,7 @@ void Core_SVBkSbTest::prepare_to_validation( int ) ...@@ -2150,7 +2153,7 @@ void Core_SVBkSbTest::prepare_to_validation( int )
CvMat _w = w, _wdb = wdb; CvMat _w = w, _wdb = wdb;
// use exactly the same threshold as in icvSVD... , // use exactly the same threshold as in icvSVD... ,
// so the changes in the library and here should be synchronized. // so the changes in the library and here should be synchronized.
double threshold = cv::sum(w)[0]*2*(is_float ? FLT_EPSILON : DBL_EPSILON); double threshold = cv::sum(w)[0]*(is_float ? FLT_EPSILON*10 : DBL_EPSILON*2);
wdb = Scalar::all(0); wdb = Scalar::all(0);
for( i = 0; i < min_size; i++ ) for( i = 0; i < min_size; i++ )
......
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