class PearsonsCorrelation {

    public double correlation(final double[] xArray, final double[] yArray) {
        SimpleRegression regression = new SimpleRegression();
        if (xArray.length != yArray.length) {
            throw new DimensionMismatchException(xArray.length, yArray.length);
        } else if (xArray.length < 2) {
            throw new MathIllegalArgumentException(LocalizedFormats.INSUFFICIENT_DIMENSION,
                                                   xArray.length, 2);
        } else {
            for(int i=0; i<xArray.length; i++) {
                regression.addData(xArray[i], yArray[i]);
            }
            return regression.getR();
        }
    }

    public  PearsonsCorrelation();
    public  PearsonsCorrelation(double[][] data);
    public  PearsonsCorrelation(RealMatrix matrix);
    public  PearsonsCorrelation(Covariance covariance);
    public  PearsonsCorrelation(RealMatrix covarianceMatrix, int numberOfObservations);

}