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
1a2a524a
Commit
1a2a524a
authored
Oct 01, 2011
by
Davis King
Browse files
Changed LAPACK bindings so that really small matrices don't use LAPACK
for eigenvalue_decomposition or the triangular solver.
parent
2bbab691
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
33 deletions
+48
-33
dlib/matrix/matrix_eigenvalue.h
dlib/matrix/matrix_eigenvalue.h
+36
-27
dlib/matrix/matrix_trsm.h
dlib/matrix/matrix_trsm.h
+12
-6
No files found.
dlib/matrix/matrix_eigenvalue.h
View file @
1a2a524a
...
...
@@ -18,6 +18,8 @@
#include "lapack/syevr.h"
#endif
#define DLIB_LAPACK_EIGENVALUE_DECOMP_SIZE_THRESH 4
namespace
dlib
{
...
...
@@ -178,6 +180,8 @@ namespace dlib
V
=
A
;
#ifdef DLIB_USE_LAPACK
if
(
A
.
nr
()
>
DLIB_LAPACK_EIGENVALUE_DECOMP_SIZE_THRESH
)
{
e
=
0
;
// We could compute the result using syev()
...
...
@@ -189,24 +193,28 @@ namespace dlib
lapack
::
integer
temp
;
lapack
::
syevr
(
'V'
,
'A'
,
'L'
,
tempA
,
0
,
0
,
0
,
0
,
-
1
,
temp
,
d
,
V
,
isupz
);
#else
}
#endif
// Tridiagonalize.
tred2
();
// Diagonalize.
tql2
();
#endif
}
else
{
#ifdef DLIB_USE_LAPACK
if
(
A
.
nr
()
>
DLIB_LAPACK_EIGENVALUE_DECOMP_SIZE_THRESH
)
{
matrix
<
type
,
0
,
0
,
mem_manager_type
,
column_major_layout
>
temp
,
vl
,
vr
;
temp
=
A
;
lapack
::
geev
(
'N'
,
'V'
,
temp
,
d
,
e
,
vl
,
vr
);
V
=
vr
;
#else
return
;
}
#endif
H
=
A
;
ort
.
set_size
(
n
);
...
...
@@ -216,7 +224,6 @@ namespace dlib
// Reduce Hessenberg to real Schur form.
hqr2
();
#endif
}
}
...
...
@@ -252,6 +259,8 @@ namespace dlib
V
=
A
;
#ifdef DLIB_USE_LAPACK
if
(
A
.
nr
()
>
DLIB_LAPACK_EIGENVALUE_DECOMP_SIZE_THRESH
)
{
e
=
0
;
// We could compute the result using syev()
...
...
@@ -263,14 +272,14 @@ namespace dlib
lapack
::
integer
temp
;
lapack
::
syevr
(
'V'
,
'A'
,
'L'
,
tempA
,
0
,
0
,
0
,
0
,
-
1
,
temp
,
d
,
V
,
isupz
);
#else
return
;
}
#endif
// Tridiagonalize.
tred2
();
// Diagonalize.
tql2
();
#endif
}
...
...
dlib/matrix/matrix_trsm.h
View file @
1a2a524a
...
...
@@ -519,10 +519,13 @@ namespace dlib
float
*
B
,
const
int
ldb
)
{
#ifdef DLIB_USE_BLAS
if
(
M
>
4
)
{
cblas_strsm
(
Order
,
Side
,
Uplo
,
TransA
,
Diag
,
M
,
N
,
alpha
,
A
,
lda
,
B
,
ldb
);
#else
local_trsm
(
Order
,
Side
,
Uplo
,
TransA
,
Diag
,
M
,
N
,
alpha
,
A
,
lda
,
B
,
ldb
);
return
;
}
#endif
local_trsm
(
Order
,
Side
,
Uplo
,
TransA
,
Diag
,
M
,
N
,
alpha
,
A
,
lda
,
B
,
ldb
);
}
inline
void
cblas_trsm
(
const
enum
CBLAS_ORDER
Order
,
const
enum
CBLAS_SIDE
Side
,
...
...
@@ -532,10 +535,13 @@ namespace dlib
double
*
B
,
const
int
ldb
)
{
#ifdef DLIB_USE_BLAS
if
(
M
>
4
)
{
cblas_dtrsm
(
Order
,
Side
,
Uplo
,
TransA
,
Diag
,
M
,
N
,
alpha
,
A
,
lda
,
B
,
ldb
);
#else
local_trsm
(
Order
,
Side
,
Uplo
,
TransA
,
Diag
,
M
,
N
,
alpha
,
A
,
lda
,
B
,
ldb
);
return
;
}
#endif
local_trsm
(
Order
,
Side
,
Uplo
,
TransA
,
Diag
,
M
,
N
,
alpha
,
A
,
lda
,
B
,
ldb
);
}
inline
void
cblas_trsm
(
const
enum
CBLAS_ORDER
Order
,
const
enum
CBLAS_SIDE
Side
,
...
...
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