pylibsparseir 0.5.2__cp310-cp310-musllinux_1_2_x86_64.whl → 0.6.0__cp310-cp310-musllinux_1_2_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.
Potentially problematic release.
This version of pylibsparseir might be problematic. Click here for more details.
- pylibsparseir/core.py +21 -20
- pylibsparseir/libsparseir.so +0 -0
- {pylibsparseir-0.5.2.dist-info → pylibsparseir-0.6.0.dist-info}/METADATA +59 -61
- {pylibsparseir-0.5.2.dist-info → pylibsparseir-0.6.0.dist-info}/RECORD +7 -7
- share/pkgconfig/eigen3.pc +1 -1
- {pylibsparseir-0.5.2.dist-info → pylibsparseir-0.6.0.dist-info}/WHEEL +0 -0
- {pylibsparseir-0.5.2.dist-info → pylibsparseir-0.6.0.dist-info}/licenses/LICENSE +0 -0
pylibsparseir/core.py
CHANGED
|
@@ -75,8 +75,9 @@ try:
|
|
|
75
75
|
_lib.spir_register_dgemm(ptr)
|
|
76
76
|
_lib.spir_register_zgemm.argtypes = [ctypes.c_void_p]
|
|
77
77
|
_lib.spir_register_zgemm(ptr_z)
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
if os.environ.get("SPARSEIR_DEBUG", "").lower() in ("1", "true", "yes", "on"):
|
|
79
|
+
print(f"[core.py] Registered SciPy BLAS dgemm @ {hex(ptr)}")
|
|
80
|
+
print(f"[core.py] Registered SciPy BLAS zgemm @ {hex(ptr_z)}")
|
|
80
81
|
except Exception as e:
|
|
81
82
|
raise RuntimeError(f"Failed to load SparseIR library: {e}")
|
|
82
83
|
|
|
@@ -172,11 +173,11 @@ def _setup_prototypes():
|
|
|
172
173
|
]
|
|
173
174
|
_lib.spir_funcs_batch_eval_matsu.restype = c_int
|
|
174
175
|
|
|
175
|
-
_lib.
|
|
176
|
-
_lib.
|
|
176
|
+
_lib.spir_funcs_get_n_knots.argtypes = [spir_funcs, POINTER(c_int)]
|
|
177
|
+
_lib.spir_funcs_get_n_knots.restype = c_int
|
|
177
178
|
|
|
178
|
-
_lib.
|
|
179
|
-
_lib.
|
|
179
|
+
_lib.spir_funcs_get_knots.argtypes = [spir_funcs, POINTER(c_double)]
|
|
180
|
+
_lib.spir_funcs_get_knots.restype = c_int
|
|
180
181
|
|
|
181
182
|
# Default sampling points
|
|
182
183
|
_lib.spir_basis_get_n_default_taus.argtypes = [spir_basis, POINTER(c_int)]
|
|
@@ -524,24 +525,24 @@ def funcs_eval_single_complex128(funcs, x):
|
|
|
524
525
|
return out
|
|
525
526
|
|
|
526
527
|
|
|
527
|
-
def
|
|
528
|
-
"""Get the number of
|
|
529
|
-
|
|
530
|
-
status = _lib.
|
|
528
|
+
def funcs_get_n_knots(funcs):
|
|
529
|
+
"""Get the number of knots of the underlying piecewise Legendre polynomial."""
|
|
530
|
+
n_knots = c_int()
|
|
531
|
+
status = _lib.spir_funcs_get_n_knots(funcs, byref(n_knots))
|
|
531
532
|
if status != COMPUTATION_SUCCESS:
|
|
532
|
-
raise RuntimeError(f"Failed to get number of
|
|
533
|
-
return
|
|
533
|
+
raise RuntimeError(f"Failed to get number of knots: {status}")
|
|
534
|
+
return n_knots.value
|
|
534
535
|
|
|
535
536
|
|
|
536
|
-
def
|
|
537
|
-
"""Get the
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
status = _lib.
|
|
541
|
-
funcs,
|
|
537
|
+
def funcs_get_knots(funcs):
|
|
538
|
+
"""Get the knots of the underlying piecewise Legendre polynomial."""
|
|
539
|
+
n_knots = funcs_get_n_knots(funcs)
|
|
540
|
+
knots = np.zeros(n_knots, dtype=np.float64)
|
|
541
|
+
status = _lib.spir_funcs_get_knots(
|
|
542
|
+
funcs, knots.ctypes.data_as(POINTER(c_double)))
|
|
542
543
|
if status != COMPUTATION_SUCCESS:
|
|
543
|
-
raise RuntimeError(f"Failed to get
|
|
544
|
-
return
|
|
544
|
+
raise RuntimeError(f"Failed to get knots: {status}")
|
|
545
|
+
return knots
|
|
545
546
|
|
|
546
547
|
|
|
547
548
|
def basis_get_default_tau_sampling_points(basis):
|
pylibsparseir/libsparseir.so
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pylibsparseir
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Python bindings for the libsparseir library
|
|
5
5
|
Maintainer: SpM-lab
|
|
6
6
|
License: MIT License
|
|
@@ -41,7 +41,7 @@ Project-URL: Documentation, https://github.com/SpM-lab/libsparseir
|
|
|
41
41
|
Project-URL: Repository, https://github.com/SpM-lab/libsparseir
|
|
42
42
|
Project-URL: Issues, https://github.com/SpM-lab/libsparseir/issues
|
|
43
43
|
Requires-Python: >=3.10
|
|
44
|
-
Requires-Dist: numpy>=
|
|
44
|
+
Requires-Dist: numpy>=1.26.4
|
|
45
45
|
Requires-Dist: scipy
|
|
46
46
|
Description-Content-Type: text/markdown
|
|
47
47
|
|
|
@@ -54,26 +54,17 @@ This is a low-level binding for the [libsparseir](https://github.com/SpM-lab/lib
|
|
|
54
54
|
- Python >= 3.10
|
|
55
55
|
- CMake (for building the C++ library)
|
|
56
56
|
- C++11 compatible compiler
|
|
57
|
-
- numpy
|
|
57
|
+
- numpy >= 1.26.4
|
|
58
|
+
- scipy
|
|
58
59
|
|
|
59
|
-
###
|
|
60
|
+
### BLAS Support
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
- macOS: `brew install openblas`
|
|
63
|
-
- Ubuntu/Debian: `sudo apt install libopenblas-dev`
|
|
64
|
-
- CentOS/RHEL: `sudo yum install openblas-devel`
|
|
62
|
+
This package automatically uses SciPy's BLAS backend for optimal performance. No additional BLAS installation is required - SciPy will provide the necessary BLAS functionality.
|
|
65
63
|
|
|
66
64
|
## Build
|
|
67
65
|
|
|
68
66
|
### Install Dependencies and Build
|
|
69
67
|
|
|
70
|
-
**Option 1: Automatic build (recommended)**
|
|
71
|
-
```bash
|
|
72
|
-
# Build will automatically run prepare_build.py if needed
|
|
73
|
-
uv build
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**Option 2: Manual preparation**
|
|
77
68
|
```bash
|
|
78
69
|
# First, prepare the build by copying necessary files from parent directory
|
|
79
70
|
python3 prepare_build.py
|
|
@@ -84,7 +75,7 @@ uv build
|
|
|
84
75
|
|
|
85
76
|
This will:
|
|
86
77
|
- Copy source files (`src/`, `include/`, `cmake/`) from the parent libsparseir directory
|
|
87
|
-
- Build the C++ libsparseir library using CMake with BLAS support
|
|
78
|
+
- Build the C++ libsparseir library using CMake with automatic BLAS support via SciPy
|
|
88
79
|
- Create both source distribution (sdist) and wheel packages
|
|
89
80
|
|
|
90
81
|
### Development Build
|
|
@@ -107,17 +98,9 @@ uv build
|
|
|
107
98
|
|
|
108
99
|
See `.github-workflows-example.yml` for a complete GitHub Actions example.
|
|
109
100
|
|
|
110
|
-
###
|
|
111
|
-
|
|
112
|
-
OpenBLAS support is enabled by default in the build configuration. The build system will automatically detect OpenBLAS if it's installed in standard locations.
|
|
101
|
+
### BLAS Configuration
|
|
113
102
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
export CMAKE_PREFIX_PATH="/path/to/openblas"
|
|
118
|
-
python3 prepare_build.py
|
|
119
|
-
uv build
|
|
120
|
-
```
|
|
103
|
+
The package automatically uses SciPy's BLAS backend, which provides optimized BLAS operations without requiring separate BLAS installation. The build system is configured to use SciPy's BLAS functions directly.
|
|
121
104
|
|
|
122
105
|
### Clean Build Artifacts
|
|
123
106
|
|
|
@@ -143,8 +126,8 @@ The build process works as follows:
|
|
|
143
126
|
- CMake configuration (`../cmake/` → `cmake/`)
|
|
144
127
|
|
|
145
128
|
2. **Package Building**: `uv build` or `uv sync` uses scikit-build-core to:
|
|
146
|
-
- Configure CMake with BLAS support
|
|
147
|
-
- Compile the C++ library with dynamic BLAS symbol lookup (for
|
|
129
|
+
- Configure CMake with automatic BLAS support via SciPy
|
|
130
|
+
- Compile the C++ library with dynamic BLAS symbol lookup (for SciPy compatibility)
|
|
148
131
|
- Package everything into distributable wheels and source distributions
|
|
149
132
|
|
|
150
133
|
3. **Installation**: The built package includes the compiled shared library and Python bindings
|
|
@@ -154,20 +137,62 @@ The build process works as follows:
|
|
|
154
137
|
- Proper inclusion in source distributions (sdist)
|
|
155
138
|
- Clean separation between the main C++ library and Python bindings
|
|
156
139
|
|
|
140
|
+
### Conda Build
|
|
141
|
+
|
|
142
|
+
This package can also be built and distributed via conda-forge. The conda recipe is located in `conda-recipe/` and supports multiple platforms and Python versions.
|
|
143
|
+
|
|
144
|
+
**Building conda packages locally:**
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Install conda-build
|
|
148
|
+
conda install conda-build
|
|
149
|
+
|
|
150
|
+
# Build the conda package
|
|
151
|
+
cd python
|
|
152
|
+
conda build conda-recipe
|
|
153
|
+
|
|
154
|
+
# Build for specific platforms
|
|
155
|
+
conda build conda-recipe --platform linux-64
|
|
156
|
+
conda build conda-recipe --platform osx-64
|
|
157
|
+
conda build conda-recipe --platform osx-arm64
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Supported platforms:**
|
|
161
|
+
- Linux x86_64
|
|
162
|
+
- macOS Intel (x86_64)
|
|
163
|
+
- macOS Apple Silicon (ARM64)
|
|
164
|
+
|
|
165
|
+
**Supported Python versions:**
|
|
166
|
+
- Python 3.11, 3.12, 3.13
|
|
167
|
+
|
|
168
|
+
**Supported NumPy versions:**
|
|
169
|
+
- NumPy 2.1, 2.2, 2.3
|
|
170
|
+
|
|
171
|
+
The conda build automatically:
|
|
172
|
+
- Uses SciPy's BLAS backend for optimal performance
|
|
173
|
+
- Cleans up old shared libraries before building
|
|
174
|
+
- Builds platform-specific packages with proper dependencies
|
|
175
|
+
|
|
157
176
|
## Performance Notes
|
|
158
177
|
|
|
159
178
|
### BLAS Support
|
|
160
179
|
|
|
161
|
-
This package
|
|
180
|
+
This package automatically uses SciPy's optimized BLAS backend for improved linear algebra performance:
|
|
162
181
|
|
|
163
|
-
- **
|
|
164
|
-
- **
|
|
182
|
+
- **Automatic BLAS**: Uses SciPy's BLAS functions for optimal performance
|
|
183
|
+
- **No additional setup**: SciPy provides all necessary BLAS functionality
|
|
165
184
|
|
|
166
|
-
The build system
|
|
185
|
+
The build system automatically configures BLAS support through SciPy. You can verify BLAS support by checking the build output for messages like:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
export SPARSEIR_DEBUG=1
|
|
189
|
+
python -c "import pylibsparseir"
|
|
190
|
+
```
|
|
167
191
|
|
|
192
|
+
This will show:
|
|
168
193
|
```
|
|
169
194
|
BLAS support enabled
|
|
170
|
-
|
|
195
|
+
Registered SciPy BLAS dgemm @ 0x...
|
|
171
196
|
```
|
|
172
197
|
|
|
173
198
|
### Troubleshooting
|
|
@@ -179,37 +204,10 @@ python3 prepare_build.py
|
|
|
179
204
|
uv build
|
|
180
205
|
```
|
|
181
206
|
|
|
182
|
-
**Build fails with "Could NOT find BLAS":**
|
|
183
|
-
```bash
|
|
184
|
-
# Install OpenBLAS first
|
|
185
|
-
brew install openblas # macOS
|
|
186
|
-
sudo apt install libopenblas-dev # Ubuntu
|
|
187
|
-
|
|
188
|
-
# Then build with proper CMake path
|
|
189
|
-
export CMAKE_PREFIX_PATH="/path/to/openblas"
|
|
190
|
-
python3 prepare_build.py
|
|
191
|
-
uv build
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**OpenBLAS not detected automatically:**
|
|
195
|
-
```bash
|
|
196
|
-
# Set CMake prefix path manually
|
|
197
|
-
export CMAKE_PREFIX_PATH="/usr/local/opt/openblas" # or your OpenBLAS path
|
|
198
|
-
python3 prepare_build.py
|
|
199
|
-
uv build
|
|
200
|
-
```
|
|
201
|
-
|
|
202
207
|
**Clean rebuild:**
|
|
203
208
|
```bash
|
|
204
209
|
# Remove all copied files and build artifacts
|
|
205
210
|
uv run clean
|
|
206
211
|
python3 prepare_build.py
|
|
207
212
|
uv build
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
**Verify BLAS support in built package:**
|
|
211
|
-
```python
|
|
212
|
-
import pylibsparseir
|
|
213
|
-
# Check build logs for "BLAS support enabled" message
|
|
214
|
-
# BLAS symbols are resolved dynamically through NumPy at runtime
|
|
215
|
-
```
|
|
213
|
+
```
|
|
@@ -531,17 +531,17 @@ include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h,sha256=5K91T9EDnVCqWxNo
|
|
|
531
531
|
pylibsparseir/__init__.py,sha256=c1D9nFVHJUxUqUPsVmZyWwf09LSYAacsLMpCockTrBw,954
|
|
532
532
|
pylibsparseir/clean_build_artifacts.py,sha256=vYQVocm55yvC5zhACXGRRp03GOj8X1CyryOe1J5KvQ0,2054
|
|
533
533
|
pylibsparseir/constants.py,sha256=Ek3JnmgiDWy3LB8f_9QA7Gh0ReaEC-W2MlCBJG3cBYg,864
|
|
534
|
-
pylibsparseir/core.py,sha256=
|
|
534
|
+
pylibsparseir/core.py,sha256=je_E9ED_shU_jF6ADo2z2Ze_qpo4qoACJ8rngRBrWtw,25882
|
|
535
535
|
pylibsparseir/ctypes_wrapper.py,sha256=G6_eraRUh9ON_2e_v4U_hc34HXirlotoawQDOkS0my0,798
|
|
536
|
-
pylibsparseir/libsparseir.so,sha256=
|
|
536
|
+
pylibsparseir/libsparseir.so,sha256=1_LdRJZezbZ2GumpEi1kR2U6zMlEECPtAqArx6sQyHg,2306161
|
|
537
537
|
pylibsparseir.libs/libgcc_s-0cd532bd.so.1,sha256=yPk0-VjyKzucjnkP3mvC0vVaua6Ln17qZUJbICcXgtA,181737
|
|
538
538
|
pylibsparseir.libs/libstdc++-5d72f927.so.6.0.33,sha256=fogxHsmB1_D6C-a_-uHh8Ei_6Qh52a8vLlicJRM3ehk,3562401
|
|
539
539
|
share/eigen3/cmake/Eigen3Config.cmake,sha256=x0pY00N82bHVUD1ieWKjI_i5qPiEv65l-CBuY1YKRaQ,1339
|
|
540
540
|
share/eigen3/cmake/Eigen3ConfigVersion.cmake,sha256=kmx0uYAIqWGE5dwo0MIlPyZuKUyNvtbBNmg53QMw5kU,2759
|
|
541
541
|
share/eigen3/cmake/Eigen3Targets.cmake,sha256=0y9N3APTOXbI0ENVRbTJw5ckKceCPb0xm8IwRWs9yVo,4122
|
|
542
542
|
share/eigen3/cmake/UseEigen3.cmake,sha256=1VpGAFMK_5H1HlGbGPlyv9lepMl0JF_PDi5TkumFvZU,177
|
|
543
|
-
share/pkgconfig/eigen3.pc,sha256=
|
|
544
|
-
pylibsparseir-0.
|
|
545
|
-
pylibsparseir-0.
|
|
546
|
-
pylibsparseir-0.
|
|
547
|
-
pylibsparseir-0.
|
|
543
|
+
share/pkgconfig/eigen3.pc,sha256=ac6hO3WeOjzTJ1NSByi9ou72cS6XvYh8iZTFMKifvq8,238
|
|
544
|
+
pylibsparseir-0.6.0.dist-info/METADATA,sha256=epgkYSzpsjchO2n7WefJoPFsmq78eNziaaNoGhIAL78,7032
|
|
545
|
+
pylibsparseir-0.6.0.dist-info/WHEEL,sha256=CYpLaz3rW_bfd-VpqD3YW_mevtuSEo6tT6wWD7un-xA,117
|
|
546
|
+
pylibsparseir-0.6.0.dist-info/RECORD,,
|
|
547
|
+
pylibsparseir-0.6.0.dist-info/licenses/LICENSE,sha256=f7O_CoSPJW9fmszTOBcCtKDB2QMfPsrYyL41nyE3I-o,1064
|
share/pkgconfig/eigen3.pc
CHANGED
|
File without changes
|
|
File without changes
|