Skip to main content

No project description provided

Project description

Python math library written in Rust

Work in progress

Installation

pip install rem-math

Examples

Sum of two 32-bit integer array

from rem_math import rem_math as rm
import numpy as np

array = [i for i in range(100_000_000)]
np_array = np.array([i for i in range(100_000_000)])

sum_two_i32_result = rm.sum_two_ints32(array, array, simd=True)
sum_of_array = rm.sum_arr_int32(array)
sum_of_np_array = rm.sum_nparr_int32(np_array)

print(sum_two_i32_result)

Benchmarks (Python)

Accamulate array values of integer32

--------------------------------------- benchmark 'arr_i32': 1 tests ---------------------------------------
Name (time in ms)        Min     Max    Mean  StdDev  Median     IQR  Outliers       OPS  Rounds  Iterations
------------------------------------------------------------------------------------------------------------
test_sum_arr_i32      4.2611  4.4810  4.3450  0.0814  4.3310  0.0625       2;1  230.1495       5         100
------------------------------------------------------------------------------------------------------------

---------------------------------------- benchmark 'arr_i32_simd': 1 tests -----------------------------------------
Name (time in us)            Min     Max    Mean  StdDev  Median     IQR  Outliers  OPS (Kops/s)  Rounds  Iterations
--------------------------------------------------------------------------------------------------------------------
test_sum_arr_i32_simd     1.1802  1.2003  1.1903  0.0071  1.1903  0.0051       2;0      840.1472       5      100000
--------------------------------------------------------------------------------------------------------------------

---------------------------------------- benchmark 'numpy': 1 tests ----------------------------------------
Name (time in ms)        Min     Max    Mean  StdDev  Median     IQR  Outliers       OPS  Rounds  Iterations
------------------------------------------------------------------------------------------------------------
test_numpy_sum        7.6939  7.8477  7.7710  0.0544  7.7710  0.0387       2;0  128.6840       5          13
------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

Accumulate values of indexes of two arrays (float32 & int32)

```
-------------------------------------- benchmark 'numpy_arr_sum': 1 tests --------------------------------------
Name (time in ms)          Min      Max     Mean  StdDev   Median     IQR  Outliers      OPS  Rounds  Iterations
----------------------------------------------------------------------------------------------------------------
test_numpy_arr_sum     70.3064  78.1331  75.1148  4.1352  78.1298  7.3991       2;0  13.3129       5           2
----------------------------------------------------------------------------------------------------------------

-------------------------------------- benchmark 'sum_floatsf32': 1 tests --------------------------------------
Name (time in ms)          Min      Max     Mean  StdDev   Median     IQR  Outliers      OPS  Rounds  Iterations
----------------------------------------------------------------------------------------------------------------
test_sum_floatsf32     54.6912  54.8023  54.7604  0.0562  54.8004  0.0981       1;0  18.2614       5          10
----------------------------------------------------------------------------------------------------------------

-------------------------------------- benchmark 'sum_floatsf32_simd': 1 tests --------------------------------------
Name (time in ms)               Min      Max     Mean  StdDev   Median     IQR  Outliers      OPS  Rounds  Iterations
---------------------------------------------------------------------------------------------------------------------
test_sum_floatsf32_simd     52.0826  52.5085  52.1729  0.1877  52.0914  0.1119       1;1  19.1670       5           3
---------------------------------------------------------------------------------------------------------------------

--------------------------------------- benchmark 'sum_ints32': 1 tests ---------------------------------------
Name (time in ms)         Min      Max     Mean  StdDev   Median     IQR  Outliers      OPS  Rounds  Iterations
---------------------------------------------------------------------------------------------------------------
test_sum_ints32       32.8143  40.4775  36.1822  3.0797  34.9533  4.6386       2;0  27.6379       5          10
---------------------------------------------------------------------------------------------------------------

-------------------------------------- benchmark 'sum_ints32_simd': 1 tests --------------------------------------
Name (time in ms)            Min      Max     Mean  StdDev   Median     IQR  Outliers      OPS  Rounds  Iterations
------------------------------------------------------------------------------------------------------------------
test_sum_ints32_simd     32.8149  34.9717  33.8741  0.9905  34.3772  1.7000       3;0  29.5211       5          10
------------------------------------------------------------------------------------------------------------------
```

Compare with NumPy

-------------------------------------- benchmark 'numpy_sum': 1 tests --------------------------------------
Name (time in ms)        Min     Max    Mean  StdDev  Median     IQR  Outliers       OPS  Rounds  Iterations
------------------------------------------------------------------------------------------------------------
test_numpy_sum        7.8130  8.9292  8.4827  0.6113  8.9290  1.1160       2;0  117.8870       5          14
------------------------------------------------------------------------------------------------------------

--------------------------------------- benchmark 'rm_sum': 1 tests ----------------------------------------
Name (time in ms)        Min     Max    Mean  StdDev  Median     IQR  Outliers       OPS  Rounds  Iterations
------------------------------------------------------------------------------------------------------------
test_rm_sum           1.7189  1.8860  1.7523  0.0747  1.7189  0.0419       1;1  570.6719       5         100
------------------------------------------------------------------------------------------------------------

Benchmarks (Rust)

Accamulate array values of integer32

Array accumulation      time:   [15.509 µs 15.532 µs 15.575 µs]
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild
  7 (7.00%) high severe

Array accumulation with SIMD instructions
                        time:   [77.083 ns 77.499 ns 78.264 ns]
Found 9 outliers among 100 measurements (9.00%)
  2 (2.00%) high mild
  7 (7.00%) high severe

Accumulate values of indexes of two arrays (float32 & int32)

Array accumulation      time:   [4.9527 ms 4.9757 ms 5.0013 ms]
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) high mild
  10 (10.00%) high severe

Array accumulation with SIMD instructions
                        time:   [4.8752 ms 4.8976 ms 4.9250 ms]
Found 8 outliers among 100 measurements (8.00%)
  2 (2.00%) high mild
  6 (6.00%) high severe

Benchmarking Array accumulation of two float arrays: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.6s, or reduce sample count to 80.
Array accumulation of two float arrays
                        time:   [53.260 ms 53.448 ms 53.653 ms]
Found 13 outliers among 100 measurements (13.00%)
  9 (9.00%) high mild
  4 (4.00%) high severe

Benchmarking Array accumulation of two float arrays with SIMD: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.8s, or reduce sample count to 80.
Array accumulation of two float arrays with SIMD
                        time:   [55.241 ms 55.470 ms 55.718 ms]
Found 10 outliers among 100 measurements (10.00%)
  8 (8.00%) high mild
  2 (2.00%) high severe

Benchmarking Array accumulation of two integer arrays: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.6s, or reduce sample count to 80.
Array accumulation of two integer arrays
                        time:   [53.543 ms 53.783 ms 54.043 ms]
Found 10 outliers among 100 measurements (10.00%)
  7 (7.00%) high mild
  3 (3.00%) high severe

Benchmarking Array accumulation of two integer arrays with SIMD: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.8s, or reduce sample count to 80.
Array accumulation of two integer arrays with SIMD
                        time:   [55.783 ms 56.053 ms 56.360 ms]
Found 15 outliers among 100 measurements (15.00%)
  7 (7.00%) high mild
  8 (8.00%) high severe

Roadmap

  • Add GPU-accelerated operations for improved performance.
  • Implement own custom type objects for best performance from ecosystem.
  • Expand mathematical functionality with additional features and algorithms.

Stay tuned for updates as the library evolves!

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

rem_math-0.1.3.tar.gz (24.5 kB view details)

Uploaded Source

Built Distributions

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

rem_math-0.1.3-cp313-cp313-win_amd64.whl (171.7 kB view details)

Uploaded CPython 3.13Windows x86-64

rem_math-0.1.3-cp312-cp312-win_amd64.whl (172.1 kB view details)

Uploaded CPython 3.12Windows x86-64

rem_math-0.1.3-cp311-cp311-win_amd64.whl (172.1 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file rem_math-0.1.3.tar.gz.

File metadata

  • Download URL: rem_math-0.1.3.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.0

File hashes

Hashes for rem_math-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3c92ef820d8a99ccc32c0ce86618273feaafe5dbdbd88ea7178beea8f23d6164
MD5 98dbdc9d6c0d7a36a7ecbb71c4f28e3a
BLAKE2b-256 9b0fadf9c831345f0087af7895c676a4173af937d0fc7068b7c53b50464f60f3

See more details on using hashes here.

File details

Details for the file rem_math-0.1.3-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for rem_math-0.1.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9adca57d1c0785a93ee0ec331e32abf262389c4dfe05ae8988ada117e90d1de5
MD5 f22759d2073d621f3c578f4b60d750b9
BLAKE2b-256 788b8ca4b4ac531ae8e1272fb303dd8873de559991b47736d2834018d687be04

See more details on using hashes here.

File details

Details for the file rem_math-0.1.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for rem_math-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e8c9bc7efe2a82fcb96fbd6e1d8260464fc7cb29ffa2b477ee84fb96be212e10
MD5 b69c62d556c5befa0620fa80a6a4fc25
BLAKE2b-256 40c12b24d7a6cb1ddbda79614d1955b8d3fd6496dd86689045af87973a3af712

See more details on using hashes here.

File details

Details for the file rem_math-0.1.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for rem_math-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 20f4a84eeb4e083bac2e7a67f9e8f25c0f84a784686da4ee4a5774e7ec99daca
MD5 7308982a96b3e57af6a33f91b09d085e
BLAKE2b-256 aa7b525eba07a2c2880e33a29f13e9872ae93012ddf4eb98c9e8c200727ce56e

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