def compute(self, deltaLocation=(), newLocation=(),
              featureLocationInput=(), featureLocationGrowthCandidates=(),
              learn=True):
    prevActiveCells = self.activeCells
    self.activeDeltaSegments = np.where(
      (self.internalConnections.computeActivity(
        prevActiveCells, self.connectedPermanence
      ) >= self.activationThreshold)
      &
      (self.deltaConnections.computeActivity(
        deltaLocation, self.connectedPermanence
      ) >= self.activationThreshold))[0]
    if len(deltaLocation) == 0:
      self.activeFeatureLocationSegments = np.where(
        self.featureLocationConnections.computeActivity(
          featureLocationInput, self.connectedPermanence
        ) >= self.activationThreshold)[0]
    else:
      self.activeFeatureLocationSegments = np.empty(0, dtype="uint32")
    if len(newLocation) > 0:
      self.activeCells = newLocation
      if learn:
        self._learnTransition(prevActiveCells, deltaLocation, newLocation)
        self._learnFeatureLocationPair(newLocation, featureLocationInput,
                                       featureLocationGrowthCandidates)
    elif len(prevActiveCells) > 0:
      if len(deltaLocation) > 0:
        cellsForDeltaSegments = self.internalConnections.mapSegmentsToCells(
          self.activeDeltaSegments)
        self.activeCells = np.unique(cellsForDeltaSegments)
      else:
        if len(self.activeFeatureLocationSegments) > 0:
          cellsForFeatureLocationSegments = (
            self.featureLocationConnections.mapSegmentsToCells(
              self.activeFeatureLocationSegments))
          self.activeCells = np.intersect1d(prevActiveCells,
                                            cellsForFeatureLocationSegments)
        else:
          self.activeCells = prevActiveCells
    elif len(featureLocationInput) > 0:
      cellsForFeatureLocationSegments = (
        self.featureLocationConnections.mapSegmentsToCells(
          self.activeFeatureLocationSegments))
      self.activeCells = np.unique(cellsForFeatureLocationSegments)