Public Member Functions | Protected Attributes | List of all members
o2scl::smooth_func< vec_t, func_t > Class Template Reference

Smooth a function by averaging in a neighborhood of points defined by a Sobol sequence. More...

#include <smooth_func.h>

Detailed Description

template<class vec_t, class func_t>
class o2scl::smooth_func< vec_t, func_t >

Warning
The function o2scl::smooth_func::set_func() stores a pointer to the function specified by the user, so the user must ensure that this pointer is still valid when o2scl::smooth_func::operator()() is called.
Idea for Future:
Move memory allocation outside of o2scl::smooth_func::operator()() .

Definition at line 49 of file smooth_func.h.

Public Member Functions

void set_func (func_t &func)
 Set the base function.
 
void set_n (size_t n_new)
 Set the number of points to use in the average. More...
 
template<class vec2_t >
void set_step (vec2_t &v)
 Set the stepsize.
 
int operator() (size_t nv, const vec_t &x, vec_t &y)
 Evaluate the smoothed function. More...
 

Protected Attributes

func_t * f
 The pointer to the original function.
 
std::vector< double > step
 Step size defining the neighborhood (default 0.01)
 
size_t N
 Number of points in the Sobol sequence (default 40)
 

Member Function Documentation

◆ operator()()

template<class vec_t , class func_t >
int o2scl::smooth_func< vec_t, func_t >::operator() ( size_t  nv,
const vec_t &  x,
vec_t &  y 
)
inline

If the user-specified function returns a non-zero value for any point, then that contribution to the average is ignored. This function will return a non-zero value if the user-specified function returns a non-zero value for all of the points.

Definition at line 113 of file smooth_func.h.

◆ set_n()

template<class vec_t , class func_t >
void o2scl::smooth_func< vec_t, func_t >::set_n ( size_t  n_new)
inline

If n_new is zero then the error handler will be called.

Definition at line 85 of file smooth_func.h.


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

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).