Struct aegir::ops::Sign

source ·
pub struct Sign<N>(pub N);
Expand description

Operator that applies f[g](x) = sgn(g(x)) to a buffer.

Examples

let f = Sign(X.into_var());

assert_eq!(f.evaluate_dual(X, ctx!{X = -1.0}).unwrap(), dual!(-1.0, 0.0));
assert_eq!(f.evaluate_dual(X, ctx!{X = 0.0}).unwrap(), dual!(0.0, INFINITY));
assert_eq!(f.evaluate_dual(X, ctx!{X = 1.0}).unwrap(), dual!(1.0, 0.0));

Tuple Fields§

§0: N

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns true if the identifier is present in the expression.
Formats the value using the given formatter. Read more
The adjoint operator; i.e. the gradient.
Transform the node into its Adjoint operator tree. Read more
Helper method that computes the adjoint and evaluates its value. Read more
Helper method that evaluates the function and its adjoint, wrapping up in a Dual.
Formats the value using the given formatter. Read more
The error type of the function.
The codomain of the function.
Evaluate the function and return its Value. Read more
Evaluate the function and return its lifted Value. Read more
Evaluate the function and return the shape of the Value. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Convert the node to an expression string. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.