Computes the Longest Common Subsequence table
@param xs Indexed Sequence 1
@param ys Indexed Sequence 2
196731
function computeLcsMatrix(xs, ys) {
  var n = xs.size||0;
  var m = ys.size||0;
  var a = makeMatrix(n + 1, m + 1, 0);

  for (var i = 0; i < n; i++) {
    for (var j = 0; j < m; j++) {
      if (Immutable.is(xs.get(i), ys.get(j))) {
        a[i + 1][j + 1] = a[i][j] + 1;
      }
      else {
        a[i + 1][j + 1] = Math.max(a[i + 1][j], a[i][j + 1]);
      }
    }
  }

  return a;
}
646702
@Pure
	public static GeodesicPosition EL2_WSG84(double x, double y) {
		final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
				LAMBERT_2E_N,
				LAMBERT_2E_C,
				LAMBERT_2E_XS,
				LAMBERT_2E_YS);
		return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY());
	}
1110349
private static int SA_IS(BaseArray T, int[] SA, int fs, int n, int k, boolean isbwt) {
        BaseArray C, B, RA;
        int i, j, c, m, p, q, plen, qlen, name, pidx = 0;
        int c0, c1;
        boolean diff;

    /* stage 1: reduce the problem by at least 1/2
       sort all the S-substrings */
        if (k <= fs) {
            C = new IntArray(SA, n);
            B = (k <= (fs - k)) ? new IntArray(SA, n + k) : C;
        } else {
            B = C = new IntArray(new int[k], 0);
        }
        getCounts(T, C, n, k);
        getBuckets(C, B, k, true); /* find ends of buckets */
        for (i = 0; i < n; ++i) {
            SA[i] = 0;
        }
        for (i = n - 2, c = 0, c1 = T.get(n - 1); 0 <= i; --i, c1 = c0) {
            if ((c0 = T.get(i)) < (c1 + c)) {
                c = 1;
            } else if (c != 0) {
                SA[B.update(c1, -1)] = i + 1;
                c = 0;
            }
        }
        induceSA(T, SA, C, B, n, k);
        C = null;
        B = null;

    /* compact all the sorted substrings into the first m items of SA
       2*m must be not larger than n (proveable) */
        for (i = 0, m = 0; i < n; ++i) {
            p = SA[i];
            if ((0 < p) && (T.get(p - 1) > (c0 = T.get(p)))) {
                for (j = p + 1; (j < n) && (c0 == (c1 = T.get(j))); ++j) {
                }
                if ((j < n) && (c0 < c1)) {
                    SA[m++] = p;
                }
            }
        }
        j = m + (n >> 1);
        for (i = m; i < j; ++i) {
            SA[i] = 0;
        } /* init the name array buffer */
    /* store the length of all substrings */
        for (i = n - 2, j = n, c = 0, c1 = T.get(n - 1); 0 <= i; --i, c1 = c0) {
            if ((c0 = T.get(i)) < (c1 + c)) {
                c = 1;
            } else if (c != 0) {
                SA[m + ((i + 1) >> 1)] = j - i - 1;
                j = i + 1;
                c = 0;
            }
        }
    /* find the lexicographic names of all substrings */
        for (i = 0, name = 0, q = n, qlen = 0; i < m; ++i) {
            p = SA[i];
            plen = SA[m + (p >> 1)];
            diff = true;
            if (plen == qlen) {
                for (j = 0; (j < plen) && (T.get(p + j) == T.get(q + j)); ++j) {
                }
                if (j == plen) {
                    diff = false;
                }
            }
            if (diff) {
                ++name;
                q = p;
                qlen = plen;
            }
            SA[m + (p >> 1)] = name;
        }

    /* stage 2: solve the reduced problem
       recurse if names are not yet unique */
        if (name < m) {
            RA = new IntArray(SA, n + fs - m);
            for (i = m + (n >> 1) - 1, j = n + fs - 1; m <= i; --i) {
                if (SA[i] != 0) {
                    SA[j--] = SA[i] - 1;
                }
            }
            SA_IS(RA, SA, fs + n - m * 2, m, name, false);
            RA = null;
            for (i = n - 2, j = m * 2 - 1, c = 0, c1 = T.get(n - 1); 0 <= i; --i, c1 = c0) {
                if ((c0 = T.get(i)) < (c1 + c)) {
                    c = 1;
                } else if (c != 0) {
                    SA[j--] = i + 1;
                    c = 0;
                } /* get p1 */
            }
            for (i = 0; i < m; ++i) {
                SA[i] = SA[SA[i] + m];
            } /* get index */
        }

    /* stage 3: induce the result for the original problem */
        if (k <= fs) {
            C = new IntArray(SA, n);
            B = (k <= (fs - k)) ? new IntArray(SA, n + k) : C;
        } else {
            B = C = new IntArray(new int[k], 0);
        }
    /* put all left-most S characters into their buckets */
        getCounts(T, C, n, k);
        getBuckets(C, B, k, true); /* find ends of buckets */
        for (i = m; i < n; ++i) {
            SA[i] = 0;
        } /* init SA[m..n-1] */
        for (i = m - 1; 0 <= i; --i) {
            j = SA[i];
            SA[i] = 0;
            SA[B.update(T.get(j), -1)] = j;
        }
        if (!isbwt) {
            induceSA(T, SA, C, B, n, k);
        } else {
            pidx = computeBWT(T, SA, C, B, n, k);
        }
        C = null;
        B = null;
        return pidx;
    }
588022
private void createSequencesConstraintsStatements(Statements statements, Iterable<Sequence> sequences) {
		Statement statement = createUniqueConstraintStatement( SEQUENCE_NAME_PROPERTY, NodeLabel.SEQUENCE.name() );
		statements.addStatement( statement );
	}
1105152
public void merge(ClusteringFeature x) {
		assert (this.sumPoints.length == x.sumPoints.length);
		this.numPoints += x.numPoints;
		super.setWeight(this.numPoints);
		for (int i = 0; i < this.sumPoints.length; i++) {
			this.sumPoints[i] += x.sumPoints[i];
		}
		this.sumSquaredLength += x.sumSquaredLength;
	}
272449
void computeSyndromes( GrowQueue_I8 input ,
						   GrowQueue_I8 ecc ,
						   GrowQueue_I8 syndromes)
	{
		syndromes.resize(syndromeLength());
		for (int i = 0; i < syndromes.size; i++) {
			int val = math.power(2,i);
			syndromes.data[i] = (byte)math.polyEval(input,val);
			syndromes.data[i] = (byte)math.polyEvalContinue(syndromes.data[i]&0xFF,ecc,val);
		}
	}
1025804
public static int compare(CharSequence s1, CharSequence s2)
    {
        return compare(s1, s2, Funcs::same);
    }
45809
private static boolean cs_vcount(Dcs A, Dcss S) {
        int i, k, p, pa, n = A.n, m = A.m, Ap[] = A.p, Ai[] = A.i, next[], head[], tail[], nque[], pinv[], leftmost[], w[], parent[] = S.parent;
        S.pinv = pinv = new int[m + n]; /* allocate pinv, */
        S.leftmost = leftmost = new int[m]; /* and leftmost */
        w = new int[m + 3 * n]; /* get workspace */
        next = w;
        head = w;
        int head_offset = m;
        tail = w;
        int tail_offset = m + n;
        nque = w;
        int nque_offset = m + 2 * n;
        for (k = 0; k < n; k++)
            head[head_offset + k] = -1; /* queue k is empty */
        for (k = 0; k < n; k++)
            tail[tail_offset + k] = -1;
        for (k = 0; k < n; k++)
            nque[nque_offset + k] = 0;
        for (i = 0; i < m; i++)
            leftmost[i] = -1;
        for (k = n - 1; k >= 0; k--) {
            for (p = Ap[k]; p < Ap[k + 1]; p++) {
                leftmost[Ai[p]] = k; /* leftmost[i] = min(find(A(i,:)))*/
            }
        }
        for (i = m - 1; i >= 0; i--) /* scan rows in reverse order */
        {
            pinv[i] = -1; /* row i is not yet ordered */
            k = leftmost[i];
            if (k == -1)
                continue; /* row i is empty */
            if (nque[nque_offset + k]++ == 0)
                tail[tail_offset + k] = i; /* first row in queue k */
            next[i] = head[head_offset + k]; /* put i at head of queue k */
            head[head_offset + k] = i;
        }
        S.lnz = 0;
        S.m2 = m;
        for (k = 0; k < n; k++) /* find row permutation and nnz(V)*/
        {
            i = head[head_offset + k]; /* remove row i from queue k */
            S.lnz++; /* count V(k,k) as nonzero */
            if (i < 0)
                i = S.m2++; /* add a fictitious row */
            pinv[i] = k; /* associate row i with V(:,k) */
            if (--nque[nque_offset + k] <= 0)
                continue; /* skip if V(k+1:m,k) is empty */
            S.lnz += nque[nque_offset + k]; /* nque [nque_offset+k] is nnz (V(k+1:m,k)) */
            if ((pa = parent[k]) != -1) /* move all rows to parent of k */
            {
                if (nque[nque_offset + pa] == 0)
                    tail[tail_offset + pa] = tail[tail_offset + k];
                next[tail[tail_offset + k]] = head[head_offset + pa];
                head[head_offset + pa] = next[i];
                nque[nque_offset + pa] += nque[nque_offset + k];
            }
        }
        for (i = 0; i < m; i++)
            if (pinv[i] < 0)
                pinv[i] = k++;
        w = null;
        return (true);
    }
144158
def longest_increasing_subsequence(sequence):
    
    length = len(sequence)
    counts = [1 for _ in range(length)]
    for i in range(1, length):
        for j in range(0, i):
            if sequence[i] > sequence[j]:
                counts[i] = max(counts[i], counts[j] + 1)
                print(counts)
    return max(counts)
1337353
void incr1( int b, double y, double yy ) {
    Utils.AtomicDoubleArray.add(_sums,b,y);
    Utils.AtomicDoubleArray.add(_ssqs,b,yy);
  }
655419
public static boolean endsWith(CharSequence s, String end) {
    return (s.length() >= end.length() && s.subSequence(s.length() - end.length(), s.length()).equals(end));
  }
1201214
static double slowCos(final double x, final double result[]) {

        final double xs[] = new double[2];
        final double ys[] = new double[2];
        final double facts[] = new double[2];
        final double as[] = new double[2];
        split(x, xs);
        ys[0] = ys[1] = 0.0;

        for (int i = FACT.length-1; i >= 0; i--) {
            splitMult(xs, ys, as);
            ys[0] = as[0]; ys[1] = as[1];

            if ( (i & 1) != 0) { // skip odd entries
                continue;
            }

            split(FACT[i], as);
            splitReciprocal(as, facts);

            if ( (i & 2) != 0 ) { // alternate terms are negative
                facts[0] = -facts[0];
                facts[1] = -facts[1];
            }

            splitAdd(ys, facts, as);
            ys[0] = as[0]; ys[1] = as[1];
        }

        if (result != null) {
            result[0] = ys[0];
            result[1] = ys[1];
        }

        return ys[0] + ys[1];
    }
655143
public static boolean equalContents(int[][] xs, int[][] ys) {
    if(xs ==null)
      return ys == null;
    if(ys == null)
      return false;
    if(xs.length != ys.length)
      return false;
    for(int i = xs.length-1; i >= 0; i--) {
      if(! equalContents(xs[i],ys[i]))
        return false;
    }
    return true;
  }
880734
private void computeIJTable(InfoTree it, int subtreePreorder,
			int subtreeRevPreorder, int subtreeSize, int aStrategy, int treeSize) {

		int change;

		int[] post2pre = it.info[POST2_PRE];
		int[] rpost2post = it.info[RPOST2_POST];

		if (aStrategy == LEFT) {
			for (int x = 0; x < subtreeSize; x++) {
				ij[0][x] = x + subtreePreorder;
			}
			for (int x = 1; x < subtreeSize; x++) {
				change = post2pre[(treeSize - 1 - (x - 1 + subtreeRevPreorder))];
				for (int z = 0; z < subtreeSize; z++) {
					if (ij[x - 1][z] >= change) {
						ij[x][z] = ij[x - 1][z] + 1;
					} else {
						ij[x][z] = ij[x - 1][z];
					}
				}
			}
		} else { // if (aStrategy == RIGHT) {
			for (int x = 0; x < subtreeSize; x++) {
				ij[0][x] = x + subtreeRevPreorder;
			}
			for (int x = 1; x < subtreeSize; x++) {
				change = treeSize
						- 1
						- rpost2post[(treeSize - 1 - (x - 1 + subtreePreorder))];
				for (int z = 0; z < subtreeSize; z++) {
					if (ij[x - 1][z] >= change) {
						ij[x][z] = ij[x - 1][z] + 1;
					} else {
						ij[x][z] = ij[x - 1][z];
					}
				}
			}
		}
	}
681798
private static CoordinateArraySequence convertSequence(Coordinate[] cs,int dimension) {        
        for (int i = 0; i < cs.length; i++) { 
            Coordinate coord = cs[i];
            switch (dimension) {
                case 2:
                    coord.z = Double.NaN;
                    cs[i]=coord;
                    break;
                case 3: {
                    double z = coord.z;
                    if (Double.isNaN(z)) {
                        coord.z = 0;
                        cs[i]=coord;
                    }
                    break;
                }                
                default:
                    break;
            }
        }        
        return new CoordinateArraySequence(cs, dimension);        
    }
31381
public CharBuffer subSequence(int start, int end) {
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        pos = (pos <= lim ? pos : lim);
        int len = lim - pos;

        if ((start < 0) || (end > len) || (start > end))
            throw new IndexOutOfBoundsException();
        return new ByteBufferAsCharBuffer(bb,
                -1,
                pos + start,
                pos + end,
                capacity(),
                offset,
                order);
    }
359931
private static long lcs(String arg0, String arg1, int i, int j) {
        if (arg0.length() == i || arg1.length() == j) {
            return 0;
        }

        if (arg0.charAt(i) == arg1.charAt(j)) {
            return 1 + lcs(arg0, arg1, ++i, ++j);
        } else {
            return Math.max(lcs(arg0, arg1, ++i, j), lcs(arg0, arg1, i, ++j));
        }
    }