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 {
181181 }
182182
183183 /// 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) ) {
186186 Some ( rate) => Some ( * rate) ,
187187 None => {
188188 let rate = self . interpolator . interpolate ( date) . ok ( ) ?;
189- self . nodes . insert ( date, rate) ;
189+ self . nodes . insert ( OrderedFloat ( date) , rate) ;
190190 Some ( rate)
191191 }
192192 }
@@ -198,7 +198,7 @@ impl Curve {
198198 }
199199
200200 /// 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 > > {
202202 dates
203203 . iter ( )
204204 . map ( |date| self . get_rate_and_insert ( * date) )
Original file line number Diff line number Diff line change @@ -173,7 +173,6 @@ where
173173#[ cfg( test) ]
174174mod tests_exponential_interpolation {
175175 use super :: * ;
176- use time:: macros:: date;
177176 use RustQuant_utils :: { assert_approx_equal, RUSTQUANT_EPSILON } ;
178177
179178 #[ test]
You can’t perform that action at this time.
0 commit comments