rust-num-lib 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rust_num_lib-0.1.0/.github/workflows/CI.yml +219 -0
- rust_num_lib-0.1.0/.gitignore +28 -0
- rust_num_lib-0.1.0/Cargo.lock +267 -0
- rust_num_lib-0.1.0/Cargo.toml +23 -0
- rust_num_lib-0.1.0/LICENSE +21 -0
- rust_num_lib-0.1.0/PKG-INFO +106 -0
- rust_num_lib-0.1.0/README.md +86 -0
- rust_num_lib-0.1.0/docs/build_docs.py +74 -0
- rust_num_lib-0.1.0/docs/rust_num_lib.pdf +162 -0
- rust_num_lib-0.1.0/pyproject.toml +31 -0
- rust_num_lib-0.1.0/python/rust_num_lib/__init__.py +2 -0
- rust_num_lib-0.1.0/python/rust_num_lib/__init__.pyi +3 -0
- rust_num_lib-0.1.0/python/rust_num_lib/linalg.pyi +176 -0
- rust_num_lib-0.1.0/python/rust_num_lib/py.typed +0 -0
- rust_num_lib-0.1.0/python/rust_num_lib/stats.pyi +40 -0
- rust_num_lib-0.1.0/src/lib.rs +248 -0
- rust_num_lib-0.1.0/src/linalg/benchmark.rs +204 -0
- rust_num_lib-0.1.0/src/linalg/cholesky.rs +122 -0
- rust_num_lib-0.1.0/src/linalg/eigenv.rs +379 -0
- rust_num_lib-0.1.0/src/linalg/matmul.rs +301 -0
- rust_num_lib-0.1.0/src/linalg/matrix.rs +454 -0
- rust_num_lib-0.1.0/src/linalg/mod.rs +41 -0
- rust_num_lib-0.1.0/src/linalg/solve.rs +352 -0
- rust_num_lib-0.1.0/src/main.exe +0 -0
- rust_num_lib-0.1.0/src/main.pdb +0 -0
- rust_num_lib-0.1.0/src/main.rs +53 -0
- rust_num_lib-0.1.0/src/python.rs +232 -0
- rust_num_lib-0.1.0/src/stats/mean.rs +29 -0
- rust_num_lib-0.1.0/src/stats/median.rs +45 -0
- rust_num_lib-0.1.0/src/stats/mod.rs +11 -0
- rust_num_lib-0.1.0/src/stats/normal.rs +49 -0
- rust_num_lib-0.1.0/src/stats/std.rs +13 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.14.0
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
platform:
|
|
27
|
+
- runner: ubuntu-22.04
|
|
28
|
+
target: x86_64
|
|
29
|
+
- runner: ubuntu-22.04
|
|
30
|
+
target: x86
|
|
31
|
+
- runner: ubuntu-22.04
|
|
32
|
+
target: aarch64
|
|
33
|
+
- runner: ubuntu-22.04
|
|
34
|
+
target: armv7
|
|
35
|
+
- runner: ubuntu-22.04
|
|
36
|
+
target: s390x
|
|
37
|
+
- runner: ubuntu-22.04
|
|
38
|
+
target: ppc64le
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v6
|
|
41
|
+
- uses: actions/setup-python@v6
|
|
42
|
+
with:
|
|
43
|
+
python-version: "3.9"
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.platform.target }}
|
|
48
|
+
args: --release --out dist
|
|
49
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
50
|
+
manylinux: auto
|
|
51
|
+
- name: Build free-threaded wheels
|
|
52
|
+
uses: PyO3/maturin-action@v1
|
|
53
|
+
with:
|
|
54
|
+
target: ${{ matrix.platform.target }}
|
|
55
|
+
args: --release --out dist -i python3.14t
|
|
56
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
57
|
+
manylinux: auto
|
|
58
|
+
- name: Upload wheels
|
|
59
|
+
uses: actions/upload-artifact@v6
|
|
60
|
+
with:
|
|
61
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
62
|
+
path: dist
|
|
63
|
+
|
|
64
|
+
musllinux:
|
|
65
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
66
|
+
strategy:
|
|
67
|
+
matrix:
|
|
68
|
+
platform:
|
|
69
|
+
- runner: ubuntu-22.04
|
|
70
|
+
target: x86_64
|
|
71
|
+
- runner: ubuntu-22.04
|
|
72
|
+
target: x86
|
|
73
|
+
- runner: ubuntu-22.04
|
|
74
|
+
target: aarch64
|
|
75
|
+
- runner: ubuntu-22.04
|
|
76
|
+
target: armv7
|
|
77
|
+
steps:
|
|
78
|
+
- uses: actions/checkout@v6
|
|
79
|
+
- uses: actions/setup-python@v6
|
|
80
|
+
with:
|
|
81
|
+
python-version: "3.9"
|
|
82
|
+
- name: Build wheels
|
|
83
|
+
uses: PyO3/maturin-action@v1
|
|
84
|
+
with:
|
|
85
|
+
target: ${{ matrix.platform.target }}
|
|
86
|
+
args: --release --out dist
|
|
87
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
88
|
+
manylinux: musllinux_1_2
|
|
89
|
+
- name: Build free-threaded wheels
|
|
90
|
+
uses: PyO3/maturin-action@v1
|
|
91
|
+
with:
|
|
92
|
+
target: ${{ matrix.platform.target }}
|
|
93
|
+
args: --release --out dist -i python3.14t
|
|
94
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
95
|
+
manylinux: musllinux_1_2
|
|
96
|
+
- name: Upload wheels
|
|
97
|
+
uses: actions/upload-artifact@v6
|
|
98
|
+
with:
|
|
99
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
100
|
+
path: dist
|
|
101
|
+
|
|
102
|
+
windows:
|
|
103
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
104
|
+
strategy:
|
|
105
|
+
matrix:
|
|
106
|
+
platform:
|
|
107
|
+
- runner: windows-latest
|
|
108
|
+
target: x64
|
|
109
|
+
python_arch: x64
|
|
110
|
+
- runner: windows-latest
|
|
111
|
+
target: x86
|
|
112
|
+
python_arch: x86
|
|
113
|
+
- runner: windows-11-arm
|
|
114
|
+
target: aarch64
|
|
115
|
+
python_arch: arm64
|
|
116
|
+
steps:
|
|
117
|
+
- uses: actions/checkout@v6
|
|
118
|
+
- uses: actions/setup-python@v6
|
|
119
|
+
with:
|
|
120
|
+
python-version: "3.13"
|
|
121
|
+
architecture: ${{ matrix.platform.python_arch }}
|
|
122
|
+
- name: Build wheels
|
|
123
|
+
uses: PyO3/maturin-action@v1
|
|
124
|
+
with:
|
|
125
|
+
target: ${{ matrix.platform.target }}
|
|
126
|
+
args: --release --out dist
|
|
127
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
128
|
+
- uses: actions/setup-python@v6
|
|
129
|
+
with:
|
|
130
|
+
python-version: "3.14t"
|
|
131
|
+
architecture: ${{ matrix.platform.python_arch }}
|
|
132
|
+
- name: Build free-threaded wheels
|
|
133
|
+
uses: PyO3/maturin-action@v1
|
|
134
|
+
with:
|
|
135
|
+
target: ${{ matrix.platform.target }}
|
|
136
|
+
args: --release --out dist -i python3.14t
|
|
137
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
138
|
+
- name: Upload wheels
|
|
139
|
+
uses: actions/upload-artifact@v6
|
|
140
|
+
with:
|
|
141
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
142
|
+
path: dist
|
|
143
|
+
|
|
144
|
+
macos:
|
|
145
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
146
|
+
strategy:
|
|
147
|
+
matrix:
|
|
148
|
+
platform:
|
|
149
|
+
- runner: macos-15-intel
|
|
150
|
+
target: x86_64
|
|
151
|
+
- runner: macos-latest
|
|
152
|
+
target: aarch64
|
|
153
|
+
steps:
|
|
154
|
+
- uses: actions/checkout@v6
|
|
155
|
+
- uses: actions/setup-python@v6
|
|
156
|
+
with:
|
|
157
|
+
python-version: "3.9"
|
|
158
|
+
- name: Build wheels
|
|
159
|
+
uses: PyO3/maturin-action@v1
|
|
160
|
+
with:
|
|
161
|
+
target: ${{ matrix.platform.target }}
|
|
162
|
+
args: --release --out dist
|
|
163
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
164
|
+
- uses: actions/setup-python@v6
|
|
165
|
+
with:
|
|
166
|
+
python-version: "3.14t"
|
|
167
|
+
- name: Build free-threaded wheels
|
|
168
|
+
uses: PyO3/maturin-action@v1
|
|
169
|
+
with:
|
|
170
|
+
target: ${{ matrix.platform.target }}
|
|
171
|
+
args: --release --out dist -i python3.14t
|
|
172
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
173
|
+
- name: Upload wheels
|
|
174
|
+
uses: actions/upload-artifact@v6
|
|
175
|
+
with:
|
|
176
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
177
|
+
path: dist
|
|
178
|
+
|
|
179
|
+
sdist:
|
|
180
|
+
runs-on: ubuntu-latest
|
|
181
|
+
steps:
|
|
182
|
+
- uses: actions/checkout@v6
|
|
183
|
+
- name: Build sdist
|
|
184
|
+
uses: PyO3/maturin-action@v1
|
|
185
|
+
with:
|
|
186
|
+
command: sdist
|
|
187
|
+
args: --out dist
|
|
188
|
+
- name: Upload sdist
|
|
189
|
+
uses: actions/upload-artifact@v6
|
|
190
|
+
with:
|
|
191
|
+
name: wheels-sdist
|
|
192
|
+
path: dist
|
|
193
|
+
|
|
194
|
+
release:
|
|
195
|
+
name: Release
|
|
196
|
+
runs-on: ubuntu-latest
|
|
197
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
198
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
199
|
+
permissions:
|
|
200
|
+
# Use to sign the release artifacts
|
|
201
|
+
id-token: write
|
|
202
|
+
# Used to upload release artifacts
|
|
203
|
+
contents: write
|
|
204
|
+
# Used to generate artifact attestation
|
|
205
|
+
attestations: write
|
|
206
|
+
steps:
|
|
207
|
+
- uses: actions/download-artifact@v7
|
|
208
|
+
- name: Generate artifact attestation
|
|
209
|
+
uses: actions/attest@v4
|
|
210
|
+
with:
|
|
211
|
+
subject-path: 'wheels-*/*'
|
|
212
|
+
- name: Install uv
|
|
213
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
214
|
+
uses: astral-sh/setup-uv@v7
|
|
215
|
+
- name: Publish to PyPI
|
|
216
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
217
|
+
run: uv publish 'wheels-*/*'
|
|
218
|
+
env:
|
|
219
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Rust
|
|
2
|
+
/target
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
/.venv
|
|
6
|
+
/venv
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*.egg-info/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
|
|
14
|
+
# Compiled extension built by maturin
|
|
15
|
+
/python/rust_num_lib/*.so
|
|
16
|
+
/python/rust_num_lib/*.pyd
|
|
17
|
+
|
|
18
|
+
# Build artifacts
|
|
19
|
+
*.whl
|
|
20
|
+
/dist/
|
|
21
|
+
|
|
22
|
+
# macOS
|
|
23
|
+
.DS_Store
|
|
24
|
+
|
|
25
|
+
# Editors / IDEs
|
|
26
|
+
.idea/
|
|
27
|
+
.vscode/
|
|
28
|
+
*.swp
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "cfg-if"
|
|
7
|
+
version = "1.0.4"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "crossbeam-deque"
|
|
13
|
+
version = "0.8.6"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"crossbeam-epoch",
|
|
18
|
+
"crossbeam-utils",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "crossbeam-epoch"
|
|
23
|
+
version = "0.9.18"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"crossbeam-utils",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "crossbeam-utils"
|
|
32
|
+
version = "0.8.21"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "either"
|
|
38
|
+
version = "1.16.0"
|
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
+
checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
|
|
41
|
+
|
|
42
|
+
[[package]]
|
|
43
|
+
name = "getrandom"
|
|
44
|
+
version = "0.2.17"
|
|
45
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
46
|
+
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
47
|
+
dependencies = [
|
|
48
|
+
"cfg-if",
|
|
49
|
+
"libc",
|
|
50
|
+
"wasi",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "heck"
|
|
55
|
+
version = "0.5.0"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "libc"
|
|
61
|
+
version = "0.2.186"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
64
|
+
|
|
65
|
+
[[package]]
|
|
66
|
+
name = "once_cell"
|
|
67
|
+
version = "1.21.4"
|
|
68
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
69
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "portable-atomic"
|
|
73
|
+
version = "1.13.1"
|
|
74
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
75
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
76
|
+
|
|
77
|
+
[[package]]
|
|
78
|
+
name = "ppv-lite86"
|
|
79
|
+
version = "0.2.21"
|
|
80
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
81
|
+
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
|
82
|
+
dependencies = [
|
|
83
|
+
"zerocopy",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[[package]]
|
|
87
|
+
name = "proc-macro2"
|
|
88
|
+
version = "1.0.106"
|
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
91
|
+
dependencies = [
|
|
92
|
+
"unicode-ident",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[[package]]
|
|
96
|
+
name = "pyo3"
|
|
97
|
+
version = "0.29.0"
|
|
98
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
99
|
+
checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
|
|
100
|
+
dependencies = [
|
|
101
|
+
"libc",
|
|
102
|
+
"once_cell",
|
|
103
|
+
"portable-atomic",
|
|
104
|
+
"pyo3-build-config",
|
|
105
|
+
"pyo3-ffi",
|
|
106
|
+
"pyo3-macros",
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
[[package]]
|
|
110
|
+
name = "pyo3-build-config"
|
|
111
|
+
version = "0.29.0"
|
|
112
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
113
|
+
checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
|
|
114
|
+
dependencies = [
|
|
115
|
+
"target-lexicon",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "pyo3-ffi"
|
|
120
|
+
version = "0.29.0"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
|
|
123
|
+
dependencies = [
|
|
124
|
+
"libc",
|
|
125
|
+
"pyo3-build-config",
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "pyo3-macros"
|
|
130
|
+
version = "0.29.0"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
|
|
133
|
+
dependencies = [
|
|
134
|
+
"proc-macro2",
|
|
135
|
+
"pyo3-macros-backend",
|
|
136
|
+
"quote",
|
|
137
|
+
"syn",
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
[[package]]
|
|
141
|
+
name = "pyo3-macros-backend"
|
|
142
|
+
version = "0.29.0"
|
|
143
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
+
checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
|
|
145
|
+
dependencies = [
|
|
146
|
+
"heck",
|
|
147
|
+
"proc-macro2",
|
|
148
|
+
"quote",
|
|
149
|
+
"syn",
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
[[package]]
|
|
153
|
+
name = "quote"
|
|
154
|
+
version = "1.0.45"
|
|
155
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
157
|
+
dependencies = [
|
|
158
|
+
"proc-macro2",
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
[[package]]
|
|
162
|
+
name = "rand"
|
|
163
|
+
version = "0.8.6"
|
|
164
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
165
|
+
checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
|
|
166
|
+
dependencies = [
|
|
167
|
+
"libc",
|
|
168
|
+
"rand_chacha",
|
|
169
|
+
"rand_core",
|
|
170
|
+
]
|
|
171
|
+
|
|
172
|
+
[[package]]
|
|
173
|
+
name = "rand_chacha"
|
|
174
|
+
version = "0.3.1"
|
|
175
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
176
|
+
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
|
177
|
+
dependencies = [
|
|
178
|
+
"ppv-lite86",
|
|
179
|
+
"rand_core",
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
[[package]]
|
|
183
|
+
name = "rand_core"
|
|
184
|
+
version = "0.6.4"
|
|
185
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
186
|
+
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|
187
|
+
dependencies = [
|
|
188
|
+
"getrandom",
|
|
189
|
+
]
|
|
190
|
+
|
|
191
|
+
[[package]]
|
|
192
|
+
name = "rayon"
|
|
193
|
+
version = "1.12.0"
|
|
194
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
195
|
+
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
|
|
196
|
+
dependencies = [
|
|
197
|
+
"either",
|
|
198
|
+
"rayon-core",
|
|
199
|
+
]
|
|
200
|
+
|
|
201
|
+
[[package]]
|
|
202
|
+
name = "rayon-core"
|
|
203
|
+
version = "1.13.0"
|
|
204
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
205
|
+
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
|
206
|
+
dependencies = [
|
|
207
|
+
"crossbeam-deque",
|
|
208
|
+
"crossbeam-utils",
|
|
209
|
+
]
|
|
210
|
+
|
|
211
|
+
[[package]]
|
|
212
|
+
name = "rust_num_lib"
|
|
213
|
+
version = "0.1.0"
|
|
214
|
+
dependencies = [
|
|
215
|
+
"pyo3",
|
|
216
|
+
"rand",
|
|
217
|
+
"rayon",
|
|
218
|
+
]
|
|
219
|
+
|
|
220
|
+
[[package]]
|
|
221
|
+
name = "syn"
|
|
222
|
+
version = "2.0.117"
|
|
223
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
224
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
225
|
+
dependencies = [
|
|
226
|
+
"proc-macro2",
|
|
227
|
+
"quote",
|
|
228
|
+
"unicode-ident",
|
|
229
|
+
]
|
|
230
|
+
|
|
231
|
+
[[package]]
|
|
232
|
+
name = "target-lexicon"
|
|
233
|
+
version = "0.13.5"
|
|
234
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
235
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
236
|
+
|
|
237
|
+
[[package]]
|
|
238
|
+
name = "unicode-ident"
|
|
239
|
+
version = "1.0.24"
|
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
241
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
242
|
+
|
|
243
|
+
[[package]]
|
|
244
|
+
name = "wasi"
|
|
245
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
248
|
+
|
|
249
|
+
[[package]]
|
|
250
|
+
name = "zerocopy"
|
|
251
|
+
version = "0.8.48"
|
|
252
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
253
|
+
checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
|
|
254
|
+
dependencies = [
|
|
255
|
+
"zerocopy-derive",
|
|
256
|
+
]
|
|
257
|
+
|
|
258
|
+
[[package]]
|
|
259
|
+
name = "zerocopy-derive"
|
|
260
|
+
version = "0.8.48"
|
|
261
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
262
|
+
checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
|
|
263
|
+
dependencies = [
|
|
264
|
+
"proc-macro2",
|
|
265
|
+
"quote",
|
|
266
|
+
"syn",
|
|
267
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "rust_num_lib"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
description = "Scientific computing library written in Rust: linear algebra and statistics"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
authors = ["Wiktor Augustyn <wiktoraugustyn2005@gmail.com>"]
|
|
8
|
+
repository = "https://github.com/wiktor6741/rust_num_lib"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
|
|
11
|
+
[lib]
|
|
12
|
+
name = "rust_num_lib"
|
|
13
|
+
crate-type = ["cdylib", "rlib"]
|
|
14
|
+
|
|
15
|
+
[dependencies]
|
|
16
|
+
pyo3 = { version = "0.29.0", optional = true, features = ["abi3-py39"] }
|
|
17
|
+
rand = "0.8"
|
|
18
|
+
rayon = "1.12"
|
|
19
|
+
|
|
20
|
+
[features]
|
|
21
|
+
default = []
|
|
22
|
+
python = ["dep:pyo3"]
|
|
23
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wiktor Augustyn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rust-num-lib
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Rust
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
10
|
+
Classifier: Typing :: Typed
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Summary: Scientific computing library written in Rust: linear algebra and statistics
|
|
13
|
+
Keywords: linear algebra,matrix,statistics,rust
|
|
14
|
+
Author-email: Wiktor Augustyn <wiktoraugustyn2005@gmail.com>
|
|
15
|
+
License: MIT
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
|
+
Project-URL: Documentation, https://github.com/wiktor6741/rust_num_lib/blob/main/docs/rust_num_lib.pdf
|
|
19
|
+
Project-URL: Repository, https://github.com/wiktor6741/rust_num_lib
|
|
20
|
+
|
|
21
|
+
# rust_num_lib
|
|
22
|
+
|
|
23
|
+
A scientific computing library written in Rust, with Python bindings via [PyO3](https://pyo3.rs/).
|
|
24
|
+
|
|
25
|
+
The goal of this project is to provide fast, low-level implementations of numerical algorithms (linear algebra, statistics) with a convenient Python interface — combining Rust's performance with Python's ergonomics.
|
|
26
|
+
|
|
27
|
+
## Modules
|
|
28
|
+
|
|
29
|
+
- **`rust_num_lib.linalg`** — linear algebra: matrix multiplication, factorizations (LU, QR, Cholesky), solving linear systems, eigenvalues and eigenvectors.
|
|
30
|
+
- **`rust_num_lib.stats`** — statistics: mean, standard deviation, sampling from distributions, data generation.
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
- [Rust](https://www.rust-lang.org/tools/install) (stable toolchain, 2024 edition — Rust 1.85+)
|
|
35
|
+
- Python 3.8+
|
|
36
|
+
- [maturin](https://www.maturin.rs/) — tool for building Python extensions from Rust
|
|
37
|
+
|
|
38
|
+
## Installation and Setup
|
|
39
|
+
|
|
40
|
+
The library is not (yet) published on PyPI, so it has to be built locally from source using `maturin`.
|
|
41
|
+
|
|
42
|
+
### 1. Clone the repository
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone <repository-url>
|
|
46
|
+
cd rust_num_lib
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Create and activate a virtual environment
|
|
50
|
+
|
|
51
|
+
Using a clean `venv` is recommended (not conda — mixing the two causes conflicts during the build):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python3 -m venv .venv
|
|
55
|
+
source .venv/bin/activate # Linux / macOS
|
|
56
|
+
# .venv\Scripts\activate # Windows
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
> **Note:** if you have a conda environment active, deactivate it first (`conda deactivate`), because `maturin` will refuse to build when both `VIRTUAL_ENV` and `CONDA_PREFIX` are set.
|
|
60
|
+
|
|
61
|
+
### 3. Install maturin
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install maturin
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 4. Build and install the library
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
maturin develop --release
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The `--release` flag matters — without it the code compiles in debug mode (no optimizations), which is many times slower and unsuitable for benchmarking.
|
|
74
|
+
|
|
75
|
+
This command builds the extension and installs it into the active virtual environment.
|
|
76
|
+
|
|
77
|
+
### 5. Verify it works
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import rust_num_lib.linalg as linalg
|
|
81
|
+
|
|
82
|
+
a = linalg.Matrix.identity(3)
|
|
83
|
+
print(a)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Tests
|
|
87
|
+
|
|
88
|
+
Unit tests (pure Rust, without PyO3) are run via Cargo:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cargo test
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Project Structure
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
rust_num_lib/
|
|
98
|
+
├── src/
|
|
99
|
+
│ ├── lib.rs # entry point, PyO3 module registration
|
|
100
|
+
│ ├── python.rs # Python bindings for Matrix methods
|
|
101
|
+
│ ├── linalg/ # linear algebra module
|
|
102
|
+
│ └── stats/ # statistics module
|
|
103
|
+
├── Cargo.toml
|
|
104
|
+
├── pyproject.toml
|
|
105
|
+
└── README.md
|
|
106
|
+
```
|