This project provides tatami matrix representations in Python.
Package is published to PyPI
pip install mattress
Currently only supports dense matrices.
To convert a numpy dense matrix to tatami representation -
import numpy as np
from mattress import tatamize
x = np.random.rand(1000, 100)
tatamat = tatamize(y)
Methods are available to access the matrix by row
, column
tatamat.row(0)
tatamat.column(1)
Additionally you can also specify if the input matrix is a column or row major.
x = np.ones((2, 3), order='F')
tatamat = tatamize(y, order="F")
Steps to setup dependencies -
- initialize git submodules in
extern/tatami
&extern/tatami_hdf5
First one needs to build the extern library, this would generate a shared object file to src/mattress/core-[*].so
python setup.py build_ext --inplace
For typical development workflows, run this for tests
python setup.py build_ext --inplace && tox
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.