(self, states)
return np.ravel_multi_index(ind, self.num_points - 1)
Convert physical states to its closest rectangle index.

        Parameters
        ----------
        states : ndarray
            Physical states on the discretization.

        Returns
        -------
        rectangles : ndarray (int)
            The indices that correspond to rectangles of the physical states.
Convert physical states to its closest rectangle index.
Convert physical states to its closest rectangle index .
def state_to_rectangle(self, states):
        """Convert physical states to its closest rectangle index.

        Parameters
        ----------
        states : ndarray
            Physical states on the discretization.

        Returns
        -------
        rectangles : ndarray (int)
            The indices that correspond to rectangles of the physical states.

        """
        ind = []
        for i, (discrete, num_points) in enumerate(zip(self.discrete_points,
                                                       self.num_points)):
            idx = np.digitize(states[:, i], discrete)
            idx -= 1
            np.clip(idx, 0, num_points - 2, out=idx)

            ind.append(idx)
        return np.ravel_multi_index(ind, self.num_points - 1)
def state_to_rectangle ( self , states ) : ind = [ ] for i , ( discrete , num_points ) in enumerate ( zip ( self . discrete_points , self . num_points ) ) : idx = np . digitize ( states [ : , i ] , discrete ) idx -= 1 np . clip ( idx , 0 , num_points - 2 , out = idx ) ind . append ( idx ) return np . ravel_multi_index ( ind , self . num_points - 1 )