From a1ff7a970e3079339b0be8c7ca53daf643ac447e Mon Sep 17 00:00:00 2001 From: Gal <gal.pascual@epfl.ch> Date: Thu, 14 Dec 2023 12:06:03 +0100 Subject: [PATCH] Corrected Documentation --- exec/Solver.cpp | 29 +++++++++++++---------------- tests.cpp | 1 + 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/exec/Solver.cpp b/exec/Solver.cpp index c121f4a1..9320ae48 100644 --- a/exec/Solver.cpp +++ b/exec/Solver.cpp @@ -106,8 +106,8 @@ Solution Solver::NewtonMethodA(const std::string& eq, const std::string& der, do * relevant & interesting information about the result of the method. * * @param eqs the equations of the `MultiFunction`'s in the `System` we want to find a root of. - * @param der the derivative of the `MultiFunction`'s in the `System` we want to find a root of. - * @param start_point the point from which the `Newton` method will start to iterate. + * @param der the Jacobian of the system of equations we want to find a root of. + * @param start_points the vector from which the `Newton` method will start to iterate. * @param stop_tol the tolerance at which the `Newton` method considers its sequence to be converged. * @param max_iter the maximal iterations the `Newton` method will perform before returning, converged or not. * @@ -132,17 +132,17 @@ Solution Solver::SystemNewtonMethod(const std::vector<std::string>& eqs, const s /** * @brief Applies the non-accelerated `Fixed Point` method to find a root of a given mono-variable equation for given conditions. * - * This function will initialize the `MonoFunction` with the given `equation` & `der`, then perform the `Fixed Point` method on it + * This function will initialize the `MonoFunction` with the given `equation` & `fixed point equation`, then perform the `Fixed Point` method on it * for the given conditions (`max_iter`, `tolerance`, `start_point`). It returns a `Solution` class which encapsulates all * relevant & interesting information about the result of the method. * * @param eq the equation of the `MonoFunction` we want to find a root of. - * @param der the derivative of the `MonoFunction` we want to find a root of. + * @param fp the fixed-point equation `g(x)` such that `f(x) = g(x) - x` * @param start_point the point from which the `Fixed Point` method will start to iterate. * @param stop_tol the tolerance at which the `Fixed Point` method considers its sequence to be converged. * @param max_iter the maximal iterations the `Fixed Point` method will perform before returning, converged or not. * - * @return a `Solution`class with all information about the method's result. + * @return a `Solution` class with all information about the method's result. */ Solution Solver::FixedPointMethod(const std::string& eq, const std::string& fp, double start_point, double stop_tol, int max_iter) { @@ -156,12 +156,12 @@ Solution Solver::FixedPointMethod(const std::string& eq, const std::string& fp, /** * @brief Applies the accelerated `Fixed Point` method to find a root of a given mono-variable equation for given conditions. * - * This function will initialize the `MonoFunction` with the given `equation` & `der`, then perform the Accelerated `Fixed Point` method on it + * This function will initialize the `MonoFunction` with the given `equation` & `fixed-point equation`, then perform the Accelerated `Fixed Point` method on it * for the given conditions (`max_iter`, `tolerance`, `start_point`), by instantiating the `Aitken` method with this `Fixed Point` class. * It returns a `Solution` class which encapsulates all relevant & interesting information about the result of the method. * * @param eq the equation of the `MonoFunction` we want to find a root of. - * @param der the derivative of the `MonoFunction` we want to find a root of. + * @param fp the fixed-point equation `g(x)` such that `f(x) = g(x) - x` * @param start_point the point from which the `Aitken` ( & `Fixed Point`) method will start to iterate. * @param stop_tol the tolerance at which the `Aitken` method considers its sequence to be converged. * @param max_iter the maximal iterations the `Aitken` method will perform before returning, converged or not. @@ -186,12 +186,11 @@ Solution Solver::FixedPointMethodA(const std::string& eq, const std::string& fp, * relevant & interesting information about the result of the method. * * @param eq the equation of the `MonoFunction` we want to find a root of. - * @param der the derivative of the `MonoFunction` we want to find a root of. * @param start_point the 2 first points/iterations from which the `Chord` method will start to iterate. * @param stop_tol the tolerance at which the `Chord` method considers its sequence to be converged. * @param max_iter the maximal iterations the `Chord` method will perform before returning, converged or not. * - * @return a `Solution`class with all information about the method's result. + * @return a `Solution` class with all information about the method's result. */ Solution Solver::ChordMethod(const std::string& eq, std::pair<double, double> start_point, double stop_tol, int max_iter) { @@ -203,19 +202,18 @@ Solution Solver::ChordMethod(const std::string& eq, std::pair<double, double> st } /** - * @brief Applies the non-accelerated `Bisection` method to find a root of a given mono-variable equation for given conditions. + * @brief Applies the `Bisection` method to find a root of a given mono-variable equation for given conditions. * - * This function will initialize the `MonoFunction` with the given `equation` & `der`, then perform the `Bisection` method on it + * This function will initialize the `MonoFunction` with the given `equation`, then perform the `Bisection` method on it * for the given conditions (`max_iter`, `tolerance`, `start_point`). It returns a `Solution` class which encapsulates all * relevant & interesting information about the result of the method. * * @param eq the equation of the `MonoFunction` we want to find a root of. - * @param der the derivative of the `MonoFunction` we want to find a root of. * @param start_point the interval of points from which the `Bisection` method will start to iterate. * @param stop_tol the tolerance at which the `Bisection` method considers its sequence to be converged. * @param max_iter the maximal iterations the `Bisection` method will perform before returning, converged or not. * - * @return a `Solution`class with all information about the method's result. + * @return a `Solution` class with all information about the method's result. */ Solution Solver::BisectionMethod(const std::string& eq, std::pair<double, double> start_point, double stop_tol, int max_iter) { @@ -255,7 +253,7 @@ void Solver::PointOutput(Solution root, const std::string& method, bool Aitken, * This function will print all (relevant) info included in the `Solution`, customized towards the root being (within) an interval. * It is called for the showcasing of the solutions of the `Bisection` method. * - * @param root the root that includes all relevant info about the solution/result of the algorithm. + * @param root the Solution that includes all relevant info about the solution/result of the algorithm. * @param method the method that was used, in string form. * @param function the function for which we attempted to find a root (in string format). * @@ -277,8 +275,7 @@ void Solver::IntervalOutput(Solution root, const std::string& method, const std: * This function will print all (relevant) info included in the `Solution`, customized towards the root being a vector of doubles (roots). * It is called for the showcasing of the solutions of the `Newton` method for Systems. * - * @param root the root that includes all relevant info about the solution/result of the algorithm. - * @param method the method that was used, in string form. + * @param root the Solution that includes all relevant info about the solution/result of the algorithm. * @param function the system of functions for which we attempted to find a root (in string format). * */ diff --git a/tests.cpp b/tests.cpp index 1ff9ab33..5a80598f 100644 --- a/tests.cpp +++ b/tests.cpp @@ -357,6 +357,7 @@ TEST(ConfigFile, Errors) { EXPECT_THROW(read_test.getFixedPoint(), std::invalid_argument); } + int main() { testing::InitGoogleTest(); -- GitLab