Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
8a962d34
Commit
8a962d34
authored
Mar 21, 2013
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #676 from vpisarev/svd_stuff
added test for bug #1448 and hopefully fixes the bug #2898
parents
172b4554
9a862452
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
4 deletions
+33
-4
lapack.cpp
modules/core/src/lapack.cpp
+4
-4
test_math.cpp
modules/core/test/test_math.cpp
+29
-0
No files found.
modules/core/src/lapack.cpp
View file @
8a962d34
...
...
@@ -531,12 +531,12 @@ template<> inline int VBLAS<double>::givensx(double* a, double* b, int n, double
#endif
template
<
typename
_Tp
>
void
JacobiSVDImpl_
(
_Tp
*
At
,
size_t
astep
,
_Tp
*
_W
,
_Tp
*
Vt
,
size_t
vstep
,
int
m
,
int
n
,
int
n1
,
double
minval
)
JacobiSVDImpl_
(
_Tp
*
At
,
size_t
astep
,
_Tp
*
_W
,
_Tp
*
Vt
,
size_t
vstep
,
int
m
,
int
n
,
int
n1
,
double
minval
,
_Tp
eps
)
{
VBLAS
<
_Tp
>
vblas
;
AutoBuffer
<
double
>
Wbuf
(
n
);
double
*
W
=
Wbuf
;
_Tp
eps
=
DBL_EPSILON
*
10
;
int
i
,
j
,
k
,
iter
,
max_iter
=
std
::
max
(
m
,
30
);
_Tp
c
,
s
;
double
sd
;
...
...
@@ -729,12 +729,12 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int
static
void
JacobiSVD
(
float
*
At
,
size_t
astep
,
float
*
W
,
float
*
Vt
,
size_t
vstep
,
int
m
,
int
n
,
int
n1
=-
1
)
{
JacobiSVDImpl_
(
At
,
astep
,
W
,
Vt
,
vstep
,
m
,
n
,
!
Vt
?
0
:
n1
<
0
?
n
:
n1
,
FLT_MIN
);
JacobiSVDImpl_
(
At
,
astep
,
W
,
Vt
,
vstep
,
m
,
n
,
!
Vt
?
0
:
n1
<
0
?
n
:
n1
,
FLT_MIN
,
FLT_EPSILON
*
2
);
}
static
void
JacobiSVD
(
double
*
At
,
size_t
astep
,
double
*
W
,
double
*
Vt
,
size_t
vstep
,
int
m
,
int
n
,
int
n1
=-
1
)
{
JacobiSVDImpl_
(
At
,
astep
,
W
,
Vt
,
vstep
,
m
,
n
,
!
Vt
?
0
:
n1
<
0
?
n
:
n1
,
DBL_MIN
);
JacobiSVDImpl_
(
At
,
astep
,
W
,
Vt
,
vstep
,
m
,
n
,
!
Vt
?
0
:
n1
<
0
?
n
:
n1
,
DBL_MIN
,
DBL_EPSILON
*
10
);
}
/* y[0:m,0:n] += diag(a[0:1,0:m]) * x[0:m,0:n] */
...
...
modules/core/test/test_math.cpp
View file @
8a962d34
...
...
@@ -2487,6 +2487,35 @@ TEST(Core_SVBkSb, accuracy) { Core_SVBkSbTest test; test.safe_run(); }
TEST
(
Core_Trace
,
accuracy
)
{
Core_TraceTest
test
;
test
.
safe_run
();
}
TEST
(
Core_SolvePoly
,
accuracy
)
{
Core_SolvePolyTest
test
;
test
.
safe_run
();
}
TEST
(
Core_SVD
,
flt
)
{
float
a
[]
=
{
1.23377746e+011
f
,
-
7.05490125e+010
f
,
-
4.18380882e+010
f
,
-
11693456.
f
,
-
39091328.
f
,
77492224.
f
,
-
7.05490125e+010
f
,
2.36211143e+011
f
,
-
3.51093473e+010
f
,
70773408.
f
,
-
4.83386156e+005
f
,
-
129560368.
f
,
-
4.18380882e+010
f
,
-
3.51093473e+010
f
,
9.25311222e+010
f
,
-
49052424.
f
,
43922752.
f
,
12176842.
f
,
-
11693456.
f
,
70773408.
f
,
-
49052424.
f
,
8.40836094e+004
f
,
5.17475293e+003
f
,
-
1.16122949e+004
f
,
-
39091328.
f
,
-
4.83386156e+005
f
,
43922752.
f
,
5.17475293e+003
f
,
5.16047969e+004
f
,
5.68887842e+003
f
,
77492224.
f
,
-
129560368.
f
,
12176842.
f
,
-
1.16122949e+004
f
,
5.68887842e+003
f
,
1.28060578e+005
f
};
float
b
[]
=
{
283751232.
f
,
2.61604198e+009
f
,
-
745033216.
f
,
2.31125625e+005
f
,
-
4.52429188e+005
f
,
-
1.37596525e+006
f
};
Mat
A
(
6
,
6
,
CV_32F
,
a
);
Mat
B
(
6
,
1
,
CV_32F
,
b
);
Mat
X
,
B1
;
solve
(
A
,
B
,
X
,
DECOMP_SVD
);
B1
=
A
*
X
;
EXPECT_LE
(
norm
(
B1
,
B
,
NORM_L2
+
NORM_RELATIVE
),
FLT_EPSILON
*
10
);
}
// TODO: eigenvv, invsqrt, cbrt, fastarctan, (round, floor, ceil(?)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment