toy_problem (type)
Stable type · Building and running
Tier: stable · Kind: type · Topic: Building and running
| Julia | Rust |
|---|---|
| not exported | toy::ToyProblem |
Julia
Julia does not export this type.
Rust
pub struct ToyProblem<T: Scalar> {
pub name: String,
pub n: usize,
pub param_names: Vec<&'static str>,
pub p: Vec<f64>,
pub u0: Vec<f64>,
pub tspan: (f64, f64),
pub variables: Vec<&'static str>,
pub cells: Option<Vec<usize>>,
pub operators: Vec<Arc<dyn Operator<T>>>,
pub maps: Vec<Arc<dyn MapOperator<T>>>,
pub invariants: Vec<Vec<(usize, f64)>>,
}
impl<T: Scalar> ToyProblem<T> { pub fn operator(&self, name: &str) -> Option<Arc<dyn Operator<T>>> }
impl<T: Scalar> ToyProblem<T> { pub fn map(&self, name: &str) -> Option<Arc<dyn MapOperator<T>>> }
A toy problem: its operators, layout, parameters, initial state, interval and the facts the conformance checks use.
Example (toy)
let prob = toy_problem::<f64>("toy:forced_decay").unwrap();
assert_eq!(prob.p, vec![2.0, 3.0]);
assert_eq!(prob.u0, vec![1.0]);