pub struct IntervalLowerUnboundedUpperBounded<RealType: RealScalar, UpperBoundType: BoundType> { /* private fields */ }
Expand description
FINAL DOC Generic structure for intervals extending from negative infinity with finite upper bound.
The IntervalLowerUnboundedUpperBounded
struct represents semi-infinite intervals
that extend infinitely in the negative direction but have a finite upper bound.
The upper bound can be either included (closed) or excluded (open) based on the
type parameter.
§Generic Parameters
RealType
: Must implementRealScalar
for mathematical operationsUpperBoundType
: EitherClosed
orOpen
to specify upper boundary inclusion
§Boundary Type Combinations
Upper | Notation | Mathematical Set |
---|---|---|
Closed | (-∞, b] | {x : x ≤ b} |
Open | (-∞, b) | {x : x < b} |
§Mathematical Properties
- Infinite measure:
μ(I) = +∞
for all variants - Non-compactness: Never compact (unbounded)
- Connectedness: Always connected (no gaps)
- Lower bound: No finite lower bound (extends from -∞)
- Upper bound: Always has a finite upper bound
§Type Aliases
The library provides convenient type aliases:
IntervalLowerUnboundedUpperClosed
=IntervalLowerUnboundedUpperBounded<RealType, Closed>
IntervalLowerUnboundedUpperOpen
=IntervalLowerUnboundedUpperBounded<RealType, Open>
§Use Cases
- Capacity limits: Systems with maximum bounds but no minimum restrictions
- “At most” constraints: x ≤ b (closed) or x < b (open)
- Temperature limits: Physical systems with maximum safe temperatures
- Budget constraints: Financial models with spending limits
- Upper thresholds: Where values cannot exceed a certain limit
§Construction
use grid1d::intervals::*;
// Using type aliases (recommended)
let upper_bounded_closed = IntervalLowerUnboundedUpperClosed::new(100.0); // (-∞, 100]
let upper_bounded_open = IntervalLowerUnboundedUpperOpen::new(100.0); // (-∞, 100)
assert!(upper_bounded_closed.contains_point(&100.0)); // Includes upper bound
assert!(!upper_bounded_open.contains_point(&100.0)); // Excludes upper bound
Implementations§
Source§impl<RealType: RealScalar, UpperBoundType: BoundType> IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
impl<RealType: RealScalar, UpperBoundType: BoundType> IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
Sourcepub fn new(upper_bound: RealType) -> Self
pub fn new(upper_bound: RealType) -> Self
Build and return a new instance of IntervalLowerUnboundedUpperBounded
from the upper bound of the interval.
Source§impl<RealType: RealScalar, UpperBoundType: BoundType> IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
impl<RealType: RealScalar, UpperBoundType: BoundType> IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
Sourcepub fn upper_bound(&self) -> &UpperBound<RealType, UpperBoundType>
pub fn upper_bound(&self) -> &UpperBound<RealType, UpperBoundType>
The upper bound of the interval, included in the interval.
This value represents the largest point contained in the interval.
For a closed upper bound b]
, any point x
in the interval satisfies x ≤ b
.
For an open upper bound b)
, any point x
in the interval satisfies x < b
.
Trait Implementations§
Source§impl<RealType: Clone + RealScalar, UpperBoundType: Clone + BoundType> Clone for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
impl<RealType: Clone + RealScalar, UpperBoundType: Clone + BoundType> Clone for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
Source§fn clone(&self) -> IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
fn clone(&self) -> IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<RealType: RealScalar, UpperBoundType: BoundType> Contains<RealType> for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>where
Self: GetIntervalBound<BoundType = RealType>,
UpperBound<RealType, UpperBoundType>: ValueWithinBound<RealType = RealType>,
impl<RealType: RealScalar, UpperBoundType: BoundType> Contains<RealType> for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>where
Self: GetIntervalBound<BoundType = RealType>,
UpperBound<RealType, UpperBoundType>: ValueWithinBound<RealType = RealType>,
Source§fn contains_point(&self, x: &RealType) -> bool
fn contains_point(&self, x: &RealType) -> bool
Source§fn contains_interval<IntervalType: IntervalTrait<RealType = RealType>>(
&self,
other: &IntervalType,
) -> bool
fn contains_interval<IntervalType: IntervalTrait<RealType = RealType>>( &self, other: &IntervalType, ) -> bool
Source§impl<RealType: Debug + RealScalar, UpperBoundType: Debug + BoundType> Debug for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
impl<RealType: Debug + RealScalar, UpperBoundType: Debug + BoundType> Debug for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
Source§impl<'de, RealType, UpperBoundType: BoundType> Deserialize<'de> for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>where
RealType: for<'a> Deserialize<'a> + RealScalar,
impl<'de, RealType, UpperBoundType: BoundType> Deserialize<'de> for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>where
RealType: for<'a> Deserialize<'a> + RealScalar,
Source§fn 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>,
Source§impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Closed>> for Interval<RealType>
impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Closed>> for Interval<RealType>
Source§fn from(interval: IntervalLowerUnboundedUpperClosed<RealType>) -> Self
fn from(interval: IntervalLowerUnboundedUpperClosed<RealType>) -> Self
Source§impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Closed>> for IntervalInfiniteLength<RealType>
impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Closed>> for IntervalInfiniteLength<RealType>
Source§fn from(interval: IntervalLowerUnboundedUpperClosed<RealType>) -> Self
fn from(interval: IntervalLowerUnboundedUpperClosed<RealType>) -> Self
Source§impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Open>> for Interval<RealType>
impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Open>> for Interval<RealType>
Source§fn from(interval: IntervalLowerUnboundedUpperOpen<RealType>) -> Self
fn from(interval: IntervalLowerUnboundedUpperOpen<RealType>) -> Self
Source§impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Open>> for IntervalInfiniteLength<RealType>
impl<RealType: RealScalar> From<IntervalLowerUnboundedUpperBounded<RealType, Open>> for IntervalInfiniteLength<RealType>
Source§fn from(interval: IntervalLowerUnboundedUpperOpen<RealType>) -> Self
fn from(interval: IntervalLowerUnboundedUpperOpen<RealType>) -> Self
Source§impl<RealType: RealScalar, UpperBoundType: BoundType> HasUpperBound for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
impl<RealType: RealScalar, UpperBoundType: BoundType> HasUpperBound for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
type UpperBoundValue = RealType
Source§fn upper_bound_value(&self) -> &RealType
fn upper_bound_value(&self) -> &RealType
Source§impl<RealType: RealScalar, UpperBoundType: BoundType> IntervalOperations for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>where
Self: GetIntervalBound<BoundType = RealType>,
impl<RealType: RealScalar, UpperBoundType: BoundType> IntervalOperations for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>where
Self: GetIntervalBound<BoundType = RealType>,
Source§fn intersection<IntervalType: IntervalTrait<RealType = Self::RealType>>(
&self,
other: &IntervalType,
) -> Option<Interval<Self::RealType>>
fn intersection<IntervalType: IntervalTrait<RealType = Self::RealType>>( &self, other: &IntervalType, ) -> Option<Interval<Self::RealType>>
Source§fn union<IntervalType: IntervalTrait<RealType = Self::RealType>>(
&self,
other: &IntervalType,
) -> IntervalUnion<Self::RealType>
fn union<IntervalType: IntervalTrait<RealType = Self::RealType>>( &self, other: &IntervalType, ) -> IntervalUnion<Self::RealType>
Source§impl<RealType: PartialEq + RealScalar, UpperBoundType: PartialEq + BoundType> PartialEq for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
impl<RealType: PartialEq + RealScalar, UpperBoundType: PartialEq + BoundType> PartialEq for IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>
Source§fn eq(
&self,
other: &IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>,
) -> bool
fn eq( &self, other: &IntervalLowerUnboundedUpperBounded<RealType, UpperBoundType>, ) -> bool
self
and other
values to be equal, and is used by ==
.