pub fn set_order(value: Number, order: ADOrder, vars: Vec<String>) -> NumberExpand description
Convert a Number of one ADOrder to another and consume the value.
Why use this method?
From is implemented to convert into all the types f64, Dual and Dual2 from each other,
however, when doing so there is no variable information attached for an f64. For example,
let d = Dual::from(2.5_f64);
assert_eq!(d, Dual::new(2.5_f64, vec![]));On the other hand using a Number enum can convert any value to a dual data type tagged
with specific variables. vars are only used in this instance when converting an f64 to a
dual type.
let f_ = Number::F64(2.5_f64);
let d_ = set_order(f_, ADOrder::One, vec!["x".to_string()]);
let d = Dual::from(d_);
assert_eq!(d, Dual::new(2.5_f64, vec!["x".to_string()]));