Skip to content

Commit 1493a9b

Browse files
committed
Squashed commit of the following:
commit 1a6618a Author: swayaminsync <hawkempire007@gmail.com> Date: Sun Sep 22 02:19:59 2024 +0530 missed the comma :) commit 87a7891 Author: swayaminsync <hawkempire007@gmail.com> Date: Sun Sep 22 02:16:24 2024 +0530 updated meson.build commit 77e25b6 Author: swayaminsync <hawkempire007@gmail.com> Date: Sun Sep 22 00:53:57 2024 +0530 made ufunc return actual value instead of 0 commit 600b2c8 Author: swayaminsync <hawkempire007@gmail.com> Date: Sat Sep 21 03:06:36 2024 +0530 fixed inter-backend cast segment fault commit 672be17 Author: swayaminsync <hawkempire007@gmail.com> Date: Sat Sep 21 00:01:39 2024 +0530 added aligned and unaligned casting loops commit 2fd9cad Author: swayaminsync <hawkempire007@gmail.com> Date: Fri Sep 20 21:00:45 2024 +0530 refactoring commit 41ca3f9 Author: swayaminsync <hawkempire007@gmail.com> Date: Fri Sep 20 20:58:08 2024 +0530 added 128-bit common constants commit 012e90f Merge: 082b64b bbc99a6 Author: swayaminsync <hawkempire007@gmail.com> Date: Fri Sep 20 19:30:53 2024 +0530 Merge branch 'dragon4' into constants commit bbc99a6 Author: swayaminsync <hawkempire007@gmail.com> Date: Fri Sep 20 19:27:55 2024 +0530 fixing constant error commit e53edba Author: swayaminsync <hawkempire007@gmail.com> Date: Fri Sep 20 17:03:24 2024 +0530 resolved reviews commit 082b64b Author: swayaminsync <hawkempire007@gmail.com> Date: Thu Sep 19 21:43:48 2024 +0530 exposing constants commit 0052e16 Author: swayaminsync <hawkempire007@gmail.com> Date: Thu Sep 19 13:17:01 2024 +0530 Creating Quad with Quad commit 0a75b91 Author: swayaminsync <hawkempire007@gmail.com> Date: Wed Sep 18 15:39:46 2024 +0530 aligned and unaligned comparison loops commit 707d5d6 Author: swayaminsync <hawkempire007@gmail.com> Date: Wed Sep 18 13:47:32 2024 +0530 fixed longdouble comparison casting issue commit 4f0a604 Author: swayaminsync <hawkempire007@gmail.com> Date: Tue Sep 17 21:51:17 2024 +0530 WIP commit 0fba040 Author: swayaminsync <hawkempire007@gmail.com> Date: Tue Sep 17 18:01:14 2024 +0530 added separate aligned and unaligned ufunc support commit fe6cabc Author: swayaminsync <hawkempire007@gmail.com> Date: Mon Sep 16 18:40:47 2024 +0530 removed unnecessary prints commit b719ba4 Author: swayaminsync <hawkempire007@gmail.com> Date: Mon Sep 16 18:35:54 2024 +0530 fixing import statements commit 25dd6b3 Author: swayaminsync <hawkempire007@gmail.com> Date: Mon Sep 16 18:02:42 2024 +0530 removing testing files commit 0ac5464 Author: swayaminsync <hawkempire007@gmail.com> Date: Mon Sep 16 15:16:12 2024 +0530 added more unary func commit 755e2cd Author: swayaminsync <hawkempire007@gmail.com> Date: Tue Sep 10 08:30:15 2024 +0530 fixing base commit 04480ce Author: swayaminsync <hawkempire007@gmail.com> Date: Sat Sep 7 18:23:20 2024 +0530 np.dot WIP commit 7b43f3b Author: swayaminsync <hawkempire007@gmail.com> Date: Sat Sep 7 12:58:45 2024 +0530 fixing reduction redorderable issue commit 22982a4 Author: swayaminsync <hawkempire007@gmail.com> Date: Fri Sep 6 19:09:12 2024 +0530 adding dragon4 commit 01e9b7e Author: swayaminsync <hawkempire007@gmail.com> Date: Fri Sep 6 12:04:01 2024 +0530 post-cleaning commit e8cba6a Author: swayaminsync <hawkempire007@gmail.com> Date: Thu Sep 5 14:58:47 2024 +0530 temporary solution to handle both backends commit 7a85fbf Author: swayaminsync <hawkempire007@gmail.com> Date: Mon Sep 2 00:24:29 2024 +0530 removed todo comment: umath.cpp commit d664a59 Author: swayaminsync <hawkempire007@gmail.com> Date: Mon Sep 2 00:23:12 2024 +0530 added backend parameter in default descriptor commit 7fd8da6 Author: swayaminsync <hawkempire007@gmail.com> Date: Sun Sep 1 21:14:11 2024 +0530 failing: londouble with different dtype commit a652985 Author: swayaminsync <hawkempire007@gmail.com> Date: Sun Sep 1 12:34:59 2024 +0530 added multi backend support to scalar operations commit 8408227 Author: swayaminsync <hawkempire007@gmail.com> Date: Sun Sep 1 04:17:31 2024 +0530 added ld backend support to casting commit d56e592 Author: swayaminsync <hawkempire007@gmail.com> Date: Sat Aug 31 22:37:00 2024 +0530 renaming module and adding initial longdouble backend support commit 0a36a9d Author: swayaminsync <hawkempire007@gmail.com> Date: Sun Aug 25 12:02:33 2024 +0530 added readme
1 parent ac51015 commit 1493a9b

31 files changed

+5206
-1980
lines changed

quaddtype/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Numpy-QuadDType
2+
3+
## Installation
4+
5+
```
6+
pip install numpy==2.1.0
7+
pip install -i https://test.pypi.org/simple/ quaddtype
8+
```
9+
10+
## Usage
11+
12+
```python
13+
import numpy as np
14+
from numpy_quaddtype import QuadPrecDType, QuadPrecision
15+
16+
# using sleef backend (default)
17+
np.array([1,2,3], dtype=QuadPrecDType())
18+
np.array([1,2,3], dtype=QuadPrecDType("sleef"))
19+
20+
# using longdouble backend
21+
np.array([1,2,3], dtype=QuadPrecDType("longdouble"))
22+
```

quaddtype/meson.build

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project('quaddtype', 'c', 'cpp', default_options : ['cpp_std=c++20', 'b_pie=true'])
1+
project('numpy_quaddtype', 'c', 'cpp', default_options : ['cpp_std=c++17', 'b_pie=true'])
22

33
py_mod = import('python')
44
py = py_mod.find_installation()
@@ -71,41 +71,41 @@ endif
7171
includes = include_directories(
7272
[
7373
incdir_numpy,
74-
'quaddtype/src',
74+
'numpy_quaddtype/src',
7575
]
7676
)
7777

7878
srcs = [
79-
'quaddtype/src/casts.h',
80-
'quaddtype/src/casts.cpp',
81-
'quaddtype/src/scalar.h',
82-
'quaddtype/src/scalar.c',
83-
'quaddtype/src/dtype.h',
84-
'quaddtype/src/dtype.c',
85-
'quaddtype/src/quaddtype_main.c',
86-
'quaddtype/src/scalar_ops.h',
87-
'quaddtype/src/scalar_ops.cpp',
88-
'quaddtype/src/ops.hpp',
89-
'quaddtype/src/umath.h',
90-
'quaddtype/src/umath.cpp'
79+
'numpy_quaddtype/src/quad_common.h',
80+
'numpy_quaddtype/src/casts.h',
81+
'numpy_quaddtype/src/casts.cpp',
82+
'numpy_quaddtype/src/scalar.h',
83+
'numpy_quaddtype/src/scalar.c',
84+
'numpy_quaddtype/src/dtype.h',
85+
'numpy_quaddtype/src/dtype.c',
86+
'numpy_quaddtype/src/quaddtype_main.c',
87+
'numpy_quaddtype/src/scalar_ops.h',
88+
'numpy_quaddtype/src/scalar_ops.cpp',
89+
'numpy_quaddtype/src/ops.hpp',
90+
'numpy_quaddtype/src/umath.h',
91+
'numpy_quaddtype/src/umath.cpp',
92+
'numpy_quaddtype/src/dragon4.h',
93+
'numpy_quaddtype/src/dragon4.c'
9194
]
9295

9396
py.install_sources(
9497
[
95-
'quaddtype/__init__.py',
98+
'numpy_quaddtype/__init__.py',
9699
],
97-
subdir: 'quaddtype',
100+
subdir: 'numpy_quaddtype',
98101
pure: false
99102
)
100103

101104
py.extension_module('_quaddtype_main',
102-
srcs,
103-
c_args: is_windows ? ['/DWIN32', '/D_WINDOWS'] : ['-g', '-O0'],
104-
cpp_args: is_windows ? ['/DWIN32', '/D_WINDOWS', '/EHsc'] : ['-g', '-O0'],
105-
link_args: is_windows ? ['/DEFAULTLIB:sleef', '/DEFAULTLIB:sleefquad'] : ['-lsleef', '-lsleefquad'],
106-
dependencies: [sleef_dep] + (is_windows ? [] : [sleefquad_dep]),
107-
link_language: 'cpp',
108-
install: true,
109-
subdir: 'quaddtype',
110-
include_directories: includes
105+
srcs,
106+
c_args: ['-g', '-O0', '-lsleef', '-lsleefquad'],
107+
dependencies: [sleef_dep, sleefquad_dep],
108+
install: true,
109+
subdir: 'numpy_quaddtype',
110+
include_directories: includes
111111
)

quaddtype/numpy_quaddtype/__init__.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from ._quaddtype_main import (
2+
QuadPrecision,
3+
QuadPrecDType,
4+
is_longdouble_128,
5+
get_sleef_constant
6+
)
7+
8+
__all__ = [
9+
'QuadPrecision', 'QuadPrecDType', 'SleefQuadPrecision', 'LongDoubleQuadPrecision',
10+
'SleefQuadPrecDType', 'LongDoubleQuadPrecDType', 'is_longdouble_128', 'pi', 'e',
11+
'log2e', 'log10e', 'ln2', 'ln10', 'max_value', 'min_value', 'epsilon'
12+
]
13+
14+
def SleefQuadPrecision(value):
15+
return QuadPrecision(value, backend='sleef')
16+
17+
def LongDoubleQuadPrecision(value):
18+
return QuadPrecision(value, backend='longdouble')
19+
20+
def SleefQuadPrecDType():
21+
return QuadPrecDType(backend='sleef')
22+
23+
def LongDoubleQuadPrecDType():
24+
return QuadPrecDType(backend='longdouble')
25+
26+
pi = get_sleef_constant("pi")
27+
e = get_sleef_constant("e")
28+
log2e = get_sleef_constant("log2e")
29+
log10e = get_sleef_constant("log10e")
30+
ln2 = get_sleef_constant("ln2")
31+
ln10 = get_sleef_constant("ln10")
32+
max_value = get_sleef_constant("quad_max")
33+
min_value = get_sleef_constant("quad_min")
34+
epsilon = get_sleef_constant("epsilon")

0 commit comments

Comments
 (0)