From 71a3adf0cf65b3056c6fddb01b94036e6d1962e0 Mon Sep 17 00:00:00 2001 From: alimf17 Date: Sun, 9 Jun 2024 12:31:48 -0400 Subject: [PATCH] feat: Added in the std_dev method from the Distribution trait explicitly It simply wastes computation to square and then square root a value which is simply inherently part of the distribution definition. --- src/distribution/normal.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/distribution/normal.rs b/src/distribution/normal.rs index 8e7b1e1a..48436955 100644 --- a/src/distribution/normal.rs +++ b/src/distribution/normal.rs @@ -193,6 +193,13 @@ impl Distribution for Normal { Some(self.std_dev * self.std_dev) } + /// Returns the standard deviation of the normal distribution + /// # Remarks + /// This is the same standard deviation used to construct the distribution + fn std_dev(&self) -> Option { + Some(self.std_dev) + } + /// Returns the entropy of the normal distribution /// /// # Formula