Skip to content

Commit 1146881

Browse files
author
peng.li24
committed
Resolve issue 001: remove npy_bridge.h, use std::exp/log/sqrt directly
numpycpp author confirmed: scipy's npy_exp/npy_log/npy_sqrt are just libm, same as std::exp/log/sqrt. No bridge needed for bit-level alignment. Changes: - Delete scipy/npy_bridge.h (no longer needed) - scipy/stats.h: npy_bridge::exp → std::exp, npy_bridge::sqrt → std::sqrt, npy_bridge::log → std::log, remove #include "npy_bridge.h" - scipy/ndimage.h: remove #include "npy_bridge.h" (was unused) - scipy/transform.h: remove #include "npy_bridge.h" (was unused) numpycpp's bridge stays as-is — it serves numpy ufunc alignment.
1 parent a371a18 commit 1146881

4 files changed

Lines changed: 3 additions & 144 deletions

File tree

scipy/ndimage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <vector>
99
#include <cstddef>
1010
#include "numpy/core.h"
11-
#include "npy_bridge.h" // direct npy_* access, bypasses SVML
1211

1312
namespace scipy {
1413
namespace ndimage {

scipy/npy_bridge.h

Lines changed: 0 additions & 138 deletions
This file was deleted.

scipy/stats.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <limits>
1717
#include <vector>
1818
#include "numpy/core.h"
19-
#include "npy_bridge.h" // direct npy_* access, bypasses SVML
2019

2120
namespace scipy::stats {
2221

@@ -173,7 +172,7 @@ inline T cephes_erfc(T a) {
173172
return (a < T(0)) ? T(2) : T(0);
174173
}
175174

176-
z = npy_bridge::exp(z); // exp(-a^2) via npy_exp, bypasses SVML
175+
z = std::exp(z); // exp(-a^2) — std::exp is libm, same as scipy's npy_exp
177176

178177
T p, q;
179178
if (x < T(8)) {
@@ -331,8 +330,8 @@ inline T cephes_ndtri(T y0) {
331330
}
332331

333332
// Tail region: sqrt(-2 * log(y)) based approximation
334-
T x = npy_bridge::sqrt(T(-2) * npy_bridge::log(y));
335-
T x0 = x - npy_bridge::log(x) / x;
333+
T x = std::sqrt(T(-2) * std::log(y));
334+
T x0 = x - std::log(x) / x;
336335

337336
T z = T(1) / x;
338337
T x1;

scipy/transform.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <string>
1212
#include <algorithm>
1313
#include "numpy/core.h"
14-
#include "npy_bridge.h" // direct npy_* access, bypasses SVML
1514

1615
namespace scipy {
1716
namespace spatial {

0 commit comments

Comments
 (0)