interp Module

This file contains the interpolation routines for the grids that are built using the grid.py file in the smolyak package... Write more doc soon.

smolyak.interp.find_theta(sg, f_on_grid)

Given a SmolyakGrid object and the value of the function on the points of the grid, this function will return the coefficients theta

class smolyak.interp.SmolyakInterp(sg, f_on_grid)

Bases: object

This class is going to take several inputs. It will need a SmolyakGrid object to be passed in and the values of the function evaluated at the grid points

Methods

interpolate(pts[, interp, deriv, deriv_th, ...]) Basic Lagrange interpolation, with optional first derivatives
update_theta(f_on_grid)
interpolate(pts, interp=True, deriv=False, deriv_th=False, deriv_X=False)

Basic Lagrange interpolation, with optional first derivatives (gradient)

Parameters:

pts : array (float, ndim=2)

A 2d array of points on which to evaluate the function. Each row is assumed to be a new d-dimensional point. Therefore, pts must have the same number of columns as si.SGrid.d

interp : bool, optional(default=false)

Whether or not to compute the actual interpolation values at pts

deriv : bool, optional(default=false)

Whether or not to compute the gradient of the function at each of the points. This will have the same dimensions as pts, where each column represents the partial derivative with respect to a new dimension.

deriv_th : bool, optional(default=false)

Whether or not to compute the ???? derivative with respect to the Smolyak polynomial coefficients (maybe?)

deriv_X : bool, optional(default=false)

Whether or not to compute the ???? derivative with respect to grid points

Returns:

rets : list (array(float))

A list of arrays containing the objects asked for. There are 4 possible objects that can be computed in this function. They will, if they are called for, always be in the following order:

  1. Interpolation values at pts
  2. Gradient at pts
  3. ???? at pts
  4. ???? at pts

If the user only asks for one of these objects, it is returned directly as an array and not in a list.

Notes

This is a stripped down port of dolo.SmolyakBasic.interpolate

TODO: There may be a better way to do this

TODO: finish the docstring for the 2nd and 3rd type of derivatives

update_theta(f_on_grid)