Java Code Examples for cern.colt.matrix.DoubleMatrix1D#cardinality()

The following examples show how to use cern.colt.matrix.DoubleMatrix1D#cardinality() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MassPreconditioner.java    From beast-mcmc with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void boundEigenvalues(DoubleMatrix1D eigenvalues) {

                for (int i = 0; i < eigenvalues.cardinality(); ++i) {
                    if (eigenvalues.get(i) > MAX_EIGENVALUE) {
                        eigenvalues.set(i, MAX_EIGENVALUE);
                    } else if (eigenvalues.get(i) < MIN_EIGENVALUE) {
                        eigenvalues.set(i, MIN_EIGENVALUE);
                    }
                }
            }
 
Example 2
Source File: MassPreconditioner.java    From beast-mcmc with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void scaleEigenvalues(DoubleMatrix1D eigenvalues) {
    double sum = 0.0;
    for (int i = 0; i < eigenvalues.cardinality(); ++i) {
        sum += eigenvalues.get(i);
    }

    double mean = -sum / eigenvalues.cardinality();

    for (int i = 0; i < eigenvalues.cardinality(); ++i) {
        eigenvalues.set(i, eigenvalues.get(i) / mean);
    }
}
 
Example 3
Source File: MassPreconditioner.java    From beast-mcmc with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected void inverseNegateEigenvalues(DoubleMatrix1D eigenvalues) {
    for (int i = 0; i < eigenvalues.cardinality(); i++) {
        eigenvalues.set(i, -1.0 / eigenvalues.get(i));
    }
}
 
Example 4
Source File: MassPreconditioner.java    From beast-mcmc with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected void negateEigenvalues(DoubleMatrix1D eigenvalues) {
    for (int i = 0; i < eigenvalues.cardinality(); i++) {
        eigenvalues.set(i, -eigenvalues.get(i));
    }
}