Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IP
elsa
Commits
a849243a
Commit
a849243a
authored
Mar 21, 2022
by
David Frank
Browse files
Simplify calculation of Lipschitz constant
parent
b8549267
Changes
2
Show whitespace changes
Inline
Side-by-side
elsa/problems/Problem.cpp
View file @
a849243a
...
...
@@ -160,16 +160,14 @@ namespace elsa
}
// compute the Lipschitz Constant as the largest eigenvalue of the Hessian
const
auto
hessian
=
getHessian
();
Eigen
::
Matrix
<
data_t
,
Eigen
::
Dynamic
,
1
>
bVec
(
hessian
.
getDomainDescriptor
().
getNumberOfCoefficients
());
bVec
.
setOnes
();
DataContainer
<
data_t
>
dcB
(
hessian
.
getDomainDescriptor
(),
bVec
);
DataContainer
<
data_t
>
dcB
(
hessian
.
getDomainDescriptor
());
dcB
=
1
;
for
(
index_t
i
=
0
;
i
<
nIterations
;
i
++
)
{
dcB
=
hessian
.
apply
(
dcB
);
dcB
=
dcB
/
sqrt
(
dcB
.
dot
(
dcB
)
);
dcB
=
dcB
/
dcB
.
l2Norm
(
);
}
return
dcB
.
dot
(
hessian
.
apply
(
dcB
))
/
(
dcB
.
dot
(
dcB
)
);
return
dcB
.
dot
(
hessian
.
apply
(
dcB
))
/
dcB
.
l2Norm
(
);
}
template
<
typename
data_t
>
...
...
elsa/problems/tests/test_LASSOProblem.cpp
View file @
a849243a
...
...
@@ -131,7 +131,7 @@ TEST_CASE_TEMPLATE("Scenario: Testing LASSOProblem", data_t, float, double)
THEN
(
"the Lipschitz Constant of a LASSOProblem with an Identity Operator as the "
"Linear Operator A is 1"
)
{
REQUIRE_EQ
(
lipschitzConstant
,
as
<
data_t
>
(
1.0
));
REQUIRE_EQ
(
lipschitzConstant
,
Approx
(
as
<
data_t
>
(
1.0
))
)
;
}
}
}
...
...
Write
Preview
Supports
Markdown
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