//! Lorenz three-variables system //! https://en.wikipedia.org/wiki/Lorenz_system //! //#[feature(test)] use ida::{linear::*, nonlinear::*, traits::*, *}; use ndarray::prelude::*; #[derive(Clone, Copy, Debug)] pub struct Lorenz63 { pub p: f64, pub r: f64, pub b: f64, } impl Default for Lorenz63 { fn default() -> Self { Lorenz63 { p: 10.0, r: 28.0, b: 8.0 / 3.0, } } } impl Lorenz63 { pub fn new(p: f64, r: f64, b: f64) -> Self { Lorenz63 { p: p, r: r, b: b } } } impl ModelSpec for Lorenz63 { type Scalar = f64; type Dim = Ix1; fn model_size(&self) -> usize { 3 } } impl Residual for Lorenz63 { //fn residual<'a, S>(&mut self, v: &'a mut ArrayBase) -> &'a mut ArrayBase //where // S: DataMut, //{ // let x = v[0]; // let y = v[1]; // let z = v[2]; // v[0] = self.p * (y - x); // v[1] = x * (self.r - z) - y; // v[2] = x * y - self.b * z; // v //} fn res( &self, tres: Self::Scalar, yy: ArrayBase, yp: ArrayBase, mut resval: ArrayBase, ) where S1: ndarray::Data, S2: ndarray::Data, S3: ndarray::DataMut, { } } impl Jacobian for Lorenz63 { fn jac( &self, tt: Self::Scalar, cj: Self::Scalar, yy: ArrayBase, yp: ArrayBase, rr: ArrayBase, mut j: ArrayBase, ) where S1: ndarray::Data, S2: ndarray::Data, S3: ndarray::Data, S4: ndarray::DataMut, { unimplemented!(); } }