Function Class

The function class provides a wrapper around a function \(f\) posed on some domain \(\mathcal{D} \subset \mathbb{R}^m\).

Design Considerations

Often-times functions coming from engineering applications come in application units, e.g., in meters, Pascals, etc. The trouble is that these units are often poorly scaled with respect to each other, causing numerical issues. Hence, one of the first steps is to restate the problem on the normalized domain: an affine transform of \(\mathcal{D}\) into the unit box \([-1,1]^m\). One of the roles of the Function class is to transparently handle working in the normalized domain so that no changes are needed for the functions provided.

Function Class API

class psdr.Function(funs, domain, grads=None, fd_grad=None, vectorized=False, kwargs={}, dask_client=None, return_grad=False)[source]

Wrapper around function specifying the domain

Provided a function \(f: \mathcal{D} \subset \mathbb{R}^m \to \mathbb{R}^d\), and a domain \(\mathcal{D}\), this class acts as a wrapper for both. The key contribution of this class is to provide access to the function on the normalized domain \(\mathcal{D}_{\text{norm}}\) that is a subset of the \([-1,1]^m\) cube; i.e.,

\[\mathcal{D}_{\text{norm}} \subset [-1,1]^m \subset \mathbb{R}^m.\]
  • fun (function or list of functions) – Either a python function or a list of functions to evaluate
  • domain (Domain) – The domain on which the function is posed
  • vectorized (bool, default: False) – If True, the functions are vectorized for use with numpy.
  • kwargs (dict, default: empty) – Keyword arguments to pass to the functions when evaluating function
  • dask_client (dask.distributed.Client) – Client to use for multiprocessing