Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to latest pyo3 and numpy versions, adjusted function signatures #49

Merged
merged 5 commits into from
Jan 20, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -15,17 +15,17 @@ exclude = ["/.github/*", "*.ipynb", "./docs/*"]

[dependencies]
num-traits = "0.2"
pyo3 = { version = "0.16", optional = true }
pyo3 = { version = "0.18", optional = true }
ndarray = { version = "0.15", optional = true }
numpy = { version = "0.16", optional = true }
numpy = { version = "0.18", optional = true }

[features]
default = []
python = ["pyo3", "numpy", "ndarray"]
linalg = ["ndarray"]

[dev-dependencies]
criterion = "0.3"
criterion = "0.4"
approx = "0.5"

[[bench]]
2 changes: 1 addition & 1 deletion build_wheel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -19,4 +19,4 @@ crate-type = ["cdylib"]

[dependencies]
num-dual = { path = "..", features = ["python"]}
pyo3 = { version = "0.16", features = ["extension-module", "abi3", "abi3-py37", "multiple-pymethods"] }
pyo3 = { version = "0.18", features = ["extension-module", "abi3", "abi3-py37", "multiple-pymethods"] }
4 changes: 2 additions & 2 deletions build_wheel/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use num_dual as num_dual_rs;
use ::num_dual as num_dual_rs;
use pyo3::prelude::*;

/// Implementation of SI numbers.
/// Implementation of dual numbers.
#[pymodule]
pub fn num_dual(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
num_dual_rs::python::num_dual(_py, m)
1 change: 0 additions & 1 deletion src/python/dual.rs
Original file line number Diff line number Diff line change
@@ -72,7 +72,6 @@ macro_rules! impl_dual_n {
macro_rules! impl_derive {
([$(($py_type_name:ident, $n:literal)),+]) => {
#[pyfunction]
#[pyo3(text_signature = "(x)")]
pub fn derive1(x: &PyAny) -> PyResult<PyObject> {
Python::with_gil(|py| {
if let Ok(x) = x.extract::<f64>() {
1 change: 0 additions & 1 deletion src/python/dual3.rs
Original file line number Diff line number Diff line change
@@ -71,7 +71,6 @@ impl PyDual3Dual64 {
impl_dual_num!(PyDual3Dual64, Dual3<Dual64, f64>, PyDual64);

#[pyfunction]
#[pyo3(text_signature = "(x)")]
pub fn derive3(x: &PyAny) -> PyResult<PyObject> {
Python::with_gil(|py| {
if let Ok(x) = x.extract::<f64>() {
1 change: 0 additions & 1 deletion src/python/macros.rs
Original file line number Diff line number Diff line change
@@ -213,7 +213,6 @@ macro_rules! impl_dual_num {
}

#[inline]
#[pyo3(text_signature = "($self, b: Self, c: Self)")]
/// Fused multiply-add. Computes (self * a) + b with only one rounding error.
fn mul_add(&self, a: Self, b: Self) -> Self {
self.0.mul_add(a.0, b.0).into()