Skip to main content

A Numba-compatible Scipy port

Project description

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                                          

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numsci-1.0.0.tar.gz (38.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numsci-1.0.0-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file numsci-1.0.0.tar.gz.

File metadata

  • Download URL: numsci-1.0.0.tar.gz
  • Upload date:
  • Size: 38.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for numsci-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a736d45da186b7f88eef4f80543a9167a0ac0c652d00fddb14704c37c9081ee3
MD5 ef8fccb0768a26ebb21e2ade93e92c8a
BLAKE2b-256 b56269b0310dc763db06743fc4811cfb598f54c19541cbee9b6c3676267fccca

See more details on using hashes here.

File details

Details for the file numsci-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: numsci-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for numsci-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54174bef78c60b8a620158917f01206a9a12059dbebaf9d82210df89ff5518c9
MD5 e290bbe452653ad6f320d5a659a5e99e
BLAKE2b-256 f5583fdd5abb2742dbf1f945116162d9384bda9ced5692cb8d93133744ac76c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page