Skip to main content

A library for matrix operations with Fraction support

Project description

MATRIX OPERATIONS LIBRARY

This is a Python library that provides functionality to perform basic matrix operations and convert matrices to Reduced Row Echelon Form (RREF). The library supports operations with fractions to maintain precision in calculations.

FEATURES

  • Create and manipulate matrices
  • Add, subtract, multiply, and divide matrices
  • Swap rows of a matrix
  • Convert a matrix to Reduced Row Echelon Form (RREF)
  • Perform operations using fractions (fractions.Fraction) for accurate results

REQUIREMENTS

  • Python 3.7 or later
  • The library depends on Python's built-in fractions.Fraction for precise fractional arithmetic.

INSTALLATION

To install this library, clone this repository:

git clone https://github.com/ArturZZerg/matrix.git

Once cloned, install any necessary dependencies:

pip install -r requirements.txt

If you're using fractions in your code, ensure that you have Python's fractions module available, which comes by default with Python installations.

USAGE

Here's an example of how to use the library:

from matrix import Matrix,calc_matrix

# Create a matrix using a two-dimensional list
A = Matrix([[1, 2], [3, 4]])

# Convert to RREF
calc_matrix(A)
print(A)

MATRIX CLASS METHODS

Initialization

Matrix(matrix: list[list[float]])

Initialize the matrix with a 2D list of numbers.

Basic Operations

  • rows in matrix starts from 1.
  • add_trans(self, r1, r2, mult=None): Adds. r1(row number) += r2(row number)*mult
  • sub_trans(self, r1, r2, mult=None): Subtracts. r1(row number) -= r2(row number)*mult.
  • mult_trans(self,r, mult): Multiplies r(row number)+=mult.
  • div_trans(matrix: Matrix): Divides r(row number)/=mult.
  • swap_trans(row1: int, row2: int): Swaps two rows of the matrix.

RREF Conversion

  • calc_matrix("matrix"): Converts the matrix to Reduced Row Echelon Form.

CONTRIBUTING

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix:
    git checkout -b feature-name
    
  3. Commit your changes:
    git commit -m "Add new feature"
    
  4. Push to the branch:
    git push origin feature-name
    
  5. Create a pull request.

CONTACT

For questions or suggestions, please contact me at artur.vakula@gmail.com.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

my_matrix_module-0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

my_matrix_module-0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file my_matrix_module-0.1.tar.gz.

File metadata

  • Download URL: my_matrix_module-0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for my_matrix_module-0.1.tar.gz
Algorithm Hash digest
SHA256 c34e3ba574b96594774c6f63e08fb9beb6cb66dd6add97f5efff3e50abf4853a
MD5 ec2f0bb4695dd35d6c22e3236acfe9a3
BLAKE2b-256 12acf5acbbf93fe3a172f197f4e7bd9ff7b7ccb208700f47c6a21677830dc9ed

See more details on using hashes here.

File details

Details for the file my_matrix_module-0.1-py3-none-any.whl.

File metadata

  • Download URL: my_matrix_module-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for my_matrix_module-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ac6cbfd766eb6d740caaff4abaa1ee94dd5ae9f053b960c74c533099454fe6c
MD5 d6e6d5a2cdce16c0ea65d87b92a3dd78
BLAKE2b-256 2819123e0ab1211d8d8e96897d40e002cd66ec92e69f8ab1dd73c66a2be7854e

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