Skip to content

Commit b81cd52

Browse files
authored
implement features from num-dual 0.11.1 (#83)
1 parent cd4c34e commit b81cd52

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.10.2] - 2025-04-09
10+
### Added
11+
- Added support for the new features in num-dual 0.11.1. [#83](https://github.com/itt-ustutt/quantity/pull/83)
12+
913
## [0.10.1] - 2025-01-09
1014
### Added
1115
- Added formatting (and thus Python support) for heat capacity rates. [#81](https://github.com/itt-ustutt/quantity/pull/81)

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "quantity"
3-
version = "0.10.1"
3+
version = "0.10.2"
44
authors = [
55
"Philipp Rehner <prehner@ethz.ch>",
66
"Gernot Bauer <bauer@itt.uni-stuttgart.de>",
@@ -32,7 +32,7 @@ approx = { version = "0.5", optional = true }
3232
pyo3 = { version = "0.23", optional = true }
3333
numpy = { version = "0.23", optional = true }
3434
## Use generalized (hyper-)dual numbers from the [num-dual] crate as value of a quantity.
35-
num-dual = { version = "0.11", optional = true }
35+
num-dual = { version = "0.11.1", optional = true }
3636

3737
[features]
3838
default = []

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,19 @@ impl<T, U> Quantity<T, U> {
506506
#[cfg(feature = "num-dual")]
507507
mod num_dual {
508508
use super::Quantity;
509-
use num_dual::DualNum;
509+
use num_dual::{DualNum, Lift};
510510

511511
impl<D: DualNum<f64>, U> Quantity<D, U> {
512512
pub fn re(&self) -> Quantity<f64, U> {
513513
Quantity::new(self.0.re())
514514
}
515515
}
516+
517+
impl<D, F, T: Lift<D, F>, U> Lift<D, F> for Quantity<T, U> {
518+
type Lifted<D2: DualNum<F, Inner = D>> = Quantity<T::Lifted<D2>, U>;
519+
520+
fn lift<D2: DualNum<F, Inner = D>>(&self) -> Self::Lifted<D2> {
521+
Quantity::new(self.0.lift())
522+
}
523+
}
516524
}

0 commit comments

Comments
 (0)