STAG Python  2.1.2
Spectral Toolkit of Algorithms for Graphs
Loading...
Searching...
No Matches
stag.data Namespace Reference

Classes

class  DataPoint
 A data point in d-dimensional space. More...
 

Functions

stag.utility.DenseMat load_matrix (str filename)
 Load data into a matrix from a file.
 
None save_matrix (stag.utility.DenseMat data, str filename)
 Save a data matrix to a text file.
 

Function Documentation

◆ load_matrix()

stag.utility.DenseMat stag.data.load_matrix ( str  filename)

Load data into a matrix from a file.

Each line of the file corresponds to a row in the matrix. On each row, matrix entries should be separated by blank spaces, or commas. Every row in the file must contain the same number of entries.

Lines beginning with '#' or '//' are ignored.

Parameters
filenamethe name of the file containing the data
Returns
a stag.utility.DenseMat containing the data from the file
Exceptions
aruntime exception if the file doesn't exist or cannot be parsed

◆ save_matrix()

None stag.data.save_matrix ( stag.utility.DenseMat  data,
str  filename 
)

Save a data matrix to a text file.

Parameters
datathe matrix to save
filenamethe name of the file to save the matrix to
Exceptions
aruntime exception if the file cannot be opened for writing