Generate values from a function with optional input containers.
- Parameters
-
func | The generator function, which takes as many inputs as there are arguments |
args | The arguments in the form of containers of compatible sizes |
For example, here is how to imlement element-wise square root and multiplication:
Container a = ...;
Container b = ...;
Container res(a.size());
res.generate([](
auto v) {
return std::sqrt(v) }, a);
res.generate([](auto v, auto w) { return v * w; }, a, b);