public static SparseMatrix text(Path path) throws IOException {
        try (InputStream stream = Files.newInputStream(path);
             Scanner scanner = new Scanner(stream)) {
            int nrow = scanner.nextInt();
            int ncol = scanner.nextInt();
            int nz = scanner.nextInt();

            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 testText() throws Exception {
        System.out.println("text");
        SparseMatrix data = SparseMatrix.text(smile.util.Paths.getTestData("matrix/08blocks.txt"));
        assertEquals(592, data.size());
        assertEquals(300, data.nrow());
        assertEquals(300, data.ncol());
        assertEquals(94.0, data.get(36, 0), 1E-7);
        assertEquals(1.0, data.get(0, 1), 1E-7);
        assertEquals(33.0, data.get(36, 1), 1E-7);
        assertEquals(95.0, data.get(299, 299), 1E-7);
    }