Metadata-Version: 2.1
Name: numsci
Version: 1.0.0
Summary: A Numba-compatible Scipy port
License: BSD 3-Clause License
         
         Copyright (c) 2025, josephhanrahan
         
         Redistribution and use in source and binary forms, with or without
         modification, are permitted provided that the following conditions are met:
         
         1. Redistributions of source code must retain the above copyright notice, this
            list of conditions and the following disclaimer.
         
         2. Redistributions in binary form must reproduce the above copyright notice,
            this list of conditions and the following disclaimer in the documentation
            and/or other materials provided with the distribution.
         
         3. Neither the name of the copyright holder nor the names of its
            contributors may be used to endorse or promote products derived from
            this software without specific prior written permission.
         
         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
         DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
         FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
         DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
         SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
         CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
         OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         
Requires-Dist: numpy
Requires-Dist: numba
Description-Content-Type: text/markdown

# numsci

## num[ba]sci[py] - A Numba-Compatible Port for Popular Scipy Functions

Most Scipy Functions do not work in jit-compiled Numba functions. This project aims to make this possible.

### How to use

Model functions must abide by the following convention

```
from numsci.optimize import model_sig

@model_sig
def model_function(x: float64, params: ndarray(dtype=float64)) -> float64:
    ***do computation***
    return result
```

Where the @model_sig decorator indicates that the function is a Numba Cfunc of signature `float64(float64, *float64)`.

Outside of the jit-compiled function, the caller must also obtain the address to the model function

```
model_function_address = model_function.address
```

This can then be used to call Scipy-like functions like `curve_fit()` in a `@njit` decorated function


```
from numsci.optimize import curve_fit

@njit
def njit_function():
    fvec, pcov = curve_fit(model_function_address, xdata, ydata)
```

### Setup

Install dependencies and compile

```
pip install -r requirements.txt
bash build.sh                                          
```