A general purpose Python math module
Project description
LibPyMath
A fast, general purpose Python math library
Install
Run pip install libpymath
to dowload and install libpymath
for your operating system and python version. There are also wheels provided for many of the latest Python versions on Windows, Mac OS and Linux thanks to the cibuildwheel
project.
Features and usage
Matrix math
Easily create, manipulate and perform calculations with dense matrices. The matrices themselves are stored and manipulated with optimised C code, resulting in faster operations and more efficient calculations.
The matrix library is currently very primitive and supports very few operations, though is constantly being expanded on and improved. Many ease of use features also exist, such as the ability to format and print a matrix, alligning the decimal points (if present) and providing brackets in the relevant places.
For example, the following creates a new matrix from a 2d list of data
# Import the Matrix object from the matrix library
from libpymath.matrix import Matrix
# Create the data
matrixData = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
# Produce a new Matrix with the data
mat = Matrix(data=matrixData)
# Print the matrix
print(mat)
>>> [[1.0, 2.0, 3.0]
[4.0, 5.0, 6.0]
[7.0, 8.0, 9.0]]
Here is another example to show the formating abilities of libpymath's matrix type. The decimal points, commas and brackets are all alined on a per-row basis, saving space and producing a nicer result.
# Create the data
matrixData = [[1, 2, 3.14159],
[4, 5000, 6],
[7, 8, 9]]
# Produce a new Matrix with the data
mat = Matrix(data=matrixData)
# Print the matrix
print(mat)
>>> [[1.0, 2.0, 3.14159]
[4.0, 5000.0, 6.0 ]
[7.0, 8.0, 9.0 ]]
The example below shows what happens when printing a large matrix, as the entire thing could not fit on the screen -- libpymath shows only the corners, missing out the middle section of the matrix on both the x and y axis, allowing large matrices to be printed quickly and using a small amount of space.
# Create the data for a 1000x1000 matrix
rows = 1000
cols = 1000
matrixData = [[j + i * cols for j in range(rows)] for i in range(cols)]
# Produce a new Matrix with the data
mat = Matrix(data=matrixData)
# Print the matrix
print(mat)
>>> [[ 0.0, 1.0, 2.0 *** 997.0, 998.0, 999.0]
[ 1000.0, 1001.0, 1002.0 *** 1997.0, 1998.0, 1999.0]
[ 2000.0, 2001.0, 2002.0 *** 2997.0, 2998.0, 2999.0]
*** *** *** *** *** ***
[997000.0, 997001.0, 997002.0 *** 997997.0, 997998.0, 997999.0]
[998000.0, 998001.0, 998002.0 *** 998997.0, 998998.0, 998999.0]
[999000.0, 999001.0, 999002.0 *** 999997.0, 999998.0, 999999.0]]
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 Distributions
Hashes for libpymath-0.1.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9f958e6ff9ab58e8e4dfb6262b2a081d9d1eaa390d79ca90d439dccf3b4c117 |
|
MD5 | 3800621c5fe447702bc96666c2fc3a92 |
|
BLAKE2b-256 | 6d2db48e0d6e528b89d1bf56822b5b35cf267e0451dcbe77ab30f1058016c10a |
Hashes for libpymath-0.1.1-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5975d24c75c2d2ca8250a88b6fdda29e8e345df58afeb52eaedeba8f3137e8f3 |
|
MD5 | bf7aab86bd1fa72f64c97071c2ad63c3 |
|
BLAKE2b-256 | 19113adfbb3c3c667e035ef9da51ca73ffb71f67d244e7bda456f46ff469770b |
Hashes for libpymath-0.1.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f48b791f30619e60f9ab707b8228c4641ede5bd64ede7b12e154ef691bdae18 |
|
MD5 | 83a2978872ba3516cdb3224fafb52699 |
|
BLAKE2b-256 | 62e307108552eee5f53aa5bfc5bc2ab7c64e1b6f978f316218d073ff629cc84a |
Hashes for libpymath-0.1.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a577a577dc53670367cd0b1dd55ebb205ba76a7be9e30b1d671699395915908 |
|
MD5 | 73047d1542ef7216098e95d5efebe97a |
|
BLAKE2b-256 | 6a13df2ad5ecf4f5b5f90d544b0b703f4af386d395163b9ed0313ad04daac4a2 |
Hashes for libpymath-0.1.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81040e7df7b7832db6cfdc196c5fa308c35368f750a142a237ecbb04a46f637e |
|
MD5 | ce1fa4bd6cf5ecafd1b2bc57f18d0e00 |
|
BLAKE2b-256 | 0696e9c25aeb6dfd27d06f91882cbdae0f44e46a32d64b5f7f4c2bb27cd3a942 |
Hashes for libpymath-0.1.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9a209e31b19e86b6d94c5de6add7dc0b9a535fbb3caccde24a0018294b5d8e6 |
|
MD5 | b3af561b00cf82d98f67b77768af0605 |
|
BLAKE2b-256 | 99bdbd1e32ca7141708e3923b533393093d9c91c9c2ebdf747958435e5097800 |
Hashes for libpymath-0.1.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddf3e4b5d56f1f75b604e5bd0b0b6e9bea4d94f85093323864ff5813ef0a75d4 |
|
MD5 | 68f125444b52b27ec8e3ca3bae3966f0 |
|
BLAKE2b-256 | 3ee2a6d8a8e9201653672c9b6d4c32bfb7858aceeb9010528b341159906f4a6c |
Hashes for libpymath-0.1.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44d0f2e23600b89e4a222435270c6f572567931ac0ac6505003aa5ac4dabbb35 |
|
MD5 | 38ab588003041b8fe0da8d93bf8d7558 |
|
BLAKE2b-256 | 09d1646269bfc1ee9abafce85259e12185c4befbbeecc28ba27d3b3539aae269 |