From 69b4cff75913f4d2f3100f6106c06ad5e487870c Mon Sep 17 00:00:00 2001 From: SwayamInSync Date: Sat, 10 Jan 2026 15:01:13 +0000 Subject: [PATCH 1/5] looks good --- .github/workflows/typecheck.yml | 2 +- quaddtype/meson.build | 76 ++++++------- quaddtype/pyproject.toml | 4 +- quaddtype/release_tracker.md | 101 ------------------ .../src => src/csrc}/casts.cpp | 0 .../{numpy_quaddtype/src => src/csrc}/casts.h | 0 .../src => src/csrc}/constants.hpp | 0 .../src => src/csrc}/dragon4.c | 0 .../src => src/csrc}/dragon4.h | 0 .../{numpy_quaddtype/src => src/csrc}/dtype.c | 0 .../{numpy_quaddtype/src => src/csrc}/dtype.h | 0 .../{numpy_quaddtype/src => src/csrc}/lock.c | 0 .../{numpy_quaddtype/src => src/csrc}/lock.h | 0 .../{numpy_quaddtype/src => src/csrc}/ops.hpp | 0 .../src => src/csrc}/quad_common.h | 0 .../src => src/csrc}/quadblas_interface.cpp | 0 .../src => src/csrc}/quadblas_interface.h | 0 .../src => src/csrc}/quaddtype_main.c | 0 .../src => src/csrc}/scalar.c | 0 .../src => src/csrc}/scalar.h | 0 .../src => src/csrc}/scalar_ops.cpp | 0 .../src => src/csrc}/scalar_ops.h | 0 .../src => src/csrc}/umath/binary_ops.cpp | 0 .../src => src/csrc}/umath/binary_ops.h | 0 .../src => src/csrc}/umath/comparison_ops.cpp | 0 .../src => src/csrc}/umath/comparison_ops.h | 0 .../src => src/csrc}/umath/matmul.cpp | 0 .../src => src/csrc}/umath/matmul.h | 0 .../src => src/csrc}/umath/promoters.hpp | 0 .../src => src/csrc}/umath/umath.cpp | 0 .../src => src/csrc}/umath/umath.h | 0 .../src => src/csrc}/umath/unary_ops.cpp | 0 .../src => src/csrc}/umath/unary_ops.h | 0 .../src => src/csrc}/umath/unary_props.cpp | 0 .../src => src/csrc}/umath/unary_props.h | 0 .../src => src/csrc}/utilities.c | 0 .../src => src/csrc}/utilities.h | 0 .../{ => src}/numpy_quaddtype/__init__.py | 0 .../{ => src}/numpy_quaddtype/__init__.pyi | 0 .../numpy_quaddtype/_quaddtype_main.pyi | 0 quaddtype/{ => src}/numpy_quaddtype/py.typed | 0 41 files changed, 41 insertions(+), 142 deletions(-) delete mode 100644 quaddtype/release_tracker.md rename quaddtype/{numpy_quaddtype/src => src/csrc}/casts.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/casts.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/constants.hpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/dragon4.c (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/dragon4.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/dtype.c (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/dtype.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/lock.c (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/lock.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/ops.hpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/quad_common.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/quadblas_interface.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/quadblas_interface.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/quaddtype_main.c (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/scalar.c (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/scalar.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/scalar_ops.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/scalar_ops.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/binary_ops.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/binary_ops.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/comparison_ops.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/comparison_ops.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/matmul.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/matmul.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/promoters.hpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/umath.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/umath.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/unary_ops.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/unary_ops.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/unary_props.cpp (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/umath/unary_props.h (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/utilities.c (100%) rename quaddtype/{numpy_quaddtype/src => src/csrc}/utilities.h (100%) rename quaddtype/{ => src}/numpy_quaddtype/__init__.py (100%) rename quaddtype/{ => src}/numpy_quaddtype/__init__.pyi (100%) rename quaddtype/{ => src}/numpy_quaddtype/_quaddtype_main.pyi (100%) rename quaddtype/{ => src}/numpy_quaddtype/py.typed (100%) diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index c106684a..a09f18fb 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -5,7 +5,7 @@ on: pull_request: paths: - .github/workflows/typecheck.yml - - quaddtype/numpy_quaddtype/** + - quaddtype/src/numpy_quaddtype/** - quaddtype/meson.build - quaddtype/pyproject.toml workflow_dispatch: diff --git a/quaddtype/meson.build b/quaddtype/meson.build index 40783cf3..8bfc2fc0 100644 --- a/quaddtype/meson.build +++ b/quaddtype/meson.build @@ -155,53 +155,53 @@ build_includes = include_directories('.') # compile time generated headers as pe includes = include_directories( [ incdir_numpy, - 'numpy_quaddtype/src', + 'src/csrc', ] ) pythoncapi_includes = pythoncapi_compat_inc srcs = [ - 'numpy_quaddtype/src/quad_common.h', - 'numpy_quaddtype/src/casts.h', - 'numpy_quaddtype/src/casts.cpp', - 'numpy_quaddtype/src/scalar.h', - 'numpy_quaddtype/src/scalar.c', - 'numpy_quaddtype/src/dtype.h', - 'numpy_quaddtype/src/dtype.c', - 'numpy_quaddtype/src/quaddtype_main.c', - 'numpy_quaddtype/src/scalar_ops.h', - 'numpy_quaddtype/src/scalar_ops.cpp', - 'numpy_quaddtype/src/ops.hpp', - 'numpy_quaddtype/src/dragon4.h', - 'numpy_quaddtype/src/dragon4.c', - 'numpy_quaddtype/src/quadblas_interface.h', - 'numpy_quaddtype/src/quadblas_interface.cpp', - 'numpy_quaddtype/src/umath/umath.h', - 'numpy_quaddtype/src/umath/umath.cpp', - 'numpy_quaddtype/src/umath/binary_ops.h', - 'numpy_quaddtype/src/umath/binary_ops.cpp', - 'numpy_quaddtype/src/umath/unary_ops.h', - 'numpy_quaddtype/src/umath/unary_ops.cpp', - 'numpy_quaddtype/src/umath/unary_props.h', - 'numpy_quaddtype/src/umath/unary_props.cpp', - 'numpy_quaddtype/src/umath/comparison_ops.h', - 'numpy_quaddtype/src/umath/comparison_ops.cpp', - 'numpy_quaddtype/src/umath/promoters.hpp', - 'numpy_quaddtype/src/umath/matmul.h', - 'numpy_quaddtype/src/umath/matmul.cpp', - 'numpy_quaddtype/src/constants.hpp', - 'numpy_quaddtype/src/lock.h', - 'numpy_quaddtype/src/lock.c', - 'numpy_quaddtype/src/utilities.h', - 'numpy_quaddtype/src/utilities.c', + 'src/csrc/quad_common.h', + 'src/csrc/casts.h', + 'src/csrc/casts.cpp', + 'src/csrc/scalar.h', + 'src/csrc/scalar.c', + 'src/csrc/dtype.h', + 'src/csrc/dtype.c', + 'src/csrc/quaddtype_main.c', + 'src/csrc/scalar_ops.h', + 'src/csrc/scalar_ops.cpp', + 'src/csrc/ops.hpp', + 'src/csrc/dragon4.h', + 'src/csrc/dragon4.c', + 'src/csrc/quadblas_interface.h', + 'src/csrc/quadblas_interface.cpp', + 'src/csrc/umath/umath.h', + 'src/csrc/umath/umath.cpp', + 'src/csrc/umath/binary_ops.h', + 'src/csrc/umath/binary_ops.cpp', + 'src/csrc/umath/unary_ops.h', + 'src/csrc/umath/unary_ops.cpp', + 'src/csrc/umath/unary_props.h', + 'src/csrc/umath/unary_props.cpp', + 'src/csrc/umath/comparison_ops.h', + 'src/csrc/umath/comparison_ops.cpp', + 'src/csrc/umath/promoters.hpp', + 'src/csrc/umath/matmul.h', + 'src/csrc/umath/matmul.cpp', + 'src/csrc/constants.hpp', + 'src/csrc/lock.h', + 'src/csrc/lock.c', + 'src/csrc/utilities.h', + 'src/csrc/utilities.c', ] py.install_sources( [ - 'numpy_quaddtype/__init__.py', - 'numpy_quaddtype/__init__.pyi', - 'numpy_quaddtype/_quaddtype_main.pyi', - 'numpy_quaddtype/py.typed', + 'src/numpy_quaddtype/__init__.py', + 'src/numpy_quaddtype/__init__.pyi', + 'src/numpy_quaddtype/_quaddtype_main.pyi', + 'src/numpy_quaddtype/py.typed', ], subdir: 'numpy_quaddtype', pure: false diff --git a/quaddtype/pyproject.toml b/quaddtype/pyproject.toml index feca2441..49735c43 100644 --- a/quaddtype/pyproject.toml +++ b/quaddtype/pyproject.toml @@ -49,7 +49,7 @@ Documentation = "https://github.com/numpy/numpy-user-dtypes/tree/main/quaddtype" Issues = "https://github.com/numpy/numpy-user-dtypes/issues" [tool.pyright] -include = ["numpy_quaddtype/*.pyi"] +include = ["src/numpy_quaddtype/*.pyi"] typeCheckingMode = "strict" enableTypeIgnoreComments = false reportImplicitOverride = true @@ -58,7 +58,7 @@ reportUnnecessaryTypeIgnoreComment = true [tool.mypy] strict = true strict_equality_for_none = true -exclude = ["build", "numpy_quaddtype/src", "subprojects", "tests"] +exclude = ["build", "src/csrc", "subprojects", "tests"] enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] warn_unreachable = false diff --git a/quaddtype/release_tracker.md b/quaddtype/release_tracker.md deleted file mode 100644 index 158336b6..00000000 --- a/quaddtype/release_tracker.md +++ /dev/null @@ -1,101 +0,0 @@ -# Plan for `numpy-quaddtype` v1.0.0 - -- [x] High-Endian System support -- [ ] Complete Documentation - -| ufunc name | Added | Edge Cases Tested\* | -| ------------- | ----- | -------------------------------------------------------------------- | -| add | ✅ | ✅ | -| subtract | ✅ | ✅ | -| multiply | ✅ | ✅ | -| matmul | ✅ | ✅ | -| divide | ✅ | ✅ | -| logaddexp | ✅ | ✅ | -| logaddexp2 | ✅ | ✅ | -| true_divide | ✅ | ✅ | -| floor_divide | ✅ | ✅ | -| negative | ✅ | ✅ | -| positive | ✅ | ✅ | -| power | ✅ | ✅ | -| float_power | ✅ | ✅ | -| remainder | ✅ | ✅ | -| mod | ✅ | ✅ | -| fmod | ✅ | ✅ | -| divmod | ✅ | ✅ | -| absolute | ✅ | ✅ | -| fabs | ✅ | ✅ | -| rint | ✅ | ✅ | -| sign | ✅ | ✅ | -| heaviside | ✅ | ✅ | -| conj | ✅ | ✅ | -| conjugate | ✅ | ✅ | -| exp | ✅ | ✅ | -| exp2 | ✅ | ✅ | -| log | ✅ | ✅ | -| log2 | ✅ | ✅ | -| log10 | ✅ | ✅ | -| expm1 | ✅ | ✅ | -| log1p | ✅ | ✅ | -| sqrt | ✅ | ✅ | -| square | ✅ | ✅ | -| cbrt | ✅ | ✅ | -| reciprocal | ✅ | ✅ | -| sin | ✅ | ✅ | -| cos | ✅ | ✅ | -| tan | ✅ | ✅ | -| arcsin | ✅ | ✅ | -| arccos | ✅ | ✅ | -| arctan | ✅ | ✅ | -| arctan2 | ✅ | ✅ | -| hypot | ✅ | ✅ | -| sinh | ✅ | ✅ | -| cosh | ✅ | ✅ | -| tanh | ✅ | ✅ | -| arcsinh | ✅ | ✅ | -| arccosh | ✅ | ✅ | -| arctanh | ✅ | ✅ | -| degrees | ✅ | ✅ | -| radians | ✅ | ✅ | -| deg2rad | ✅ | ✅ | -| rad2deg | ✅ | ✅ | -| greater | ✅ | ✅ | -| greater_equal | ✅ | ✅ | -| less | ✅ | ✅ | -| less_equal | ✅ | ✅ | -| not_equal | ✅ | ✅ | -| equal | ✅ | ✅ | -| logical_and | ✅ | ✅ | -| logical_or | ✅ | ✅ | -| logical_xor | ✅ | ✅ | -| logical_not | ✅ | ✅ | -| maximum | ✅ | ✅ | -| minimum | ✅ | ✅ | -| fmax | ✅ | ✅ | -| fmin | ✅ | ✅ | -| isfinite | ✅ | ✅ | -| isinf | ✅ | ✅ | -| isnan | ✅ | ✅ | -| signbit | ✅ | ✅ | -| copysign | ✅ | ✅ | -| nextafter | ✅ | ✅ | -| spacing | ✅ | ✅ | -| modf | ✅ | ✅ | -| ldexp | ✅ | ✅ | -| frexp | ✅ | ✅ | -| floor | ✅ | ✅ | -| ceil | ✅ | ✅ | -| trunc | ✅ | ✅ | - -\* **Edge Cases Tested**: Indicates whether the ufunc has parametrized tests that compare QuadPrecision results against `float` and `np.float64` for edge cases including: - -- Special values: `0.0`, `-0.0`, `inf`, `-inf`, `nan`, `-nan` -- For trigonometric functions: Critical points like `0`, `π/2`, `π`, `3π/2`, `2π`, values in `[0, 2π]` -- For logarithmic functions: Values near `0`, `1`, large values -- For exponential functions: Large positive/negative values, values near `0` - -**Testing Status:** - -- ✅ = Comprehensive edge case tests exist in `test_quaddtype.py` with parametrized tests against float64 -- 🟡 = Good basic testing exists but missing some edge cases (specific missing tests noted in italics) -- ❌ = Ufunc is implemented but lacks systematic testing (required tests noted in italics) -- (blank) = Ufunc not yet implemented (implementation needed first) diff --git a/quaddtype/numpy_quaddtype/src/casts.cpp b/quaddtype/src/csrc/casts.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/casts.cpp rename to quaddtype/src/csrc/casts.cpp diff --git a/quaddtype/numpy_quaddtype/src/casts.h b/quaddtype/src/csrc/casts.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/casts.h rename to quaddtype/src/csrc/casts.h diff --git a/quaddtype/numpy_quaddtype/src/constants.hpp b/quaddtype/src/csrc/constants.hpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/constants.hpp rename to quaddtype/src/csrc/constants.hpp diff --git a/quaddtype/numpy_quaddtype/src/dragon4.c b/quaddtype/src/csrc/dragon4.c similarity index 100% rename from quaddtype/numpy_quaddtype/src/dragon4.c rename to quaddtype/src/csrc/dragon4.c diff --git a/quaddtype/numpy_quaddtype/src/dragon4.h b/quaddtype/src/csrc/dragon4.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/dragon4.h rename to quaddtype/src/csrc/dragon4.h diff --git a/quaddtype/numpy_quaddtype/src/dtype.c b/quaddtype/src/csrc/dtype.c similarity index 100% rename from quaddtype/numpy_quaddtype/src/dtype.c rename to quaddtype/src/csrc/dtype.c diff --git a/quaddtype/numpy_quaddtype/src/dtype.h b/quaddtype/src/csrc/dtype.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/dtype.h rename to quaddtype/src/csrc/dtype.h diff --git a/quaddtype/numpy_quaddtype/src/lock.c b/quaddtype/src/csrc/lock.c similarity index 100% rename from quaddtype/numpy_quaddtype/src/lock.c rename to quaddtype/src/csrc/lock.c diff --git a/quaddtype/numpy_quaddtype/src/lock.h b/quaddtype/src/csrc/lock.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/lock.h rename to quaddtype/src/csrc/lock.h diff --git a/quaddtype/numpy_quaddtype/src/ops.hpp b/quaddtype/src/csrc/ops.hpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/ops.hpp rename to quaddtype/src/csrc/ops.hpp diff --git a/quaddtype/numpy_quaddtype/src/quad_common.h b/quaddtype/src/csrc/quad_common.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/quad_common.h rename to quaddtype/src/csrc/quad_common.h diff --git a/quaddtype/numpy_quaddtype/src/quadblas_interface.cpp b/quaddtype/src/csrc/quadblas_interface.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/quadblas_interface.cpp rename to quaddtype/src/csrc/quadblas_interface.cpp diff --git a/quaddtype/numpy_quaddtype/src/quadblas_interface.h b/quaddtype/src/csrc/quadblas_interface.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/quadblas_interface.h rename to quaddtype/src/csrc/quadblas_interface.h diff --git a/quaddtype/numpy_quaddtype/src/quaddtype_main.c b/quaddtype/src/csrc/quaddtype_main.c similarity index 100% rename from quaddtype/numpy_quaddtype/src/quaddtype_main.c rename to quaddtype/src/csrc/quaddtype_main.c diff --git a/quaddtype/numpy_quaddtype/src/scalar.c b/quaddtype/src/csrc/scalar.c similarity index 100% rename from quaddtype/numpy_quaddtype/src/scalar.c rename to quaddtype/src/csrc/scalar.c diff --git a/quaddtype/numpy_quaddtype/src/scalar.h b/quaddtype/src/csrc/scalar.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/scalar.h rename to quaddtype/src/csrc/scalar.h diff --git a/quaddtype/numpy_quaddtype/src/scalar_ops.cpp b/quaddtype/src/csrc/scalar_ops.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/scalar_ops.cpp rename to quaddtype/src/csrc/scalar_ops.cpp diff --git a/quaddtype/numpy_quaddtype/src/scalar_ops.h b/quaddtype/src/csrc/scalar_ops.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/scalar_ops.h rename to quaddtype/src/csrc/scalar_ops.h diff --git a/quaddtype/numpy_quaddtype/src/umath/binary_ops.cpp b/quaddtype/src/csrc/umath/binary_ops.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/binary_ops.cpp rename to quaddtype/src/csrc/umath/binary_ops.cpp diff --git a/quaddtype/numpy_quaddtype/src/umath/binary_ops.h b/quaddtype/src/csrc/umath/binary_ops.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/binary_ops.h rename to quaddtype/src/csrc/umath/binary_ops.h diff --git a/quaddtype/numpy_quaddtype/src/umath/comparison_ops.cpp b/quaddtype/src/csrc/umath/comparison_ops.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/comparison_ops.cpp rename to quaddtype/src/csrc/umath/comparison_ops.cpp diff --git a/quaddtype/numpy_quaddtype/src/umath/comparison_ops.h b/quaddtype/src/csrc/umath/comparison_ops.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/comparison_ops.h rename to quaddtype/src/csrc/umath/comparison_ops.h diff --git a/quaddtype/numpy_quaddtype/src/umath/matmul.cpp b/quaddtype/src/csrc/umath/matmul.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/matmul.cpp rename to quaddtype/src/csrc/umath/matmul.cpp diff --git a/quaddtype/numpy_quaddtype/src/umath/matmul.h b/quaddtype/src/csrc/umath/matmul.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/matmul.h rename to quaddtype/src/csrc/umath/matmul.h diff --git a/quaddtype/numpy_quaddtype/src/umath/promoters.hpp b/quaddtype/src/csrc/umath/promoters.hpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/promoters.hpp rename to quaddtype/src/csrc/umath/promoters.hpp diff --git a/quaddtype/numpy_quaddtype/src/umath/umath.cpp b/quaddtype/src/csrc/umath/umath.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/umath.cpp rename to quaddtype/src/csrc/umath/umath.cpp diff --git a/quaddtype/numpy_quaddtype/src/umath/umath.h b/quaddtype/src/csrc/umath/umath.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/umath.h rename to quaddtype/src/csrc/umath/umath.h diff --git a/quaddtype/numpy_quaddtype/src/umath/unary_ops.cpp b/quaddtype/src/csrc/umath/unary_ops.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/unary_ops.cpp rename to quaddtype/src/csrc/umath/unary_ops.cpp diff --git a/quaddtype/numpy_quaddtype/src/umath/unary_ops.h b/quaddtype/src/csrc/umath/unary_ops.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/unary_ops.h rename to quaddtype/src/csrc/umath/unary_ops.h diff --git a/quaddtype/numpy_quaddtype/src/umath/unary_props.cpp b/quaddtype/src/csrc/umath/unary_props.cpp similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/unary_props.cpp rename to quaddtype/src/csrc/umath/unary_props.cpp diff --git a/quaddtype/numpy_quaddtype/src/umath/unary_props.h b/quaddtype/src/csrc/umath/unary_props.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/umath/unary_props.h rename to quaddtype/src/csrc/umath/unary_props.h diff --git a/quaddtype/numpy_quaddtype/src/utilities.c b/quaddtype/src/csrc/utilities.c similarity index 100% rename from quaddtype/numpy_quaddtype/src/utilities.c rename to quaddtype/src/csrc/utilities.c diff --git a/quaddtype/numpy_quaddtype/src/utilities.h b/quaddtype/src/csrc/utilities.h similarity index 100% rename from quaddtype/numpy_quaddtype/src/utilities.h rename to quaddtype/src/csrc/utilities.h diff --git a/quaddtype/numpy_quaddtype/__init__.py b/quaddtype/src/numpy_quaddtype/__init__.py similarity index 100% rename from quaddtype/numpy_quaddtype/__init__.py rename to quaddtype/src/numpy_quaddtype/__init__.py diff --git a/quaddtype/numpy_quaddtype/__init__.pyi b/quaddtype/src/numpy_quaddtype/__init__.pyi similarity index 100% rename from quaddtype/numpy_quaddtype/__init__.pyi rename to quaddtype/src/numpy_quaddtype/__init__.pyi diff --git a/quaddtype/numpy_quaddtype/_quaddtype_main.pyi b/quaddtype/src/numpy_quaddtype/_quaddtype_main.pyi similarity index 100% rename from quaddtype/numpy_quaddtype/_quaddtype_main.pyi rename to quaddtype/src/numpy_quaddtype/_quaddtype_main.pyi diff --git a/quaddtype/numpy_quaddtype/py.typed b/quaddtype/src/numpy_quaddtype/py.typed similarity index 100% rename from quaddtype/numpy_quaddtype/py.typed rename to quaddtype/src/numpy_quaddtype/py.typed From 2dc4ae0718840629616ee4e615ab8f1660037ca7 Mon Sep 17 00:00:00 2001 From: SwayamInSync Date: Sat, 10 Jan 2026 15:09:27 +0000 Subject: [PATCH 2/5] rem not needed bash files --- quaddtype/sdist_test.sh | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 quaddtype/sdist_test.sh diff --git a/quaddtype/sdist_test.sh b/quaddtype/sdist_test.sh deleted file mode 100644 index 786f05fd..00000000 --- a/quaddtype/sdist_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -x - -if [ -d "build/" ]; then - rm -rf dist/ -fi - -python -m pip uninstall -y numpy_quaddtype -python -m build --sdist --outdir dist/ -python -m pip install dist/*.tar.gz -v \ No newline at end of file From 07ea57752923bfe766d31d0955eac2b87fcb3c6d Mon Sep 17 00:00:00 2001 From: swayaminsync Date: Tue, 13 Jan 2026 10:37:36 +0530 Subject: [PATCH 3/5] updated readme --- quaddtype/README.md | 138 ++++++++++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 62 deletions(-) diff --git a/quaddtype/README.md b/quaddtype/README.md index c3dd655b..79c6c84e 100644 --- a/quaddtype/README.md +++ b/quaddtype/README.md @@ -1,11 +1,31 @@ # NumPy-QuadDType +[![PyPI](https://img.shields.io/pypi/v/numpy-quaddtype.svg)](https://pypi.org/project/numpy-quaddtype/) +[![PyPI Downloads](https://static.pepy.tech/badge/numpy-quaddtype/month)](https://pepy.tech/project/numpy-quaddtype) +[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/numpy_quaddtype.svg?label=Conda%20downloads)](https://anaconda.org/conda-forge/numpy_quaddtype) +[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) + A cross-platform Quad (128-bit) float Data-Type for NumPy. +## Table of Contents + +- [NumPy-QuadDType](#numpy-quaddtype) + - [Table of Contents](#table-of-contents) + - [Installation](#installation) + - [Usage](#usage) + - [Installation from source](#installation-from-source) + - [Linux/Unix/macOS](#linuxunixmacos) + - [Windows](#windows) + - [Building with ThreadSanitizer (TSan)](#building-with-threadsanitizer-tsan) + - [Building the documentation](#building-the-documentation) + - [Serving the documentation](#serving-the-documentation) + - [Development Tips](#development-tips) + - [Cleaning the Build Directory](#cleaning-the-build-directory) + ## Installation ```bash -pip install numpy +pip install "numpy>=2.4" pip install numpy-quaddtype ``` @@ -25,50 +45,31 @@ np.array([1,2,3], dtype=QuadPrecDType("longdouble")) ## Installation from source -### Prerequisites - -- **gcc/clang** -- **CMake** (≥3.15) -- **Python 3.10+** -- **Git** -- **NumPy >= 2.4** (build from source) - ### Linux/Unix/macOS -Building the `numpy-quaddtype` package: +**Prerequisites:** gcc/clang, CMake (≥3.15), Python 3.11+, Git, NumPy ≥ 2.4 ```bash # setup the virtual env python3 -m venv temp source temp/bin/activate -# Install NumPy from source -pip install "numpy @ git+https://github.com/numpy/numpy.git" - # Install build and test dependencies -pip install pytest meson meson-python +pip install pytest meson meson-python "numpy>=2.4" # To build without QBLAS (default for MSVC) # export CFLAGS="-DDISABLE_QUADBLAS" # export CXXFLAGS="-DDISABLE_QUADBLAS" -python -m pip install . -v --no-build-isolation +python -m pip install ".[test]" -v # Run the tests -cd .. -python -m pytest/quaddtype/tests/ +python -m pytest tests ``` ### Windows -#### Prerequisites - -- **Visual Studio 2017 or later** (with MSVC compiler) -- **CMake** (≥3.15) -- **Python 3.10+** -- **Git** - -#### Step-by-Step Installation +**Prerequisites:** Visual Studio 2017+ (with MSVC), CMake (≥3.15), Python 3.11+, Git 1. **Setup Development Environment** @@ -98,14 +99,14 @@ python -m pytest/quaddtype/tests/ ```powershell # Build and install the package - python -m pip install . -v --no-build-isolation + python -m pip install ".[test]" -v ``` 5. **Test Installation** ```powershell # Run tests - pytest -s ..\quaddtype\tests\ + pytest -s tests ``` 6. **QBLAS Disabled**: QuadBLAS optimization is automatically disabled on Windows builds due to MSVC compatibility issues. This is handled by the `-DDISABLE_QUADBLAS` compiler flag. @@ -122,6 +123,7 @@ python -m pytest/quaddtype/tests/ This is a development feature to help detect threading issues. To build `numpy-quaddtype` with TSan enabled, follow these steps: > Use of clang is recommended with machine NOT supporting `libquadmath` (like ARM64). Set the compiler to clang/clang++ before proceeding. +> > ```bash > export CC=clang > export CXX=clang++ @@ -131,46 +133,48 @@ This is a development feature to help detect threading issues. To build `numpy-q 2. Create and activate a virtual environment using the TSan-enabled Python build. 3. Installing dependencies: - ```bash - python -m pip install meson meson-python wheel ninja - # Need NumPy built with TSan as well - python -m pip install "numpy @ git+https://github.com/numpy/numpy" -C'setup-args=-Db_sanitize=thread' - ``` +```bash +python -m pip install meson meson-python wheel ninja +# Need NumPy built with TSan as well +python -m pip install "numpy @ git+https://github.com/numpy/numpy" -C'setup-args=-Db_sanitize=thread' +``` + 4. Building SLEEF with TSan: - ```bash - # clone the repository - git clone -b 3.8 https://github.com/shibatch/sleef.git - cd sleef - - # Build SLEEF with TSan - cmake \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_FLAGS="-fsanitize=thread -g -O1" \ - -DCMAKE_CXX_FLAGS="-fsanitize=thread -g -O1" \ - -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" \ - -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=thread" \ - -DSLEEF_BUILD_QUAD=ON \ - -DSLEEF_BUILD_TESTS=OFF \ - -S . -B build - - cmake --build build -j - - # Install the built library and headers into the system path (/usr/local) - sudo cmake --install build --prefix=/usr/local - ``` +```bash +# clone the repository +git clone https://github.com/shibatch/sleef.git +cd sleef +git checkout 43a0252ba9331adc7fb10755021f802863678c38 + +# Build SLEEF with TSan +cmake \ +-DCMAKE_C_COMPILER=clang \ +-DCMAKE_CXX_COMPILER=clang++ \ +-DCMAKE_C_FLAGS="-fsanitize=thread -g -O1" \ +-DCMAKE_CXX_FLAGS="-fsanitize=thread -g -O1" \ +-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" \ +-DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=thread" \ +-DSLEEF_BUILD_QUAD=ON \ +-DSLEEF_BUILD_TESTS=OFF \ +-DCMAKE_INSTALL_PREFIX=/usr/local +-S . -B build + +cmake --build build -j --clean-first +cmake --install build +``` + 5. Build and install `numpy-quaddtype` with TSan: - ```bash - # SLEEF is already installed with TSan, we need to provide proper flags to numpy-quaddtype's meson file - # So that it does not build SLEEF again and use the installed one. +```bash +# SLEEF is already installed with TSan, we need to provide proper flags to numpy-quaddtype's meson file +# So that it does not build SLEEF again and use the installed one. - export CFLAGS="-fsanitize=thread -g -O0" - export CXXFLAGS="-fsanitize=thread -g -O0" - export LDFLAGS="-fsanitize=thread" - python -m pip install . -vv --no-build-isolation -Csetup-args=-Db_sanitize=thread - ``` +export CFLAGS="-fsanitize=thread -g -O0" +export CXXFLAGS="-fsanitize=thread -g -O0" +export LDFLAGS="-fsanitize=thread" +python -m pip install . -vv -Csetup-args=-Db_sanitize=thread +``` ## Building the documentation @@ -204,3 +208,13 @@ https://numpy.github.io/numpy-user-dtypes/quaddtype/ ``` Check the `.github/workflows/build_docs.yml` file for details. + +## Development Tips + +### Cleaning the Build Directory + +The subproject folders (`subprojects/sleef`, `subprojects/qblas`) are cloned as git repositories. To fully clean them, use double force: + +```bash +git clean -ffxd +``` From d466e0883b51a1416d8441228e0055ee1646ff49 Mon Sep 17 00:00:00 2001 From: SwayamInSync Date: Tue, 13 Jan 2026 10:23:21 +0000 Subject: [PATCH 4/5] added docs link --- quaddtype/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quaddtype/README.md b/quaddtype/README.md index 79c6c84e..aa2884d5 100644 --- a/quaddtype/README.md +++ b/quaddtype/README.md @@ -3,10 +3,13 @@ [![PyPI](https://img.shields.io/pypi/v/numpy-quaddtype.svg)](https://pypi.org/project/numpy-quaddtype/) [![PyPI Downloads](https://static.pepy.tech/badge/numpy-quaddtype/month)](https://pepy.tech/project/numpy-quaddtype) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/numpy_quaddtype.svg?label=Conda%20downloads)](https://anaconda.org/conda-forge/numpy_quaddtype) +[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://numpy.org/numpy-user-dtypes/quaddtype/) [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) A cross-platform Quad (128-bit) float Data-Type for NumPy. +**[📖 Read the full documentation](https://numpy.org/numpy-user-dtypes/quaddtype/)** + ## Table of Contents - [NumPy-QuadDType](#numpy-quaddtype) @@ -204,7 +207,7 @@ The documentation for the `numpy-quaddtype` package is built using Sphinx. To bu The documentation is automatically built and served using GitHub Pages. Every time changes are pushed to the `main` branch, the documentation is rebuilt and deployed to the `gh-pages` branch of the repository. You can access the documentation at: ``` -https://numpy.github.io/numpy-user-dtypes/quaddtype/ +https://numpy.org/numpy-user-dtypes/quaddtype/ ``` Check the `.github/workflows/build_docs.yml` file for details. From b030db8f42d2c041fb5765b7f751dc313772c1e0 Mon Sep 17 00:00:00 2001 From: swayaminsync Date: Wed, 14 Jan 2026 11:16:30 +0530 Subject: [PATCH 5/5] update version + dynamic version fetch --- quaddtype/pyproject.toml | 2 +- quaddtype/src/numpy_quaddtype/__init__.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/quaddtype/pyproject.toml b/quaddtype/pyproject.toml index 97142913..2a1d0b40 100644 --- a/quaddtype/pyproject.toml +++ b/quaddtype/pyproject.toml @@ -11,7 +11,7 @@ build-backend = "mesonpy" [project] name = "numpy_quaddtype" description = "Quad (128-bit) float dtype for numpy" -version = "0.2.0" +version = "1.0.0" readme = 'README.md' license = "BSD-3-Clause" license-files = ["LICENSE"] diff --git a/quaddtype/src/numpy_quaddtype/__init__.py b/quaddtype/src/numpy_quaddtype/__init__.py index aa7839e0..e6aba393 100644 --- a/quaddtype/src/numpy_quaddtype/__init__.py +++ b/quaddtype/src/numpy_quaddtype/__init__.py @@ -1,4 +1,5 @@ import enum +from importlib.metadata import version, PackageNotFoundError from ._quaddtype_main import ( QuadPrecision, @@ -10,7 +11,10 @@ get_quadblas_version ) -__version__ = "0.2.0" +try: + __version__ = version("numpy_quaddtype") +except PackageNotFoundError: + __version__ = "unknown" class QuadBackend(enum.IntEnum):