Econforgeinterp#
- class HARK.econforgeinterp.LinearFast(f_val, grids, extrap_mode='linear', prebuilt_grid=None)#
Bases:
MetricObject
A class that constructs and holds all the necessary elements to call a multilinear interpolator from econforge.interpolator in a way that resembles the basic interpolators in HARK.interpolation.
- distance_criteria = ['f_val', 'grid_list']#
- gradient(*args)#
Evaluates gradient of the interpolator.
- Parameters:
args ([numpy.array]) – List of arrays. The i-th entry contains the i-th coordinate of all the points to be evaluated. All entries must have the same shape.
- Returns:
List of the derivatives of the function with respect to each input, evaluated at the given points. E.g. if the interpolator represents 3D function f, f.gradient(x,y,z) will return [df/dx(x,y,z), df/dy(x,y,z), df/dz(x,y,z)]. Each element has the shape of items in args.
- Return type:
[numpy.array]
- class HARK.econforgeinterp.DecayInterp(interp, limit_fun, limit_grad=None, extrap_method='decay_prop')#
Bases:
MetricObject
A class of interpolators that use a limiting function for extrapolation.
See HARK/examples/Interpolation/DecayInterp.ipynb for examples of how to use this class.
- distance_criteria = ['interp']#
- extrap_decay_prop(x, closest_x)#
“decay_prop” extrapolation method. Combines the interpolator’s default extrapolation and the limiting function with weights that depend on how far from the grid the values are.
- Parameters:
x (inputs that require extrapolation.)
closest_x (for each of the inputs that require extrapolation, contains) – the closest point that falls inside the grid.
- extrap_decay_hark(x, closest_x)#
“decay_hark” extrapolation method. Takes into account the rate at which the interpolator and limiting function are approaching at the edge of the grid for combining them.
- Parameters:
x (inputs that require extrapolation.)
closest_x (for each of the inputs that require extrapolation, contains) – the closest point that falls inside the grid.
- extrap_paste(x, closest_x)#
“paste” extrapolation method. Uses the limiting function for extrapolation, but with a vertical shift that “pastes” it to the interpolator at the edge of the grid.
- Parameters:
x (inputs that require extrapolation.)
closest_x (for each of the inputs that require extrapolation, contains) – the closest point that falls inside the grid.