def grid_evaluation(X, Y, f,vectorized=True):
XX = np.reshape(np.concatenate([X[..., None], Y[..., None]], axis=<NUM_LIT:2>), (X.size, <NUM_LIT:2>), order='<STR_LIT:C>')<EOL>if vectorized:<EOL><INDENT>ZZ = f(XX)<EOL><DEDENT>else:<EOL><INDENT>ZZ = np.array([f(x) for x in XX])<EOL><DEDENT>return np.reshape(ZZ, X.shape, order='<STR_LIT:C>')<EOL>
Evaluate function on given grid and return values in grid format

Assume X and Y are 2-dimensional arrays containing x and y coordinates, 
respectively, of a two-dimensional grid, and f is a function that takes
1-d arrays with two entries. This function evaluates f on the grid points
described by X and Y and returns another 2-dimensional array of the shape 
of X and Y that contains the values of f.

:param X: 2-dimensional array of x-coordinates
:param Y: 2-dimensional array of y-coordinates
:param f: function to be evaluated on grid
:param vectorized: `f` can handle arrays of inputs
:return: 2-dimensional array of values of f