Skip to content

Commit

Permalink
fix doctests to use () where appropriate as type parameters for IterS…
Browse files Browse the repository at this point in the history
…tate
  • Loading branch information
gmilleramilar committed Mar 31, 2023
1 parent 82f6a9d commit 255cbe6
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions argmin/src/core/state/iterstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State};
/// # let state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # let param_old = vec![1.0f64, 2.0f64];
/// # let state = state.param(param_old);
/// # assert!(state.prev_param.is_none());
Expand All @@ -124,7 +124,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State};
/// # let state: IterState<(), Vec<f64>, (), (), f64, Vec<f64>> = IterState::new();
/// # let state: IterState<(), Vec<f64>, (), (), f64, ()> = IterState::new();
/// # let grad_old = vec![1.0f64, 2.0f64];
/// # let state = state.gradient(grad_old);
/// # assert!(state.prev_grad.is_none());
Expand All @@ -150,7 +150,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State};
/// # let state: IterState<(), (), (), Vec<f64>, f64, Vec<f64>> = IterState::new();
/// # let state: IterState<(), (), (), Vec<f64>, f64, ()> = IterState::new();
/// # let hessian_old = vec![1.0f64, 2.0f64];
/// # let state = state.hessian(hessian_old);
/// # assert!(state.prev_hessian.is_none());
Expand All @@ -176,7 +176,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State};
/// # let state: IterState<(), (), (), Vec<f64>, f64, Vec<f64>> = IterState::new();
/// # let state: IterState<(), (), (), Vec<f64>, f64, ()>> = IterState::new();
/// # let inv_hessian_old = vec![1.0f64, 2.0f64];
/// # let state = state.inv_hessian(inv_hessian_old);
/// # assert!(state.prev_inv_hessian.is_none());
Expand All @@ -202,7 +202,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State};
/// # let state: IterState<(), (), Vec<f64>, (), f64, Vec<f64>> = IterState::new();
/// # let state: IterState<(), (), Vec<f64>, (), f64, ()> = IterState::new();
/// # let jacobian_old = vec![1.0f64, 2.0f64];
/// # let state = state.jacobian(jacobian_old);
/// # assert!(state.prev_jacobian.is_none());
Expand All @@ -229,7 +229,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State};
/// # let state: IterState<(), (), Vec<f64>, (), f64, Vec<f64>> = IterState::new();
/// # let state: IterState<(), (), Vec<f64>, (), f64, ()> = IterState::new();
/// # let cost_old = 1.0f64;
/// # let state = state.cost(cost_old);
/// # assert_eq!(state.prev_cost.to_ne_bytes(), f64::INFINITY.to_ne_bytes());
Expand All @@ -255,7 +255,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert_eq!(state.target_cost.to_ne_bytes(), f64::NEG_INFINITY.to_ne_bytes());
/// let state = state.target_cost(0.0);
/// # assert_eq!(state.target_cost.to_ne_bytes(), 0.0f64.to_ne_bytes());
Expand All @@ -272,7 +272,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert_eq!(state.max_iters, std::u64::MAX);
/// let state = state.max_iters(1000);
/// # assert_eq!(state.max_iters, 1000);
Expand All @@ -289,7 +289,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # let state = state.cost(2.0);
/// let cost = state.get_cost();
/// # assert_eq!(cost.to_ne_bytes(), 2.0f64.to_ne_bytes());
Expand All @@ -304,7 +304,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # state.prev_cost = 2.0;
/// let prev_cost = state.get_prev_cost();
/// # assert_eq!(prev_cost.to_ne_bytes(), 2.0f64.to_ne_bytes());
Expand All @@ -319,7 +319,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # state.best_cost = 2.0;
/// let best_cost = state.get_best_cost();
/// # assert_eq!(best_cost.to_ne_bytes(), 2.0f64.to_ne_bytes());
Expand All @@ -334,7 +334,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # state.prev_best_cost = 2.0;
/// let prev_best_cost = state.get_prev_best_cost();
/// # assert_eq!(prev_best_cost.to_ne_bytes(), 2.0f64.to_ne_bytes());
Expand All @@ -349,7 +349,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert_eq!(state.target_cost.to_ne_bytes(), std::f64::NEG_INFINITY.to_ne_bytes());
/// # state.target_cost = 0.0;
/// let target_cost = state.get_target_cost();
Expand All @@ -365,7 +365,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert!(state.take_param().is_none());
/// # let mut state = state.param(vec![1.0, 2.0]);
/// # assert_eq!(state.param.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -386,7 +386,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert!(state.prev_param.is_none());
/// # state.prev_param = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.prev_param.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -405,7 +405,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert!(state.take_prev_param().is_none());
/// # state.prev_param = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.prev_param.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -426,7 +426,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert!(state.prev_best_param.is_none());
/// # state.prev_best_param = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.prev_best_param.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -445,7 +445,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert!(state.take_best_param().is_none());
/// # state.best_param = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.best_param.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -466,7 +466,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, ()> = IterState::new();
/// # assert!(state.take_prev_best_param().is_none());
/// # state.prev_best_param = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.prev_best_param.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -487,7 +487,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, ()> = IterState::new();
/// # assert!(state.grad.is_none());
/// # assert!(state.get_gradient().is_none());
/// # state.grad = Some(vec![1.0, 2.0]);
Expand All @@ -507,7 +507,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, ()> = IterState::new();
/// # assert!(state.take_gradient().is_none());
/// # state.grad = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.grad.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -528,7 +528,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, ()> = IterState::new();
/// # assert!(state.prev_grad.is_none());
/// # assert!(state.get_prev_gradient().is_none());
/// # state.prev_grad = Some(vec![1.0, 2.0]);
Expand All @@ -548,7 +548,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), Vec<f64>, (), (), f64, ()> = IterState::new();
/// # assert!(state.take_prev_gradient().is_none());
/// # state.prev_grad = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.prev_grad.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -569,7 +569,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.hessian.is_none());
/// # assert!(state.get_hessian().is_none());
/// # state.hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -593,7 +593,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.hessian.is_none());
/// # assert!(state.take_hessian().is_none());
/// # state.hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -619,7 +619,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.prev_hessian.is_none());
/// # assert!(state.get_prev_hessian().is_none());
/// # state.prev_hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -643,7 +643,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.prev_hessian.is_none());
/// # assert!(state.take_prev_hessian().is_none());
/// # state.prev_hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -669,7 +669,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.inv_hessian.is_none());
/// # assert!(state.get_inv_hessian().is_none());
/// # state.inv_hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -693,7 +693,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.inv_hessian.is_none());
/// # assert!(state.take_inv_hessian().is_none());
/// # state.inv_hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -719,7 +719,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.prev_inv_hessian.is_none());
/// # assert!(state.get_prev_inv_hessian().is_none());
/// # state.prev_inv_hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -743,7 +743,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), Vec<Vec<f64>>, f64, ()> = IterState::new();
/// # assert!(state.prev_inv_hessian.is_none());
/// # assert!(state.take_prev_inv_hessian().is_none());
/// # state.prev_inv_hessian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -769,7 +769,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, ()> = IterState::new();
/// # assert!(state.jacobian.is_none());
/// # assert!(state.get_jacobian().is_none());
/// # state.jacobian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -793,7 +793,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, ()> = IterState::new();
/// # assert!(state.jacobian.is_none());
/// # assert!(state.take_jacobian().is_none());
/// # state.jacobian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -819,7 +819,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, ()> = IterState::new();
/// # assert!(state.prev_jacobian.is_none());
/// # assert!(state.get_prev_jacobian().is_none());
/// # state.prev_jacobian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -843,7 +843,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), Vec<Vec<f64>>, (), f64, ()> = IterState::new();
/// # assert!(state.prev_jacobian.is_none());
/// # assert!(state.take_prev_jacobian().is_none());
/// # state.prev_jacobian = Some(vec![vec![1.0, 2.0], vec![3.0, 4.0]]);
Expand All @@ -869,7 +869,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), (), f64, Vec<f64>> = IterState::new();
/// # assert!(state.residuals.is_none());
/// # state.residuals = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.residuals.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand All @@ -888,7 +888,7 @@ where
///
/// ```
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), f64, Vec<f64>> = IterState::new();
/// # let mut state: IterState<(), (), (), (), f64, Vec<f64>> = IterState::new();
/// # assert!(state.take_residuals().is_none());
/// # state.residuals = Some(vec![1.0, 2.0]);
/// # assert_eq!(state.residuals.as_ref().unwrap()[0].to_ne_bytes(), 1.0f64.to_ne_bytes());
Expand Down

0 comments on commit 255cbe6

Please sign in to comment.