Example usage for org.apache.commons.math3.stat.clustering Cluster getPoints

List of usage examples for org.apache.commons.math3.stat.clustering Cluster getPoints

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.clustering Cluster getPoints.

Prototype

public List<T> getPoints() 

Source Link

Document

Get the points contained in the cluster.

Usage

From source file:org.moeaframework.core.operator.real.AdaptiveMetropolisTest.java

/**
 * Returns the covariance matrix for the specified cluster.
 * /*from w w w.ja va2 s. co m*/
 * @param cluster the cluster
 * @return the covariance matrix for the specified cluster
 */
private RealMatrix getCovariance(Cluster<ClusterablePoint> cluster) {
    List<ClusterablePoint> points = cluster.getPoints();
    RealMatrix rm = MatrixUtils.createRealMatrix(points.size(), 2);

    for (int i = 0; i < points.size(); i++) {
        rm.setRow(i, points.get(i).getPoint());
    }

    return new Covariance(rm).getCovarianceMatrix();
}