tatami_mtx
Matrix Market to tatami matrices
Loading...
Searching...
No Matches
Classes | Functions
tatami_mtx Namespace Reference

Read tatami matrices from Matrix Market files. More...

Classes

struct  Automatic
 Enable automatic type determination. More...
 
struct  Options
 Options for load_matrix() and friends. More...
 

Functions

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > load_matrix (byteme::Reader &reader, const Options &options)
 
template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > load_matrix_from_text_file (const char *filepath, const Options &options)
 
template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > load_matrix_from_gzip_file (const char *filepath, const Options &options)
 
template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > load_matrix_from_some_file (const char *filepath, const Options &options)
 
template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > load_matrix_from_text_buffer (const unsigned char *buffer, size_t n, const Options &options)
 
template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > load_matrix_from_zlib_buffer (const unsigned char *buffer, size_t n, const Options &options)
 
template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > load_matrix_from_some_buffer (const unsigned char *buffer, size_t n, const Options &options)
 

Detailed Description

Read tatami matrices from Matrix Market files.

Function Documentation

◆ load_matrix()

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > tatami_mtx::load_matrix ( byteme::Reader reader,
const Options options 
)

Load a tatami::Matrix from a Matrix Market file. Coordinate formats will yield a sparse matrix, while array formats will yield a dense matrix. The storage types depend on the Matrix Market field type as well as the settings of StoredValue_ and StoredIndex_.

Template Parameters
Value_Data type for the tatami::Matrix interface.
Index_Integer index type for the tatami::Matrix interface.
StoredValue_Matrix data type that is stored in memory. If set to Automatic, it defaults to double for real/double fields and int for integer fields.
StoredIndex_Index data type that is stored in memory for sparse matrices. If set to Automatic, it defaults to uint8_t if no dimension is greater than 255; uint16_t if no dimension is greater than 65536; and int otherwise.
Parameters
readerA byteme::Reader instance containing bytes from a Matrix Market file.
optionsOptions for loading the matrix.
Returns
Pointer to a tatami::Matrix instance containing data from the Matrix Market file.

◆ load_matrix_from_text_file()

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > tatami_mtx::load_matrix_from_text_file ( const char *  filepath,
const Options options 
)

Load a tatami::Matrix from a Matrix Market text file, see load_matrix() for details.

Template Parameters
Value_Data type for the tatami::Matrix interface.
Index_Integer index type for the tatami::Matrix interface.
StoredValue_Matrix data type that is stored in memory, see load_matrix() for details.
StoredIndex_Index data type that is stored in memory for sparse matrices, see load_matrix() for details.
parallel_Whether to parallelize the loading and parsing.
Parameters
filepathPath to a Matrix Market file.
optionsOptions for loading the matrix.
Returns
Pointer to a tatami::Matrix instance containing data from the Matrix Market file.

◆ load_matrix_from_gzip_file()

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > tatami_mtx::load_matrix_from_gzip_file ( const char *  filepath,
const Options options 
)

Load a tatami::Matrix from a Gzip-compressed Matrix Market file, see load_matrix() for details.

Template Parameters
Value_Data type for the tatami::Matrix interface.
Index_Integer index type for the tatami::Matrix interface.
StoredValue_Matrix data type that is stored in memory, see load_matrix() for details.
StoredIndex_Index data type that is stored in memory for sparse matrices, see load_matrix() for details.
Parameters
filepathPath to a Matrix Market file.
optionsOptions for loading the matrix.
Returns
Pointer to a tatami::Matrix instance containing data from the Matrix Market file.

◆ load_matrix_from_some_file()

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > tatami_mtx::load_matrix_from_some_file ( const char *  filepath,
const Options options 
)

Load a tatami::Matrix from a possibly Gzip-compressed Matrix Market file, see load_matrix() for details.

Template Parameters
Value_Data type for the tatami::Matrix interface.
Index_Integer index type for the tatami::Matrix interface.
StoredValue_Matrix data type that is stored in memory, see load_matrix() for details.
StoredIndex_Index data type that is stored in memory for sparse matrices, see load_matrix() for details.
Parameters
filepathPath to a Matrix Market file.
optionsOptions for loading the matrix.
Returns
Pointer to a tatami::Matrix instance containing data from the Matrix Market file.

◆ load_matrix_from_text_buffer()

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > tatami_mtx::load_matrix_from_text_buffer ( const unsigned char *  buffer,
size_t  n,
const Options options 
)

Load a tatami::Matrix from a buffer containing a Matrix Market file, see load_matrix() for details.

Template Parameters
Value_Data type for the tatami::Matrix interface.
Index_Integer index type for the tatami::Matrix interface.
StoredValue_Matrix data type that is stored in memory, see load_matrix() for details.
StoredIndex_Index data type that is stored in memory for sparse matrices, see load_matrix() for details.
Parameters
bufferArray containing the contents of an uncompressed Matrix Market file.
nLength of the array.
optionsOptions for loading the matrix.
Returns
Pointer to a tatami::Matrix instance containing data from the Matrix Market file.

◆ load_matrix_from_zlib_buffer()

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > tatami_mtx::load_matrix_from_zlib_buffer ( const unsigned char *  buffer,
size_t  n,
const Options options 
)

Load a tatami::Matrix from a buffer containing a Gzip/Zlib-compressed Matrix Market file, see load_matrix() for details.

Template Parameters
Value_Data type for the tatami::Matrix interface.
Index_Integer index type for the tatami::Matrix interface.
StoredValue_Matrix data type that is stored in memory, see load_matrix() for details.
StoredIndex_Index data type that is stored in memory for sparse matrices, see load_matrix() for details.
Parameters
bufferArray containing the contents of a Matrix Market file after Gzip/Zlib compression.
nLength of the array.
optionsOptions for loading the matrix.
Returns
Pointer to a tatami::Matrix instance containing data from the Matrix Market file.

◆ load_matrix_from_some_buffer()

template<typename Value_ , typename Index_ , typename StoredValue_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr< tatami::Matrix< Value_, Index_ > > tatami_mtx::load_matrix_from_some_buffer ( const unsigned char *  buffer,
size_t  n,
const Options options 
)

Load a tatami::Matrix from a buffer containing a possibly Gzip/Zlib-compressed Matrix Market file, see load_matrix() for details.

Template Parameters
Value_Data type for the tatami::Matrix interface.
Index_Integer index type for the tatami::Matrix interface.
StoredValue_Matrix data type that is stored in memory, see load_matrix() for details.
StoredIndex_Index data type that is stored in memory for sparse matrices, see load_matrix() for details.
Parameters
bufferArray containing the contents of a Matrix Market file, possibly after Gzip/Zlib compression.
nLength of the array.
optionsOptions for loading the matrix.
Returns
Pointer to a tatami::Matrix instance containing data from the Matrix Market file.