Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
d25df5a9
Commit
d25df5a9
authored
Apr 30, 2015
by
Davis King
Browse files
Fixed a bug in the eigenvalue_decomposition which could occur when
a symmetric matrix was used along with the LAPACK bindings.
parent
555de01d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
dlib/matrix/matrix_eigenvalue.h
dlib/matrix/matrix_eigenvalue.h
+1
-0
dlib/test/matrix_eig.cpp
dlib/test/matrix_eig.cpp
+21
-0
No files found.
dlib/matrix/matrix_eigenvalue.h
View file @
d25df5a9
...
@@ -193,6 +193,7 @@ namespace dlib
...
@@ -193,6 +193,7 @@ namespace dlib
lapack
::
integer
temp
;
lapack
::
integer
temp
;
lapack
::
syevr
(
'V'
,
'A'
,
'L'
,
tempA
,
0
,
0
,
0
,
0
,
-
1
,
temp
,
d
,
V
,
isupz
);
lapack
::
syevr
(
'V'
,
'A'
,
'L'
,
tempA
,
0
,
0
,
0
,
0
,
-
1
,
temp
,
d
,
V
,
isupz
);
return
;
}
}
#endif
#endif
// Tridiagonalize.
// Tridiagonalize.
...
...
dlib/test/matrix_eig.cpp
View file @
d25df5a9
...
@@ -193,6 +193,21 @@ namespace
...
@@ -193,6 +193,21 @@ namespace
test_eigenvalue
(
10
*
randm
<
float
,
3
,
3
>
());
test_eigenvalue
(
10
*
randm
<
float
,
3
,
3
>
());
}
}
template
<
int
dims
>
void
test_eigenvalue2
()
{
for
(
int
seed
=
0
;
seed
<
10
;
++
seed
)
{
print_spinner
();
matrix
<
double
>
H
=
gaussian_randm
(
dims
,
dims
,
seed
);
H
=
H
*
trans
(
H
);
eigenvalue_decomposition
<
matrix
<
double
>
>
eig
(
H
);
matrix
<
double
>
HH
=
eig
.
get_pseudo_v
()
*
diagm
(
eig
.
get_real_eigenvalues
())
*
trans
(
eig
.
get_pseudo_v
());
DLIB_TEST_MSG
(
max
(
abs
(
H
-
HH
))
<
1e-12
,
"dims: "
<<
dims
<<
" error: "
<<
max
(
abs
(
H
-
HH
)));
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class
matrix_tester
:
public
tester
class
matrix_tester
:
public
tester
...
@@ -215,6 +230,12 @@ namespace
...
@@ -215,6 +230,12 @@ namespace
matrix_test_double
();
matrix_test_double
();
dlog
<<
LINFO
<<
"begin testing with float"
;
dlog
<<
LINFO
<<
"begin testing with float"
;
matrix_test_float
();
matrix_test_float
();
test_eigenvalue2
<
10
>
();
test_eigenvalue2
<
11
>
();
test_eigenvalue2
<
3
>
();
test_eigenvalue2
<
2
>
();
test_eigenvalue2
<
1
>
();
}
}
}
a
;
}
a
;
...
...
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