quadint 0.0.7__cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.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.
- 9c46a97409a639359bbf__mypyc.cpython-310-x86_64-linux-gnu.so +0 -0
- quadint/__init__.cpython-310-x86_64-linux-gnu.so +0 -0
- quadint/complex.cpython-310-x86_64-linux-gnu.so +0 -0
- quadint/eisenstein.cpython-310-x86_64-linux-gnu.so +0 -0
- quadint/quad.cpython-310-x86_64-linux-gnu.so +0 -0
- quadint-0.0.7.dist-info/METADATA +73 -0
- quadint-0.0.7.dist-info/RECORD +14 -0
- quadint-0.0.7.dist-info/WHEEL +7 -0
- quadint-0.0.7.dist-info/licenses/LICENSE +19 -0
- quadint-0.0.7.dist-info/top_level.txt +3 -0
- quadint-stubs/__init__.pyi +0 -0
- quadint-stubs/complex.pyi +8 -0
- quadint-stubs/eisenstein.pyi +8 -0
- quadint-stubs/quad.pyi +46 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quadint
|
|
3
|
+
Version: 0.0.7
|
|
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
|
|
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 :: Implementation :: CPython
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
This library provides a `QuadInt` class for dealing with Quadratic integers.
|
|
24
|
+
|
|
25
|
+
Additionally, a `complexint` class is provided by default where D == -1 obviously.
|
|
26
|
+
This class acts just like Python's built-in `complex` except it is backed by Python integers instead of doubles.
|
|
27
|
+
This allows for infinite precision.
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from quadint import complexint
|
|
33
|
+
|
|
34
|
+
a = complexint(1, 2)
|
|
35
|
+
b = complexint(3, 6)
|
|
36
|
+
|
|
37
|
+
c = a * b
|
|
38
|
+
print(c) # Outputs "-9+12j"
|
|
39
|
+
|
|
40
|
+
print(type(c.real)) # Outputs "int"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from quadint import make_quadint
|
|
45
|
+
|
|
46
|
+
Q2 = make_quadint(-2)
|
|
47
|
+
|
|
48
|
+
a = Q2(1, 2)
|
|
49
|
+
b = Q2(3, 6)
|
|
50
|
+
|
|
51
|
+
c = a * b
|
|
52
|
+
print(c) # Outputs "(-21+12*sqrt(-2))"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Disclaimer
|
|
56
|
+
|
|
57
|
+
This is intended for use with discrete mathematics, and ideally will be limited to the
|
|
58
|
+
operations: add, sub, mul, and pow.
|
|
59
|
+
|
|
60
|
+
Trying to divide using this class, or using floats with this class, will (probably) result in integer conversion cutoff.
|
|
61
|
+
|
|
62
|
+
As an example of this problem, note the equivalences below:
|
|
63
|
+
```python
|
|
64
|
+
from quadint import complexint
|
|
65
|
+
|
|
66
|
+
a = complexint(3, 6)
|
|
67
|
+
|
|
68
|
+
print(a / 3) # Outputs "(1+2j)
|
|
69
|
+
print(a / 3.5) # Outputs "(1+2j)"
|
|
70
|
+
|
|
71
|
+
print(a + 1) # Outputs "(4+6j)"
|
|
72
|
+
print(a + 1.5) # Outputs "(4+6j)"
|
|
73
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
9c46a97409a639359bbf__mypyc.cpython-310-x86_64-linux-gnu.so,sha256=bk7Us-yIjCxjfPSNCfdUP3g8822K_C8wHaiK1ojXrzY,454952
|
|
2
|
+
quadint/__init__.cpython-310-x86_64-linux-gnu.so,sha256=gDYDFL8UkEMXfEobyrpsh2CCqAoVbGMDDZ_KdgyfI_I,17416
|
|
3
|
+
quadint/complex.cpython-310-x86_64-linux-gnu.so,sha256=gFMWPptv-p0BnMXGjJyjujJjHvDKUMsnYnqubPkfIAo,17432
|
|
4
|
+
quadint/eisenstein.cpython-310-x86_64-linux-gnu.so,sha256=7tTX5AsIwgSPOAscLha5hY4SRxNzBrpWSvsaxtsZwF0,17440
|
|
5
|
+
quadint/quad.cpython-310-x86_64-linux-gnu.so,sha256=XRM_2DOzJ0FHfJnge6jNkgMWtpgIM-6gTR6BTLa0jHw,17408
|
|
6
|
+
quadint-stubs/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
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.7.dist-info/METADATA,sha256=GTAXLAJOV7xR1BcD8-AaqXna_M9LccsMAQapdxwtXe8,1977
|
|
11
|
+
quadint-0.0.7.dist-info/WHEEL,sha256=DZl4yYurviXJJQsilHH1qAzCRDsdz--oNtDZ-hUrZUk,190
|
|
12
|
+
quadint-0.0.7.dist-info/top_level.txt,sha256=3uozn88TjoQFTKJWsN_qpidOqiCMI-Vk5jp1XkGRW78,50
|
|
13
|
+
quadint-0.0.7.dist-info/RECORD,,
|
|
14
|
+
quadint-0.0.7.dist-info/licenses/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
|
@@ -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.
|
|
File without changes
|
|
@@ -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: ...
|
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: ...
|