public static SparseMatrix harwell(Path path) throws IOException {
        logger.info("Reads sparse matrix file '{}'", path.toAbsolutePath());
        try (InputStream stream = Files.newInputStream(path);
             Scanner scanner = new Scanner(stream)) {

            // Ignore the title line.
            String line = scanner.nextLine();
            logger.info(line);

            line = scanner.nextLine().trim();
            logger.info(line);
            String[] tokens = line.split("\\s+");
            int RHSCRD = Integer.parseInt(tokens[4]);

            line = scanner.nextLine().trim();
            logger.info(line);
            if (!line.startsWith("R")) {
                throw new UnsupportedOperationException("SparseMatrix supports only real-valued matrix.");
            }

            tokens = line.split("\\s+");
            int nrow = Integer.parseInt(tokens[1]);
            int ncol = Integer.parseInt(tokens[2]);
            int nz = Integer.parseInt(tokens[3]);

            line = scanner.nextLine();
            logger.info(line);
            if (RHSCRD > 0) {
                line = scanner.nextLine();
                logger.info(line);
            }

            int[] colIndex = new int[ncol + 1];
            int[] rowIndex = new int[nz];
            float[] data = new float[nz];
            for (int i = 0; i <= ncol; i++) {
                colIndex[i] = scanner.nextInt() - 1;
            }
            for (int i = 0; i < nz; i++) {
                rowIndex[i] = scanner.nextInt() - 1;
            }
            for (int i = 0; i < nz; i++) {
                data[i] = scanner.nextFloat();
            }

            return new SparseMatrix(nrow, ncol, data, rowIndex, colIndex);
        }
    }
@Test
    public void testHarwell() throws Exception {
        System.out.println("HB exchange format");
        SparseMatrix data = SparseMatrix.harwell(smile.util.Paths.getTestData("matrix/5by5_rua.hb"));
        assertEquals(13, data.size());
        assertEquals(5, data.nrow());
        assertEquals(5, data.ncol());
        assertEquals(11.0, data.get(0, 0), 1E-7);
        assertEquals(31.0, data.get(2, 0), 1E-7);
        assertEquals(51.0, data.get(4, 0), 1E-7);
        assertEquals(55.0, data.get(4, 4), 1E-7);
    }