A Python package for matrix operations (transpose, multiply, inverse, rank)
Project description
testup_package
A Python package for matrix operations.
Features
- Matrix transpose
- Matrix multiplication
- Matrix inverse
- Matrix rank
Installation
pip install testupackage
Or install from source:
git clone https://github.com/yourusername/testup_package.git
cd testup_package
pip install -e .
Usage
from testup_package import transpose, matrix_multiply, inverse, rank
# Matrix transpose
m = [[1, 2, 3], [4, 5, 6]]
print(transpose(m))
# [[1. 4.]
# [2. 5.]
# [3. 6.]]
# Matrix multiplication
a = [[1, 2], [3, 4]]
b = [[5, 6], [7, 8]]
print(matrix_multiply(a, b))
# [[19. 22.]
# [43. 50.]]
# Matrix inverse
m = [[1, 2], [3, 4]]
print(inverse(m))
# [[-2. 1. ]
# [ 1.5 -0.5]]
# Matrix rank
print(rank([[1, 2], [2, 4]])) # 1 (singular matrix)
print(rank([[1, 0], [0, 1]])) # 2 (full rank)
API Reference
transpose(matrix)
Return the transpose of a matrix.
- Parameters:
matrix- Input matrix (list of lists or numpy array) - Returns: Transposed matrix as numpy array
matrix_multiply(a, b)
Multiply two matrices.
- Parameters:
a,b- Input matrices - Returns: Product matrix as numpy array
- Raises:
ValueErrorif dimensions are incompatible
inverse(matrix)
Return the inverse of a square matrix.
- Parameters:
matrix- Square matrix to invert - Returns: Inverse matrix as numpy array
- Raises:
ValueErrorif matrix is not square or is singular
rank(matrix)
Return the rank of a matrix.
- Parameters:
matrix- Input matrix - Returns: Rank as integer
Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
Dependencies
- Python >= 3.8
- NumPy
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
testupackage-0.1.0.tar.gz
(2.8 kB
view details)
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 testupackage-0.1.0.tar.gz.
File metadata
- Download URL: testupackage-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28608373d0f8e36155136432576ded3831123958b539cf766850f7b0615ae606
|
|
| MD5 |
53b699929830565ce7266d8308b209a2
|
|
| BLAKE2b-256 |
11ea61f197cf5972af5b4b2747d064007a9677553ce8d674ba06bd6904908481
|
File details
Details for the file testupackage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: testupackage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eadd998cc19f92e7188b7e398dd05380ecb26d7f312e87d18202761be98bed18
|
|
| MD5 |
c426f06eb77ce0a71b15caa8f435f8fa
|
|
| BLAKE2b-256 |
9aaa6b8a979093c7f70caf15ea5d5e7a03f00c73913ea744235a70e2501b1b49
|