Example usage for org.apache.commons.math3.linear RealMatrix getColumn

List of usage examples for org.apache.commons.math3.linear RealMatrix getColumn

Introduction

In this page you can find the example usage for org.apache.commons.math3.linear RealMatrix getColumn.

Prototype

double[] getColumn(int column) throws OutOfRangeException;

Source Link

Document

Get the entries at the given column index as an array.

Usage

From source file:edu.oregonstate.eecs.mcplan.ml.SequentialProjectionHashLearner.java

/**
 * @param X Each column is an unlabeled data point. Will be modified to have 0 mean.
 * @param XL Each column is a labeled data point. Will be modified to have 0 mean.
 * @param S S_ij = 1 if XL.get(i) similar to XL.get(j), -1 if not similar, 0 if unknown
 * @param K Number of hash bits//from w w  w  .  j a v  a2  s . c o m
 * @param eta Regularization parameter
 * @param alpha Learning rate (it's more like a boosting weight)
 */
public SequentialProjectionHashLearner(final RealMatrix X, final RealMatrix XL, final RealMatrix S, final int K,
        final double eta, final double alpha) {
    assert (K <= 64); // Because we're going to hash into a long

    this.X = X;
    this.XL = XL;
    this.S = S;
    this.K = K;
    this.eta = eta;
    this.alpha = alpha;

    Xi_ = X;
    Si_ = S;

    final VectorMeanVarianceAccumulator mu = new VectorMeanVarianceAccumulator(X.getRowDimension());
    for (int j = 0; j < X.getColumnDimension(); ++j) {
        mu.add(X.getColumn(j));
    }
    b = new ArrayRealVector(mu.mean(), false);

    for (int i = 0; i < X.getRowDimension(); ++i) {
        for (int j = 0; j < X.getColumnDimension(); ++j) {
            final double x = X.getEntry(i, j);
            X.setEntry(i, j, x / b.getEntry(i));
        }
    }

    for (int i = 0; i < XL.getRowDimension(); ++i) {
        for (int j = 0; j < XL.getColumnDimension(); ++j) {
            final double x = XL.getEntry(i, j);
            XL.setEntry(i, j, x / b.getEntry(i));
        }
    }

    XLt = XL.transpose();
}

From source file:com.datumbox.framework.core.machinelearning.featureselection.continuous.PCA.java

/** {@inheritDoc} */
@Override/*from  w  w w  . j  av a  2s.  co  m*/
protected void _fit(Dataframe originalData) {
    ModelParameters modelParameters = kb().getModelParameters();

    int n = modelParameters.getN();
    int d = modelParameters.getD();

    //convert data into matrix
    Map<Object, Integer> featureIds = modelParameters.getFeatureIds();
    MatrixDataframe matrixDataset = MatrixDataframe.newInstance(originalData, false, null, featureIds);
    RealMatrix X = matrixDataset.getX();

    //calculate means and subtract them from data
    double[] meanValues = new double[d];
    for (Integer columnId : featureIds.values()) {

        meanValues[columnId] = 0.0;
        for (double v : X.getColumn(columnId)) {
            meanValues[columnId] += v;
        }
        meanValues[columnId] /= n;

        for (int row = 0; row < n; row++) {
            X.addToEntry(row, columnId, -meanValues[columnId]);
        }
    }
    modelParameters.setMean(meanValues);

    RealMatrix components;
    double[] eigenValues;

    //dxd matrix
    RealMatrix covarianceDD = (X.transpose().multiply(X)).scalarMultiply(1.0 / (n - 1.0));

    EigenDecomposition decomposition = new EigenDecomposition(covarianceDD);
    eigenValues = decomposition.getRealEigenvalues();

    components = decomposition.getV();

    //Whiten Components W = U*L^0.5; To whiten them we multiply with L^0.5.
    if (kb().getTrainingParameters().isWhitened()) {

        double[] sqrtEigenValues = new double[eigenValues.length];
        for (int i = 0; i < eigenValues.length; i++) {
            sqrtEigenValues[i] = Math.sqrt(eigenValues[i]);
        }

        components = components.multiply(new DiagonalMatrix(sqrtEigenValues));
    }

    //the eigenvalues and their components are sorted by descending order no need to resort them
    Integer maxDimensions = kb().getTrainingParameters().getMaxDimensions();
    Double variancePercentageThreshold = kb().getTrainingParameters().getVariancePercentageThreshold();
    if (variancePercentageThreshold != null && variancePercentageThreshold <= 1) {
        double sum = 0.0;
        double totalVariance = StatUtils.sum(eigenValues);
        int varCounter = 0;
        for (double l : eigenValues) {
            sum += l / totalVariance;
            varCounter++;
            if (sum >= variancePercentageThreshold) {
                break;
            }
        }

        if (maxDimensions == null || maxDimensions > varCounter) {
            maxDimensions = varCounter;
        }
    }

    if (maxDimensions != null && maxDimensions < d) {
        //keep only the maximum selected eigenvalues
        double[] newEigenValues = new double[maxDimensions];
        System.arraycopy(eigenValues, 0, newEigenValues, 0, maxDimensions);
        eigenValues = newEigenValues;

        //keep only the maximum selected eigenvectors
        components = components.getSubMatrix(0, components.getRowDimension() - 1, 0, maxDimensions - 1);
    }

    modelParameters.setRows(components.getRowDimension());
    modelParameters.setCols(components.getColumnDimension());

    modelParameters.setEigenValues(eigenValues);
    modelParameters.setComponents(components.getData());
}

From source file:ffx.autoparm.Energy.java

/**
 * <p>/*from w  w  w .  j  a v a  2 s  .com*/
 * system_mpoles</p>
 */
public void system_mpoles() {
    //Find center of mass.
    double weigh = 0;
    double xyzmid[] = { 0, 0, 0 };
    double xyzcm[][] = new double[nAtoms][3];
    for (int i = 0; i < nAtoms; i++) {
        weigh = weigh + atoms[i].getMass();
        double coords[] = atoms[i].getXYZ(null);
        for (int j = 0; j < 3; j++) {
            xyzmid[j] = xyzmid[j] + coords[j] * atoms[i].getMass();
        }
    }
    if (weigh != 0) {
        for (int j = 0; j < 3; j++) {
            xyzmid[j] = xyzmid[j] / weigh;
        }
    }

    for (int i = 0; i < nAtoms; i++) {
        for (int j = 0; j < 3; j++) {
            double coords[] = atoms[i].getXYZ(null);
            xyzcm[i][j] = coords[j] - xyzmid[j];
        }
    }
    addInducedToGlobal();
    double netchg = 0, xdpl = 0, ydpl = 0, zdpl = 0, xxqdp = 0, xyqdp = 0, xzqdp = 0, yxqdp = 0, yyqdp = 0,
            yzqdp = 0, zxqdp = 0, zyqdp = 0, zzqdp = 0;
    for (int i = 0; i < nAtoms; i++) {
        double charge = atoms[i].getMultipoleType().charge;
        double[] dipole = { pme2.globalMultipole[0][i][1], pme2.globalMultipole[0][i][2],
                pme2.globalMultipole[0][i][3] };
        //double[] dipole = atoms[i].getMultipoleType().dipole;
        netchg = netchg + charge;
        xdpl = xdpl + xyzcm[i][0] * charge + dipole[0];
        ydpl = ydpl + xyzcm[i][1] * charge + dipole[1];
        zdpl = zdpl + xyzcm[i][2] * charge + dipole[2];
        xxqdp = xxqdp + xyzcm[i][0] * xyzcm[i][0] * charge + 2 * xyzcm[i][0] * dipole[0];
        xyqdp = xyqdp + xyzcm[i][0] * xyzcm[i][1] * charge + xyzcm[i][0] * dipole[1] + xyzcm[i][1] * dipole[0];
        xzqdp = xzqdp + xyzcm[i][0] * xyzcm[i][2] * charge + xyzcm[i][0] * dipole[2] + xyzcm[i][2] * dipole[0];

        yxqdp = yxqdp + xyzcm[i][0] * xyzcm[i][1] * charge + xyzcm[i][0] * dipole[1] + xyzcm[i][1] * dipole[0];
        yyqdp = yyqdp + xyzcm[i][1] * xyzcm[i][1] * charge + 2 * xyzcm[i][1] * dipole[1];
        yzqdp = yzqdp + xyzcm[i][1] * xyzcm[i][2] * charge + xyzcm[i][1] * dipole[2] + xyzcm[i][2] * dipole[1];

        //zxqdp = zxqdp + xyzcm[i][2] * xyzcm[i][0] * charge + xyzcm[i][2] * dipole[0] + xyzcm[i][0] * dipole[2];
        zxqdp = zxqdp + xyzcm[i][0] * xyzcm[i][2] * charge + xyzcm[i][0] * dipole[2] + xyzcm[i][2] * dipole[0];
        //zyqdp = zyqdp + xyzcm[i][2] * xyzcm[i][1] * charge + xyzcm[i][2] * dipole[1] + xyzcm[i][1] * dipole[2];
        zyqdp = zyqdp + xyzcm[i][1] * xyzcm[i][2] * charge + xyzcm[i][1] * dipole[2] + xyzcm[i][2] * dipole[1];
        zzqdp = zzqdp + xyzcm[i][2] * xyzcm[i][2] * charge + 2 * xyzcm[i][2] * dipole[2];
    }

    double qave = (xxqdp + yyqdp + zzqdp) / 3;
    xxqdp = 1.5 * (xxqdp - qave);
    xyqdp = 1.5 * xyqdp;
    xzqdp = 1.5 * xzqdp;
    yxqdp = 1.5 * yxqdp;
    yyqdp = 1.5 * (yyqdp - qave);
    yzqdp = 1.5 * yzqdp;
    zxqdp = 1.5 * zxqdp;
    zyqdp = 1.5 * zyqdp;
    zzqdp = 1.5 * (zzqdp - qave);

    for (int i = 0; i < nAtoms; i++) {
        double[][] quadrupole = {
                { pme2.globalMultipole[0][i][4], pme2.globalMultipole[0][i][7], pme2.globalMultipole[0][i][8] },
                { pme2.globalMultipole[0][i][7], pme2.globalMultipole[0][i][5], pme2.globalMultipole[0][i][9] },
                { pme2.globalMultipole[0][i][8], pme2.globalMultipole[0][i][9],
                        pme2.globalMultipole[0][i][6] } };
        //double[][] quadrupole = atoms[i].getMultipoleType().quadrupole;
        xxqdp = xxqdp + 3 * quadrupole[0][0];
        xyqdp = xyqdp + 3 * quadrupole[0][1];
        xzqdp = xzqdp + 3 * quadrupole[0][2];
        yxqdp = yxqdp + 3 * quadrupole[1][0];
        yyqdp = yyqdp + 3 * quadrupole[1][1];
        yzqdp = yzqdp + 3 * quadrupole[1][2];
        zxqdp = zxqdp + 3 * quadrupole[2][0];
        zyqdp = zyqdp + 3 * quadrupole[2][1];
        zzqdp = zzqdp + 3 * quadrupole[2][2];
    }

    xdpl = MultipoleType.DEBYE * xdpl;
    ydpl = MultipoleType.DEBYE * ydpl;
    zdpl = MultipoleType.DEBYE * zdpl;

    xxqdp = MultipoleType.DEBYE * xxqdp;
    xyqdp = MultipoleType.DEBYE * xyqdp;
    xzqdp = MultipoleType.DEBYE * xzqdp;
    yxqdp = MultipoleType.DEBYE * yxqdp;
    yyqdp = MultipoleType.DEBYE * yyqdp;
    yzqdp = MultipoleType.DEBYE * yzqdp;
    zxqdp = MultipoleType.DEBYE * zxqdp;
    zyqdp = MultipoleType.DEBYE * zyqdp;
    zzqdp = MultipoleType.DEBYE * zzqdp;

    double netdpl = Math.sqrt(xdpl * xdpl + ydpl * ydpl + zdpl * zdpl);

    RealMatrix a = new Array2DRowRealMatrix(
            new double[][] { { xxqdp, xyqdp, xzqdp }, { yxqdp, yyqdp, yzqdp }, { zxqdp, zyqdp, zzqdp } });

    EigenDecomposition e = new EigenDecomposition(a, 1);
    a = e.getD();
    double[] netqdp = { a.getColumn(0)[0], a.getColumn(1)[1], a.getColumn(2)[2] };

    DecimalFormat myFormatter = new DecimalFormat(" ##########0.00000;-##########0.00000");
    String output;
    output = String.format(" Total Electric Charge:   %13s %s Electrons\n", " ", myFormatter.format(netchg));
    System.out.println(output);
    output = String.format(" Dipole Moment Magnitude: %13s %s Debyes\n", " ", myFormatter.format(netdpl));
    System.out.println(output);
    output = String.format(" Dipole X,Y,Z-Components: %13s %s %s %s\n", " ", myFormatter.format(xdpl),
            myFormatter.format(ydpl), myFormatter.format(zdpl));
    System.out.println(output);
    output = String.format(" Quadrupole Moment Tensor:%13s %s %s %s", " ", myFormatter.format(xxqdp),
            myFormatter.format(xyqdp), myFormatter.format(xzqdp));
    System.out.println(output);
    output = String.format("      (Buckinghams)       %13s %s %s %s", " ", myFormatter.format(yxqdp),
            myFormatter.format(yyqdp), myFormatter.format(yzqdp));
    System.out.println(output);
    output = String.format("                          %13s %s %s %s\n", " ", myFormatter.format(zxqdp),
            myFormatter.format(zyqdp), myFormatter.format(zzqdp));
    System.out.println(output);
    output = String.format("Principle Axes Quadrupole:%13s %s %s %s", " ", myFormatter.format(netqdp[2]),
            myFormatter.format(netqdp[1]), myFormatter.format(netqdp[0]));
    System.out.println(output);

}

From source file:hulo.localization.models.obs.GaussianProcess.java

public double looPredLogLikelihood() {

    double[][] Y = getY();
    double[][] dY = getdY();

    int ns = X.length;
    int ny = Y[0].length;

    RealMatrix Ky = MatrixUtils.createRealMatrix(this.Ky);
    RealMatrix invKy = new LUDecomposition(Ky).getSolver().getInverse();

    RealMatrix dYmat = MatrixUtils.createRealMatrix(dY);

    double[] LOOPredLL = new double[ny];
    for (int j = 0; j < ny; j++) {
        RealMatrix dy = MatrixUtils.createColumnRealMatrix(dYmat.getColumn(j));
        RealMatrix invKdy = invKy.multiply(dy);
        double sum = 0;
        for (int i = 0; i < ns; i++) {
            double mu_i = dYmat.getEntry(i, j) - invKdy.getEntry(i, 0) / invKy.getEntry(i, i);
            double sigma_i2 = 1 / invKy.getEntry(i, i);
            double logLL = StatUtils.logProbaNormal(dYmat.getEntry(i, j), mu_i, Math.sqrt(sigma_i2));
            sum += logLL;//from w w w. j  a v a  2 s  .  c om
        }
        LOOPredLL[j] = sum;
    }

    double sumLOOPredLL = 0;
    for (int j = 0; j < ny; j++) {
        sumLOOPredLL += LOOPredLL[j];
    }

    return sumLOOPredLL;
}

From source file:citation_prediction.CitationCore.java

/**
 * This function will take a list of WSB solutions and graph them. You can add solutions to the graph by saving
 *       the return of the function the first time and passing it back in on the next call as the 'plot'.
 * //from  w w  w .  j  a v a 2s.  co m
 * 
 * @param data_in_days The citation data distributed mostly even in days (call fixdata function if data is in years).
 * @param m The average number of new references in each new paper for a journal.
 * @param plot The plot you would like the WSB solution plotted to.
 * @param graphTitle The title to display on the JPanel.
 * @param lineLegend The title of this curve.
 * @param wsbSolutions The list of WSB solutions to graph.
 * @param showGraph Display the graph to the user (generally called once all curves have been added.)
 * @param frame The frame to display the graph in.
 * @return A Panel containing the graph.
 */
public Plot2DPanel graphWSB(double[][] data_in_days, double m, Plot2DPanel plot, String graphTitle,
        String lineLegend, ArrayList<LinkedHashMap<String, Double>> wsbSolutions, boolean showGraph,
        JFrame frame) {

    //source of library: http://code.google.com/p/jmathplot/

    int plotLength = data_in_days.length + (365 * 3);
    double[][] data_in_years = new double[plotLength][2];

    //Translate the data into years instead of days
    for (int i = 0; i < data_in_days.length; i++) {
        data_in_years[i][0] = data_in_days[i][0] / 365;
        data_in_years[i][1] = data_in_days[i][1];
    }

    for (int i = data_in_days.length; i < plotLength; i++) {
        data_in_years[i][0] = data_in_years[i - 1][0] + .025;
        data_in_years[i][1] = data_in_years[data_in_days.length - 1][1];
    }

    if (plot == null) {
        plot = new Plot2DPanel();

        plot.addScatterPlot("Actual Citations", data_in_years); //Plot the data
    }

    //Extract the timevalue column
    RealMatrix mdata = MatrixUtils.createRealMatrix(data_in_years);
    double[] tvalues = mdata.getColumn(0);
    double[] cvalues = new double[plotLength];

    for (LinkedHashMap<String, Double> s : wsbSolutions) {
        //calculate their fitted y values
        for (int i = 0; i < plotLength; i++) {
            cvalues[i] = m * (Math.exp(
                    s.get("lambda") * pnorm((Math.log(365 * tvalues[i]) - s.get("mu")) / s.get("sigma"))) - 1);
        }
        //Calculate the Ultimate Impact
        double c_impact = m * (Math.exp(s.get("lambda")) - 1);
        //plot the fit
        plot.addLinePlot("Ultimate Impact=" + c_impact + " :: " + lineLegend, tvalues, cvalues);
    }

    // put the PlotPanel in a JFrame, as a JPanel
    if (showGraph) {
        plot.setAxisLabel(0, "Time in Years");
        plot.setAxisLabel(1, "Cumulative Citations");

        //Uncomment these if you wish to have fixed axis.
        //plot.setFixedBounds(1, 0, 500);
        //plot.setFixedBounds(0, 0, 60);

        // Add the file Title
        BaseLabel filetitle = new BaseLabel(graphTitle, Color.GRAY, 0.5, 1.1);
        filetitle.setFont(new Font("Courier", Font.BOLD, 13));
        plot.addPlotable(filetitle);

        plot.addLegend("SOUTH");
        //JFrame frame = new JFrame(graphTitle); 
        frame.setTitle(graphTitle);
        frame.setContentPane(plot);
        frame.setBounds(0, 0, 1000, 800);
        frame.setVisible(true);
        frame.repaint();
    }
    return plot;
}

From source file:lirmm.inria.fr.math.BigSparseRealMatrixTest.java

@Test
public void testSetColumn() {
    RealMatrix m = new BigSparseRealMatrix(subTestData);
    double[] mColumn3 = columnToArray(subColumn3);
    Assert.assertTrue(mColumn3[0] != m.getColumn(1)[0]);
    m.setColumn(1, mColumn3);/*from  w w w.j  av  a2s . c  o  m*/
    checkArrays(mColumn3, m.getColumn(1));
    try {
        m.setColumn(-1, mColumn3);
        Assert.fail("Expecting OutOfRangeException");
    } catch (OutOfRangeException ex) {
        // expected
    }
    try {
        m.setColumn(0, new double[5]);
        Assert.fail("Expecting MatrixDimensionMismatchException");
    } catch (MatrixDimensionMismatchException ex) {
        // expected
    }
}

From source file:lirmm.inria.fr.math.BigSparseRealMatrixTest.java

@Test
public void testGetVectors() {
    RealMatrix m = new BigSparseRealMatrix(testData);
    TestUtils.assertEquals("get row", m.getRow(0), testDataRow1, entryTolerance);
    TestUtils.assertEquals("get col", m.getColumn(2), testDataCol3, entryTolerance);
    try {/*from  w  w w .j a va  2 s.  c o  m*/
        m.getRow(10);
        Assert.fail("expecting OutOfRangeException");
    } catch (OutOfRangeException ex) {
        // ignored
    }
    try {
        m.getColumn(-1);
        Assert.fail("expecting OutOfRangeException");
    } catch (OutOfRangeException ex) {
        // ignored
    }
}

From source file:lirmm.inria.fr.math.BigSparseRealMatrixTest.java

@Test
public void testGetColumn() {
    RealMatrix m = new BigSparseRealMatrix(subTestData);
    double[] mColumn1 = columnToArray(subColumn1);
    double[] mColumn3 = columnToArray(subColumn3);
    checkArrays(mColumn1, m.getColumn(1));
    checkArrays(mColumn3, m.getColumn(3));
    try {//from   w  w  w  . j  ava2 s  .  com
        m.getColumn(-1);
        Assert.fail("Expecting OutOfRangeException");
    } catch (OutOfRangeException ex) {
        // expected
    }
    try {
        m.getColumn(4);
        Assert.fail("Expecting OutOfRangeException");
    } catch (OutOfRangeException ex) {
        // expected
    }
}

From source file:edu.cmu.tetrad.search.TestHippocampus.java

private double[][] calcFirstPrincipleComponent(int sampleSize, DataSet data, int[][] voxellation) {
    double[][] sums = new double[sampleSize][voxellation.length];

    for (int s = 0; s < voxellation.length; s++) {
        RealMatrix m = new BlockRealMatrix(sampleSize, voxellation[s].length);

        for (int i = 0; i < sampleSize; i++) {
            for (int j = 0; j < voxellation[s].length; j++) {
                m.setEntry(i, j, data.getDouble(i, voxellation[s][j]));
            }//from  w w  w  .  j  av a2 s  . c  om
        }

        SingularValueDecomposition d = new SingularValueDecomposition(m);

        RealMatrix s1 = d.getU();

        double[] c = s1.getColumn(0);

        for (int i = 0; i < sampleSize; i++) {
            sums[i][s] = c[i];
        }
    }

    return sums;
}

From source file:edu.cmu.tetrad.search.TestIndTestConditionalCorrelation.java

public void test18() {
    String data = "Index              x           y\n" + "1   -0.72948059  1.01209350\n"
            + "2    0.80798715  1.03681935\n" + "3   -0.02095235 -0.37993571\n"
            + "4   -1.64513107  2.80567356\n" + "5    0.07684120  0.53549655\n"
            + "6    0.43023555  0.42394366\n" + "7   -0.42676522 -0.29117311\n"
            + "8   -2.10007622  5.05256527\n" + "9   -0.65580699  0.23033719\n"
            + "10  -1.63617591  2.37332487\n" + "11  -1.23680958  1.64217631\n"
            + "12  -0.98708873  1.64958398\n" + "13   0.28235697 -0.01322421\n"
            + "14  -0.08159946  0.38443774\n" + "15  -1.54593292  1.84517283\n"
            + "16   0.82161145  1.67503553\n" + "17   0.67867283  0.29451478\n"
            + "18   0.82985465  0.42267041\n" + "19   1.00260529  1.27773320\n"
            + "20   0.13351448 -0.12437656\n" + "21  -1.09904966  1.64203132\n"
            + "22   0.73016304  0.30991127\n" + "23  -1.27354175  1.76457703\n"
            + "24   0.46934600 -0.23096083\n" + "25   0.94805730  0.81191566\n"
            + "26   0.97957563  0.14710183\n" + "27   0.04757990  0.02270664\n"
            + "28  -1.91368914  4.23463302\n" + "29  -0.59444606  0.28346340\n"
            + "30  -0.71910846  0.48055435\n" + "31  -1.25986488  0.88790498\n"
            + "32  -0.26204911  0.26060420\n" + "33  -2.86116183  7.72689392\n"
            + "34  -0.33872119  0.15511555\n" + "35   0.29524601  0.78723474\n"
            + "36  -1.55505998  2.42226687\n" + "37   1.31363087  1.99018993\n"
            + "38   0.30416367 -0.30086889\n" + "39  -0.40490442  1.17313339\n"
            + "40  -0.21411599  1.00948841\n" + "41  -0.28109120  0.01365507\n"
            + "42   0.17603210 -0.14206316\n" + "43  -0.19844413 -0.22548862\n"
            + "44   1.28357341  1.76345693\n" + "45  -0.75131049  1.05025460\n"
            + "46   1.28333702  1.94343654\n" + "47  -0.34022614  0.65501745\n"
            + "48   0.43365272 -0.11294250\n" + "49   0.75461100  0.92198555\n"
            + "50   0.46322642  0.27829113\n" + "51  -0.16022255 -0.15490153\n"
            + "52  -2.60920107  7.10439922\n" + "53  -0.10300395 -0.54715708\n"
            + "54  -0.71776100  0.61004902\n" + "55  -1.02983268  1.49005198\n"
            + "56   2.00803519  3.60926848\n" + "57   0.04192123  0.36825046\n"
            + "58  -0.46263362  0.08504761\n" + "59   1.94847020  4.11896195\n"
            + "60  -1.07745523  0.98709943\n" + "61  -0.17589703 -0.65818477\n"
            + "62   0.81287659  1.48322666\n" + "63  -0.45400031  0.31150709\n"
            + "64  -0.47554954  0.72039244\n" + "65   0.54807911  0.04695733\n"
            + "66   0.19344402  0.27785098\n" + "67  -0.50269640 -0.04849118\n"
            + "68  -0.61802126  0.92677808\n" + "69   0.31346941  0.10233607\n"
            + "70   0.63577987  0.52803445\n" + "71   0.72578604  0.47726866\n"
            + "72  -0.80020174  0.31059430\n" + "73  -1.76306378  3.37591020\n"
            + "74  -1.61635258  2.28390644\n" + "75  -0.17252515  0.10342195\n"
            + "76   1.05079002  0.98551042\n" + "77  -0.19664975 -0.28227379\n"
            + "78   0.76963250  0.75710892\n" + "79  -0.41856370  0.17429286\n"
            + "80   0.97880357  1.32522307\n" + "81   1.80407499  3.51901515\n"
            + "82  -0.64527851 -0.02947269\n" + "83  -0.03990843 -0.33027020\n"
            + "84  -2.61749411  6.49758868\n" + "85  -0.11104965 -0.92909214\n"
            + "86  -0.49033442  1.13918307\n" + "87   1.14478318  1.09747092\n"
            + "88   0.64945125  0.93815580\n" + "89  -0.09521951  0.89221710\n"
            + "90  -0.15796234  0.49929398\n" + "91  -0.06598984 -0.12423091\n"
            + "92   1.34827195  1.74975607\n" + "93  -1.61475922  3.09393360\n"
            + "94  -1.83002418  3.48332919\n" + "95   0.99130390  1.45967080\n"
            + "96  -0.22961622  0.88516120\n" + "97   0.17939985  0.02820274\n"
            + "98   0.64887770  0.54387382\n" + "99   0.83298219  0.63271454\n" + "100 -1.37347477  1.82045830";

    DataReader reader = new DataReader();

    DataSet dataSet = reader.parseTabular(data.toCharArray());

    //        System.out.println(dataSet);

    List<String> varnames = dataSet.getVariableNames();

    RealMatrix realMatrix = dataSet.getDoubleData().getRealMatrix();

    Cci cci = new Cci(realMatrix, varnames, 0.05);

    //        cci.temp(realMatrix.getColumn(1), realMatrix.getColumn(2));
    boolean indep = cci.independent(realMatrix.getColumn(1), realMatrix.getColumn(2));

    System.out.println(indep);//  w  w  w . j a  v  a 2s.  c o m
}