protected static <A> double[] computeDistances(NumberArrayAdapter<?, A> adapter, A data) {
    final int size = adapter.size(data);
    double[] dMatrix = new double[(size * (size + 1)) >> 1];
    for(int i = 0, c = 0; i < size; i++) {
      for(int j = 0; j < i; j++) {
        double dx = adapter.getDouble(data, i) - adapter.getDouble(data, j);
        dMatrix[c++] = (dx < 0) ? -dx : dx; // Absolute difference.
      }
      c++; // Diagonal entry: zero
    }
    doubleCenterMatrix(dMatrix, size);
    return dMatrix;
  }
protected static < A > double [ ] computeDistances ( NumberArrayAdapter < ? , A > adapter , A data ) { final int size = adapter . size ( data ) ; double [ ] dMatrix = new double [ ( size * ( size + 1 ) ) > > 1 ] ; for ( int i = 0 , c = 0 ; i < size ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { double dx = adapter . getDouble ( data , i ) - adapter . getDouble ( data , j ) ; dMatrix [ c ++ ] = ( dx < 0 ) ? - dx : dx ; } c ++ ; } doubleCenterMatrix ( dMatrix , size ) ; return dMatrix ; }
Compute the double-centered delta matrix.

@param adapter Data adapter
@param data Input data
@return Double-centered delta matrix.