Skip to main content

Matrix on class

Project description

Matrix Class Library

This Python library provides an implementation of a matrix using classes, offering a range of functionalities for matrix operations.

Installation

Install the library using pip:

pip install matrix_class

Features

  • Initialization: Create matrices with specified rows and columns.
  • Item Assignment and Retrieval: Set and get values of specific cells in the matrix.
  • Matrix Properties: Access the number of rows and columns in the matrix.
  • String Representation: Print the matrix in a readable format.
  • Determinant Calculation: Compute the determinant of the matrix.
  • Matrix Arithmetic: Perform addition, subtraction, and multiplication (with both scalars and other matrices).
  • Matrix Transposition: Transpose the matrix, swapping rows with columns.
  • Matrix Inversion: Invert a matrix, provided it is square and has a non-zero determinant.
  • Matrix Complementation: Calculate the complement of a matrix.

Usage

Below are some examples of how to use the Matrix class:

from matrix import Matrix

# Create a new Matrix with specified dimensions
matrix = Matrix(3, 3)

# Set and get values
matrix[1, 1] = 5.0
value = matrix[1, 1]

# Access matrix properties
rows = matrix.rows
columns = matrix.columns

# Print the matrix
print(matrix)

# Perform arithmetic operations
sum_matrix = matrix1 + matrix2
difference = matrix1 - matrix2
product = matrix1 * matrix2
scaled_matrix = matrix * 2.0

# Transpose and invert matrices
transposed_matrix = matrix.get_transported()
inverse_matrix = matrix.get_inverse()

Contributing

Contributions to enhance the Matrix Class Library are welcomed. Please open an issue first to discuss proposed changes. Ensure to update tests as appropriate.

License

This library is released under the MIT License.

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

matrix_class-0.2.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

matrix_class-0.2.0-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page