Skip to main content

Builder

Trait Builder 

Source
pub trait Builder: Sized {
    type F: Clone;
    type B: Clone;

Show 14 methods // Required methods fn is_f64(&self) -> bool; fn constant(&mut self, v: f64) -> Self::F; fn unary(&mut self, op: UnaryOp, x: &Self::F) -> Self::F; fn binary(&mut self, op: BinaryOp, x: &Self::F, y: &Self::F) -> Self::F; fn compare(&mut self, op: CompareOp, x: &Self::F, y: &Self::F) -> Self::B; fn logical(&mut self, op: BinaryOp, x: &Self::B, y: &Self::B) -> Self::B; fn not(&mut self, x: &Self::B) -> Self::B; fn select( &mut self, pred: &Self::B, on_true: &Self::F, on_false: &Self::F, ) -> Self::F; fn mask(&mut self, v: bool) -> Self::B; fn is_finite(&mut self, x: &Self::F) -> Self::B; fn any(&mut self, x: &Self::B) -> Self::B; fn while_loop( &mut self, init: Carry<Self>, cond: &mut dyn FnMut(&mut Self, &Carry<Self>) -> Self::B, body: &mut dyn FnMut(&mut Self, &Carry<Self>) -> Carry<Self>, ) -> Carry<Self>; // Provided methods fn lgamma(&mut self, x: &Self::F) -> Self::F { ... } fn digamma(&mut self, x: &Self::F) -> Self::F { ... }
}
Expand description

The operations the special functions are written with.

Floats (Builder::F) have one type, f32 or f64 (16-bit floats are computed in f32), and every value has the same shape.

Required Associated Types§

Source

type F: Clone

A floating point value.

Source

type B: Clone

A boolean value.

Required Methods§

Source

fn is_f64(&self) -> bool

Whether the floats are f64 (otherwise f32).

Source

fn constant(&mut self, v: f64) -> Self::F

A constant, rounded to the float type.

Source

fn unary(&mut self, op: UnaryOp, x: &Self::F) -> Self::F

A unary operation.

Source

fn binary(&mut self, op: BinaryOp, x: &Self::F, y: &Self::F) -> Self::F

A binary operation.

Source

fn compare(&mut self, op: CompareOp, x: &Self::F, y: &Self::F) -> Self::B

A comparison.

Source

fn logical(&mut self, op: BinaryOp, x: &Self::B, y: &Self::B) -> Self::B

A logical operation on masks (And, Or).

Source

fn not(&mut self, x: &Self::B) -> Self::B

Logical not.

Source

fn select( &mut self, pred: &Self::B, on_true: &Self::F, on_false: &Self::F, ) -> Self::F

pred ? on_true : on_false, element by element.

Source

fn mask(&mut self, v: bool) -> Self::B

A constant mask.

Source

fn is_finite(&mut self, x: &Self::F) -> Self::B

Whether each element is finite.

Source

fn any(&mut self, x: &Self::B) -> Self::B

Whether any element is true, broadcast to every element.

Source

fn while_loop( &mut self, init: Carry<Self>, cond: &mut dyn FnMut(&mut Self, &Carry<Self>) -> Self::B, body: &mut dyn FnMut(&mut Self, &Carry<Self>) -> Carry<Self>, ) -> Carry<Self>

Repeats body while cond holds (for any element).

Provided Methods§

Source

fn lgamma(&mut self, x: &Self::F) -> Self::F

lgamma, which a builder may emit as a primitive.

Source

fn digamma(&mut self, x: &Self::F) -> Self::F

digamma, which a builder may emit as a primitive.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§