quadint 0.0.9__cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

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.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.1
2
+ Name: quadint
3
+ Version: 0.0.9
4
+ Summary: A quadint class, for using quadratic integers.
5
+ Author-email: Ryan Heard <ryanwheard@gmail.com>
6
+ License: MIT
7
+ Project-URL: Repository, https://github.com/rheard/quadint
8
+ Keywords: complex,math,eisenstein
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: Implementation :: CPython
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+
22
+ # quadint
23
+
24
+ Fast, integer-backed algebraic number types for **exact** arithmetic in imaginary quadratic integer rings.
25
+
26
+ - **`complexint`**: a Gaussian integer type that mirrors Python’s `complex`, but stores **`int`** components (no floating-point drift).
27
+ - **`QuadInt` / `QuadraticRing`**: a general quadratic-integer implementation for elements of the form
28
+ $(a + b\sqrt{D}) / \mathrm{den}$ with $den ∈ {1,2}$.
29
+ - **`eisensteinint`**: Eisenstein integers in the ω-basis (`a + bω`, where `ω = (-1 + √-3)/2`).
30
+
31
+ Designed for discrete math, number theory tooling, and high-throughput exact computations (this project is built to compile cleanly with **mypyc**).
32
+
33
+ ---
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ python -m pip install quadint
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Quickstart (recommended): `complexint`
44
+
45
+ ```python
46
+ from quadint import complexint
47
+
48
+ a = complexint(1, 2)
49
+ b = complexint(3, 6)
50
+
51
+ c = a * b
52
+ print(c) # "(-9+12j)" (exact, integer-backed)
53
+ print(c.real) # -9
54
+ print(c.imag) # 12
55
+ print(type(c.real)) # <class 'int'>
56
+
57
+ print(abs(a)) # 1^2 + 2^2 = 5 (norm)
58
+ ```
59
+
60
+ `complexint` is ideal when you want something that *feels like* `complex`, but with infinite-precision integer components.
61
+
62
+ ---
63
+
64
+ ## Quadratic integers: `make_quadint`
65
+
66
+ Create a ring instance for a chosen discriminant parameter `D`, then construct values in that ring:
67
+
68
+ ```python
69
+ from quadint import make_quadint
70
+
71
+ Q2 = make_quadint(-2) # Z[√-2]
72
+
73
+ x = Q2(1, 2) # (1 + 2*sqrt(-2))
74
+ y = Q2(3, 6)
75
+
76
+ print(x * y) # "(-21+12*sqrt(-2))"
77
+ print(abs(x)) # norm: 1^2 - (-2)*2^2 = 9
78
+ ```
79
+
80
+ Common operations include `+`, `-`, `*`, `**` (non-negative powers), `conjugate()`, and `abs()` (the norm).
81
+
82
+ ---
83
+
84
+ ## Eisenstein integers: `eisensteinint`
85
+
86
+ ```python
87
+ from quadint import eisensteinint
88
+
89
+ z = eisensteinint(2, 3) # 2 + 3ω
90
+ w = eisensteinint(1, -1) # 1 - ω
91
+
92
+ print(z)
93
+ print(z * w) # exact product in Z[ω]
94
+ print(abs(z)) # norm (integer)
95
+ ```
96
+
97
+ Use `real` and `omega` to access the ω-basis components.
98
+
99
+ ---
100
+
101
+ ## Division & interoperability notes
102
+
103
+ * This package is primarily intended for **exact, discrete** arithmetic (`+`, `-`, `*`, `**`, conjugation, norms).
104
+ * Some division helpers exist (e.g. `divmod`, `//`, `%`) for **imaginary** quadratic rings, using a nearest-lattice approach; it may be `NotImplemented` for `D ≥ 0`, and behavior depends on the ring being Euclidean enough for your use case.
105
+ * **Floats and Python `complex` are accepted in some operations but are converted via `int(...)`, which truncates toward zero. If you care about rationals, avoid mixing in `float`.
106
+
107
+ Example of truncation behavior:
108
+
109
+ ```python
110
+ from quadint import complexint
111
+
112
+ a = complexint(3, 6)
113
+
114
+ print(a / 3) # "(1+2j)"
115
+ print(a / 3.5) # "(1+2j)" (3.5 -> 3 by int(...) conversion)
116
+
117
+ print(a + 1) # "(4+6j)"
118
+ print(a + 1.5) # "(4+6j)" (1.5 -> 1)
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Minimal API overview
124
+
125
+ ### Constructors
126
+
127
+ * `complexint(a: int = 0, b: int = 0)`
128
+ * `eisensteinint(a: int = 0, b: int = 0)` where `a + bω`
129
+ * `make_quadint(D: int) -> QuadraticRing`
130
+
131
+ ### Ring instance (`QuadraticRing`)
132
+
133
+ * `Q(a: int = 0, b: int = 0) -> QuadInt` (constructs using the ring’s internal basis)
134
+ * `Q.from_ab(a: int, b: int) -> QuadInt` (construct with user coords, respecting `den`)
135
+ * `Q.from_obj(x) -> QuadInt` (embed `int`/`float`, and `complex` only when `D == -1`)
136
+
137
+ ### Value type (`QuadInt`)
138
+
139
+ * `x.conjugate()`
140
+ * `abs(x)` (norm)
141
+ * `divmod(x, y)`, `x // y`, `x % y` (where supported)
142
+ * Iteration/indexing over the stored coefficients: `list(x)`, `x[0]`, `x[1]`
@@ -0,0 +1,14 @@
1
+ 9c46a97409a639359bbf__mypyc.cpython-38-aarch64-linux-gnu.so,sha256=4He6KmxXWYsV9jhuHRoJND5FauLJ-15wZ4XjDIi7D5c,496152
2
+ quadint/__init__.cpython-38-aarch64-linux-gnu.so,sha256=yGmCyf07NOnTmxJmyqSINaobBPjItq_Z3k7oIE9KOQU,202680
3
+ quadint/complex.cpython-38-aarch64-linux-gnu.so,sha256=K7EoMF1YfAZtjOk2GmNgRGbZeDpTlTbGzCIaxGlIDLI,202696
4
+ quadint/eisenstein.cpython-38-aarch64-linux-gnu.so,sha256=-ICOsbjLt_dmuFY9rYAqCfCehwZNzTY47xuapILIwxw,202712
5
+ quadint/quad.cpython-38-aarch64-linux-gnu.so,sha256=Rq0zM6sDskqkW0VJhxp2EM4gQEcjT5Lo4T_wGRmG7fk,202680
6
+ quadint-stubs/__init__.pyi,sha256=K0N25PpxhvmQtHsMT6EguhUm1dfE9fHC3Il230hcwgY,159
7
+ quadint-stubs/complex.pyi,sha256=e0U3ZWBFcae4VV6Gt-xNt_0qmHK53mmb3sT8lDrDLFQ,276
8
+ quadint-stubs/eisenstein.pyi,sha256=0z8RXhUWC77jE0Wn4rYw_EQDIY_O1i39XjfWDvPYC1A,258
9
+ quadint-stubs/quad.pyi,sha256=6sx0WTA1r5cT4g2pKxpX-g892OBYXFISUlLTX_M5umM,1855
10
+ quadint-0.0.9.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
11
+ quadint-0.0.9.dist-info/METADATA,sha256=KoGwuGY3b1dOa5Jt1Dah9vR26YcCAAcVfdrWOMeVI4o,4359
12
+ quadint-0.0.9.dist-info/WHEEL,sha256=meVcZCNcgqIpPuN679sCmn1SisGBkUvqqxe4a5wYKyE,187
13
+ quadint-0.0.9.dist-info/top_level.txt,sha256=3uozn88TjoQFTKJWsN_qpidOqiCMI-Vk5jp1XkGRW78,50
14
+ quadint-0.0.9.dist-info/RECORD,,
@@ -0,0 +1,7 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.3.3)
3
+ Root-Is-Purelib: false
4
+ Tag: cp38-cp38-manylinux_2_17_aarch64
5
+ Tag: cp38-cp38-manylinux2014_aarch64
6
+ Tag: cp38-cp38-manylinux_2_28_aarch64
7
+
@@ -0,0 +1,3 @@
1
+ 9c46a97409a639359bbf__mypyc
2
+ quadint
3
+ quadint-stubs
@@ -0,0 +1,2 @@
1
+ from quadint.complex import complexint as complexint
2
+ from quadint.quad import QuadInt as QuadInt, QuadraticRing as QuadraticRing, make_quadint as make_quadint
@@ -0,0 +1,8 @@
1
+ from quadint.quad import OP_TYPES as OP_TYPES, QuadInt as QuadInt, QuadraticRing as QuadraticRing
2
+
3
+ class complexint(QuadInt):
4
+ def __init__(self, a: int = 0, b: int = 0) -> None: ...
5
+ @property
6
+ def real(self) -> int: ...
7
+ @property
8
+ def imag(self) -> int: ...
@@ -0,0 +1,8 @@
1
+ from quadint.quad import QuadInt as QuadInt, QuadraticRing as QuadraticRing
2
+
3
+ class eisensteinint(QuadInt):
4
+ def __init__(self, a: int = 0, b: int = 0) -> None: ...
5
+ @property
6
+ def real(self) -> int: ...
7
+ @property
8
+ def omega(self) -> int: ...
quadint-stubs/quad.pyi ADDED
@@ -0,0 +1,46 @@
1
+ from _typeshed import Incomplete
2
+ from typing import Iterator
3
+
4
+ OTHER_OP_TYPES = complex | int | float
5
+ OP_TYPES: Incomplete
6
+
7
+ class QuadraticRing:
8
+ D: int
9
+ den: int
10
+ def __init__(self, D: int) -> None: ...
11
+ def __call__(self, a: int = 0, b: int = 0) -> QuadInt: ...
12
+ def from_obj(self, n: OP_TYPES) -> QuadInt: ...
13
+ def from_ab(self, a: int, b: int) -> QuadInt: ...
14
+
15
+ class QuadInt:
16
+ ring: QuadraticRing
17
+ a: int
18
+ b: int
19
+ def __init__(self, ring: QuadraticRing, a: int = 0, b: int = 0) -> None: ...
20
+ def assert_same_ring(self, other: QuadInt): ...
21
+ def conjugate(self) -> QuadInt: ...
22
+ def __add__(self, other: OP_TYPES) -> QuadInt: ...
23
+ def __radd__(self, other: OTHER_OP_TYPES) -> QuadInt: ...
24
+ def __sub__(self, other: OP_TYPES) -> QuadInt: ...
25
+ def __rsub__(self, other: OTHER_OP_TYPES) -> QuadInt: ...
26
+ def __neg__(self) -> QuadInt: ...
27
+ def __pos__(self) -> QuadInt: ...
28
+ def __mul__(self, other: OP_TYPES) -> QuadInt: ...
29
+ def __rmul__(self, other: OTHER_OP_TYPES) -> QuadInt: ...
30
+ def __pow__(self, exp: float) -> QuadInt: ...
31
+ def __divmod__(self, other: OP_TYPES) -> tuple['QuadInt', 'QuadInt']: ...
32
+ def __truediv__(self, other: OP_TYPES) -> QuadInt: ...
33
+ def __rtruediv__(self, other: OTHER_OP_TYPES) -> QuadInt: ...
34
+ def __floordiv__(self, other: OP_TYPES) -> QuadInt: ...
35
+ def __rfloordiv__(self, other: OTHER_OP_TYPES) -> QuadInt: ...
36
+ def __mod__(self, other: QuadInt) -> QuadInt: ...
37
+ def __abs__(self) -> int: ...
38
+ def __bool__(self) -> bool: ...
39
+ def __iter__(self) -> Iterator[int]: ...
40
+ def __len__(self) -> int: ...
41
+ def __getitem__(self, idx: int) -> int: ...
42
+ def __eq__(self, other: object) -> bool: ...
43
+ def __ne__(self, other: object) -> bool: ...
44
+ def __hash__(self) -> int: ...
45
+
46
+ def make_quadint(D: int) -> QuadraticRing: ...