Vital
Loading...
Searching...
No Matches
vital::OneDimLookup< function, resolution > Class Template Reference

A one-dimensional lookup table for a given function with a specified resolution. More...

#include <lookup_table.h>

Public Member Functions

 OneDimLookup (float scale=1.0f)
 Constructs the lookup table by sampling the given function.
 
 ~OneDimLookup ()
 Destructor.
 
force_inline poly_float cubicLookup (poly_float value) const
 Performs a cubic interpolation lookup on the precomputed data.
 

Detailed Description

template<mono_float(*)(mono_float) function, size_t resolution>
class vital::OneDimLookup< function, resolution >

A one-dimensional lookup table for a given function with a specified resolution.

The OneDimLookup class precomputes values of a given function at a certain resolution. It then provides a method to retrieve interpolated values using cubic interpolation, allowing for fast, smooth approximations of the function.

Template Parameters
functionA pointer to a function taking a mono_float and returning a mono_float. This function will be sampled to build the lookup table.
resolutionThe number of sample points used to build the lookup table. Higher values provide more accuracy but use more memory.

Constructor & Destructor Documentation

◆ OneDimLookup()

template<mono_float(*)(mono_float) function, size_t resolution>
vital::OneDimLookup< function, resolution >::OneDimLookup ( float scale = 1.0f)
inline

Constructs the lookup table by sampling the given function.

Parameters
scaleA scaling factor applied to the function's input before sampling.

◆ ~OneDimLookup()

template<mono_float(*)(mono_float) function, size_t resolution>
vital::OneDimLookup< function, resolution >::~OneDimLookup ( )
inline

Destructor.

Member Function Documentation

◆ cubicLookup()

template<mono_float(*)(mono_float) function, size_t resolution>
force_inline poly_float vital::OneDimLookup< function, resolution >::cubicLookup ( poly_float value) const
inline

Performs a cubic interpolation lookup on the precomputed data.

This function takes a poly_float of input values, scales them, and uses cubic interpolation to estimate the function's value at these points. It returns a poly_float with the interpolated results.

Parameters
valueThe input poly_float values to lookup.
Returns
A poly_float containing the interpolated function values.

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