public static double [ ] computeSimilarityMatrix ( DependenceMeasure sim , Relation < ? extends NumberVector > rel ) { final int dim = RelationUtil . dimensionality ( rel ) ; // TODO: we could use less memory (no copy), but this would likely be // slower. Maybe as a fallback option? double [ ] [ ] data = new double [ dim ] [ rel . size ( ) ] ; int r = 0 ; for ( DBIDIter it = rel . iterDBIDs ( ) ; it . valid ( ) ; it . advance ( ) , r ++ ) { NumberVector v = rel . get ( it ) ; for ( int d = 0 ; d < dim ; d ++ ) { data [ d ] [ r ] = v . doubleValue ( d ) ; } } return sim . dependence ( DoubleArrayAdapter . STATIC , Arrays . asList ( data ) ) ; }
Compute a column - wise dependency matrix for the given relation .