@Test
public void testEigenSeedGenerator() throws Exception {

  List<VectorWritable> points = getPoints();
  Job job = new Job();
  Configuration conf = job.getConfiguration();
  job.setMapOutputValueClass(VectorWritable.class);
  Path input = getTestTempFilePath("eigen-input");
  Path output = getTestTempDirPath("eigen-output");
  ClusteringTestUtils.writePointsToFile(points, input, fs, conf);
  EigenSeedGenerator.buildFromEigens(conf, input, output, 3, new ManhattanDistanceMeasure());
  int clusterCount = 0;
  Collection<Integer> set = new HashSet<>();
  Vector v[] = new Vector[3];
  for (ClusterWritable clusterWritable :
       new SequenceFileValueIterable<ClusterWritable>(
           new Path(output, "part-eigenSeed"), true, conf)) {
    Cluster cluster = clusterWritable.getValue();
    int id = cluster.getId();
    assertTrue(set.add(id)); // validate unique id's
    v[id] = cluster.getCenter();
    clusterCount++;
  }
  assertEquals(3, clusterCount); // validate sample count
  // validate pair-wise orthogonality
  assertEquals(0, v[0].dot(v[1]), 1E-10);
  assertEquals(0, v[1].dot(v[2]), 1E-10);
  assertEquals(0, v[0].dot(v[2]), 1E-10);
}