Skip to main content

Synthetic Sparse Matrix Generator

Project description

MatrixGen

PyPI Status Python Version License

Read the documentation at https://matrixgen.readthedocs.io/ Tests Codecov

pre-commit Black

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 --help to 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matrixgen-0.1.0.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matrixgen-0.1.0-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file matrixgen-0.1.0.tar.gz.

File metadata

  • Download URL: matrixgen-0.1.0.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-26-generic

File hashes

Hashes for matrixgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 826f04a92a4c36980f4f613d12b7bb6b62f962887b7beccace9141415ce06cb8
MD5 c02b0165e30548bb6b2e404fed6a002a
BLAKE2b-256 cf1bbde9d3cb06b251352d5ed6cd82f1ca35baee2cd93012dcc29ac80e43b949

See more details on using hashes here.

File details

Details for the file matrixgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: matrixgen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-26-generic

File hashes

Hashes for matrixgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6adf07c24965048b9a02b683978950fd9e529fe674258777eecab8398a77d78
MD5 57e00e5bef5c4dd0b5f236f4f7d5d933
BLAKE2b-256 f99f7cbe8258758bea8d691b4eb3932fa5a4db425454452f56a1bf9bf6b6efbb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page