Docs / nablatensor-ops / com.nablatensor.ops

final class

Smooth

Smoothed indicators: differentiable stand-ins for the discontinuous STEP / GT / 1{a<x<b} that path-dependent payoffs need for barrier monitoring and digital settlement.

Each takes a width in the same units as its argument. The functions are built entirely from the engine's primitive ops, so their adjoint is the exact derivative of the smoothed form (no special-cased reverse rule) and they run unchanged on every backend. As width -> 0 the smoothed value converges to the discontinuous limit; its derivative concentrates into a spike, so a barrier delta computed this way is a genuine (mollified) delta, not a bumped one.

Rule of thumb: width a fraction of a percent of the monitored quantity's scale (e.g. 0.01 * spot). Too small re-introduces the variance a discontinuity brings; too large biases the price.

Methods

static ADouble step(AadRecorder rec, ADouble x, double width)

Logistic step: ~1 for x >> 0, ~0 for x << 0, 0.5 at 0.

static ADouble gt(AadRecorder rec, ADouble a, ADouble b, double width)

Smoothed 1{a > b}.

static ADouble gt(AadRecorder rec, ADouble a, double level, double width)

Smoothed 1{a > level}.

static ADouble lt(AadRecorder rec, ADouble a, double level, double width)

Smoothed 1{a < level}.

static ADouble lt(AadRecorder rec, ADouble a, ADouble b, double width)

Smoothed 1{a < b}.

static ADouble between(AadRecorder rec, ADouble x, double lo, double hi, double width)

Smoothed band indicator 1{lo < x < hi}.

static ADouble ramp(AadRecorder rec, ADouble x, double width)

Numerically stable softplus: a smoothed max(x, 0). width -> 0 recovers the hockey-stick; useful for a smoothed option intrinsic when the whole payoff must stay differentiable.