项目作者: sauln

项目描述 :
Simple module for computing Smith Normal Form of a numpy array over Z_2
高级语言: Python
项目地址: git://github.com/sauln/smith-normal-form.git
创建时间: 2018-04-01T05:52:08Z
项目社区:https://github.com/sauln/smith-normal-form

开源协议:

下载


smith-normal-form

Simple module for computing Smith Normal Form of a numpy array over Z_2

Usage

  1. import numpy as np
  2. from snf import SmithNormalForm
  3. bm = np.array([[1, 1, 0, 0, 0, 0, 0],
  4. [1, 0, 1, 1, 1, 0, 0],
  5. [0, 1, 1, 0, 0, 1, 0],
  6. [0, 0, 0, 1, 0, 1, 1],
  7. [0, 0, 0, 0, 1, 0, 1]])
  8. smithers = SmithNormalForm()
  9. bm_snf = smithers.smithify(bm)
  10. >>> array([[1, 0, 0, 0, 0, 0, 0],
  11. [0, 1, 0, 0, 0, 0, 0],
  12. [0, 0, 1, 0, 0, 0, 0],
  13. [0, 0, 0, 1, 0, 0, 0],
  14. [0, 0, 0, 0, 0, 0, 0]])