sparsity-pattern

Generate different types of sparsity pattern for sparse matrices.

https://github.com/ulf1/sparsity-pattern

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary

Keywords

sparse-matrix sparsity-pattern
Last synced: 6 months ago · JSON representation

Repository

Generate different types of sparsity pattern for sparse matrices.

Basic Info
  • Host: GitHub
  • Owner: ulf1
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 72.3 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • Open Issues: 14
  • Releases: 2
Topics
sparse-matrix sparsity-pattern
Created almost 6 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog Funding License Zenodo

README.md

PyPI version PyPi downloads DOI sparsity-pattern Total alerts Language grade: Python

sparsity-pattern

Generate different types of sparsity pattern for sparse matrices.

Installation

The sparsity-pattern git repo is available as PyPi package

pip install sparsity-pattern pip install git+ssh://git@github.com/ulf1/sparsity-pattern.git

Usage

The block-diagonal pattern for tensorflow

```py import sparsity_pattern import tensorflow as tf

nrows, ncols = 10, 12 idx = sparsitypattern.get('block', min(nrows, ncols), blocksizes=[3, 1, 2])

mat = tf.sparse.SparseTensor( denseshape=(nrows, ncols), indices=tf.convertto_tensor(idx, dtype=tf.int64), values=range(1, len(idx)+1))

print(tf.sparse.to_dense(mat)) ```

The circle pattern for pytorch

```py import sparsity_pattern import torch

nrows, ncols = 5, 7 idx = sparsitypattern.get('circle', min(nrows, n_cols), offsets=[1, 2])

mat = torch.sparsecootensor( indices=torch.tensor(idx).transpose(0, 1), values=range(1, len(idx)+1), size=[nrows, ncols])

print(mat.to_dense()) ```

The triu pattern for scipy

```py import sparsity_pattern import scipy.sparse import numpy as np

n, k = 4, -1 idx = sparsitypattern.get('triu', n, k) idxrows, idxcols = np.array(idx)[:, 0], np.array(idx)[:, 1] mat = scipy.sparse.lilmatrix((n, n), dtype=np.int64) mat[idxrows, idxcols] = range(1, len(idx)+1)

print(mat.todense()) ```

Check the examples folder for more notebooks.

Appendix

Install a virtual environment

python3 -m venv .venv source .venv/bin/activate pip3 install --upgrade pip pip3 install -r requirements-dev.txt pip3 install -r requirements-demo.txt

(If your git repo is stored in a folder with whitespaces, then don't use the subfolder .venv. Use an absolute path without whitespaces.)

Python commands

  • Jupyter for the examples: jupyter lab
  • Check syntax: flake8 --ignore=F401 --exclude=$(grep -v '^#' .gitignore | xargs | sed -e 's/ /,/g')
  • Run Unit Tests: pytest

Publish

sh pandoc README.md --from markdown --to rst -s -o README.rst python setup.py sdist twine upload -r pypi dist/*

Clean up

find . -type f -name "*.pyc" | xargs rm find . -type d -name "__pycache__" | xargs rm -r rm -r .pytest_cache rm -r .venv

Support

Please open an issue for support.

License and citation

This software is licensed under Apache License 2.0 and archived on Zenodo. If you would like to cite the software, please use this DOI: 10.5281/zenodo.4357290.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.

Owner

  • Name: Ulf Hamster
  • Login: ulf1
  • Kind: user

1x developer

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 39
  • Total Committers: 3
  • Avg Commits per committer: 13.0
  • Development Distribution Score (DDS): 0.128
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
UH 5****6@g****m 34
snyk-bot s****t@s****o 4
LGTM Migrator l****r 1
Committer Domains (Top 20 + Academic)
snyk.io: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 8
  • Total pull requests: 24
  • Average time to close issues: 2 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ulf1 (8)
Pull Request Authors
  • ulf1 (25)
  • snyk-bot (2)
  • lgtm-com[bot] (1)
Top Labels
Issue Labels
wontfix (2) documentation (1) invalid (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 33 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 2
  • Total versions: 8
  • Total maintainers: 1
pypi.org: sparsity-pattern

Generate different types of sparsity pattern for sparse matrices.

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 33 Last month
Rankings
Dependent packages count: 10.0%
Dependent repos count: 11.6%
Forks count: 22.6%
Average: 23.1%
Downloads: 32.5%
Stargazers count: 38.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements-demo.txt pypi
  • jupyterlab ==1.
  • scipy ==1.
  • tensorflow ==2.
  • torch ==1.
requirements-dev.txt pypi
  • flake8 >=3.8.4 development
  • pypandoc >=1.5 development
  • pytest >=6.2.1 development
  • setuptools >=56.0.0 development
  • twine ==3.3.0 development
  • wheel >=0.31.0 development
.github/workflows/syntax-and-unit-tests.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v1 composite
.github/workflows/codeql.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
setup.py pypi