Docs / nablatensor-core / com.nablatensor.engine

final class

AadRecorder

Records one pass of a valuation into an AadTape.

AadTape tape = AadRecorder.record(rec -> {
  SDouble s0 = rec.input("S0", 100.0);
  SDouble s = s0;
  for (int t = 0; t < steps; t++) {
    s = s.mul(rec.randn().mul(vol).add(drift).exp());
  }
  rec.output(s.sub(strike).max(0.0));
});

Methods

static AadTape record(Consumer<AadRecorder> body)
ADouble input(String name, double value)

A differentiable input; its recorded value is the default for a replay.

ADouble constant(double value)
ADouble randn()

A standard normal that varies per scenario, drawn from the default stream. Nothing is drawn while recording: the node only reserves the next slot in the per-scenario random stream, which the replay kernel generates on-device.

ADouble randu()

A uniform draw on [0, 1) that varies per scenario, from the default stream.

RandomStream stream(String name)

An independent named random stream. Draws from a stream are statistically independent of every other stream and of the default one, so a jump-time clock, a low-discrepancy dimension or a second factor can be advanced without perturbing the primary path. stream("default") is the same stream randn() / randu() use.

void output(ADouble value)

Records the single output of this valuation, named "value".

void output(String name, ADouble value)

Records one of several named outputs. Every reverse sweep over the tape then yields this output's value, its Monte-Carlo standard error and its full input gradient; the names address the rows of AadResult. A name may be recorded only once, and mixing this with output(ADouble) (which uses the name "value") is allowed as long as the names stay distinct.