From 31c5b6070d8cea0118b7736bfc9c2326868d1e4f Mon Sep 17 00:00:00 2001 From: Orion Yeung <11580988+orionyeung001@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:09:06 -0500 Subject: [PATCH] test(docs): update Multinomial doc tests --- src/distribution/multinomial.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/distribution/multinomial.rs b/src/distribution/multinomial.rs index fbd8d594..dc402050 100644 --- a/src/distribution/multinomial.rs +++ b/src/distribution/multinomial.rs @@ -16,10 +16,10 @@ use rand::Rng; /// ``` /// use statrs::distribution::Multinomial; /// use statrs::statistics::MeanN; -/// use nalgebra::DVector; +/// use nalgebra::vector; /// -/// let n = Multinomial::new(&[0.3, 0.7], 5).unwrap(); -/// assert_eq!(n.mean().unwrap(), DVector::from_vec(vec![1.5, 3.5])); +/// let n = Multinomial::new_from_nalgebra(vector![0.3, 0.7], 5).unwrap(); +/// assert_eq!(n.mean().unwrap(), (vector![1.5, 3.5])); /// ``` #[derive(Debug, Clone, PartialEq)] pub struct Multinomial @@ -84,9 +84,10 @@ where /// /// ``` /// use statrs::distribution::Multinomial; + /// use nalgebra::dvector; /// - /// let n = Multinomial::new(&[0.0, 1.0, 2.0], 3).unwrap(); - /// assert_eq!(n.p(), [0.0, 1.0, 2.0]); + /// let n = Multinomial::new(vec![0.0, 1.0, 2.0], 3).unwrap(); + /// assert_eq!(*n.p(), dvector![0.0, 1.0/3.0, 2.0/3.0]); /// ``` pub fn p(&self) -> &OVector { &self.p @@ -100,7 +101,7 @@ where /// ``` /// use statrs::distribution::Multinomial; /// - /// let n = Multinomial::new(&[0.0, 1.0, 2.0], 3).unwrap(); + /// let n = Multinomial::new(vec![0.0, 1.0, 2.0], 3).unwrap(); /// assert_eq!(n.n(), 3); /// ``` pub fn n(&self) -> u64 {