SpECTRE Documentation Coverage Report
 Current view: top level - NumericalAlgorithms/RootFinding - QuadraticEquation.hpp Hit Total Coverage Commit: 817e13c5144619b701c7cd870655d8dbf94ab8ce Lines: 5 5 100.0 % Date: 2024-07-19 22:17:05 Legend: Lines: hit not hit
  Line data Source code  1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : /// \file 5 : /// Declares functions for solving quadratic equations 6 : 7 : #pragma once 8 : 9 : #include 10 : #include 11 : 12 : /*! 13 : * \ingroup NumericalAlgorithmsGroup 14 : * \brief Returns the positive root of a quadratic equation \f$ax^2 + 15 : * bx + c = 0\f$ 16 : * \returns The positive root of a quadratic equation. 17 : * \requires That there are two real roots, of which only one is positive. 18 : */ 19 1 : double positive_root(double a, double b, double c); 20 : 21 : /*! 22 : * \ingroup NumericalAlgorithmsGroup 23 : * \brief Returns the smallest root of a quadratic equation \f$ax^2 + 24 : * bx + c = 0\f$ that is greater than the given value, within roundoff. 25 : * \returns A root of a quadratic equation. 26 : * \requires That there are two real roots. 27 : * \requires At least one root is greater than the given value, to roundoff. 28 : */ 29 : template 30 1 : T smallest_root_greater_than_value_within_roundoff(const T& a, const T& b, 31 : const T& c, double value); 32 : /*! 33 : * \ingroup NumericalAlgorithmsGroup 34 : * \brief Returns the largest root of a quadratic equation 35 : * \f$ax^2 + bx + c = 0\f$ that is between min_value and max_value, 36 : * within roundoff. 37 : * \returns A root of a quadratic equation. 38 : * \requires That there are two real roots. 39 : * \requires At least one root is between min_value and max_value, to roundoff. 40 : */ 41 : template 42 1 : T largest_root_between_values_within_roundoff(const T& a, const T& b, 43 : const T& c, double min_value, 44 : double max_value); 45 : /*! 46 : * \ingroup NumericalAlgorithmsGroup 47 : * \brief Returns the two real roots of a quadratic equation \f$ax^2 + 48 : * bx + c = 0\f$ with the root closer to \f$-\infty\f$ first, or an 49 : * empty optional if there are no real roots. 50 : */ 51 1 : std::optional> real_roots(double a, double b, double c); 

 Generated by: LCOV version 1.14