drepr/old_code/prototype/drepr/services/index_iterator.py
def next(self) -> Optional[List[int]]:
        """Get the next index by move current index one step and return it"""
        if self.no_more_val:
            return None

        # for the last dimension, we don't need to re-calculate the upperbound everytime
        # we do that
        dim_pivot = self.unfrozen_dimensions[0]
        self.curr_index[dim_pivot] += self.step_sizes[dim_pivot]
        if self.curr_index[dim_pivot] >= self.local_up_idx[dim_pivot]:
            self.curr_index[dim_pivot] = self.lower_bound_index[dim_pivot]
        else:
            return self.curr_index

        for dim_pivot in islice(self.unfrozen_dimensions, 1, None):
            self.curr_index[dim_pivot] += self.step_sizes[dim_pivot]
            if self.curr_index[dim_pivot] >= self.local_up_idx[dim_pivot]:
                self.curr_index[dim_pivot] = self.lower_bound_index[dim_pivot]
            else:
                # TODO: may be we can still improve the performance
                self.update_local_upperbound_index(dim_pivot)
                return self.curr_index
        else:
            self.no_more_val = True
            if len(self.unfrozen_dimensions) == 0:
                return self.curr_index
            else:
                return None
Get the next index by move current index one step and return it
Get the next index by move current index one step and return it
Get the next index by move current index one step and return it
def next(self) -> Optional[List[int]]:
        if self.no_more_val:
            return None
        dim_pivot = self.unfrozen_dimensions[0]
        self.curr_index[dim_pivot] += self.step_sizes[dim_pivot]
        if self.curr_index[dim_pivot] >= self.local_up_idx[dim_pivot]:
            self.curr_index[dim_pivot] = self.lower_bound_index[dim_pivot]
        else:
            return self.curr_index
        for dim_pivot in islice(self.unfrozen_dimensions, 1, None):
            self.curr_index[dim_pivot] += self.step_sizes[dim_pivot]
            if self.curr_index[dim_pivot] >= self.local_up_idx[dim_pivot]:
                self.curr_index[dim_pivot] = self.lower_bound_index[dim_pivot]
            else:
                self.update_local_upperbound_index(dim_pivot)
                return self.curr_index
        else:
            self.no_more_val = True
            if len(self.unfrozen_dimensions) == 0:
                return self.curr_index
            else:
                return None
def next ( self ) -> Optional [ List [ int ] ] : if self . no_more_val : return None dim_pivot = self . unfrozen_dimensions [ 0 ] self . curr_index [ dim_pivot ] += self . step_sizes [ dim_pivot ] if self . curr_index [ dim_pivot ] >= self . local_up_idx [ dim_pivot ] : self . curr_index [ dim_pivot ] = self . lower_bound_index [ dim_pivot ] else : return self . curr_index for dim_pivot in islice ( self . unfrozen_dimensions , 1 , None ) : self . curr_index [ dim_pivot ] += self . step_sizes [ dim_pivot ] if self . curr_index [ dim_pivot ] >= self . local_up_idx [ dim_pivot ] : self . curr_index [ dim_pivot ] = self . lower_bound_index [ dim_pivot ] else : self . update_local_upperbound_index ( dim_pivot ) return self . curr_index else : self . no_more_val = True if len ( self . unfrozen_dimensions ) == 0 : return self . curr_index else : return None
Get the next index by move current index one step and return it
Get the next index by move current index one step and return it
"""Get the next index by move current index one step and return it""" # for the last dimension, we don't need to re-calculate the upperbound everytime # we do that # TODO: may be we can still improve the performance
self