Commit 0de5c998 authored by Oliver Sander's avatar Oliver Sander
Browse files

Add boilerplate for three more tests

Viz, finite difference tests for addGradient, addHessian, directionalSubDiff.
I will delegate writing the actual test to somebody else.
parent 6c346300
......@@ -48,6 +48,63 @@ void testConvexity(const Functional& functional,
}
}
/** \brief Test the addGradient method
*
* This method tests the Functional::addGradient method by comparing its result with a
* Finite-Difference-Approximation. Test points from the testPoints input argument
* are skipped if the method Functional::regularity returns a value larger than 1e6
* for them. In that case the functional is not differentiable at that point.
*
* \tparam Functional Type of the functional to be tested
* \param functional The functional to be tested
* \param testPoints Test addGradient at these points
*/
template <class Functional>
void testGradient(const Functional& functional,
const std::vector<typename Functional::VectorType>& testPoints)
{
// TODO: Implement me!
}
/** \brief Test the addHessian method
*
* This method tests the Functional::addHessian method by comparing its result with a
* Finite-Difference-Approximation. Test points from the testPoints input argument
* are skipped if the method Functional::regularity returns a value larger than 1e6
* for them. In that case the functional is not differentiable at that point.
*
* \tparam Functional Type of the functional to be tested
* \param functional The functional to be tested
* \param testPoints Test addHessian at these points
*/
template <class Functional>
void testHessian(const Functional& functional,
const std::vector<typename Functional::VectorType>& testPoints)
{
// TODO: Implement me!
}
/** \brief Test the directionalSubDiff method
*
* This method tests the Functional::addGradient method by comparing its result with a
* Finite-Difference-Approximation. Test points from the testPoints input argument
* are skipped if the method Functional::regularity returns a value larger than 1e6
* for them. In that case the functional is not differentiable at that point.
*
* \tparam Functional Type of the functional to be tested
* \param functional The functional to be tested
* \param testPoints Test addGradient at these points
*/
template <class Functional>
void testDirectionalSubdifferential(const Functional& functional,
const std::vector<typename Functional::VectorType>& testPoints)
{
// TODO: Implement me!
}
} // namespace TNNMG
} // namespace Dune
......
......@@ -35,6 +35,15 @@ int main(int argc, char** argv) try
// Test whether the functional is convex
testConvexity(functional, testPoints);
// Test the first derivative at the given test points
testGradient(functional, testPoints);
// Test the first derivative at the given test points
testHessian(functional, testPoints);
// Test the directional subdifferential at the given test points
testDirectionalSubdifferential(functional, testPoints);
return 0;
}
catch (Exception e)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment