File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
RustQuant_math/src/interpolation Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -181,12 +181,12 @@ impl Curve {
181
181
}
182
182
183
183
/// Get a rate, and simultaneously add it to the nodes.
184
- pub fn get_rate_and_insert ( & mut self , date : Date ) -> Option < f64 > {
185
- match self . nodes . get ( & date) {
184
+ pub fn get_rate_and_insert ( & mut self , date : f64 ) -> Option < f64 > {
185
+ match self . nodes . get ( & OrderedFloat ( date) ) {
186
186
Some ( rate) => Some ( * rate) ,
187
187
None => {
188
188
let rate = self . interpolator . interpolate ( date) . ok ( ) ?;
189
- self . nodes . insert ( date, rate) ;
189
+ self . nodes . insert ( OrderedFloat ( date) , rate) ;
190
190
Some ( rate)
191
191
}
192
192
}
@@ -198,7 +198,7 @@ impl Curve {
198
198
}
199
199
200
200
/// Get multiple rates from the curve, and simultaneously add them to the nodes.
201
- pub fn get_rates_and_insert ( & mut self , dates : Vec < Date > ) -> Vec < Option < f64 > > {
201
+ pub fn get_rates_and_insert ( & mut self , dates : Vec < f64 > ) -> Vec < Option < f64 > > {
202
202
dates
203
203
. iter ( )
204
204
. map ( |date| self . get_rate_and_insert ( * date) )
Original file line number Diff line number Diff line change @@ -173,7 +173,6 @@ where
173
173
#[ cfg( test) ]
174
174
mod tests_exponential_interpolation {
175
175
use super :: * ;
176
- use time:: macros:: date;
177
176
use RustQuant_utils :: { assert_approx_equal, RUSTQUANT_EPSILON } ;
178
177
179
178
#[ test]
You can’t perform that action at this time.
0 commit comments