"The world is your slate. You get to write on it, layer by layer."
SLATE (Sparse Automatic Transformation Environment) is a Python package designed to simplify the representation and manipulation of sparse or compressed matrices through a hierarchical, modular system. By providing composable primitives like diagonal, truncated, and COO (Coordinate List) bases, SLATE allows for flexibility and automatic transformations between different matrix representations.
SLATE aims to be versatile and structured, making it ideal for users who need a flexible environment to work with matrix and tensor computations without the constraints of optimization or efficiency requirements.
- Composable Primitives: Use diagonal, truncated, transformed, and other bases to build complex matrix representations.
- Hierarchical Basis: A modular and hierarchical approach to represent matrices and tensors.
- Automatic Transformations: Seamlessly switch between different matrix representations.
- Sparse Representation: Handle large, sparse matrices in an intuitive way.
- Customization: Combine and expand matrix basis in any configuration you need.
You can install SLATE directly via pip:
pip install slate-coreTo create a Array with a given basis and data:
import numpy as np
from slate_core.array import Array
from slate_core.basis import FundamentalBasis
from slate_core.metadata import SimpleMetadata
# Create some data
data = np.array([[1, 2], [3, 4]])
# Create a Array
new_slate_array = Array.from_array(data)
print(slate_array.raw_data)SLATE supports various bases like TruncatedBasis, CroppedBasis, and TransformedBasis. Here is an example of using a CroppedBasis:
from slate_core.basis import CroppedBasis
from slate_core.metadata import BasisMetadata
# Create a truncated basis
truncated_basis = CroppedBasis(10, FundamentalBasis(SimpleMetadata((20,))))
# Create a Array with the truncated basis
truncated_slate_array = ArrayBuilder(truncated_basis, data)To convert the Array back to a full NumPy array:
full_array = slate_array.as_array()
print(full_array)