FocusedLogCoordinates1D< NT > Class Template Reference#

DiFfRG: DiFfRG::FocusedLogCoordinates1D< NT > Class Template Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows

Logarithmic coordinates which cluster grid points around an interior scale. More...

#include <coordinates.hh>

Public Types

using ctype = NT
 

Public Member Functions

 FocusedLogCoordinates1D (size_t grid_extent, NT start, NT stop, NT center, NT focus)
 Construct a new FocusedLogCoordinates1D object.
 
template<typename NT2 >
 FocusedLogCoordinates1D (const FocusedLogCoordinates1D< NT2 > &other)
 
device::array< size_t, 1 > KOKKOS_FORCEINLINE_FUNCTION from_linear_index (size_t i) const
 
template<typename IT >
NT KOKKOS_FORCEINLINE_FUNCTION forward (const IT &x) const
 Transform from the grid to the physical space.
 
template<typename IT >
device::array< NT, 1 > KOKKOS_FORCEINLINE_FUNCTION forward (const device::array< IT, 1 > &x) const
 
NT KOKKOS_FORCEINLINE_FUNCTION backward (const NT &y) const
 Transform from the physical space to the grid.
 
NT KOKKOS_FORCEINLINE_FUNCTION backward_derivative (const NT &y) const
 
size_t KOKKOS_FORCEINLINE_FUNCTION size () const
 
device::array< size_t, 1 > KOKKOS_FORCEINLINE_FUNCTION sizes () const
 
std::string to_string () const
 

Public Attributes

const NT start
 
const NT stop
 
const NT center
 
const NT focus
 

Static Public Attributes

static constexpr size_t dim = 1
 

Private Member Functions

NT KOKKOS_FORCEINLINE_FUNCTION s_of_u (const NT u) const
 asinh(c * (u - u0)), written out to pick the cancellation-free branch.
 

Static Private Member Functions

static std::string round_trip (const NT value)
 Format a parameter with the fewest digits that still identify it uniquely.
 

Private Attributes

const size_t grid_extent
 
NT u0
 
NT s_min
 
NT a
 
NT a_inv
 
NT c
 
NT c_inv
 
NT g_min
 
bool pure_log
 

Friends

template<typename NT2 >
bool operator== (const FocusedLogCoordinates1D< NT > &lhs, const FocusedLogCoordinates1D< NT2 > &rhs)
 

Detailed Description

template<typename NT = double>
requires std::is_floating_point_v<NT>
class DiFfRG::FocusedLogCoordinates1D< NT >

Logarithmic coordinates which cluster grid points around an interior scale.

In contrast to LogarithmicCoordinates1D, whose single bias knob can only pack points towards start, this coordinate spends its resolution around a freely chosen center and lets it fall off smoothly to both sides. That is what is needed when the interesting structure sits at an intermediate scale – e.g. the ~1 GeV peak of a gluon dressing on a grid spanning 0.005 to 250 GeV – while the deep IR and the deep UV are flat.

The construction works in u = log(p) and stretches it with a sinh, the standard interior-point clustering map. With u0 = log(center) and c = focus,

forward:  u(s) = u0 + sinh(s) / c,          s = s_min + a * i uniform in the index
backward: s(u) = asinh(c * (u - u0))

where s_min = s(log(start)) and a = (s(log(stop)) - s_min) / (grid_extent - 1). forward(0) returns start exactly and forward(grid_extent - 1) returns stop to a few ulp, which matters for the common idiom of pairing grid element 0 with start directly rather than going through forward(). The node density is dindex/du ~ 1 / sqrt(1 + c^2 (u - u0)^2), i.e. peaked at center and decaying like 1/(c |u - u0|), so resolution is redistributed smoothly rather than cut off at the edge of a window.

focus == 0 reproduces a pure logarithmic (geometric) grid; larger values cluster harder. As a calibration point, 64 points on [0.005, 250] with center = 1 and focus = 2 give a cell width of 0.021 decades at the center and 32 points in [0.3, 3], against 0.076 decades and 13 points for LogarithmicCoordinates1D with bias = 11 on the same interval.

center outside [start, stop] is allowed and degenerates to a one-sided stretch.

Member Typedef Documentation

◆ ctype

template<typename NT = double>
using DiFfRG::FocusedLogCoordinates1D< NT >::ctype = NT

Constructor & Destructor Documentation

◆ FocusedLogCoordinates1D() [1/2]

template<typename NT = double>
DiFfRG::FocusedLogCoordinates1D< NT >::FocusedLogCoordinates1D ( size_t grid_extent,
NT start,
NT stop,
NT center,
NT focus )
inline

Construct a new FocusedLogCoordinates1D object.

Parameters
grid_extentnumber of grid points, must be at least 2
startfirst grid point, must be positive
stoplast grid point, must be larger than start
centerthe scale to cluster around, in the same units as start and stop
focusclustering strength; 0 gives a pure logarithmic grid

◆ FocusedLogCoordinates1D() [2/2]

template<typename NT = double>
template<typename NT2 >
DiFfRG::FocusedLogCoordinates1D< NT >::FocusedLogCoordinates1D ( const FocusedLogCoordinates1D< NT2 > & other)
inline

Member Function Documentation

◆ backward()

template<typename NT = double>
NT KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::backward ( const NT & y) const
inline

Transform from the physical space to the grid.

Parameters
yphysical coordinate
Returns
double grid coordinate

◆ backward_derivative()

template<typename NT = double>
NT KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::backward_derivative ( const NT & y) const
inline

◆ forward() [1/2]

template<typename NT = double>
template<typename IT >
device::array< NT, 1 > KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::forward ( const device::array< IT, 1 > & x) const
inline

◆ forward() [2/2]

template<typename NT = double>
template<typename IT >
NT KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::forward ( const IT & x) const
inline

Transform from the grid to the physical space.

Parameters
xgrid coordinate
Returns
NumberType physical coordinate

◆ from_linear_index()

template<typename NT = double>
device::array< size_t, 1 > KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::from_linear_index ( size_t i) const
inline

◆ round_trip()

template<typename NT = double>
static std::string DiFfRG::FocusedLogCoordinates1D< NT >::round_trip ( const NT value)
inlinestaticprivate

Format a parameter with the fewest digits that still identify it uniquely.

to_string() is the identity key of a coordinate dataset in HDF5 output, and the key that HDF5Input::load_map compares against, so two grids that differ must render differently. std::to_string would not do: it emits six decimals, under which every start below 1e-6 – a perfectly ordinary IR cutoff here – renders as "0.000000" and distinct grids would silently share one dataset. Widening the precision until the text parses back to the original value keeps the common cases readable ("0.005", not "0.0050000000000000001") while still separating values that genuinely differ.

◆ s_of_u()

template<typename NT = double>
NT KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::s_of_u ( const NT u) const
inlineprivate

asinh(c * (u - u0)), written out to pick the cancellation-free branch.

Naively log(v + sqrt(v^2 + 1)) cancels catastrophically for v << 0 – these grids reach v ~ -40, where it loses several digits. Using (v + D)(D - v) = 1 to rewrite the negative branch as -log(D - v) makes both sides exact to round-off. Note this is called from the constructor, so it may only use members assigned before it.

◆ size()

template<typename NT = double>
size_t KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::size ( ) const
inline

◆ sizes()

template<typename NT = double>
device::array< size_t, 1 > KOKKOS_FORCEINLINE_FUNCTION DiFfRG::FocusedLogCoordinates1D< NT >::sizes ( ) const
inline

◆ to_string()

template<typename NT = double>
std::string DiFfRG::FocusedLogCoordinates1D< NT >::to_string ( ) const
inline

Friends And Related Symbol Documentation

◆ operator==

template<typename NT = double>
template<typename NT2 >
bool operator== ( const FocusedLogCoordinates1D< NT > & lhs,
const FocusedLogCoordinates1D< NT2 > & rhs )
friend

Member Data Documentation

◆ a

template<typename NT = double>
NT DiFfRG::FocusedLogCoordinates1D< NT >::a
private

◆ a_inv

template<typename NT = double>
NT DiFfRG::FocusedLogCoordinates1D< NT >::a_inv
private

◆ c

template<typename NT = double>
NT DiFfRG::FocusedLogCoordinates1D< NT >::c
private

◆ c_inv

template<typename NT = double>
NT DiFfRG::FocusedLogCoordinates1D< NT >::c_inv
private

◆ center

template<typename NT = double>
const NT DiFfRG::FocusedLogCoordinates1D< NT >::center

◆ dim

template<typename NT = double>
size_t DiFfRG::FocusedLogCoordinates1D< NT >::dim = 1
staticconstexpr

◆ focus

template<typename NT = double>
const NT DiFfRG::FocusedLogCoordinates1D< NT >::focus

◆ g_min

template<typename NT = double>
NT DiFfRG::FocusedLogCoordinates1D< NT >::g_min
private

◆ grid_extent

template<typename NT = double>
const size_t DiFfRG::FocusedLogCoordinates1D< NT >::grid_extent
private

◆ pure_log

template<typename NT = double>
bool DiFfRG::FocusedLogCoordinates1D< NT >::pure_log
private

◆ s_min

template<typename NT = double>
NT DiFfRG::FocusedLogCoordinates1D< NT >::s_min
private

◆ start

template<typename NT = double>
const NT DiFfRG::FocusedLogCoordinates1D< NT >::start

◆ stop

template<typename NT = double>
const NT DiFfRG::FocusedLogCoordinates1D< NT >::stop

◆ u0

template<typename NT = double>
NT DiFfRG::FocusedLogCoordinates1D< NT >::u0
private

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/coordinates/coordinates.hh