From ad9ec278bb505abe97759f74bde23d6eb57ca78d Mon Sep 17 00:00:00 2001 From: "Jeffrey Hokanson @ Thor" Date: Mon, 10 Dec 2018 13:27:59 -0700 Subject: [PATCH] Function prototype class --- psdr/function.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 psdr/function.py diff --git a/psdr/function.py b/psdr/function.py new file mode 100644 index 0000000..783d113 --- /dev/null +++ b/psdr/function.py @@ -0,0 +1,38 @@ + +class Function(object): + r"""Wrapper around function specifying the domain + + Provided a function :math:`f: \mathcal{D} \subset \mathbb{R}^m \to \mathbb{R}^d`, + and a domain :math:`\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* :math:`\mathcal{D}_{\text{norm}}` + that is a subset of the :math:`[-1,1]^m` cube; i.e., + + .. math:: + + \mathcal{D}_{\text{norm}} \subset [-1,1]^m \subset \mathbb{R}^m. + + + + Parameters + ---------- + 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. + fun_kwargs: dict, default: empty + Keyword arguments to pass to the functions when evaluating function + """ + def __init__(self, funs, domain, vectorized = False, fun_kwargs = None): + self.funs = funs + self.domain = domain + + def __call__(self, X, **kwargs): + pass + + def __get__(self, i): + """Get a particular sub-function as another Function""" + raise NotImplemented +