Intersection with another :class:`StridedInterval`.

        :param si: The other operand
        :return:
552986
def _intersection_with_si(self, si):
        

        new_si_set = set()
        for si_ in self._si_set:
            r = si_.intersection(si)
            new_si_set.add(r)

        if len(new_si_set):
            ret = DiscreteStridedIntervalSet(bits=self.bits, si_set=new_si_set)

            if ret.should_collapse(): return ret.collapse()
            else: return ret

        else:
            # There is no intersection between two operands
            return StridedInterval.empty(self.bits)
653007
def intersection(self, other):
        

        inter = MOC()

        for (order, cells) in other:
            for cell in cells:
                for i in self._compare_operation(order, cell, True, 'inter'):
                    inter.add(*i)

        return inter
1116573
def difference(self,other):
        
        res = IntervalSet.everything()
        for j in other.ints:
            tmp = []
            for i in self.ints:
                tmp.extend(i._difference(j))
            res = res.intersection(IntervalSet(tmp))
        return res
191199
def intersects(self, other):
        ''''''
        return self.CHROM == other.CHROM and self.POS <= other.ref_end_pos() and other.POS <= self.ref_end_pos()
482950
def interval(best,lo=np.nan,hi=np.nan):
    
    return [float(best),[float(lo),float(hi)]]
284295
def next(self):
        
        try:
            results = self._stride_buffer.pop()
        except (IndexError, AttributeError):
            self._rebuffer()
            results = self._stride_buffer.pop()
        if not results:
            raise StopIteration
        return results
9546
def intersect(self, other):
        """"""
        if self.overlaps(other):
            newlower_value = max(self.lower_value, other.lower_value)
            new_upper_value = min(self._upper_value, other._upper_value)
            new_lower, new_upper = self._get_new_lower_upper(other, self.intersect)
            return Interval(new_lower, newlower_value, new_upper_value, new_upper)
        else:
            return None
1055049
def geq_multiple(self, other):
        
        if other == TimeValue("0.000"):
            return self
        return int(math.ceil(other / self)) * self
313225
def _intersection(d1,d2):
    '''
        
    '''
    i = {}
    ds = _diff_internal(d1,d2)
    for key in ds['same']:
        i[key] = d1[key]
    return(i)
288022
def get_stride(self):
        
        fftlength = float(self.args.secpfft)
        overlap = fftlength * self.args.overlap
        stride = fftlength - overlap
        nfft = self.duration / stride  # number of FFTs
        ffps = int(nfft / (self.width * 0.8))  # FFTs per second
        if ffps > 3:
            return max(2 * fftlength, ffps * stride + fftlength - 1)
        return None
1086422
def _add_delta_tdi(self, other):
        
        if len(self) != len(other):
            raise ValueError("cannot add indices of unequal length")

        if isinstance(other, np.ndarray):
            # ndarray[timedelta64]; wrap in TimedeltaIndex for op
            from pandas import TimedeltaIndex
            other = TimedeltaIndex(other)

        self_i8 = self.asi8
        other_i8 = other.asi8
        new_values = checked_add_with_arr(self_i8, other_i8,
                                          arr_mask=self._isnan,
                                          b_mask=other._isnan)
        if self._hasnans or other._hasnans:
            mask = (self._isnan) | (other._isnan)
            new_values[mask] = iNaT
        return new_values.view('i8')
232310
def CreateStridedInterval(name=None, bits=0, stride=None, lower_bound=None, upper_bound=None, uninitialized=False,
                          to_conv=None, discrete_set=False, discrete_set_max_cardinality=None):
    
    if to_conv is not None:
        if isinstance(to_conv, Base):
            to_conv = to_conv._model_vsa
        if isinstance(to_conv, StridedInterval):
            # No conversion will be done
            return to_conv

        if not isinstance(to_conv, (numbers.Number, BVV)):
            raise ClaripyOperationError('Unsupported to_conv type %s' % type(to_conv))

        if (stride is not None
            or lower_bound is not None
            or upper_bound is not None):
            raise ClaripyOperationError('You cannot specify both to_conv and other parameters at the same time.')

        if isinstance(to_conv, BVV):
            bits = to_conv.bits
            to_conv_value = to_conv.value
        else:
            bits = bits
            to_conv_value = to_conv

        stride = 0
        lower_bound = to_conv_value
        upper_bound = to_conv_value

    bi = StridedInterval(name=name,
                         bits=bits,
                         stride=stride,
                         lower_bound=lower_bound,
                         upper_bound=upper_bound,
                         uninitialized=uninitialized)
    if not discrete_set:
        return bi
    else:
        dsis = DiscreteStridedIntervalSet(
            name=name,
            bits=bits,
            si_set={ bi },
            max_cardinality=discrete_set_max_cardinality
        )

        return dsis
348217
def symmetric_difference(self, other):
        
        if not isinstance(other, set): other = set(other)
        me = set(self)
        ivs = me.difference(other).union(other.difference(me))
        return IntervalTree(ivs)
1087380
def union(self, other):
        
        return Interval(min(self.low, other.low), max(self.high, other.high))
1009556
private boolean intersection(
            final long pX0, final long pY0, final long pX1, final long pY1,
            final long pX2, final long pY2, final long pX3, final long pY3
    ) {
        return SegmentIntersection.intersection(
                pX0, pY0, pX1, pY1,
                pX2, pY2, pX3, pY3, mOptimIntersection);
    }
391568
def complement(self):
        
        # case 1
        if self.is_empty:
            return StridedInterval.top(self.bits)
        # case 2
        if self.is_top:
            return StridedInterval.empty(self.bits)
        # case 3
        y_plus_1 = StridedInterval._modular_add(self.upper_bound, 1, self.bits)
        x_minus_1 = StridedInterval._modular_sub(self.lower_bound, 1, self.bits)

        # the new stride has to be the GCD between the old stride and the distance
        # between the new lower bound and the new upper bound. This assure that in
        # the new interval the boundaries are valid solution when the SI is
        # evaluated.
        dist = StridedInterval._wrapped_cardinality(y_plus_1, x_minus_1, self.bits) - 1

        # the new SI is an integer
        if dist < 0:
            new_stride = 0
        elif self._stride == 0:
            new_stride = 1
        else:
            new_stride = fractions.gcd(self._stride, dist)
        return StridedInterval(lower_bound=y_plus_1,
                               upper_bound=x_minus_1,
                               bits=self.bits,
                               stride=new_stride,
                               uninitialized=self.uninitialized)
955462
def intersect(self,range2):
    
    if not self.overlaps(range2): return None
    return type(self)(self.chr,max(self.start,range2.start)+self._start_offset,min(self.end,range2.end),self.payload,self.dir)