Expand description
An Entry
associates a LogProb
with a value on an ordered axis. It can for example be
used to set up probability mass functions or cumulative distribution functions (CDF).
Fields
value: T
A value
on the ordered axis, which has to have the Trait std::cmp::Ord
implemented.
prob: LogProb
A probability at that value
/ point x on the x-axis.
Implementations
sourceimpl<T: Ord> Entry<T>
impl<T: Ord> Entry<T>
sourcepub fn new(value: T, prob: LogProb) -> Self
pub fn new(value: T, prob: LogProb) -> Self
Create a new Entry
for prob
at value
.
value
needs to have the Trait std::cmp::Ord
implemented. As f64
only has PartialOrd, use something like the ordered_float
crate
if you want to use floating point numbers.
Example
use bio::stats::probs::cdf::Entry;
use bio::stats::LogProb;
let entry = Entry::new(5, LogProb(0.6));
assert_eq!(entry.value, 5);
assert_eq!(entry.prob, LogProb(0.6));
Trait Implementations
sourceimpl<'de, T: Ord> Deserialize<'de> for Entry<T> where
T: Deserialize<'de>,
impl<'de, T: Ord> Deserialize<'de> for Entry<T> where
T: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Entry<T> where
T: RefUnwindSafe,
impl<T> Send for Entry<T> where
T: Send,
impl<T> Sync for Entry<T> where
T: Sync,
impl<T> Unpin for Entry<T> where
T: Unpin,
impl<T> UnwindSafe for Entry<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more