I have a function f(u,v) of two variables u and v defined on a square with side of length 1.
A timer starts and for each tick of the timer I need to evaluate this function thousands of times on a discrete set of points (u,v) of this square. This points (u,v) can be different at every tick of the timer and there is no reason to suppose that they are always the same.
For performance reasons, I want to sample some points of the square [f(0,0), f(0,0.1), f(0,0.2), ..., f(0.1,0),...f(1,1)] and evaluate the function only once before the timer starts and then get them as fast as possible.
Can a dictionary be a solution? Or are there better structures?
I forgot to add that obviously I don't need all the possible u, v values of the square of side 1 but those belonging to a discrete grid.