STAG Python  2.0.2
Spectral Toolkit of Algorithms for Graphs
Loading...
Searching...
No Matches
stag.utility.DenseMat Class Reference

Description

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.
 
'DenseMattranspose (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
 

Constructor & Destructor Documentation

◆ __init__()

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.

Member Function Documentation

◆ to_numpy()

np.ndarray stag.utility.DenseMat.to_numpy (   self)

Convert the STAG DenseMat object to a numpy matrix.

◆ transpose()

'DenseMat' stag.utility.DenseMat.transpose (   self)

Return the transpose of the matrix.

◆ shape()

Tuple[int, int] stag.utility.DenseMat.shape (   self)

Return the shape of the matrix.

◆ rows()

int stag.utility.DenseMat.rows (   self)

Return the number of rows in the matrix.

◆ cols()

int stag.utility.DenseMat.cols (   self)

Return the number of columns in the matrix.

Member Data Documentation

◆ numpy_mat

stag.utility.DenseMat.numpy_mat