Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
ae9546cb
Commit
ae9546cb
authored
Aug 11, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made svd3 faster when working on small matrices.
parent
f9fac06e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
matrix_la.h
dlib/matrix/matrix_la.h
+13
-9
No files found.
dlib/matrix/matrix_la.h
View file @
ae9546cb
...
...
@@ -1541,16 +1541,21 @@ convergence:
COMPILE_TIME_ASSERT
(
wX
==
0
||
wX
==
1
);
#ifdef DLIB_USE_LAPACK
matrix
<
typename
matrix_exp
<
EXP
>::
type
,
uNR
,
uNC
,
MM1
,
L1
>
temp
(
m
);
lapack
::
gesvd
(
'S'
,
'A'
,
temp
,
w
,
u
,
v
);
v
=
trans
(
v
);
// if u isn't the size we want then pad it (and v) with zeros
if
(
u
.
nc
()
<
m
.
nc
())
// use LAPACK but only if it isn't a really small matrix we are taking the SVD of.
if
(
NR
*
NC
==
0
||
NR
*
NC
>
3
*
3
)
{
w
=
join_cols
(
w
,
zeros_matrix
<
T
>
(
m
.
nc
()
-
u
.
nc
(),
1
));
u
=
join_rows
(
u
,
zeros_matrix
<
T
>
(
u
.
nr
(),
m
.
nc
()
-
u
.
nc
()));
matrix
<
typename
matrix_exp
<
EXP
>::
type
,
uNR
,
uNC
,
MM1
,
L1
>
temp
(
m
);
lapack
::
gesvd
(
'S'
,
'A'
,
temp
,
w
,
u
,
v
);
v
=
trans
(
v
);
// if u isn't the size we want then pad it (and v) with zeros
if
(
u
.
nc
()
<
m
.
nc
())
{
w
=
join_cols
(
w
,
zeros_matrix
<
T
>
(
m
.
nc
()
-
u
.
nc
(),
1
));
u
=
join_rows
(
u
,
zeros_matrix
<
T
>
(
u
.
nr
(),
m
.
nc
()
-
u
.
nc
()));
}
return
;
}
#e
lse
#e
ndif
v
.
set_size
(
m
.
nc
(),
m
.
nc
());
u
=
m
;
...
...
@@ -1558,7 +1563,6 @@ convergence:
w
.
set_size
(
m
.
nc
(),
1
);
matrix
<
T
,
matrix_exp
<
EXP
>::
NC
,
1
,
MM1
>
rv1
(
m
.
nc
(),
1
);
nric
::
svdcmp
(
u
,
w
,
v
,
rv1
);
#endif
}
// ----------------------------------------------------------------------------------------
...
...
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