Skip to main content

Dataset

Struct Dataset 

Source
pub struct Dataset { /* private fields */ }
Expand description

A collection of events with optional metadata for name-based lookups.

Implementations§

Source§

impl Dataset

Source

pub fn events_local(&self) -> impl Iterator<Item = Event<'_>>

Iterate over locally stored events as borrowed Event views.

Source

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.

Source

pub fn metadata(&self) -> &DatasetMetadata

Borrow the dataset metadata used for name lookups.

Source

pub fn metadata_arc(&self) -> Arc<DatasetMetadata>

Clone the internal metadata handle for external consumers (e.g., language bindings).

Source

pub fn p4_names(&self) -> &[String]

Names corresponding to stored four-momenta.

Source

pub fn aux_names(&self) -> &[String]

Names corresponding to stored auxiliary scalars.

Source

pub fn p4_index(&self, name: &str) -> Option<usize>

Resolve the index of a four-momentum by name.

Source

pub fn aux_index(&self, name: &str) -> Option<usize>

Resolve the index of an auxiliary scalar by name.

Source

pub fn event_global(&self, index: usize) -> LadduResult<OwnedEvent>

Retrieve a single owned event by global index.

Source

pub fn event_local(&self, event_index: usize) -> LadduResult<Event<'_>>

Borrow a locally stored event by local rank index.

Source

pub fn p4_by_name(&self, event_index: usize, name: &str) -> Option<Vec4>

Retrieve a four-momentum by name for the event at event_index.

Source

pub fn aux_by_name(&self, event_index: usize, name: &str) -> Option<f64>

Retrieve an auxiliary scalar by name for the event at event_index.

Source§

impl Dataset

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn new(events: Vec<Arc<EventData>>) -> Self

Create a new Dataset from a list of EventData.

This method is prefered for external use because it contains proper MPI construction methods. Constructing a Dataset manually is possible, but may cause issues when interfacing with MPI and should be avoided unless you know what you are doing.

Source

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.

Source

pub fn add_p4_column_local<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
where N: Into<String>, V: IntoIterator<Item = Vec4>,

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.

Source

pub fn add_aux_column_local<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
where N: Into<String>, V: IntoIterator<Item = f64>,

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.

Source

pub fn add_p4_column_global<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
where N: Into<String>, V: IntoIterator<Item = Vec4>,

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.

Source

pub fn add_aux_column_global<N, V>( &mut self, name: N, values: V, ) -> LadduResult<()>
where N: Into<String>, V: IntoIterator<Item = f64>,

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.

Source

pub fn push_event_local<P, A>( &mut self, p4s: P, aux: A, weight: f64, ) -> LadduResult<()>
where P: IntoIterator<Item = Vec4>, A: IntoIterator<Item = f64>,

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.

Source

pub fn push_event_global<P, A>( &mut self, p4s: P, aux: A, weight: f64, ) -> LadduResult<()>
where P: IntoIterator<Item = Vec4>, A: IntoIterator<Item = f64>,

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.

Source

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.

Source

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.

Source

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.

Source

pub fn n_events(&self) -> usize

The number of EventDatas in the Dataset.

Source

pub fn n_events_global(&self) -> usize

Alias for Dataset::n_events.

This returns the global event count under MPI.

Source§

impl Dataset

Source

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.

Source

pub fn weights(&self) -> Vec<f64>

Extract a list of weights over each EventData in the Dataset.

Source

pub fn weights_global(&self) -> Vec<f64>

Alias for Dataset::weights.

This returns the global weight vector in dataset order under MPI.

Source

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.

Source

pub fn n_events_weighted(&self) -> f64

Returns the sum of the weights for each EventData in the Dataset.

Source

pub fn n_events_weighted_global(&self) -> f64

Alias for Dataset::n_events_weighted.

This returns the global weighted event count under MPI.

Source

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.

Source

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.

Source

pub fn filter( &self, expression: &VariableExpression, ) -> LadduResult<Arc<Dataset>>

Filter the Dataset by a given VariableExpression, selecting events for which the expression returns true.

Source

pub fn bin_by<V>( &self, variable: V, bins: usize, range: (f64, f64), ) -> LadduResult<BinnedDataset>
where V: Variable,

Bin a Dataset by the value of the given Variable into a number of bins within the given range.

Source

pub fn boost_to_rest_frame_of<S>(&self, names: &[S]) -> Arc<Dataset>
where S: AsRef<str>,

Boost all the four-momenta in all EventDatas to the rest frame of the given set of four-momenta identified by name.

Source

pub fn evaluate<V: Variable>(&self, variable: &V) -> LadduResult<Vec<f64>>

Evaluate a Variable on every event in the Dataset.

Trait Implementations§

Source§

impl Add<&Dataset> for &Dataset

Source§

type Output = Dataset

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Dataset) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<&Dataset> for Dataset

Source§

type Output = Dataset

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Dataset) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<Dataset> for &Dataset

Source§

type Output = Dataset

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Dataset) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Dataset

Source§

type Output = Dataset

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Dataset) -> Self::Output

Performs the + operation. Read more
Source§

impl Clone for Dataset

Source§

fn clone(&self) -> Dataset

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dataset

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,