Commit a849243a by David Frank

### Simplify calculation of Lipschitz constant

parent b8549267
 ... @@ -160,16 +160,14 @@ namespace elsa ... @@ -160,16 +160,14 @@ namespace elsa } } // compute the Lipschitz Constant as the largest eigenvalue of the Hessian // compute the Lipschitz Constant as the largest eigenvalue of the Hessian const auto hessian = getHessian(); const auto hessian = getHessian(); Eigen::Matrix bVec( DataContainer dcB(hessian.getDomainDescriptor()); hessian.getDomainDescriptor().getNumberOfCoefficients()); dcB = 1; bVec.setOnes(); DataContainer dcB(hessian.getDomainDescriptor(), bVec); for (index_t i = 0; i < nIterations; i++) { for (index_t i = 0; i < nIterations; i++) { dcB = hessian.apply(dcB); 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 template ... ...
 ... @@ -131,7 +131,7 @@ TEST_CASE_TEMPLATE("Scenario: Testing LASSOProblem", data_t, float, double) ... @@ -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 " THEN("the Lipschitz Constant of a LASSOProblem with an Identity Operator as the " "Linear Operator A is 1") "Linear Operator A is 1") { { REQUIRE_EQ(lipschitzConstant, as(1.0)); REQUIRE_EQ(lipschitzConstant, Approx(as(1.0))); } } } } } } ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!