//! Identity matrix constructor for [`DivstepMatrix`].
use super::DivstepMatrix;

impl DivstepMatrix {
    /// Creates a new identity matrix `[[1, 0], [0, 1]]`.
    ///
    /// This is the starting point before accumulating divstep transitions.
    pub(crate) fn identity() -> DivstepMatrix {
        DivstepMatrix {
            u: 1,
            v: 0,
            q: 0,
            r: 1,
        }
    }
}

#[cfg(test)]
mod ai_tests {
    use super::*;

    /// Identity matrix has expected values.
    #[test]
    fn identity_values() {
        let m = DivstepMatrix::identity();
        assert_eq!(m.u, 1);
        assert_eq!(m.v, 0);
        assert_eq!(m.q, 0);
        assert_eq!(m.r, 1);
    }
}
