Package: fastMatMR 1.2.5

fastMatMR: High-Performance Matrix Market File Operations
An interface to the 'fast_matrix_market' 'C++' library, this package offers efficient read and write operations for Matrix Market files in R. It supports both sparse and dense matrix formats. Peer-reviewed at ROpenSci (<https://github.com/ropensci/software-review/issues/606>).
Authors:
fastMatMR_1.2.5.tar.gz
fastMatMR_1.2.5.zip(r-4.5)fastMatMR_1.2.5.zip(r-4.4)fastMatMR_1.2.5.zip(r-4.3)
fastMatMR_1.2.5.tgz(r-4.5-x86_64)fastMatMR_1.2.5.tgz(r-4.5-arm64)fastMatMR_1.2.5.tgz(r-4.4-x86_64)fastMatMR_1.2.5.tgz(r-4.4-arm64)fastMatMR_1.2.5.tgz(r-4.3-x86_64)fastMatMR_1.2.5.tgz(r-4.3-arm64)
fastMatMR_1.2.5.tar.gz(r-4.5-noble)fastMatMR_1.2.5.tar.gz(r-4.4-noble)
fastMatMR_1.2.5.tgz(r-4.4-emscripten)fastMatMR_1.2.5.tgz(r-4.3-emscripten)
fastMatMR.pdf |fastMatMR.html✨
fastMatMR/json (API)
NEWS
# Install 'fastMatMR' in R: |
install.packages('fastMatMR', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org')) |
Reviews:rOpenSci Software Review #606
Bug tracker:https://github.com/ropensci/fastmatmr/issues
Pkgdown site:https://docs.ropensci.org
On CRAN:fastMatMR (archived)
cpp17matrix-marketmatrix-market-formatr-cpp11cpp
Last updated 1 years agofrom:9146e5de53 (on main). Checks:12 OK. Indexed: yes.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Mar 14 2025 |
R-4.5-win-x86_64 | OK | Mar 14 2025 |
R-4.5-mac-x86_64 | OK | Mar 14 2025 |
R-4.5-mac-aarch64 | OK | Mar 14 2025 |
R-4.5-linux-x86_64 | OK | Mar 14 2025 |
R-4.4-win-x86_64 | OK | Mar 14 2025 |
R-4.4-mac-x86_64 | OK | Mar 14 2025 |
R-4.4-mac-aarch64 | OK | Mar 14 2025 |
R-4.4-linux-x86_64 | OK | Mar 14 2025 |
R-4.3-win-x86_64 | OK | Mar 14 2025 |
R-4.3-mac-x86_64 | OK | Mar 14 2025 |
R-4.3-mac-aarch64 | OK | Mar 14 2025 |
Exports:fmm_to_matfmm_to_sparse_Matrixfmm_to_vecintmat_to_fmmintvec_to_fmmmat_to_fmmsparse_Matrix_to_fmmvec_to_fmmwrite_fmm
Dependencies:cpp11
Benchmarking Sparse Matrix Market Read Operations
Rendered fromfmm_read_bench.Rmd
usingknitr::rmarkdown
on Mar 14 2025.Last update: 2023-11-03
Started: 2023-09-02
Benchmarking Sparse Matrix Market Write Operations
Rendered fromfmm_write_bench.Rmd
usingknitr::rmarkdown
on Mar 14 2025.Last update: 2023-11-03
Started: 2023-08-31
Getting Started
Rendered fromfastMatMR.Rmd
usingknitr::rmarkdown
on Mar 14 2025.Last update: 2023-11-03
Started: 2023-10-24
Citation
To cite package ‘fastMatMR’ in publications use:
Goswami R (2025). fastMatMR: High-Performance Matrix Market File Operations. R package version 1.2.5, https://github.com/ropensci/fastmatmr.
Corresponding BibTeX entry:
@Manual{, title = {fastMatMR: High-Performance Matrix Market File Operations}, author = {Rohit Goswami}, year = {2025}, note = {R package version 1.2.5}, url = {https://github.com/ropensci/fastmatmr}, }
Readme and manuals
fastMatMR
fastMatMR

About
fastMatMR
provides R bindings for reading and writing to Matrix
Market files using the
high-performance fast_matrix_market C++
library (version
1.7.4).
Why?
Matrix Market files
are crucial to much of the data-science ecosystem. The fastMatMR
package focuses on high-performance read and write operations for Matrix
Market files, serving as a key tool for data extraction in computational
and data science pipelines.
The target audience and scientific applications primarily include data scientists or researchers developing numerical methods who may wish to either test standard NIST (National Institute of Standards and Technology) which include:
comparative studies of algorithms for numerical linear algebra, featuring nearly 500 sparse matrices from a variety of applications, as well as matrix generation tools and services.
Additionally, being able to use the matrix market file format, means it
is easier to interface R
analysis with those in Python
(e.g. SciPy
uses the same underlying C++
library). These files can also be used
with the Tensor Algebra
Compiler (TACO).
Features
-
Extended Support:
fastMatMR
supports standard R vectors, matrices, as well asMatrix
sparse objects. -
Performance: The package is a thin wrapper around one of the fastest C++ libraries for reading and writing
.mtx
files. -
Correctness: Unlike
Matrix
, roundtripping withNA
andNaN
values works by coercing toNaN
instead of to arbitrarily high numbers.
We have vignettes for both read and write operations to demonstrate the performance claims.
Alternatives and statement of need
- The
Matrix
package allows reading and writing sparse matrices in the.mtx
(matrix market) format.- However, for
.mtx
files, it can only handles sparse matrices for writing and reading. - Round-tripping (writing and subsequently reading) data with
NA
andNaN
values produces arbitrarily high numbers instead of preservingNaN
/ handlingNA
- However, for
Installation
CRAN
For the latest CRAN
version:
install.packages("fastMatMR")
R-Universe
For the latest development version of fastMatMR
:
install.packages("fastMatMR",
repos = "https://ropensci.r-universe.dev")
Development Git
For the latest commit, one can use:
# install.packages("devtools")
# devtools::install_github("ropensci/fastMatMR")
install.packages("fastMatMR", repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))
Quick Example
library(fastMatMR)
spmat <- Matrix::Matrix(c(1, 0, 3, 2), nrow = 2, sparse = TRUE)
write_fmm(spmat, "sparse.mtx")
fmm_to_sparse_Matrix("sparse.mtx")
The resulting .mtx
file is language agnostic, and can even be read
back in python
as an example:
pip install fast_matrix_market
python -c 'import fast_matrix_market as fmm; print(fmm.read_array_or_coo("sparse.mtx"))'
((array([1., 3., 2.]), (array([0, 0, 1], dtype=int32), array([0, 1, 1], dtype=int32))), (2, 2))
python -c 'import fast_matrix_market as fmm; print(fmm.read_array("sparse.mtx"))'
array([[1., 3.],
[0., 2.]])
Similarly, fastMatMR
supports writing and reading from other R
objects (e.g. standard R vectors and matrices), as seen in the getting
started
vignette.
Contributing
Contributions are very welcome. Please see the Contribution Guide and our Code of Conduct.
License
This project is licensed under the MIT License.
Logo
The logo was generated via a non-commercial use prompt on hotpot.ai, both blue, and green, as a riff on the NIST Matrix Market logo. The text was added in a presentation software (WPS Presentation). Hexagonal cropping was accomplished in a hexb compatible design using hexsticker.
Help Manual
Help page | Topics |
---|---|
Convert Matrix Market File to Matrix | fmm_to_mat |
Convert Matrix Market File to Sparse Matrix | fmm_to_sparse_Matrix |
Convert Matrix Market File to Numeric Vector | fmm_to_vec |
Convert a Numeric Matrix to Matrix Market Format | intmat_to_fmm |
Convert a numeric integer vector to Matrix Market Format | intvec_to_fmm |
Convert a Numeric Matrix to Matrix Market Format | mat_to_fmm |
Convert a Sparse Numeric Matrix to Matrix Market Format | sparse_Matrix_to_fmm |
Convert a Numeric Vector to Matrix Market Format | vec_to_fmm |
Convert Various Numeric Types to Matrix Market Format | write_fmm |