'Return size, storage parameters from Matrix Market file-like \'source\'.
Parameters
source : str or file-like
Matrix Market filename (extension .mtx) or open file-like object
Returns
rows : int
Number of matrix rows.
cols : int
Number of matrix columns.
entries : int
Number of non-zero entries of a sparse matrix
or rows*cols for a dense matrix.
format : str
Either \'coordinate\' or \'array\'.
field : str
Either \'real\', \'complex\', \'pattern\', or \'integer\'.
symmetry : str
Either \'general\', \'symmetric\', \'skew-symmetric\', or \'hermitian\'.'

@classmethod
def info(self, source):

    (stream, close_it) = self._open(source)
    try:
        line = stream.readline()
        (mmid, matrix, format, field, symmetry) = [asstr(part.strip()) for part in line.split()]
        if (not mmid.startswith('%%MatrixMarket')):
            raise ValueError('source    is    not    in    Matrix    Market    format')
        if (not (matrix.lower() == 'matrix')):
            raise ValueError(('Problem    reading    file    header:    ' + line))
        if (format.lower() == 'array'):
            format = self.FORMAT_ARRAY
        elif (format.lower() == 'coordinate'):
            format = self.FORMAT_COORDINATE
        while line.startswith('%'):
            line = stream.readline()
        line = line.split()
        if (format == self.FORMAT_ARRAY):
            if (not (len(line) == 2)):
                raise ValueError(('Header    line    not    of    length    2:    ' + line))
            (rows, cols) = map(int, line)
            entries = (rows * cols)
        else:
            if (not (len(line) == 3)):
                raise ValueError(('Header    line    not    of    length    3:    ' + line))
            (rows, cols, entries) = map(int, line)
        return (rows, cols, entries, format, field.lower(), symmetry.lower())
    finally:
        if close_it:
            stream.close()
