Commit e97f3a7 1 parent c79b42d commit e97f3a7 Copy full SHA for e97f3a7
File tree 4 files changed +25
-2
lines changed
4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased]
8
8
9
+ ## [ 0.10.1] - 2204-11-05
10
+ ## Added
11
+ - Expose the inner type of a generalized (hyper) dual number in the ` DualNum ` trait. [ #81 ] ( https://github.com/itt-ustutt/num-dual/pull/81 )
12
+
9
13
## [ 0.10.0] - 2024-10-22
10
14
### Packaging
11
15
- Updated ` nalgebra ` dependency to 0.33. [ #75 ] ( https://github.com/itt-ustutt/num-dual/pull/75 )
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " num-dual"
3
- version = " 0.10.0 "
3
+ version = " 0.10.1 "
4
4
authors = [
5
5
" Gernot Bauer <[email protected] >" ,
6
6
" Philipp Rehner <[email protected] >" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ macro_rules! impl_derivatives {
7
7
{
8
8
const NDERIV : usize = T :: NDERIV + $nderiv;
9
9
10
+ type Inner = T ;
11
+
12
+ #[ inline]
13
+ fn from_inner( inner: Self :: Inner ) -> Self {
14
+ Self :: from_re( inner)
15
+ }
16
+
10
17
#[ inline]
11
18
fn re( & self ) -> F {
12
19
self . re. re( )
Original file line number Diff line number Diff line change @@ -117,10 +117,16 @@ pub trait DualNum<F>:
117
117
/// Highest derivative that can be calculated with this struct
118
118
const NDERIV : usize ;
119
119
120
+ /// Type of the elements of this generalized (hyper) dual number
121
+ type Inner ;
122
+
123
+ /// Construct a new generalized (hyper) dual number from its real part
124
+ fn from_inner ( inner : Self :: Inner ) -> Self ;
125
+
120
126
/// Real part (0th derivative) of the number
121
127
fn re ( & self ) -> F ;
122
128
123
- /// Reciprocal (inverse) of a number `1/x`.
129
+ /// Reciprocal (inverse) of a number `1/x`
124
130
fn recip ( & self ) -> Self ;
125
131
126
132
/// Power with integer exponent `x^n`
@@ -243,6 +249,12 @@ macro_rules! impl_dual_num_float {
243
249
impl DualNum <$float> for $float {
244
250
const NDERIV : usize = 0 ;
245
251
252
+ type Inner = $float;
253
+
254
+ fn from_inner( inner: Self :: Inner ) -> Self {
255
+ inner
256
+ }
257
+
246
258
fn re( & self ) -> $float {
247
259
* self
248
260
}
You can’t perform that action at this time.
0 commit comments