pub struct Dataset { /* private fields */ }Expand description
A collection of events with optional metadata for name-based lookups.
Implementations§
Source§impl Dataset
impl Dataset
Sourcepub fn events_local(&self) -> impl Iterator<Item = Event<'_>>
pub fn events_local(&self) -> impl Iterator<Item = Event<'_>>
Iterate over locally stored events as borrowed Event views.
Sourcepub fn events_global(&self) -> DatasetGlobalIter<'_> ⓘ
pub fn events_global(&self) -> DatasetGlobalIter<'_> ⓘ
Iterate over all events using the default global iteration semantics.
When MPI is enabled, the iterator is ordered like Dataset::event_global and may
fetch remotely owned events in chunks.
Sourcepub fn metadata(&self) -> &DatasetMetadata
pub fn metadata(&self) -> &DatasetMetadata
Borrow the dataset metadata used for name lookups.
Sourcepub fn metadata_arc(&self) -> Arc<DatasetMetadata>
pub fn metadata_arc(&self) -> Arc<DatasetMetadata>
Clone the internal metadata handle for external consumers (e.g., language bindings).
Sourcepub fn p4_index(&self, name: &str) -> Option<usize>
pub fn p4_index(&self, name: &str) -> Option<usize>
Resolve the index of a four-momentum by name.
Sourcepub fn aux_index(&self, name: &str) -> Option<usize>
pub fn aux_index(&self, name: &str) -> Option<usize>
Resolve the index of an auxiliary scalar by name.
Sourcepub fn event_global(&self, index: usize) -> LadduResult<OwnedEvent>
pub fn event_global(&self, index: usize) -> LadduResult<OwnedEvent>
Retrieve a single owned event by global index.
Sourcepub fn event_local(&self, event_index: usize) -> LadduResult<Event<'_>>
pub fn event_local(&self, event_index: usize) -> LadduResult<Event<'_>>
Borrow a locally stored event by local rank index.
Source§impl Dataset
impl Dataset
Sourcepub fn new_local(
events: Vec<Arc<EventData>>,
metadata: Arc<DatasetMetadata>,
) -> Self
pub fn new_local( events: Vec<Arc<EventData>>, metadata: Arc<DatasetMetadata>, ) -> Self
Create a new Dataset from a list of EventData (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::new instead.
Sourcepub fn empty_local(metadata: DatasetMetadata) -> Self
pub fn empty_local(metadata: DatasetMetadata) -> Self
Create an empty local dataset with explicit metadata.
The returned dataset is valid immediately and can be extended with
Dataset::push_event_local or Dataset::push_event_named_local.
Under MPI, pushed rows are stored only on the rank that performs the
push. Use Dataset::push_event_global for collective single-copy
appends.
Sourcepub fn from_columns_local(
metadata: DatasetMetadata,
p4_columns: Vec<Vec<Vec4>>,
aux_columns: Vec<Vec<f64>>,
weights: Vec<f64>,
) -> LadduResult<Self>
pub fn from_columns_local( metadata: DatasetMetadata, p4_columns: Vec<Vec<Vec4>>, aux_columns: Vec<Vec<f64>>, weights: Vec<f64>, ) -> LadduResult<Self>
Create a local dataset from ordered four-momentum columns, auxiliary columns, and weights.
p4_columns and aux_columns must be ordered to match the supplied metadata. Each
column must have the same length as weights.
Sourcepub fn from_columns_global(
metadata: DatasetMetadata,
p4_columns: Vec<Vec<Vec4>>,
aux_columns: Vec<Vec<f64>>,
weights: Vec<f64>,
) -> LadduResult<Self>
pub fn from_columns_global( metadata: DatasetMetadata, p4_columns: Vec<Vec<Vec4>>, aux_columns: Vec<Vec<f64>>, weights: Vec<f64>, ) -> LadduResult<Self>
Create a global dataset from ordered columns.
Under MPI, every rank must pass the same global columns. The rows are partitioned across ranks using laddu’s canonical contiguous partition.
Sourcepub fn new_with_metadata(
events: Vec<Arc<EventData>>,
metadata: Arc<DatasetMetadata>,
) -> Self
pub fn new_with_metadata( events: Vec<Arc<EventData>>, metadata: Arc<DatasetMetadata>, ) -> Self
Create a dataset with explicit metadata for name-based lookups. Create a dataset with explicit metadata for name-based lookups.
Sourcepub fn add_p4_column_local<N, V>(
&mut self,
name: N,
values: V,
) -> LadduResult<()>
pub fn add_p4_column_local<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
Add a four-momentum column to the current rank only.
This method is non-collective. Under MPI it is only valid for datasets
without an MPI layout; use Dataset::add_p4_column_global for shared
MPI datasets.
Sourcepub fn add_aux_column_local<N, V>(
&mut self,
name: N,
values: V,
) -> LadduResult<()>
pub fn add_aux_column_local<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
Add an auxiliary scalar column to the current rank only.
This method is non-collective. Under MPI it is only valid for datasets
without an MPI layout; use Dataset::add_aux_column_global for shared
MPI datasets.
Sourcepub fn add_p4_column_global<N, V>(
&mut self,
name: N,
values: V,
) -> LadduResult<()>
pub fn add_p4_column_global<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
Add a four-momentum column collectively across all MPI ranks.
Under MPI, every rank must call this method in the same order with the same column name. Each rank supplies values for its local events only.
Sourcepub fn add_aux_column_global<N, V>(
&mut self,
name: N,
values: V,
) -> LadduResult<()>
pub fn add_aux_column_global<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
Add an auxiliary scalar column collectively across all MPI ranks.
Under MPI, every rank must call this method in the same order with the same column name. Each rank supplies values for its local events only.
Sourcepub fn push_event_local<P, A>(
&mut self,
p4s: P,
aux: A,
weight: f64,
) -> LadduResult<()>
pub fn push_event_local<P, A>( &mut self, p4s: P, aux: A, weight: f64, ) -> LadduResult<()>
Append one ordered event row to the current rank.
p4s and aux must be ordered to match Dataset::p4_names and
Dataset::aux_names.
Under MPI, this method performs no communication beyond refreshing cached global counts. Calling it on every rank appends one row per rank.
Sourcepub fn push_event_global<P, A>(
&mut self,
p4s: P,
aux: A,
weight: f64,
) -> LadduResult<()>
pub fn push_event_global<P, A>( &mut self, p4s: P, aux: A, weight: f64, ) -> LadduResult<()>
Append one ordered event row collectively as a single global event.
Under MPI, this method is collective. Exactly one rank stores the event,
selected by next_global_index % n_ranks; non-owning ranks ignore their
supplied row values. All ranks must call this method in the same order.
Sourcepub fn push_event_named_local<P, PN, A, AN>(
&mut self,
p4s: P,
aux: A,
weight: f64,
) -> LadduResult<()>where
P: IntoIterator<Item = (PN, Vec4)>,
PN: AsRef<str>,
A: IntoIterator<Item = (AN, f64)>,
AN: AsRef<str>,
pub fn push_event_named_local<P, PN, A, AN>(
&mut self,
p4s: P,
aux: A,
weight: f64,
) -> LadduResult<()>where
P: IntoIterator<Item = (PN, Vec4)>,
PN: AsRef<str>,
A: IntoIterator<Item = (AN, f64)>,
AN: AsRef<str>,
Append one named event row to the current rank.
The supplied p4 and aux names must exactly match this dataset’s metadata, regardless of order. Duplicate, missing, and unknown names are rejected.
Sourcepub fn push_event_named_global<P, PN, A, AN>(
&mut self,
p4s: P,
aux: A,
weight: f64,
) -> LadduResult<()>where
P: IntoIterator<Item = (PN, Vec4)>,
PN: AsRef<str>,
A: IntoIterator<Item = (AN, f64)>,
AN: AsRef<str>,
pub fn push_event_named_global<P, PN, A, AN>(
&mut self,
p4s: P,
aux: A,
weight: f64,
) -> LadduResult<()>where
P: IntoIterator<Item = (PN, Vec4)>,
PN: AsRef<str>,
A: IntoIterator<Item = (AN, f64)>,
AN: AsRef<str>,
Append one named event row collectively as a single global event.
Under MPI, this method is collective. Exactly one rank stores the event,
selected by next_global_index % n_ranks; non-owning ranks ignore their
supplied row values. All ranks must call this method in the same order.
Sourcepub fn n_events_local(&self) -> usize
pub fn n_events_local(&self) -> usize
The number of EventDatas in the Dataset (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::n_events instead.
Sourcepub fn n_events_global(&self) -> usize
pub fn n_events_global(&self) -> usize
Alias for Dataset::n_events.
This returns the global event count under MPI.
Source§impl Dataset
impl Dataset
Sourcepub fn weights_local(&self) -> Vec<f64>
pub fn weights_local(&self) -> Vec<f64>
Extract a list of weights over each EventData in the Dataset (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::weights instead.
Sourcepub fn weights_global(&self) -> Vec<f64>
pub fn weights_global(&self) -> Vec<f64>
Alias for Dataset::weights.
This returns the global weight vector in dataset order under MPI.
Sourcepub fn n_events_weighted_local(&self) -> f64
pub fn n_events_weighted_local(&self) -> f64
Returns the sum of the weights for each EventData in the Dataset (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::n_events_weighted instead.
Sourcepub fn n_events_weighted(&self) -> f64
pub fn n_events_weighted(&self) -> f64
Sourcepub fn n_events_weighted_global(&self) -> f64
pub fn n_events_weighted_global(&self) -> f64
Alias for Dataset::n_events_weighted.
This returns the global weighted event count under MPI.
Sourcepub fn bootstrap_local(&self, seed: usize) -> Arc<Dataset>
pub fn bootstrap_local(&self, seed: usize) -> Arc<Dataset>
Generate a new dataset with the same length by resampling the events in the original datset with replacement. This can be used to perform error analysis via the bootstrap method. (non-MPI version).
§Notes
This method is not intended to be called in analyses but rather in writing methods
that have mpi-feature-gated versions. Most users should just call Dataset::bootstrap instead.
Sourcepub fn bootstrap(&self, seed: usize) -> Arc<Dataset>
pub fn bootstrap(&self, seed: usize) -> Arc<Dataset>
Generate a new dataset with the same length by resampling the events in the original datset with replacement. This can be used to perform error analysis via the bootstrap method.
Sourcepub fn filter(
&self,
expression: &VariableExpression,
) -> LadduResult<Arc<Dataset>>
pub fn filter( &self, expression: &VariableExpression, ) -> LadduResult<Arc<Dataset>>
Filter the Dataset by a given VariableExpression, selecting events for which
the expression returns true.
Sourcepub fn bin_by<V>(
&self,
variable: V,
bins: usize,
range: (f64, f64),
) -> LadduResult<BinnedDataset>where
V: Variable,
pub fn bin_by<V>(
&self,
variable: V,
bins: usize,
range: (f64, f64),
) -> LadduResult<BinnedDataset>where
V: Variable,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dataset
impl RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnsafeUnpin for Dataset
impl UnwindSafe for Dataset
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
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>
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>
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.