def __init__(self, process_dim=1, noise_dim=None, drift=None, diffusion=None, **kwargs): self._process_dim = process_dim self._noise_dim = process_dim if noise_dim is None else noise_dim # Note: the brackets around the lambdas below are essential, otherwise the result of the parsing will not be what we need: self._drift = (lambda t, x: npu.row_of(self._process_dim, 0.)) if drift is None else drift self._diffusion = (lambda t, x: npu.matrix_of(self._process_dim, self._noise_dim, 0.)) if diffusion is None else diffusion self._to_string_helper_ItoProcess = None self._str_ItoProcess = None super(ItoProcess, self).__init__(process_dim=self._process_dim, noise_dim=self._noise_dim, drift=self._drift, diffusion=self._diffusion, **kwargs)
def test_row_of(self): row = npu.row_of(5, 429.) npt.assert_almost_equal(row, np.array([[429., 429., 429., 429., 429.]]))