Class KernelWrapper¶
Defined in File Kernel.h
Inheritance Relationships¶
Base Type¶
public Kernel(Class Kernel)
Class Documentation¶
-
class KernelWrapper : public Kernel¶
A simple wrapper, which wraps a std::function into the kernel object. This allows us to use lambdas / std::functions instead of writing a new class for a new Kernel. For example: KernelWrapper kernel([](const std::vector<data_t>& x1, const std::vector<data_t>& x2) { data_t distance = 0; if (x1 != x2) { for (unsigned int i = 0; i < x1.size(); ++i) { distance += (x1[i]-x2[i])*(x1[i]-x2[i]); } distance /= 1.0; } return 1.0 * std::exp(-distance); })
Public Functions
-
inline KernelWrapper(std::function<data_t(std::vector<data_t> const&, std::vector<data_t> const&)> f)¶
Creates a new KernelWrapper object.
Note
The supplied std::function is moved into this wrapper. There is no copy involved.
- Parameters
f – The std::function to be wrapped.
-
inline KernelWrapper(std::function<data_t(std::vector<data_t> const&, std::vector<data_t> const&)> f)¶