public int correlationDistance(PCAFilteredResult pca1,PCAFilteredResult pca2,int dimensionality){
  double[][] v1=copy(pca1.getEigenvectors());
  double[][] v1_strong=copy(pca1.adapatedStrongEigenvectors());
  double[][] e1_czech=copy(pca1.selectionMatrixOfStrongEigenvectors());
  int lambda1=pca1.getCorrelationDimension();
  double[][] v2=copy(pca2.getEigenvectors());
  double[][] v2_strong=copy(pca2.adapatedStrongEigenvectors());
  double[][] e2_czech=copy(pca2.selectionMatrixOfStrongEigenvectors());
  int lambda2=pca2.getCorrelationDimension();
  double[][] m1_czech=pca1.dissimilarityMatrix();
  for (int i=0; i < v2_strong[0].length; i++) {
    double[] v2_i=getCol(v2_strong,i);
    double dist=Math.sqrt(squareSum(v2_i) - transposeTimesTimes(v2_i,m1_czech,v2_i));
    if (lambda1 < dimensionality && dist > delta) {
      adjust(v1,e1_czech,v2_i,lambda1++);
      m1_czech=timesTranspose(times(v1,e1_czech),v1);
    }
  }
  double[][] m2_czech=pca2.dissimilarityMatrix();
  for (int i=0; i < v1_strong[0].length; i++) {
    double[] v1_i=getCol(v1_strong,i);
    double dist=Math.sqrt(squareSum(v1_i) - transposeTimesTimes(v1_i,m2_czech,v1_i));
    if (lambda2 < dimensionality && dist > delta) {
      adjust(v2,e2_czech,v1_i,lambda2++);
      m2_czech=timesTranspose(times(v2,e2_czech),v2);
    }
  }
  int correlationDistance=Math.max(lambda1,lambda2);
  return correlationDistance;
}

public int correlationDistance ( PCAFilteredResult pca1 , PCAFilteredResult pca2 , int dimensionality ) { double [ ] [ ] v1 = copy ( pca1 . getEigenvectors ( ) ) ; double [ ] [ ] v1_strong = copy ( pca1 . adapatedStrongEigenvectors ( ) ) ; double [ ] [ ] e1_czech = copy ( pca1 . selectionMatrixOfStrongEigenvectors ( ) ) ; int lambda1 = pca1 . getCorrelationDimension ( ) ; double [ ] [ ] v2 = copy ( pca2 . getEigenvectors ( ) ) ; double [ ] [ ] v2_strong = copy ( pca2 . adapatedStrongEigenvectors ( ) ) ; double [ ] [ ] e2_czech = copy ( pca2 . selectionMatrixOfStrongEigenvectors ( ) ) ; int lambda2 = pca2 . getCorrelationDimension ( ) ; double [ ] [ ] m1_czech = pca1 . dissimilarityMatrix ( ) ; for ( int i = 0 ; i < v2_strong [ 0 ] . length ; i ++ ) { double [ ] v2_i = getCol ( v2_strong , i ) ; double dist = Math . sqrt ( squareSum ( v2_i ) - transposeTimesTimes ( v2_i , m1_czech , v2_i ) ) ; if ( lambda1 < dimensionality && dist > delta ) { adjust ( v1 , e1_czech , v2_i , lambda1 ++ ) ; m1_czech = timesTranspose ( times ( v1 , e1_czech ) , v1 ) ; } } double [ ] [ ] m2_czech = pca2 . dissimilarityMatrix ( ) ; for ( int i = 0 ; i < v1_strong [ 0 ] . length ; i ++ ) { double [ ] v1_i = getCol ( v1_strong , i ) ; double dist = Math . sqrt ( squareSum ( v1_i ) - transposeTimesTimes ( v1_i , m2_czech , v1_i ) ) ; if ( lambda2 < dimensionality && dist > delta ) { adjust ( v2 , e2_czech , v1_i , lambda2 ++ ) ; m2_czech = timesTranspose ( times ( v2 , e2_czech ) , v2 ) ; } } int correlationDistance = Math . max ( lambda1 , lambda2 ) ; return correlationDistance ; }
computes the correlation distance between the two subspaces defined by the specified pcas .
