don't partially regen derivative_cache if derivative is disabled

This commit is contained in:
Simon Gardling 2022-03-08 11:00:32 -05:00
parent 21e56cac4d
commit 25c4285fc0

View File

@ -130,6 +130,7 @@ impl FunctionEntry {
); );
if self.derivative_cache.is_some() { if self.derivative_cache.is_some() {
if self.derivative {
let derivative_cache = self.derivative_cache.as_ref().unwrap(); let derivative_cache = self.derivative_cache.as_ref().unwrap();
self.derivative_cache = Some( self.derivative_cache = Some(
@ -144,6 +145,9 @@ impl FunctionEntry {
}) })
.collect(), .collect(),
); );
} else {
self.derivative_cache = None;
}
} }
} else { } else {
self.back_cache = None; self.back_cache = None;