![]() |
STAG Python
2.0.2
Spectral Toolkit of Algorithms for Graphs
|
An object representing a dense matrix for use with the STAG library.
The data is stored natively on the 'C++' side of the library, allowing for fast computation.
The object is designed for easy interoperability with numpy ndarray objects. The DenseMat object can be constructed directly from a numpy ndarray object, and the to_numpy() method can be used to convert back to a numpy ndarray.
If they are only used as arguments to STAG library methods, they will be very efficient since the data will stay on the C++ side of the library.
Public Member Functions | |
def | __init__ (self, Union[np.ndarray, List[List[float]]] matrix) |
Construct a STAG DenseMat. | |
np.ndarray | to_numpy (self) |
Convert the STAG DenseMat object to a numpy matrix. | |
'DenseMat' | transpose (self) |
Return the transpose of the matrix. | |
Tuple[int, int] | shape (self) |
Return the shape of the matrix. | |
int | rows (self) |
Return the number of rows in the matrix. | |
int | cols (self) |
Return the number of columns in the matrix. | |
Public Attributes | |
numpy_mat | |
def stag.utility.DenseMat.__init__ | ( | self, | |
Union[np.ndarray, List[List[float]]] | matrix | ||
) |
Construct a STAG DenseMat.
Pass either a numpy ndarray or a List of Lists representing the matrix.
np.ndarray stag.utility.DenseMat.to_numpy | ( | self | ) |
Convert the STAG DenseMat object to a numpy matrix.
'DenseMat' stag.utility.DenseMat.transpose | ( | self | ) |
Return the transpose of the matrix.
Tuple[int, int] stag.utility.DenseMat.shape | ( | self | ) |
Return the shape of the matrix.
int stag.utility.DenseMat.rows | ( | self | ) |
Return the number of rows in the matrix.
int stag.utility.DenseMat.cols | ( | self | ) |
Return the number of columns in the matrix.
stag.utility.DenseMat.numpy_mat |