MatrixGen
Overview
- MatrixGen is a modular Python package for generating, resizing, and analyzing sparse matrices. It supports multiple synthesis methods and provides tools for structure-aware scaling, useful in scientific computing, numerical simulations, and ML workloads where realistic matrix patterns are essential.
Features
-
Modular Sparse Matrix Generation Generate structurally realistic sparse matrices of arbitrary size from a given base matrix using a unified and extensible framework.
-
Multiple Scaling Techniques Includes support for adapted resizing methods such as:
-
Nearest Neighbor
-
Bilinear Interpolation
-
Lanczos Resampling
-
Discrete Fourier Transform (DFT)
-
Discrete Cosine Transform (DCT)
-
Wavelet Transforms
-
-
Preservation of Structure and Sparsity Each method is designed to maintain key structural properties including sparsity patterns, symmetry, and bandwidth.
-
Controlled Randomization Allows slight variations during generation to support realistic data augmentation while retaining essential characteristics.
-
Feature-Based Evaluation Measures similarity between original and synthetic matrices using structural features like:
-
Nonzero density
-
Bandwidth and profile
-
Symmetry (Psym)
-
Diagonal spread and entropy
-
Row/column distribution metrics
Cosine similarity is used to quantify structural preservation.
-
-
Scalable Generation Capable of generating matrices at much larger scales than the input while preserving core traits — useful for performance benchmarking and large-scale ML testing.
-
Fills a Sparse Matrix Data Gap Addresses the lack of diverse, realistic sparse matrices for algorithm validation, benchmarking, and ML applications.
Requirements
- Handled automatically via Poetry. Requires Python 3.11 or higher.
Installation
You can install MatrixGen via pip from PyPI:
$ pip install matrixgen
Usage
You can use MatrixGen via:
- Python API:
from matrixgen import RESIZE_METHODS, resize_matrix, load_matrix, save_matrix - Command Line: Run
matrixgen --helpto see options - See the examples/ folder for usage patterns.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the Apache 2.0 license, MatrixGen is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.
This project is based off of MatrixGen-d which in itself is a fork of the original MatrixGen by Ali Emre Pamuk, Mert Altekin, and Faruk Kaplan. They are the original creators of the matrix synthesis/generation/resizing logic and without them, this project wouldn't exist.
Metadata
Release files for matrixgen 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| matrixgen-0.1.0.tar.gz | 32.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| matrixgen-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.4 kB
Release files / matrixgen-0.1.0.tar.gz
| Download URL | matrixgen-0.1.0.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
826f04a92a4c36980f4f613d12b7bb6b62f962887b7beccace9141415ce06cb8
|
|
BLAKE2b-256 checksum How to use checksums |
cf1bbde9d3cb06b251352d5ed6cd82f1ca35baee2cd93012dcc29ac80e43b949
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-26-generic
|
Release files / matrixgen-0.1.0-py3-none-any.whl
| Download URL | matrixgen-0.1.0-py3-none-any.whl |
|---|---|
| Size | 36.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6adf07c24965048b9a02b683978950fd9e529fe674258777eecab8398a77d78
|
|
BLAKE2b-256 checksum How to use checksums |
f99f7cbe8258758bea8d691b4eb3932fa5a4db425454452f56a1bf9bf6b6efbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-26-generic
|
Security for matrixgen 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.