(self, event_fn)
return find_event(interp_fn, sign0, self.rk_state.t0, self.rk_state.t1, event_fn, self.atol)
Returns t, state(t) such that event_fn(t, state(t)) == 0.
Returns t, state(t) such that event_fn(t, state(t)) == 0.
Returns t state ( t ) such that event_fn ( t state ( t )) == 0 .
def _advance_until_event(self, event_fn):
        """Returns t, state(t) such that event_fn(t, state(t)) == 0."""
        if event_fn(self.rk_state.t1, self.rk_state.y1) == 0:
            return (self.rk_state.t1, self.rk_state.y1)

        n_steps = 0
        sign0 = torch.sign(event_fn(self.rk_state.t1, self.rk_state.y1))
        while sign0 == torch.sign(event_fn(self.rk_state.t1, self.rk_state.y1)):
            assert n_steps < self.max_num_steps, 'max_num_steps exceeded ({}>={})'.format(n_steps, self.max_num_steps)
            self.rk_state = self._adaptive_step(self.rk_state)
            n_steps += 1
        interp_fn = lambda t: _interp_evaluate(self.rk_state.interp_coeff, self.rk_state.t0, self.rk_state.t1, t)
        return find_event(interp_fn, sign0, self.rk_state.t0, self.rk_state.t1, event_fn, self.atol)
def _advance_until_event ( self , event_fn ) : if event_fn ( self . rk_state . t1 , self . rk_state . y1 ) == 0 : return ( self . rk_state . t1 , self . rk_state . y1 ) n_steps = 0 sign0 = torch . sign ( event_fn ( self . rk_state . t1 , self . rk_state . y1 ) ) while sign0 == torch . sign ( event_fn ( self . rk_state . t1 , self . rk_state . y1 ) ) : assert n_steps < self . max_num_steps , 'max_num_steps exceeded ({}>={})' . format ( n_steps , self . max_num_steps ) self . rk_state = self . _adaptive_step ( self . rk_state ) n_steps += 1 interp_fn = lambda t : _interp_evaluate ( self . rk_state . interp_coeff , self . rk_state . t0 , self . rk_state . t1 , t ) return find_event ( interp_fn , sign0 , self . rk_state . t0 , self . rk_state . t1 , event_fn , self . atol )