Class smooth_func (o2scl)

O2scl : Class List

template<class vec_t, class func_t>
class smooth_func

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

Idea for Future:

Move memory allocation outside of o2scl::smooth_func::operator()() .

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.

Public Functions

inline smooth_func()
inline void set_func(func_t &func)

Set the base function.

inline void set_n(size_t n_new)

Set the number of points to use in the average.

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

template<class vec2_t>
inline void set_step(vec2_t &v)

Set the stepsize.

inline int operator()(size_t nv, const vec_t &x, vec_t &y)

Evaluate the smoothed function.

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.

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)