Skip to main content

A mathematics matrix module for Python3

Project description

Matrix

Mathematical matrix module for Python

Requirements

  • Python 3

Usage

Create a Matrix by specifying dimensions or passing in a list of lists.

matrix_dimension = Matrix(10, 10)
matrix_listlist = Matrix([[1, 2], [3, 4], [5, 6], [7, 8]])

Note: All functions and operations will create a new Matrix instance, similar to the behaviour of Pandas' Dataframes.

Operations

Addition

Constant addition:

matrix: Matrix
k: int

matrix + k

Matrix addition:

a_matrix: Matrix
b_matrix: Matrix

a_matrix + b_matrix

Multiplication

Constant multiplication:

matrix: Matrix
k: int

matrix * k

Matrix multiplication:

a_matrix: Matrix
b_matrix: Matrix

a_matrix * b_matrix

Transposing

matrix: Matrix

matrix.transpose()

Examples

A: Matrix = 
13 83 42 69 73 35 14 43 50 58
 9 16 25 58 51 70 52 68 83 65
72 52  4 84 12 10 30 90 55  3
60 71 47 20 60 93 45 50  9 46
84  6 58 71 90 49 49 97  9 58

B: Matrix = 
96 85 52  5 81  35 54 72 67 10
98 90 71 64 56  70 60  4 92 20
 9 47 42 13 42  35 31 33 46 54
45 26 29 25 66  17 89 42 18 46
79 86 36 59 51 100 65 13 25 39

C: Matrix = 
 7  6 64 23 40
92 24 55 75 74
83 88 55 52 74
68 14 52 64  2
57 21 73 33 81
40 60 27 11 86
 2 88 98 95 85
37 12 24 76 77
44 37 58 92 89
12  4 79 94 37

k: int = 2

A + k
15 85 44 71 75 37 16 45 52 60
11 18 27 60 53 72 54 70 85 67
74 54  6 86 14 12 32 92 57  5
62 73 49 22 62 95 47 52 11 48
86  8 60 73 92 51 51 99 11 60

A + B
109 168 94  74 154  70  68 115 117 68
107 106 96 122 107 140 112  72 175 85
 81  99 46  97  54  45  61 123 101 57
105  97 76  45 126 110 134  92  27 92
163  92 94 130 141 149 114 110  34 97

A * k
 26 166  84 138 146  70  28  86 100 116
 18  32  50 116 102 140 104 136 166 130
144 104   8 168  24  20  60 180 110   6
120 142  94  40 120 186  90 100  18  92
168  12 116 142 180  98  98 194  18 116

A * C
25981 14195 27455 30568 29928
20313 17444 28137 32726 33109
18262  9827 21729 26678 23510
22241 18397 28027 26659 34208
22651 17617 32715 31758 34323

A.transpose()
13  9 72 60 84
83 16 52 71  6
42 25  4 47 58
69 58 84 20 71
73 51 12 60 90
35 70 10 93 49
14 52 30 45 49
43 68 90 50 97
50 83 55  9  9
58 65  3 46 58

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

PyMat-0.0.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

PyMat-0.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file PyMat-0.0.2.tar.gz.

File metadata

  • Download URL: PyMat-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for PyMat-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d9ed578346f1341421979cf86cddad56ec67dfd0703d6327f5e0bed56821c333
MD5 9c47be660eb5e4267c0c0b29969461c8
BLAKE2b-256 15012f2de1b6db2585f988a71215d7eb2c3ca60d78803f073166d3c5ba2ecfde

See more details on using hashes here.

File details

Details for the file PyMat-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: PyMat-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for PyMat-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a85acc1fc1e7107e8148982af61e5cb6fbc4aaa46283f470e8c5cb651662e1f5
MD5 340cf59bd573dc960515daeace66b93b
BLAKE2b-256 99656aed9795221086f8ce7e531e8ef8839b39384a0fd7e93fe3f8e5e9bf90b7

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