Skip to content

Commit

Permalink
docs modifs
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap committed Nov 22, 2023
1 parent 02564e9 commit d1896ef
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
4 changes: 2 additions & 2 deletions include/eve/module/contfrac/impl/lentz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace eve::detail
using r_t = std::decay_t<tmp_t>;
using u_t = underlying_type_t<r_t>;
u_t tiny = 16*smallestposval(as<u_t>()) ;
u_t terminator(eps <= 0 ? 16*eve::eps(as<u_t>()) : u_t(eps));
u_t terminator(eps <= 0 ? eve::abs(eps)*eve::eps(as<u_t>()) : u_t(eps));
size_t counter(max_terms);

r_t f{};
Expand Down Expand Up @@ -150,7 +150,7 @@ namespace eve::detail
using r_t = std::decay_t<tmp_t>;
using u_t = underlying_type_t<r_t>;
u_t tiny = 16*smallestposval(as<u_t>()) ;
u_t terminator(eps <= 0 ? 16*eve::eps(as<u_t>()) : u_t(eps));
u_t terminator(eps <= 0 ? eve::abs(eps)*eve::eps(as<u_t>()) : u_t(eps));
size_t counter(max_terms);

r_t f{};
Expand Down
29 changes: 13 additions & 16 deletions include/eve/module/contfrac/lentz_a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,32 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< typename Gen, eve::floating_value T>
//! T lentz_a(Gen g, const T& eps, size_t & max_terms) noexcept;
//! template< typename Gen, eve::scalar_ordered_value T> auto lentz_a(Gen g, const T& tol, size_t & max_terms) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `g` : generator function.
//! * `eps` : tolerance value.
//! * `tol` : tolerance value. If negative the effective tolerance will be abs(tol)*eve::eps(as(< u_t>)
//! where u_t is the underlying floating type associated to the return type of the invocable g.
//! * `max_terms` : no more than max_terms calls to the generator will be made,
//!
//! The generator type should be a function object which supports the following operations:
//! * Gen::result_type : The type that is the result of invoking operator().
//! This can be either an arithmetic or complex type,
//! or a std::tuple of two floating values
//! * The call to g() returns an object of type Gen::result_type.
//! Each time this operator is called then the next pair of a and b values is returned.
//! Or, if result_type is not a pair type, then the next b value
//! is returned and all the a values are assumed to be 1.
//! The generator type should be an invocable which supports the following operations:
//! * The call to g() returns a floating value or a pair (kumi::tuple) of such.
//! Each time this operator is called then the next pair of a and b values has to be returned,
//! or, if result_type is not a pair type, then the next b value
//! has to be returned and all the a values are assumed to be equal to one.
//!
//! * In all the continued fraction evaluation functions the tolerance parameter
//! is the precision desired in the result,
//! evaluation of the fraction will continue until the last term evaluated leaves
//! the relative error in the result less than tolerance.
//! * In all the continued fraction evaluation functions the effective tol parameter
//! is the relative precision desired in the result,
//! The evaluation of the fraction will continue until the last term evaluated leaves
//! the relative error in the result less than tolerance or the max_terms iteration is reached.
//!
//! **Return value**
//!
//! The value of the continued fraction is returned.
//! \f$\displaystyle \frac{a_1}{b_1+\frac{a_2}{b_2+\frac{a_3}{b_3+\cdots\vphantom{\frac{1}{1}} }}}\f$
//! \f$\displaystyle \frac{a_0}{b_0+\frac{a_1}{b_1+\frac{a_2}{b_2+\cdots\vphantom{\frac{1}{1}} }}}\f$
//!
//! @groupheader{Example}
//!
Expand Down
34 changes: 18 additions & 16 deletions include/eve/module/contfrac/lentz_b.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,38 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< typename Gen, eve::floating_value T>
//! T lentz_b(Gen g, const T& eps, size_t & max_terms) noexcept;
//! template< typename Gen, eve::floating_value T> auto lentz_b(Gen g, const T& tol, size_t & max_terms) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `g` : generator function.
//! * `eps` : tolerance value.
//! * `max_terms` : no more than max_terms calls to the generator will be made,
//! * `tol` : tolerance value. If negative the effective tolerance will be abs(tol)*eve::eps(as(< u_t>)
//! where u_t is the underlying floating type associated to the return type of the invocable g.
//! * `max_terms` : no more than max_terms calls to the generator will be made.
//!
//! The generator type should be a function object which supports the following operations:
//! * Gen::result_type : The type that is the result of invoking operator().
//! This can be either an arithmetic or complex type,
//! or a std::tuple of two floating values
//! * The call to g() returns an object of type Gen::result_type.
//! Each time this operator is called then the next pair of a and b values is returned.
//! Or, if result_type is not a pair type, then the next b value
//! is returned and all the a values are assumed to be 1.
//! The generator type should be an invocable which supports the following operations:
//! * The call to g() returns a floating value or a pair (kumi::tuple) of such.
//! Each time this operator is called then the next pair of a and b values has to be returned,
//! or, if result_type is not a pair type, then the next b value
//! has to be returned and all the a values are assumed to be equal to one.
//!
//! * In all the continued fraction evaluation functions the tolerance parameter
//! is the precision desired in the result,
//! evaluation of the fraction will continue until the last term evaluated leaves
//! the relative error in the result less than tolerance.
//! * In all the continued fraction evaluation functions the effective tol parameter
//! is the relative precision desired in the result,
//! The evaluation of the fraction will continue until the last term evaluated leaves
//! the relative error in the result less than tolerance or the max_terms iteration is reached.
//!
//! **Return value**
//!
//! The value of the continued fraction is returned.
//! \f$\displaystyle b_0+\frac{a_1}{b_1+\frac{a_2}{b_2+\frac{a_3}{b_3+\cdots\vphantom{\frac{1}{1}} }}}\f$
//!
//! Note that the the first a value (a0) generated is not used here.
//!
//! @note the implementation is largely inspired by the boost/math/fraction one, with less requirements on the invocable.
//! Peculiarly lambda functions can be used.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/polynomial/regular/lentz_b.cpp}
Expand Down

0 comments on commit d1896ef

Please sign in to comment.