python/pycubool/io.py
def write_mtx_file(path: str, shape, rows, cols, nvals):
    """
    Save data to mtx file.

    :param path: Path and file name of the file to save data
    :param shape: Matrix shape as tuple
    :param rows: Rows data
    :param cols: Columns data
    :param nvals: Number of values
    :return: None
    """

    assert len(rows) == nvals
    assert len(cols) == nvals

    with open(str(path), "w") as file:
        file.write("# pycubool sparse boolean matrix\n")
        file.write(f"{shape[0]} {shape[1]} {nvals}\n")
        for i in range(nvals):
            file.write(f"{rows[i]} {cols[i]}\n")

    Save data to mtx file.

    :param path: Path and file name of the file to save data
    :param shape: Matrix shape as tuple
    :param rows: Rows data
    :param cols: Columns data
    :param nvals: Number of values
    :return: None
    
Save data to mtx file.
Save data to mtx file .
def write_mtx_file(path: str, shape, rows, cols, nvals):
    assert len(rows) == nvals
    assert len(cols) == nvals
    with open(str(path), "w") as file:
        file.write("# pycubool sparse boolean matrix\n")
        file.write(f"{shape[0]} {shape[1]} {nvals}\n")
        for i in range(nvals):
            file.write(f"{rows[i]} {cols[i]}\n")
def write_mtx_file ( path : str , shape , rows , cols , nvals ) : assert len ( rows ) == nvals assert len ( cols ) == nvals with open ( str ( path ) , "w" ) as file : file . write ( "# pycubool sparse boolean matrix\n" ) file . write ( f"{shape[0]} {shape[1]} {nvals}\n" ) for i in range ( nvals ) : file . write ( f"{rows[i]} {cols[i]}\n" )
Save data to mtx file.
Save data to mtx file .
"""
    Save data to mtx file.

    :param path: Path and file name of the file to save data
    :param shape: Matrix shape as tuple
    :param rows: Rows data
    :param cols: Columns data
    :param nvals: Number of values
    :return: None
    """
None
path
str
Path and file name of the file to save data
Path and file name of the file to save data
shape
Matrix shape as tuple
Matrix shape as tuple
rows
None
cols
None
nvals
Number of values
Number of values