Metadata-Version: 2.4
Name: hprmat
Version: 1.0.0
Summary: High-Performance R-Matrix Solver for Nuclear Physics
Author: Jin Lei
License: MIT
Project-URL: Homepage, https://github.com/jinlei/hprmat
Project-URL: Documentation, https://github.com/jinlei/hprmat#readme
Project-URL: Repository, https://github.com/jinlei/hprmat
Project-URL: Issues, https://github.com/jinlei/hprmat/issues
Keywords: nuclear physics,R-matrix,scattering,coupled-channel,LAPACK,GPU,cuSOLVER,Fortran
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Fortran
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.20
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"

# HPRMAT - High-Performance R-Matrix Solver

A GPU-accelerated R-matrix solver for coupled-channel problems in nuclear physics.

## Installation

### From PyPI (Recommended)

```bash
pip install hprmat
```

**Note**: This installs the Python wrapper. You need to build the Fortran extension separately.

### Building from Source

```bash
# Clone the repository
git clone https://github.com/jinlei/hprmat.git
cd hprmat

# Build the library
./setup.sh
make

# Build Python bindings
cd bindings
make python
```

## Quick Start

```python
from hprmat import RMatrixSolver, SOLVER_DENSE
import numpy as np

# Initialize solver
solver = RMatrixSolver(nr=30, ns=1, rmax=10.0)

# Single channel setup
lval = np.array([0], dtype=np.int32)
qk = np.array([0.5], dtype=np.float64)
eta = np.array([0.0], dtype=np.float64)

# Define potential (Gaussian)
cpot = np.zeros((30, 1, 1), dtype=np.complex128, order='F')
for ir, r in enumerate(solver.mesh):
    cpot[ir, 0, 0] = -50.0 * np.exp(-r**2 / 4.0)

# Solve and get S-matrix
S, nopen = solver.solve(lval, qk, eta, cpot)
print(f"S-matrix: {S[0,0]}")
```

## Solver Types

| Type | Method | Best For |
|------|--------|----------|
| `SOLVER_DENSE` (1) | LAPACK ZGESV | Reference, highest precision |
| `SOLVER_MIXED` (2) | Mixed Precision | Large matrices on CPU |
| `SOLVER_WOODBURY` (3) | Woodbury Formula | CPU-only systems |
| `SOLVER_GPU` (4) | NVIDIA cuSOLVER | Systems with GPU |

## Requirements

- Python >= 3.9
- NumPy >= 1.20
- gfortran (for building from source)
- LAPACK/BLAS
- CUDA (optional, for GPU support)

## License

MIT License

## Author

Jin Lei
