Skip to main content

A general purpose Python math module

Project description

Build Status Documentation Status PyPI version fury.io PyPI license PyPI pyversions Downloads per month

LibPyMath

A fast, general purpose math library for Python


Install

Run pip install libpymath to dowload and install libpymath for your system. 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. To further increase the speed of the calculations, when libpymath imported into a project for the first time, it runs some tests on the CPU to find the optimal number of threads to use for the matrix calculations.

The matrix library is currently in its early stages and only supports elementwise addition, subtraction, division and multiplication, as well as the matrix transpose function and some ease of use functions, 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]]

* Due to Clang on Mac OS the wheels do not support OpenMP, meaning some matrix operations may be slower than on other operating systems.

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

libpymath-0.3.1.tar.gz (166.5 kB view details)

Uploaded Source

Built Distributions

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

libpymath-0.3.1-cp38-cp38-manylinux1_x86_64.whl (90.8 kB view details)

Uploaded CPython 3.8

libpymath-0.3.1-cp38-cp38-manylinux1_i686.whl (89.0 kB view details)

Uploaded CPython 3.8

libpymath-0.3.1-cp37-cp37m-manylinux1_x86_64.whl (89.8 kB view details)

Uploaded CPython 3.7m

libpymath-0.3.1-cp37-cp37m-manylinux1_i686.whl (88.1 kB view details)

Uploaded CPython 3.7m

libpymath-0.3.1-cp36-cp36m-manylinux1_x86_64.whl (89.8 kB view details)

Uploaded CPython 3.6m

libpymath-0.3.1-cp36-cp36m-manylinux1_i686.whl (88.1 kB view details)

Uploaded CPython 3.6m

libpymath-0.3.1-cp35-cp35m-manylinux1_x86_64.whl (89.8 kB view details)

Uploaded CPython 3.5m

libpymath-0.3.1-cp35-cp35m-manylinux1_i686.whl (88.1 kB view details)

Uploaded CPython 3.5m

File details

Details for the file libpymath-0.3.1.tar.gz.

File metadata

  • Download URL: libpymath-0.3.1.tar.gz
  • Upload date:
  • Size: 166.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for libpymath-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7dd43e6360419cd53e8b94f807a0a9d66745a806e13112c079f9a2ad05c84cce
MD5 2993d1efad1fdc20aa3fe594b102436c
BLAKE2b-256 bafe1eb1bafa266cc49c08eaff4b639237cd4b65ab022fa3354bf6589b429291

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 90.8 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fa1c679f686d24bae35f1d725094aa3827108fd07c2d1527613c85a54036e11f
MD5 eb16aa2da76371f5b8e03126752fac1f
BLAKE2b-256 d35c790a3dd4167335ef5b10432b255ba78c40f24c951527603bc08f8fff20be

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp38-cp38-manylinux1_i686.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp38-cp38-manylinux1_i686.whl
  • Upload date:
  • Size: 89.0 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp38-cp38-manylinux1_i686.whl
Algorithm Hash digest
SHA256 47a9fc01cc4b99aa79c47a45288c3ef9197d3479be5a35e5564052c8a2153d55
MD5 e7aeb21f81dbe7b4920cff1b8b6e95e5
BLAKE2b-256 33f09d7601885db6c90dddd3259332c69e120afecbaf2a9a0355b9265a55b230

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 89.8 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 13dc461ff937c2a4547ecddc9307dd5fab9233f5fd327a950f5866680c892210
MD5 50388853e9728e0f9943176e2d91571d
BLAKE2b-256 41a4b4108feb1c8d92ffdfab1d40d702bb81eb138bb70b024d95a0576a86b90a

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp37-cp37m-manylinux1_i686.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 88.1 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 b3ef72433c97b0b8d742b7b65372a4467e6bc9206fed07e1db64a14948b33977
MD5 0da716c012151b6f365c8c1995300264
BLAKE2b-256 4e86a52ee6b3b1e1ef957ea775b7fa6946bface5d3c64995ddfc87a63713aab1

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 89.8 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4523a69d36fd97327987eeea259047e3904ee35d955d7ee9c071a3d7fb8fd893
MD5 a0fb60b2335c00f845628b821ae996a1
BLAKE2b-256 4444bc68d85500e40ae318f418e2d0877c49e054c3596decfbdc54a2e1e953a4

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp36-cp36m-manylinux1_i686.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 88.1 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 99592b274900fd8a1bbc89de80481d2169eefdb030e6ff2932feb3d08da1a5c4
MD5 eb24964774f66efeee2321560541d453
BLAKE2b-256 404c0702fca6142060cc50f355db9866d543888ce807a29f6f4a82508475dcf3

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 89.8 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 01845038d39eff0b12003c06ffd1b2b063c5c1d0480838901e84ac22333feab6
MD5 7d8f60896803ef8db96d31dd4bab6fd2
BLAKE2b-256 fb5613db16ac30a5e2f626b751fae8a6fbe112031089ae6fc9be9a3a9474365f

See more details on using hashes here.

File details

Details for the file libpymath-0.3.1-cp35-cp35m-manylinux1_i686.whl.

File metadata

  • Download URL: libpymath-0.3.1-cp35-cp35m-manylinux1_i686.whl
  • Upload date:
  • Size: 88.1 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.7

File hashes

Hashes for libpymath-0.3.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 9d1c1625d123b3d361add33b0832b5a1903ce3fe07d87b78d5b9ca6ee419a6f7
MD5 d101b4b0d8052c11e8d7f99848b78739
BLAKE2b-256 769987d9b55bf3bcbef5c3cc6acea6b22a4ec98d6bbf95141350759678580202

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