Skip to main content

Matrix Reduction Utils

Project description

MRUs: Matrix Reduction Utils

Author @MingjunXu

Use MRUs in your project

from MRUs import *

LU Factorization

A = np.array([[0, 1, 1],
              [1, 1, 1],
              [1, 1, 1]], dtype=float)
L, U = lu_factorization(A)
print('A 矩阵')
print(A)
print('L 矩阵')
print(L)
print('U 矩阵')
print(U)
print('验证: LU')
print(np.dot(L, U))

QR Factorization

A = np.array([[0, -20, -14],
              [3, 27, -4],
              [4, 11, -2]], dtype=float)
Q, R = qr_factorization(A)
print('A 矩阵')
print(A)
print('Q 矩阵')
print(Q)
print('R 矩阵')
print(R)
print('验证: QR')
print(np.dot(Q, R))

Orthogonal Reduction

Householder Reduction

A = np.array([[3, 2, 9],
              [4, 5, 1],
              [0, 0, 0]], dtype=float)
Q, R = orthogonal_reduction(A, core='householder')
print('A 矩阵')
print(A)
print('Q 矩阵')
print(Q)
print('R 矩阵')
print(R)
print('验证: QR')
print(np.dot(Q, R))

Givens Reduction

A = np.array([[3, 2, 9],
              [4, 5, 1],
              [0, 0, 0]], dtype=float)
Q, R = orthogonal_reduction(A, core='givens')
print('A 矩阵')
print(A)
print('Q 矩阵')
print(Q)
print('R 矩阵')
print(R)
print('验证: QR')
print(np.dot(Q, R))

URV Factorization

A = np.array([[-4, -2, 4, 2],
              [2, -2, -2, -1],
              [-4, 1, 4, 2]], dtype=float) 
U, R, V = urv_factorization(A)
print('A矩阵')
print(A)
print('U矩阵')
print(U)
print('R矩阵')
print(R)
print('V矩阵')
print(V)
print('验证: URV^T')
print(np.dot(np.dot(U, R), V))

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

MRUs-0.0.7.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

MRUs-0.0.7-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file MRUs-0.0.7.tar.gz.

File metadata

  • Download URL: MRUs-0.0.7.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for MRUs-0.0.7.tar.gz
Algorithm Hash digest
SHA256 05ec5a89458cebff85f9996a26eda43d9980987eef9e47970bdfac094e6a681c
MD5 1b252e30a73787bbb24128b0a65d6159
BLAKE2b-256 9fe2b79ec81481c87164ae7b0324b33449712eb37b192ede57fe938f329292bb

See more details on using hashes here.

File details

Details for the file MRUs-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: MRUs-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for MRUs-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f4e5a4b1e7a60d409f61e13d465bc74b9af5aea3b239e5de29318bea662eae7b
MD5 8359dbb154a2d57f683c15a550f8ef28
BLAKE2b-256 aeccb1a4d83acb0257007b70d8bef38fdc80306bec75414fb8673f8f8623f30d

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