madupite.Matrix#

class madupite.Matrix(*args, **kwargs)#

Represents a matrix used within the Madupite framework.

The Matrix class provides functionalities to handle matrices, including the ability to load a matrix from a file, convert matrix types to string, and write the matrix to a file.

Methods#

__init__(self)

Initializes an empty Matrix object.

typeToString(cls, type: MatrixType) -> str

Convert a matrix type enum to its corresponding string representation.

typeMatrixType

The matrix type to convert to a string.

str

A string representation of the matrix type.

fromFile(cls, *, comm: int, name: str, filename: str, category: MatrixCategory, type: MatrixType) -> Matrix

Load a matrix from a file.

This static method creates a Matrix object by reading matrix data from a specified file.

commint, optional

The MPI communicator identifier for parallel computation.

namestr

The name to associate with the loaded matrix within the Madupite environment.

filenamestr

The path to the file from which the matrix will be loaded.

categoryMatrixCategory

The category of the matrix (Dynamics, Cost).

typeMatrixType

The type of the matrix (Dense, Sparse).

Matrix

A Matrix object containing the data loaded from the specified file.

writeToFile(self, filename: str)

Write the matrix data to a file.

This method saves the current state of the matrix to a specified file, allowing for persistence and later retrieval.

filenamestr

The path to the file where the matrix will be saved.

__init__(self) None#

Methods

__init__(self)

writeToFile(self, filename, matrix_type[, ...])

Attributes

fromFile

typeToString