drepr/old_code/prototype/drepr/services/index_iterator.py
def update_local_upperbound_and_curr_index(self, start_idx: int = 0):
        """Recalculate correct upper bound of the current index (in one dimension) always start from second dimension, and then reset the correct index of later dimension"""
        if start_idx == 0:
            # we always know the upperbound of the first (0) dimension
            self.cached_data_ptr[0] = self.ra_reader.get_value(self.curr_index[:1])
            if self.local_up_idx[1] is None:
                self.local_up_idx[1] = len(self.cached_data_ptr[0])
            if self.step_sizes[1] == 0:
                self.curr_index[1] = self.local_up_idx[1]
            else:
                self.curr_index[1] = self.local_up_idx[1] - self.step_sizes[1]
            start_idx += 1

        if self.upper_bound_index[start_idx] is None:
            self.local_up_idx[start_idx] = len(self.cached_data_ptr[start_idx - 1])
        self.cached_data_ptr[start_idx] = self.cached_data_ptr[start_idx - 1][self.curr_index[start_idx]]

        for i, l, u, s in islice(
                zip(
                    range(self.n_dims), self.lower_bound_index, self.upper_bound_index,
                    self.step_sizes), start_idx + 1, None):
            if u is None:
                # if the upperbound is undefined, we set it
                self.local_up_idx[i] = len(self.cached_data_ptr[i - 1])

            if s == 0:
                self.curr_index[i] = self.local_up_idx[i]
            else:
                self.curr_index[i] = self.local_up_idx[i] - s
            self.cached_data_ptr[i] = self.cached_data_ptr[i - 1][self.curr_index[i]]
Recalculate correct upper bound of the current index (in one dimension) always start from second dimension, and then reset the correct index of later dimension
Recalculate correct upper bound of the current index (in one dimension) always start from second dimension, and then reset the correct index of later dimension
Recalculate correct upper bound of the current index ( in one dimension ) always start from second dimension and then reset the correct index of later dimension
def update_local_upperbound_and_curr_index(self, start_idx: int = 0):
        if start_idx == 0:
            self.cached_data_ptr[0] = self.ra_reader.get_value(self.curr_index[:1])
            if self.local_up_idx[1] is None:
                self.local_up_idx[1] = len(self.cached_data_ptr[0])
            if self.step_sizes[1] == 0:
                self.curr_index[1] = self.local_up_idx[1]
            else:
                self.curr_index[1] = self.local_up_idx[1] - self.step_sizes[1]
            start_idx += 1
        if self.upper_bound_index[start_idx] is None:
            self.local_up_idx[start_idx] = len(self.cached_data_ptr[start_idx - 1])
        self.cached_data_ptr[start_idx] = self.cached_data_ptr[start_idx - 1][self.curr_index[start_idx]]
        for i, l, u, s in islice(
                zip(
                    range(self.n_dims), self.lower_bound_index, self.upper_bound_index,
                    self.step_sizes), start_idx + 1, None):
            if u is None:
                self.local_up_idx[i] = len(self.cached_data_ptr[i - 1])
            if s == 0:
                self.curr_index[i] = self.local_up_idx[i]
            else:
                self.curr_index[i] = self.local_up_idx[i] - s
            self.cached_data_ptr[i] = self.cached_data_ptr[i - 1][self.curr_index[i]]
def update_local_upperbound_and_curr_index ( self , start_idx : int = 0 ) : if start_idx == 0 : self . cached_data_ptr [ 0 ] = self . ra_reader . get_value ( self . curr_index [ : 1 ] ) if self . local_up_idx [ 1 ] is None : self . local_up_idx [ 1 ] = len ( self . cached_data_ptr [ 0 ] ) if self . step_sizes [ 1 ] == 0 : self . curr_index [ 1 ] = self . local_up_idx [ 1 ] else : self . curr_index [ 1 ] = self . local_up_idx [ 1 ] - self . step_sizes [ 1 ] start_idx += 1 if self . upper_bound_index [ start_idx ] is None : self . local_up_idx [ start_idx ] = len ( self . cached_data_ptr [ start_idx - 1 ] ) self . cached_data_ptr [ start_idx ] = self . cached_data_ptr [ start_idx - 1 ] [ self . curr_index [ start_idx ] ] for i , l , u , s in islice ( zip ( range ( self . n_dims ) , self . lower_bound_index , self . upper_bound_index , self . step_sizes ) , start_idx + 1 , None ) : if u is None : self . local_up_idx [ i ] = len ( self . cached_data_ptr [ i - 1 ] ) if s == 0 : self . curr_index [ i ] = self . local_up_idx [ i ] else : self . curr_index [ i ] = self . local_up_idx [ i ] - s self . cached_data_ptr [ i ] = self . cached_data_ptr [ i - 1 ] [ self . curr_index [ i ] ]
Recalculate correct upper bound of the current index (in one dimension) always start from second dimension, and then reset the correct index of later dimension
Recalculate correct upper bound of the current index ( in one dimension ) always start from second dimension and then reset the correct index of later dimension
"""Recalculate correct upper bound of the current index (in one dimension) always start from second dimension, and then reset the correct index of later dimension""" # we always know the upperbound of the first (0) dimension # if the upperbound is undefined, we set it
self
start_idx
int