* specified PCAs
*/
public int correlationDistance(PCAFilteredResult pca1, PCAFilteredResult pca2, int dimensionality) {
// TODO nur in eine Richtung?
// pca of rv1
Matrix v1 = pca1.getEigenvectors();
Matrix v1_strong = pca1.adapatedStrongEigenvectors();
Matrix e1_czech = pca1.selectionMatrixOfStrongEigenvectors();
int lambda1 = pca1.getCorrelationDimension();
// pca of rv2
Matrix v2 = pca2.getEigenvectors();
Matrix v2_strong = pca2.adapatedStrongEigenvectors();
Matrix e2_czech = pca2.selectionMatrixOfStrongEigenvectors();
int lambda2 = pca2.getCorrelationDimension();
// for all strong eigenvectors of rv2
Matrix m1_czech = pca1.dissimilarityMatrix();
for(int i = 0; i < v2_strong.getColumnDimensionality(); i++) {
Vector v2_i = v2_strong.getCol(i);
// check, if distance of v2_i to the space of rv1 > delta
// (i.e., if v2_i spans up a new dimension)
double dist = Math.sqrt(v2_i.transposeTimes(v2_i) - v2_i.transposeTimesTimes(m1_czech, v2_i));
// if so, insert v2_i into v1 and adjust v1
// and compute m1_czech new, increase lambda1
if(lambda1 < dimensionality && dist > delta) {
adjust(v1, e1_czech, v2_i, lambda1++);
m1_czech = v1.times(e1_czech).timesTranspose(v1);
}
}
// for all strong eigenvectors of rv1
Matrix m2_czech = pca2.dissimilarityMatrix();
for(int i = 0; i < v1_strong.getColumnDimensionality(); i++) {
Vector v1_i = v1_strong.getCol(i);
// check, if distance of v1_i to the space of rv2 > delta
// (i.e., if v1_i spans up a new dimension)
double dist = Math.sqrt(v1_i.transposeTimes(v1_i) - v1_i.transposeTimes(m2_czech).times(v1_i).get(0));