Basic Operations For Matrices
Project description
SNMATRICES
- These Operations will work only ,if both the matrices are of same order
Matrix_Operations:
MODULE NAME:operations.py
1)Getting input matrix: Function:input_matrix(Number of rows,Number of columns)
2)Matrix Addition: Function:matrix_addition(matrixA,matrixB)
3)Matrix Subraction Function:matrix_subraction(matrixA,matrixB)
-4)Matrix Multiplication: -Function:matrix_multiplication(matrixA,matrixB)
SOURCE CODE
MATRIX ADDITION
def matrix_addition(A,B): mat_addition=[] for i in range(len(A)): c=[] for j in range(len(B[0])): c.append(A[i][j]+B[i][j]) mat_addition.append(c) print('Matrix Addition=') print(mat_addition)
MATRIX SUBRACTION
def matrix_subraction(A,B): mat_subraction=[] for i in range(len(A)): c=[] for j in range(len(B)): c.append(A[i][j]-B[i][j]) mat_subraction.append(c) print('Matrix Subraction=') print(mat_subraction)
MATRIX MULTIPLICATION
def matrix_multiplication(A,B): mul_result=[] for i in range(len(A)): c=[] for j in range(len(B[0])): result=0 for k in range(len(B)): result+=A[i][k]*B[k][j] c.append(result) mul_result.append(c) print('Matrix Multiplication=') print(mul_result)
INPUT MATRIX
def input_matrix(rows,columns): A=[] print('Enter the entries row wise:') a=[] for i in range(rows): a=[] for j in range(columns): a.append(int(input())) A.append(a) print('Input Matrix=') print(A)
##LICENSE MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matSN-0.0.1.tar.gz.
File metadata
- Download URL: matSN-0.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
195a43096ce5561f2f5ca007d88bea91d93209bd937628d31f95735b946386f2
|
|
| MD5 |
267d3e0490850e7fccf295476fbba34f
|
|
| BLAKE2b-256 |
4d5c104628e0b3afaa12884d225c963d3d87467deb17301ba73223b651ed1c94
|
File details
Details for the file matSN-0.0.1-py3-none-any.whl.
File metadata
- Download URL: matSN-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4cce3466790fb4bf0d17a5a6f1ca1d5a7e2bbdcb108453b1207fe9610f05724
|
|
| MD5 |
77e2b32f3207f7dde2321de59beffdd0
|
|
| BLAKE2b-256 |
c4c795809b11805200494f8f5ca55f5e3a4cb694f9cca5fd03ea3da64acb3ba3
|