Example usage for org.apache.commons.math.linear InvalidMatrixException getMessage

List of usage examples for org.apache.commons.math.linear InvalidMatrixException getMessage

Introduction

In this page you can find the example usage for org.apache.commons.math.linear InvalidMatrixException getMessage.

Prototype

@Override
public String getMessage() 

Source Link

Usage

From source file:org.broad.igv.hic.MainWindow.java

private void getEigenvectorActionPerformed(ActionEvent e) {
    double[] rv;// w  ww  .jav a  2s .  c  om
    try {
        String number = JOptionPane.showInputDialog("Which eigenvector do you want to see?");
        int num = Integer.parseInt(number) - 1;

        rv = hic.getEigenvector(num);

        if (rv != null) {
            String str = "";
            for (int i = 0; i < rv.length; i++) {
                str += rv[i] + "\n";

            }
            JTextArea textArea = new JTextArea(str, 20, 20);
            textArea.setEditable(false);
            textArea.selectAll();
            JScrollPane pane = new JScrollPane(textArea);
            JFrame frame = new JFrame("Principal Eigenvector");
            frame.getContentPane().add(pane);
            frame.pack();
            frame.setVisible(true);

        } else {
            System.err.println("No densities available for this file.");
        }

    } catch (InvalidMatrixException error) {
        JOptionPane.showMessageDialog(this, "Unable to calculate eigenvectors after 30 iterations",
                "Eigenvector error", JOptionPane.ERROR_MESSAGE);
    } catch (NumberFormatException error) {
        JOptionPane.showMessageDialog(this, "You must enter a valid number.\n" + error.getMessage(),
                "Eigenvector error", JOptionPane.ERROR_MESSAGE);
    }

}