Skip to main content

BinaryOp

Enum BinaryOp 

Source
pub enum BinaryOp {
Show 21 variants Add, Sub, Mul, Div, Rem, Pow, Max, Min, Atan2, And, Or, Xor, ShiftLeft, ShiftRightLogical, ShiftRightArithmetic, Igamma, Igammac, IgammaGradA, RandomGammaGrad, Polygamma, Zeta,
}
Expand description

An elementwise operation with two operands of the same type and a result of that type.

Variants§

§

Add

x + y (integers wrap around).

§

Sub

x - y (integers wrap around).

§

Mul

x * y (integers wrap around).

§

Div

x / y. Integer division rounds toward zero; division by zero gives -1 (signed) or the maximum (unsigned), and MIN / -1 gives MIN.

§

Rem

The remainder of truncated division, with the sign of x. x % 0 is x for integers.

§

Pow

x^y (floats).

§

Max

The maximum, propagating NaN.

§

Min

The minimum, propagating NaN.

§

Atan2

atan2(x, y).

§

And

Logical or bitwise and.

§

Or

Logical or bitwise or.

§

Xor

Logical or bitwise exclusive or.

§

ShiftLeft

x << y; shifts by the bit width or more give 0.

§

ShiftRightLogical

x >> y filling with zeros; shifts by the bit width or more give 0.

§

ShiftRightArithmetic

x >> y filling with the sign bit; shifts by the bit width or more give 0 or -1.

§

Igamma

The regularized lower incomplete gamma function P(x, y).

§

Igammac

The regularized upper incomplete gamma function Q(x, y).

§

IgammaGradA

The derivative of igamma(x, y) with respect to x.

§

RandomGammaGrad

The derivative of a sample y of Gamma(x, 1) with respect to x.

§

Polygamma

The polygamma function psi^(x)(y) (x a natural number).

§

Zeta

The Hurwitz zeta function zeta(x, y).

Implementations§

Source§

impl BinaryOp

Source

pub const ALL: [BinaryOp; 21]

Every binary operation.

Source

pub fn is_commutative(self) -> bool

Whether op(a, b) is op(b, a) bit for bit for every element type (addition and multiplication, also of floats, and the bitwise operations; not max and min, whose NaN handling may depend on the order).

Source

pub fn name(self) -> &'static str

The name of the primitive, as in JAX.

Source

pub fn supports(self, dtype: DType) -> bool

Returns whether the operation accepts dtype.

Trait Implementations§

Source§

impl Clone for BinaryOp

Source§

fn clone(&self) -> BinaryOp

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 Copy for BinaryOp

Source§

impl Debug for BinaryOp

Source§

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

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

impl Eq for BinaryOp

Source§

impl Hash for BinaryOp

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BinaryOp

Source§

fn eq(&self, other: &BinaryOp) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BinaryOp

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

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

§

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

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

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.