returns the distance (int) between to idices.

        Two consecutive tokens must have a delta of 1.
428139
def indexdelta(self, stop_id, start_id):
        
        return self.tokenid2index(stop_id) - self.tokenid2index(start_id)
538753
public double getAndAdd(int i, double delta)
    {
        while(true)
        {
            double orig = get(i);
            double newVal = orig + delta;
            if(compareAndSet(i, orig, newVal))
                return orig;
        }
    }
380367
public static int distance (int x1, int y1, int x2, int y2)
    {
        int dx = x1-x2, dy = y1-y2;
        return (int)Math.sqrt(dx*dx+dy*dy);
    }
1221009
def get_pixel_distance(self, x1, y1, x2, y2):
        
        dx = abs(x2 - x1)
        dy = abs(y2 - y1)
        dist = np.sqrt(dx * dx + dy * dy)
        dist = np.round(dist)
        return dist
138926
protected List asMultiDistanceInstanceList(DistanceInstanceIterator i) {
		List buffer = new ArrayList();
		while (i.hasNext()) {
			DistanceInstance di = i.nextDistanceInstance();
			buffer.add( asMultiDistanceInstance( i.nextDistanceInstance() ) );
		}
		return buffer;
	}
1294338
def __hammingDistance(s1, s2):
        '''
        
        '''

        l1 = len(s1)
        l2 = len(s2)

        if l1 != l2:
            raise ValueError("Hamming distance requires strings of same size.")

        return sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2))
1135405
public int getLengthDelta() {
        int delta = 0;

        for (int mut : mutations)
            switch (mut & MUTATION_TYPE_MASK) {
                case RAW_MUTATION_TYPE_DELETION:
                    --delta;
                    break;
                case RAW_MUTATION_TYPE_INSERTION:
                    ++delta;
                    break;
            }

        return delta;
    }
1296465
protected double distance(DBIDRef a, DBIDRef b) {
    ++distComputations;
    return distanceQuery.distance(a, b);
  }
778778
private static double distance(double[] p1, double[] p2) {
		switch (p1.length) {
			case 2: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]));
			case 3: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) + (p1[2] - p2[2]) * (p1[2] - p2[2]));
			default: {
				double dist = 0;
				for (int i = p1.length - 1; i >= 0; i--) {
					final double d = (p1[i] - p2[i]);
					dist += d * d;
				}
				return Math.sqrt(dist);
			}
		}
	}
810163
public static int delta(int[] data, int start, int length, int init) {
                final int nextinit = data[start + length - 1];
                for (int i = length - 1; i > 0; --i) {
                        data[start + i] -= data[start + i - 1];
                }
                data[start] -= init;
                return nextinit;
        }
230801
public static float distanceEuclidean(HashSparseVector sv1 ,HashSparseVector sv2) {
		float dist = 0.0f;
		TIntFloatIterator it1 = sv1.data.iterator();
		TIntFloatIterator it2 = sv2.data.iterator();
		int increa = 0;
		while(it1.hasNext()&&it2.hasNext()){
			if(increa==0){
				it1.advance();
				it2.advance();
			}else if(increa==1){
				it1.advance();
			}else if(increa==2){
				it2.advance();
			}
			if(it1.key()<it2.key()){
				dist += it1.value()*it1.value();
				increa = 1;
			}else if(it1.key()>it2.key()){
				dist += it2.value()*it2.value();
				increa = 2;
			}else{
				float t = it1.value() - it2.value();
				dist += t*t;
				increa = 0;
			}
		}
		while(it1.hasNext()){
			it1.advance();
			dist += it1.value()*it1.value();			
		}
		while(it2.hasNext()){
			it2.advance();
			dist += it2.value()*it2.value();

		}
		return dist;
	}
324174
def delta(a, b):
    
    diff = a - b
    return numpy.einsum("i...,i...->...", diff, diff)
891862
function checkIdent(i) {
  const start = i;

  if (i >= tokensLength) return 0;

  if (tokens[i].type === TokenType.HyphenMinus) i++;

  if (tokens[i].type === TokenType.LowLine ||
      tokens[i].type === TokenType.Identifier) i++;
  else return 0;

  for (; i < tokensLength; i++) {
    if (tokens[i].type !== TokenType.HyphenMinus &&
        tokens[i].type !== TokenType.LowLine &&
        tokens[i].type !== TokenType.Identifier &&
        tokens[i].type !== TokenType.DecimalNumber) break;
  }

  tokens[start].ident_last = i - 1;

  return i - start;
}
711384
def _distance(coord1, coord2):
    
    xdist = coord1[0] - coord2[0]
    ydist = coord1[1] - coord2[1]
    return sqrt(xdist*xdist + ydist*ydist)
1075469
private float distance(int i, float x, float y, float z) {
        return frustum[i][0] * x + frustum[i][1] * y + frustum[i][2] * z + frustum[i][3];
    }
1369516
def distance_between(self, place_1, place_2, unit='km'):
        
        pickled_place_1 = self._pickle(place_1)
        pickled_place_2 = self._pickle(place_2)
        try:
            return self.redis.geodist(
                self.key, pickled_place_1, pickled_place_2, unit=unit
            )
        except TypeError:
            return None
875354
public ParserToken lookAhead(int distance) {
      while (distance >= buffer.size() && tokenIterator.hasNext()) {
         buffer.addLast(tokenIterator.next());
      }
      return buffer.size() > distance ? buffer.getLast() : null;
   }