Skip to content

Commit bab5ad3

Browse files
committed
Remove fn new_with_size
1 parent 5690538 commit bab5ad3

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

src/multi/dirichlet.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -318,36 +318,6 @@ where
318318
})
319319
}
320320
}
321-
322-
/// Construct a new `Dirichlet` with the given shape parameter `alpha` and `size`.
323-
///
324-
/// Requires `size >= 2`.
325-
#[inline]
326-
pub fn new_with_size(alpha: F, size: usize) -> Result<Dirichlet<F>, Error> {
327-
if !(alpha > F::zero()) {
328-
return Err(Error::AlphaTooSmall);
329-
}
330-
if size < 2 {
331-
return Err(Error::SizeTooSmall);
332-
}
333-
if alpha <= NumCast::from(0.1).unwrap() {
334-
// Use the Beta method when alpha is less than 0.1 This
335-
// threshold provides a reasonable compromise between using the faster
336-
// Gamma method for as wide a range as possible while ensuring that
337-
// the probability of generating nans is negligibly small.
338-
let dist = DirichletFromBeta::new(&vec![alpha; size])
339-
.map_err(|_| Error::FailedToCreateBeta)?;
340-
Ok(Dirichlet {
341-
repr: DirichletRepr::FromBeta(dist),
342-
})
343-
} else {
344-
let dist = DirichletFromGamma::new(&vec![alpha; size])
345-
.map_err(|_| Error::FailedToCreateGamma)?;
346-
Ok(Dirichlet {
347-
repr: DirichletRepr::FromGamma(dist),
348-
})
349-
}
350-
}
351321
}
352322

353323
impl<F> MultiDistribution<F> for Dirichlet<F>

0 commit comments

Comments
 (0)