Skip to content

Commit

Permalink
Merge branch 'numpy_no2'
Browse files Browse the repository at this point in the history
  • Loading branch information
djdt committed Jun 19, 2024
2 parents e514b2b + a85fb2e commit 7d52a4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[build-system]
requires = ["setuptools", "numpy>=2.0"]
requires = ["setuptools", "numpy>=1.22,<2.0"]
build-backend = "setuptools.build_meta"

[project]
name = "spcal"
version = "1.2.5"
dependencies = [
"numpy>=2.0",
"numpy>=1.22,<2.0",
"PySide6",
"pyqtgraph>=0.13.2",
"pyqtgraph>=0.13.4",
"bottleneck",
"h5py",
]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"spcal.lib.spcalext",
sources=["src/sort.c", "src/spcalext.c"],
include_dirs=["include", numpy.get_include()],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_2_0_API_VERSION")],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
)
Expand Down
11 changes: 7 additions & 4 deletions src/spcalext.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ static PyObject *pairwise_euclidean(PyObject *self, PyObject *args) {
const double *X = (const double *)PyArray_DATA(Xarray);
double *D = (double *)PyArray_DATA(Darray);

npy_intp i, j;
#pragma omp parallel for shared(X, n, m)
for (npy_intp i = 0; i < n; ++i) {
for (npy_intp j = i + 1; j < n; ++j) {
for (i = 0; i < n; ++i) {
for (j = i + 1; j < n; ++j) {
D[condensed_index(i, j, n)] = euclidean(X, i, j, m);
}
}
Expand Down Expand Up @@ -145,8 +146,9 @@ static PyObject *mst_linkage(PyObject *self, PyObject *args) {

// We use Z[:, 2] as M, tracking merged
// Init arrays (ZD = 0), D = inf
npy_intp i;
#pragma omp parallel for
for (npy_intp i = 0; i < n - 1; ++i) {
for (i = 0; i < n - 1; ++i) {
D[i] = INFINITY;
Z3[i].index = i;
}
Expand All @@ -162,8 +164,9 @@ static PyObject *mst_linkage(PyObject *self, PyObject *args) {
double tmin = min;
int ty = y;

int j;
#pragma omp for
for (int j = 0; j < n; ++j) {
for (j = 0; j < n; ++j) {
if (M[j] == 1)
continue;

Expand Down

0 comments on commit 7d52a4e

Please sign in to comment.