IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
ippl::random::detail::NewtonRaphson< T, Distribution > Struct Template Reference

Functor for solving equations using the Newton-Raphson method. More...

#include <Utility.h>

+ Collaboration diagram for ippl::random::detail::NewtonRaphson< T, Distribution >:

Public Member Functions

KOKKOS_INLINE_FUNCTION NewtonRaphson (const Distribution &dist_)
 
KOKKOS_INLINE_FUNCTION void solve (unsigned int d, T &x, T &u)
 Solve an equation using the Newton-Raphson method.
 

Public Attributes

Distribution dist
 
double atol = 1e-12
 
unsigned int max_iter = 20
 

Detailed Description

template<typename T, class Distribution>
struct ippl::random::detail::NewtonRaphson< T, Distribution >

Functor for solving equations using the Newton-Raphson method.

In particular, find the root x of the equation dist.obj(x, u)= 0 for a given u using Newton-Raphson method.

Template Parameters
TData type for the equation variables.
DistributionClass of target distribution to sample from.
Parameters
distDistribution object providing objective function cdf(x)-u and its derivative.
atolAbsolute tolerance for convergence (default: 1.0e-12).
max_iterMaximum number of iterations (default: 20).

Member Function Documentation

◆ solve()

template<typename T , class Distribution >
KOKKOS_INLINE_FUNCTION void ippl::random::detail::NewtonRaphson< T, Distribution >::solve ( unsigned int  d,
T &  x,
T &  u 
)
inline

Solve an equation using the Newton-Raphson method.

This function iteratively solves an equation of the form "cdf(x) - u = 0" for a given sample u using the Newton-Raphson method.

Parameters
dDimension index.
xVariable to solve for (initial guess and final solution).
uGiven sample from a uniform distribution [0, 1].

The documentation for this struct was generated from the following file: