@FXML
    private void doPowerMethod(ActionEvent event) {
        Scanner s = new Scanner(pmInput.getText());
        int row = 0;
        int col = 0;
        ArrayList<Double> vals = new ArrayList();
        try {
            while (s.hasNextLine()) {
                String line = s.nextLine();
                Scanner lineScanner = new Scanner(line);
                while (lineScanner.hasNext()) {
                    vals.add(lineScanner.nextDouble());
                    if (row == 0) {
                        col++;
                    }
                }
                row++;
            }
            Matrix A = new Matrix(row, col);
            double[] dvals = new double[vals.size()];
            for (int i = 0; i < dvals.length; i++) {
                dvals[i] = vals.get(i);
            }
            A.put(dvals);
            
            s = new Scanner(pmVectorInput.getText());
            ArrayList<Double> initVector = new ArrayList<>();
            while (s.hasNextLine()) {
                String line = s.nextLine();
                Scanner lineScanner = new Scanner(line);
                if (lineScanner.hasNextDouble()) {
                    initVector.add(lineScanner.nextDouble());
                }
            }
            dvals = new double[initVector.size()];
            for (int i = 0; i < dvals.length; i++) {
                dvals[i] = initVector.get(i);
            }
            Vector x = new Vector(dvals);
            
            PowerMethod pm = new PowerMethod(A, x, MAX_NUMBER_OF_ITERATIONS, TOLERANCE);
            pmValue.setText(pm.getNorm() + "");
            pmVector.setText(pm.getV() + "");
            pmIteration.setText(pm.getIterationsNeeded() + "");
        } catch (Exception e) {
            pmValue.setText("INVALID INPUT");
        }
    }