refactored div & pow funcs; added tests for special cases in pow() function.

fixed http://code.opencv.org/issues/3935
possibly fixed http://code.opencv.org/issues/3594
This commit is contained in:
Vadim Pisarevsky
2015-05-01 21:49:11 +03:00
parent 74e2b8cbcb
commit 9fbd1d68ad
7 changed files with 783 additions and 475 deletions

View File

@@ -502,7 +502,7 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep,
{
sd = i < n ? W[i] : 0;
while( sd <= minval )
for( int ii = 0; ii < 100 && sd <= minval; ii++ )
{
// if we got a zero singular value, then in order to get the corresponding left singular vector
// we generate a random vector, project it to the previously computed left singular vectors,
@@ -541,7 +541,7 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep,
sd = std::sqrt(sd);
}
s = (_Tp)(1/sd);
s = (_Tp)(sd > minval ? 1/sd : 0.);
for( k = 0; k < m; k++ )
At[i*astep + k] *= s;
}