From 97023e1b1cf26e79ad72174d353636d6f9fe0c43 Mon Sep 17 00:00:00 2001 From: Tajmeet Singh Date: Mon, 29 Jun 2020 15:27:44 +0100 Subject: [PATCH 1/2] docs: fixed some documentation issues --- math/complex_numbers.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/math/complex_numbers.cpp b/math/complex_numbers.cpp index 8b24c6d3c..c75b06ac1 100644 --- a/math/complex_numbers.cpp +++ b/math/complex_numbers.cpp @@ -1,8 +1,9 @@ /** * @author tjgurwara99 * @file - * - * A basic implementation of Complex Number field as a class with operators + * + * \brief An implementation of Complex Number as Objects + * \details A basic implementation of Complex Number field as a class with operators * overloaded to accommodate (mathematical) field operations. */ @@ -14,7 +15,7 @@ #include /** - * Class Complex to represent complex numbers as a field. + * \brief Class Complex to represent complex numbers as a field. */ class Complex { // The real value of the complex number @@ -24,8 +25,10 @@ class Complex { public: /** - * Complex Constructor which initialises the complex number which takes two - * arguments. + * \brief Complex Constructor which initialises our complex number. + * \details + * Complex Constructor which initialises the complex number which takes + * three arguments. * @param x If the third parameter is 'true' then this x is the absolute * value of the complex number, if the third parameter is 'false' then this * x is the real value of the complex number (optional). @@ -49,25 +52,28 @@ class Complex { } /** - * Copy Constructor + * \brief Copy Constructor * @param other The other number to equate our number to. */ Complex(const Complex &other) : re(other.real()), im(other.imag()) {} /** + * \brief Member function to get real value of our complex number. * Member function (getter) to access the class' re value. */ double real() const { return this->re; } /** + * \brief Member function to get imaginary value of our complex number. * Member function (getter) to access the class' im value. */ double imag() const { return this->im; } /** + * \brief Member function to give the modulus of our complex number. * Member function to which gives the absolute value (modulus) of our * complex number - * @return \f$ \sqrt{z \dot \bar{z}} \f$ where \f$ z \f$ is our complex + * @return \f$ \sqrt{z \dot \overline{z}} \f$ where \f$ z \f$ is our complex * number. */ double abs() const { @@ -75,12 +81,13 @@ class Complex { } /** - * Member function which gives the argument of our complex number. + * \brief Member function to give the argument of our complex number. * @return Argument of our Complex number in radians. */ double arg() const { return std::atan2(this->im, this->re); } /** + * \brief Operator overload of '+' on Complex class. * Operator overload to be able to add two complex numbers. * @param other The other number that is added to the current number. * @return result current number plus other number @@ -91,6 +98,7 @@ class Complex { } /** + * \brief Operator overload of '-' on Complex class. * Operator overload to be able to subtract two complex numbers. * @param other The other number being subtracted from the current number. * @return result current number subtract other number @@ -101,6 +109,7 @@ class Complex { } /** + * \brief Operator overload of '*' on Complex class. * Operator overload to be able to multiple two complex numbers. * @param other The other number to multiply the current number to. * @return result current number times other number. @@ -112,6 +121,7 @@ class Complex { } /** + * \brief Operator overload of '~' on Complex class. * Operator overload of the BITWISE NOT which gives us the conjugate of our * complex number. NOTE: This is overloading the BITWISE operator but its * not a BITWISE operation in this definition. @@ -123,6 +133,7 @@ class Complex { } /** + * \brief Operator overload of '/' on Complex class. * Operator overload to be able to divide two complex numbers. This function * would throw an exception if the other number is zero. * @param other The other number we divide our number by. @@ -142,6 +153,7 @@ class Complex { } /** + * \brief Operator overload of '=' on Complex class. * Operator overload to be able to copy RHS instance of Complex to LHS * instance of Complex */ @@ -153,6 +165,7 @@ class Complex { }; /** + * \brief Operator overload of '==' on Complex class. * Logical Equal overload for our Complex class. * @param a Left hand side of our expression * @param b Right hand side of our expression @@ -164,6 +177,7 @@ bool operator==(const Complex &a, const Complex &b) { } /** + * \brief Operator overload of '<<' of ostream for Complex class. * Overloaded insersion operator to accommodate the printing of our complex * number in their standard form. * @param os The console stream @@ -181,7 +195,7 @@ std::ostream &operator<<(std::ostream &os, const Complex &num) { } /** - * Function to get random numbers to generate our complex numbers for test + * \brief Function to get random numbers to generate our complex numbers for test */ double get_rand() { return (std::rand() % 100 - 50) / 100.f; } From f586ca1b6493fe5ace0d0bff7de8d7eb50fe5714 Mon Sep 17 00:00:00 2001 From: Tajmeet Singh Date: Wed, 1 Jul 2020 14:56:51 +0100 Subject: [PATCH 2/2] docs: fix --- math/complex_numbers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math/complex_numbers.cpp b/math/complex_numbers.cpp index c75b06ac1..50fd684d5 100644 --- a/math/complex_numbers.cpp +++ b/math/complex_numbers.cpp @@ -73,7 +73,7 @@ class Complex { * \brief Member function to give the modulus of our complex number. * Member function to which gives the absolute value (modulus) of our * complex number - * @return \f$ \sqrt{z \dot \overline{z}} \f$ where \f$ z \f$ is our complex + * @return \f$ \sqrt{z \bar{z}} \f$ where \f$ z \f$ is our complex * number. */ double abs() const {