spla
Loading...
Searching...
No Matches
spla::MtxLoader Class Reference

Loader for matrix data stored in matrix-market (.mtx) format. More...

#include <io.hpp>

Public Member Functions

 MtxLoader (std::string name="")
 
 ~MtxLoader ()=default
 
bool load (std::filesystem::path file_path, bool offset_indices=true, bool make_undirected=true, bool remove_loops=true)
 Load .mtx data from given file path.
 
bool save (const std::filesystem::path &file_path, bool stats_only=false)
 Saves loaded data at file.
 
void calc_stats ()
 
void output_stats ()
 
const std::vector< uint > & get_Ai () const
 
const std::vector< uint > & get_Aj () const
 
uint get_n_rows () const
 
uint get_n_cols () const
 
std::size_t get_n_values () const
 

Detailed Description

Loader for matrix data stored in matrix-market (.mtx) format.

Constructor & Destructor Documentation

◆ MtxLoader()

spla::MtxLoader::MtxLoader ( std::string name = "")
explicit

◆ ~MtxLoader()

spla::MtxLoader::~MtxLoader ( )
default

Member Function Documentation

◆ calc_stats()

void spla::MtxLoader::calc_stats ( )

◆ get_Ai()

const std::vector< uint > & spla::MtxLoader::get_Ai ( ) const
nodiscard

◆ get_Aj()

const std::vector< uint > & spla::MtxLoader::get_Aj ( ) const
nodiscard

◆ get_n_cols()

uint spla::MtxLoader::get_n_cols ( ) const
nodiscard

◆ get_n_rows()

uint spla::MtxLoader::get_n_rows ( ) const
nodiscard

◆ get_n_values()

std::size_t spla::MtxLoader::get_n_values ( ) const
nodiscard

◆ load()

bool spla::MtxLoader::load ( std::filesystem::path file_path,
bool offset_indices = true,
bool make_undirected = true,
bool remove_loops = true )

Load .mtx data from given file path.

Parameters
file_pathRelative or absolute path to file
offset_indicesTrue if requires indices offset by -1
make_undirectedTrue if for each directed edge reverse edge must be added
remove_loopsTrue if self-loops must be removed
Returns
True if successfully loaded

◆ output_stats()

void spla::MtxLoader::output_stats ( )

◆ save()

bool spla::MtxLoader::save ( const std::filesystem::path & file_path,
bool stats_only = false )

Saves loaded data at file.

Parameters
file_pathFile to create where to save data
stats_onlySave only stats without actual graph data
Returns
True if successfully saved

The documentation for this class was generated from the following files: