Docs / nablatensor-quant / com.nablatensor.quant
final class
MultiOutput
Price several named risk measures from one recorded tape and one compiled kernel: the tape carries one rec.output(name, ...) per measure, and a single replay runs the forward sweep once and one reverse sweep per measure, returning every value, its Monte-Carlo standard error, and its full input gradient — the N × M Jacobian — all from the same Philox paths.
try (MultiOutput mo = MultiOutput.of(rec -> {
SDouble s0 = rec.input("S0", 100), k = rec.input("K", 100),
vol = rec.input("sigma", 0.2), r = rec.input("r", 0.03);
SDouble sT = s0.mul(r.sub(vol.mul(vol).mul(0.5)).add(vol.mul(rec.randn())).exp());
return Map.of(
"call", sT.sub(k).max(0.0).mul(r.neg().exp()),
"digital", com.nablatensor.ops.Smooth.gt(rec, sT, k, 1.0).mul(r.neg().exp()));
}).on("cpu-jit").build()) {
MultiOutput.Result res = mo.run(1_000_000, 42L);
res.value("digital"); // digital price
res.gradient("call").get("sigma"); // call vega
}Methods
static Builder of(Measures measures)
List<String> outputNames()
String engine()
int nodes()
Result run(long scenarios, long seed)
Values + full Jacobian, using the recorded input values.
Result run(Map<String, Double> marketOverrides, long scenarios, long seed)
Values + full Jacobian, with named inputs overridden.
void close()