Skip to main content

ExprBuilder

Struct ExprBuilder 

Source
pub struct ExprBuilder<T, E>
where T: Clone, E: Expr<T>,
{ /* private fields */ }
Expand description

Expression builder for creating complex expressions with a fluent interface

Implementations§

Source§

impl<'a, T: Clone> ExprBuilder<T, ArrayExpr<'a, T>>

Source

pub fn from_array(array: &'a Array<T>) -> Self

Start building from an array

Source§

impl<T, E> ExprBuilder<T, E>
where T: Clone, E: Expr<T>,

Source

pub fn map<F: Fn(T) -> T>(self, op: F) -> ExprBuilder<T, UnaryExpr<T, E, F>>

Apply a unary operation

Source

pub fn zip_with<E2, F>( self, other: E2, op: F, ) -> Result<ExprBuilder<T, BinaryExpr<T, E, E2, F>>>
where E2: Expr<T>, F: Fn(T, T) -> T,

Apply a binary operation with another expression

Source

pub fn scalar<F: Fn(T, T) -> T>( self, scalar: T, op: F, ) -> ExprBuilder<T, ScalarExpr<T, E, F>>

Apply a scalar operation

Source

pub fn add_scalar( self, scalar: T, ) -> ExprBuilder<T, ScalarExpr<T, E, impl Fn(T, T) -> T>>
where T: Add<Output = T>,

Add a scalar value

Source

pub fn mul_scalar( self, scalar: T, ) -> ExprBuilder<T, ScalarExpr<T, E, impl Fn(T, T) -> T>>
where T: Mul<Output = T>,

Multiply by a scalar value

Source

pub fn eval(self) -> Array<T>

Evaluate and materialize the expression

Source

pub fn build(self) -> E

Get the underlying expression

Source§

impl<E: Expr<f64>> ExprBuilder<f64, E>

Source

pub fn abs(self) -> ExprBuilder<f64, UnaryExpr<f64, E, impl Fn(f64) -> f64>>

Apply absolute value

Source

pub fn sqrt(self) -> ExprBuilder<f64, UnaryExpr<f64, E, impl Fn(f64) -> f64>>

Apply square root

Source

pub fn exp(self) -> ExprBuilder<f64, UnaryExpr<f64, E, impl Fn(f64) -> f64>>

Apply exponential

Source

pub fn ln(self) -> ExprBuilder<f64, UnaryExpr<f64, E, impl Fn(f64) -> f64>>

Apply natural logarithm

Source

pub fn sin(self) -> ExprBuilder<f64, UnaryExpr<f64, E, impl Fn(f64) -> f64>>

Apply sine

Source

pub fn cos(self) -> ExprBuilder<f64, UnaryExpr<f64, E, impl Fn(f64) -> f64>>

Apply cosine

Source

pub fn sum(self) -> f64

Reduce by sum

Source

pub fn prod(self) -> f64

Reduce by product

Source

pub fn max(self) -> f64

Reduce by maximum

Source

pub fn min(self) -> f64

Reduce by minimum

Auto Trait Implementations§

§

impl<T, E> Freeze for ExprBuilder<T, E>
where E: Freeze,

§

impl<T, E> RefUnwindSafe for ExprBuilder<T, E>

§

impl<T, E> Send for ExprBuilder<T, E>
where E: Send, T: Send,

§

impl<T, E> Sync for ExprBuilder<T, E>
where E: Sync, T: Sync,

§

impl<T, E> Unpin for ExprBuilder<T, E>
where E: Unpin, T: Unpin,

§

impl<T, E> UnsafeUnpin for ExprBuilder<T, E>
where E: UnsafeUnpin,

§

impl<T, E> UnwindSafe for ExprBuilder<T, E>
where E: UnwindSafe, T: UnwindSafe,

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V