tno.mpc.mpyc.matrix-inverse

TNO PET Lab - secure Multi-Party Computation (MPC) - MPyC - Matrix Inverse

https://github.com/tno-mpc/mpyc.matrix_inverse

Science Score: 44.0%

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

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary

Keywords

matrix-inverse mpc mpc-lab mpyc multi-party-computation pet-lab secret-sharing tno
Last synced: 6 months ago · JSON representation ·

Repository

TNO PET Lab - secure Multi-Party Computation (MPC) - MPyC - Matrix Inverse

Basic Info
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
matrix-inverse mpc mpc-lab mpyc multi-party-computation pet-lab secret-sharing tno
Created over 4 years ago · Last pushed about 4 years ago
Metadata Files
Readme License Citation

README.md

TNO MPC Lab - MPyC - Matrix Inverse

The TNO MPC lab consists of generic software components, procedures, and functionalities developed and maintained on a regular basis to facilitate and aid in the development of MPC solutions. The lab is a cross-project initiative allowing us to integrate and reuse previously developed MPC functionalities to boost the development of new protocols and solutions.

The package tno.mpc.mpyc.matrix_inverse is part of the TNO Python Toolbox.

This package is based on the demo ridgeregression.py from the MPyC library on Feb 26th, 2020, as implemented by Frank Blom. https://github.com/lschoe/mpyc/blob/2de1dd76db632bdc2a48acfbbaab841fa73cf8bd/demos/ridgeregression.py. The underlying theory is published in the paper 'Efficient Secure Ridge Regression from Randomized Gaussian Elimination' by Frank Blom, Niek J. Bouman, Berry Schoenmakers, and Niels de Vreede, presented at TPMPC 2019 by Frank Blom. See https://eprint.iacr.org/2019/773 (or https://ia.cr/2019/773).

Note: we added support for secure fixed points (SecFxp).

Limitations in (end-)use: the content of this software package may solely be used for applications that comply with international export control laws.
This implementation of cryptographic software has not been audited. Use at your own risk.

Documentation

Documentation of the tno.mpc.mpyc.matrix_inverse package can be found here.

Install

Easily install the tno.mpc.mpyc.matrixinverse package using pip: ```console $ python -m pip install tno.mpc.mpyc.matrixinverse ```

Note:

A significant performance improvement can be achieved by installing the GMPY2 library. console $ python -m pip install 'tno.mpc.mpyc.matrix_inverse[gmpy]'

If you wish to run the tests you can use: console $ python -m pip install 'tno.mpc.mpyc.matrix_inverse[tests]'

Usage

Usage

example.py ```python import numpy as np from mpyc.runtime import mpc from tno.mpc.mpyc.matrixinverse import matrixinverse

async def main(): X = (np.random.randint(low=-1000, high=1000, size=(5, 5)) / 10).tolist() Xinv = np.linalg.inv(X).tolist() await mpc.start()

secfxp = mpc.SecFxp()
X_mpc = [[secfxp(x) for x in row] for row in X]
X_mpc = [mpc.input(row, 0) for row in X_mpc]

inverse = matrix_inverse(X_mpc)
Xinv_mpc = [await mpc.output(_) for _ in inverse]
Xinv_mpc = [[float(xx) for xx in x] for x in Xinv_mpc]

checker = mpc.matrix_prod(X_mpc, inverse)
checker = [await mpc.output(_) for _ in checker]

diff = np.array(Xinv) - np.array(Xinv_mpc)
rel_diff = np.divide(
    diff, np.array(Xinv), out=np.zeros_like(diff), where=np.array(Xinv) != 0
)

await mpc.shutdown()

print(f"X = \n{np.array(X)}\n")
print(f"Xinv = \n{np.array(Xinv)}\n")
print(f"Xinv_mpc = \n{np.array(Xinv_mpc)}\n")
print(f"X * Xinv_mpc = \n{np.array(checker)}\n")
print(f"max absolute diff = {np.abs(diff).max()}")
print(f"max relative diff (nonzero entries) = {np.abs(rel_diff).max()}")

if name == "main": mpc.run(main()) ```

Owner

  • Name: TNO - MPC Lab
  • Login: TNO-MPC
  • Kind: organization
  • Email: mpclab@tno.nl
  • Location: Anna van Buerenplein 1, 2595 DA Den Haag, The Netherlands

TNO - MPC Lab

Citation (CITATION.cff)

cff-version: 1.2.0
license: Apache-2.0
message: If you use this software, please cite it using these metadata.
authors:
      - name: TNO MPC Lab
        city: The Hague
        country: NL
        email: mpclab@tno.nl
        website: https://mpc.tno.nl
type: software
url: https://mpc.tno.nl
contact:
      - name: TNO MPC Lab
        city: The Hague
        country: NL
        email: mpclab@tno.nl
        website: https://mpc.tno.nl
repository-code: https://github.com/TNO-MPC/mpyc.matrix_inverse
repository-artifact: https://pypi.org/project/tno.mpc.mpyc.matrix_inverse
title: TNO MPC Lab - MPyC - Matrix Inverse
version: v0.4.3
date-released: 2021-12-28

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 3
  • Total Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Thomas Rooijakkers t****s@t****l 3
Committer Domains (Top 20 + Academic)
tno.nl: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 35 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: tno.mpc.mpyc.matrix-inverse

A generic extension to MPyC that allows you to securely compute the inverse of a matrix that may contain SecFxp values

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 35 Last month
Rankings
Dependent packages count: 6.6%
Forks count: 30.5%
Dependent repos count: 30.6%
Average: 31.3%
Stargazers count: 39.1%
Downloads: 49.8%
Maintainers (1)
Last synced: 6 months ago