Struct rustitude_core::amplitude::CohSum

source ·
pub struct CohSum(pub Vec<Box<dyn AmpLike>>);
Expand description

Struct to hold a coherent sum of AmpLikes

Tuple Fields§

§0: Vec<Box<dyn AmpLike>>

Implementations§

source§

impl CohSum

source

pub fn print_tree(&self)

Pretty prints a tree diagram to show the node structure of the CohSum.

source

pub fn norm_int(&self, cache: &[Option<Complex64>]) -> Option<f64>

Function which returns a sum of all cross terms inside a coherent sum.

Take the following coherent sum, where $\vec{p}$ are input parameters $e$ is an event, and $f_i$ is the $i$th term in the sum:

\left| \sum_{i\in\text{terms}} f_i(\vec{p}, e) \right|^2

This function will then return

\sum_{i\in\text{terms}} \sum_{j\in\text{terms}} f_i(\vec{p}, e) f_j^*(\vec{p}, e)

This should be used to compute normalization integrals. Note that if on of the terms is None, this function will not add any products which contain that term. This can be used to turn terms on and off.

source

pub fn compute(&self, cache: &[Option<Complex64>]) -> Option<f64>

Shortcut for computation using a cache of precomputed values. This method will return None if the cache value at the corresponding Amplitude’s Amplitude::cache_position is also None, otherwise it just returns the corresponding cached value. The computation is run across the CohSum’s terms, and the absolute square of the result is returned (coherent sum).

source

pub fn walk(&self) -> Vec<Amplitude>

Walks through a CohSum and collects all the contained Amplitudes recursively.

source

pub fn walk_mut(&mut self) -> Vec<&mut Amplitude>

Walks through an CohSum and collects all the contained Amplitudes recursively. This method gives mutable access to said Amplitudes.

Trait Implementations§

source§

impl Add<&&CohSum> for &CohSum

§

type Output = <CohSum as Add>::Output

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Amplitude> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Amplitude> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Imag> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Imag> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Product> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Product> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Real> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Real> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Amplitude> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Amplitude> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<CohSum> for Amplitude

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<CohSum> for Imag

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<CohSum> for Product

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<CohSum> for Real

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Imag> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Imag> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Product> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Product> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Real> for &CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Real> for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add for &CohSum

§

type Output = <CohSum as Add>::Output

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add for CohSum

§

type Output = CohSum

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Clone for CohSum

source§

fn clone(&self) -> CohSum

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for CohSum

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for CohSum

source§

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

Formats the value using the given formatter. Read more
source§

impl Mul<&Amplitude> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Amplitude) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&Amplitude> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Amplitude) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&Imag> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Imag) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&Imag> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Imag) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&Product> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Product) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&Product> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Product) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&Real> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Real) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<&Real> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Real) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Amplitude> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Amplitude) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Amplitude> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Amplitude) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<CohSum> for Amplitude

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: CohSum) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<CohSum> for Imag

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: CohSum) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<CohSum> for Product

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: CohSum) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<CohSum> for Real

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: CohSum) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Imag> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Imag) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Imag> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Imag) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Product> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Product) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Product> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Product) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Real> for &CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Real) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Real> for CohSum

§

type Output = CohSum

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Real) -> Self::Output

Performs the * operation. Read more

Auto Trait Implementations§

§

impl Freeze for CohSum

§

impl !RefUnwindSafe for CohSum

§

impl Send for CohSum

§

impl Sync for CohSum

§

impl Unpin for CohSum

§

impl !UnwindSafe for CohSum

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 + Send + Sync>

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> 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.
§

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

§

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,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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> Ungil for T
where T: Send,