~ubuntu-branches/ubuntu/quantal/commons-math/quantal

« back to all changes in this revision

Viewing changes to src/test/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClustererTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2010-04-05 23:33:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100405233302-gpqlceked76nw28a
Tags: 2.1-1
* New upstream release.
* Bump Standards-Version to 3.8.4: no changes needed
* Bump debhelper to >= 7
* Switch to 3.0 (quilt) source format:
  - Remove B-D on quilt
  - Add d/source/format
  - Remove d/README.source

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
 
95
95
    }
96
96
 
 
97
    /**
 
98
     * JIRA: MATH-305
 
99
     *
 
100
     * Two points, one cluster, one iteration
 
101
     */
 
102
    @Test
 
103
    public void testPerformClusterAnalysisDegenerate() {
 
104
        KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer = new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
 
105
                new Random(1746432956321l));
 
106
        EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[] {
 
107
                new EuclideanIntegerPoint(new int[] { 1959, 325100 }),
 
108
                new EuclideanIntegerPoint(new int[] { 1960, 373200 }), };
 
109
        List<Cluster<EuclideanIntegerPoint>> clusters = transformer.cluster(Arrays.asList(points), 1, 1);
 
110
        assertEquals(1, clusters.size());
 
111
        assertEquals(2, (clusters.get(0).getPoints().size()));
 
112
        EuclideanIntegerPoint pt1 = new EuclideanIntegerPoint(new int[] { 1959, 325100 });
 
113
        EuclideanIntegerPoint pt2 = new EuclideanIntegerPoint(new int[] { 1960, 373200 });
 
114
        assertTrue(clusters.get(0).getPoints().contains(pt1));
 
115
        assertTrue(clusters.get(0).getPoints().contains(pt2));
 
116
 
 
117
    }
 
118
 
97
119
}