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
b5467d0f
Commit
b5467d0f
authored
Oct 01, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimized the trust region solver a little bit.
parent
1a2a524a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
optimization_trust_region.h
dlib/optimization/optimization_trust_region.h
+24
-4
No files found.
dlib/optimization/optimization_trust_region.h
View file @
b5467d0f
...
...
@@ -108,14 +108,32 @@ namespace dlib
continue
;
}
using
namespace
blas_bindings
;
p
=
-
gg
;
// Solve RR'*p = -g for p.
using
namespace
blas_bindings
;
// Solve R*q = -g for q where q = R'*p.
triangular_solver
(
CblasLeft
,
CblasLower
,
CblasNoTrans
,
CblasNonUnit
,
R
,
p
);
if
(
R
.
nr
()
==
2
)
{
p
(
0
)
=
p
(
0
)
/
R
(
0
,
0
);
p
(
1
)
=
(
p
(
1
)
-
R
(
1
,
0
)
*
p
(
0
))
/
R
(
1
,
1
);
}
else
{
triangular_solver
(
CblasLeft
,
CblasLower
,
CblasNoTrans
,
CblasNonUnit
,
R
,
p
);
}
const
T
q_norm
=
length
(
p
);
// Solve R'*p = q for p.
triangular_solver
(
CblasLeft
,
CblasLower
,
CblasTrans
,
CblasNonUnit
,
R
,
p
);
if
(
R
.
nr
()
==
2
)
{
p
(
1
)
=
p
(
1
)
/
R
(
1
,
1
);
p
(
0
)
=
(
p
(
0
)
-
R
(
1
,
0
)
*
p
(
1
))
/
R
(
0
,
0
);
}
else
{
triangular_solver
(
CblasLeft
,
CblasLower
,
CblasTrans
,
CblasNonUnit
,
R
,
p
);
}
const
T
p_norm
=
length
(
p
);
// check if we are done.
...
...
@@ -233,6 +251,8 @@ namespace dlib
<<
"
\n\t
radius: "
<<
radius
);
const
double
initial_radius
=
radius
;
typedef
typename
funct_model
::
column_vector
T
;
typedef
typename
T
::
type
type
;
typedef
typename
T
::
mem_manager_type
mem_manager_type
;
...
...
@@ -280,7 +300,7 @@ namespace dlib
// something has gone horribly wrong if the radius has shrunk to zero. So just
// give up if that happens.
if
(
static_cast
<
type
>
(
radius
)
<=
std
::
numeric_limits
<
type
>::
mi
n
())
if
(
radius
<=
initial_radius
*
std
::
numeric_limits
<
double
>::
epsilo
n
())
break
;
}
else
...
...
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