Example usage for org.apache.commons.math3.exception MaxCountExceededException printStackTrace

List of usage examples for org.apache.commons.math3.exception MaxCountExceededException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.math3.exception MaxCountExceededException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

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

public static boolean allEigenvaluesAreSmallerThanOneInModulus(TetradMatrix mat) {

    double[] realEigenvalues = new double[0];
    double[] imagEigenvalues = new double[0];
    try {/*from ww w  .j av  a 2s .c  om*/
        EigenDecomposition dec = new EigenDecomposition(mat.getRealMatrix());
        realEigenvalues = dec.getRealEigenvalues();
        imagEigenvalues = dec.getImagEigenvalues();
    } catch (MaxCountExceededException e) {
        e.printStackTrace();
    }

    for (int i = 0; i < realEigenvalues.length; i++) {
        double realEigenvalue = realEigenvalues[i];
        double imagEigenvalue = imagEigenvalues[i];
        System.out.println("Real eigenvalues are : " + realEigenvalue + " and imag part : " + imagEigenvalue);
        double modulus = Math.sqrt(Math.pow(realEigenvalue, 2) + Math.pow(imagEigenvalue, 2));

        if (modulus >= 1.0) {
            return false;
        }
    }
    return true;
}