GRF2D#
- class pinnx.fnspace.GRF2D(kernel='RBF', length_scale=1, N=100, interp='splinef2d')[source]#
Gaussian random field in [0, 1]x[0, 1].
The random sampling algorithm is based on Cholesky decomposition of the covariance matrix.
- Parameters:
Example
space = pinnx.fnspace.GRF2D(length_scale=0.1) features = space.random(3) x = np.linspace(0, 1, num=500) y = np.linspace(0, 1, num=500) xv, yv = np.meshgrid(x, y) sensors = np.vstack((np.ravel(xv), np.ravel(yv))).T u = space.eval_batch(features, sensors) for ui in u: plt.figure() plt.imshow(np.reshape(ui, (len(y), len(x)))) plt.colorbar() plt.show()
- eval_batch(features, xs)[source]#
Evaluate a list of functions at a list of points.
- Parameters:
features – A NumPy array of shape (n_functions, n_features). A list of the feature vectors of the functions to be evaluated.
xs – A NumPy array of shape (n_points, dim). A list of points to be evaluated.
- Returns:
A NumPy array of shape (n_functions, n_points). The values of different functions at different points.