pub enum DataArray {
Float32(Vec<f32>),
Float64(Vec<f64>),
}Expand description
Adaptive array wrapper: holds HEALPix data in the native FITS precision.
This avoids unnecessary conversions when source data is f32. All operations convert on-demand to f64 only when needed.
Variants§
Float32(Vec<f32>)
32-bit float data (saves memory for typical HEALPix maps)
Float64(Vec<f64>)
64-bit float data (for high-precision maps)
Implementations§
Source§impl DataArray
impl DataArray
Sourcepub fn valid_f64_values(&self) -> Vec<f64>
pub fn valid_f64_values(&self) -> Vec<f64>
Collect valid values as f64 vector for percentile/statistics
Sourcepub fn as_f64_vec(&self) -> Cow<'_, Vec<f64>>
pub fn as_f64_vec(&self) -> Cow<'_, Vec<f64>>
Get underlying f64 vec if this is Float64, otherwise convert
Used for compatibility with existing code that expects Vec<f64>.
For f32 data, this allocates a new vector with conversions.
Sourcepub fn as_f64_slice(&self) -> Option<&[f64]>
pub fn as_f64_slice(&self) -> Option<&[f64]>
Get as f64 slice if Float64, otherwise panics
Used in performance-critical hot loops where we want f64 slice directly.
For code that needs to work with both types, use as_f64_vec() instead.
Sourcepub fn memory_size_bytes(&self) -> usize
pub fn memory_size_bytes(&self) -> usize
Get memory size in bytes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataArray
impl RefUnwindSafe for DataArray
impl Send for DataArray
impl Sync for DataArray
impl Unpin for DataArray
impl UnsafeUnpin for DataArray
impl UnwindSafe for DataArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.