Operations with a tape window: draws and hidden randomness
Library · Source module
Operations with a tape window: draws and hidden randomness
A contract in operand form (NLAlib.Ops.BlockRel) may read a window of the tape: the output blocks are related to the input blocks and to the entries of the window, and the position advances by the length of the window. The operation takes no random operand. Two uses:
* visible randomness: NLAlib.Ops.drawRel s, a vector draw; the output block is the window, so the values are in the store of the algorithm that called it; * hidden randomness: the output is some function of the inputs and of the window (a noisy product, a stochastically rounded sum). The algorithm holds no cell with the window entries and no operation hands them out, so it cannot compute with them.
The call rule is the one rule NLAlib.Ops.wp_call_rel, and the certificate of an implementation that draws into its own scratch is the one certificate NLAlib.Ops.Impl.Satisfies.
The statement about the law is separate and is mathematics: with the law of the tape (NLAlib.Ops.IsTapeLaw), the window of a call at the position p is independent of the past of p, with the product law (NLAlib.Ops.IsTapeLaw.integral_window). So a contract of this form is a contract conditional on the history: for inputs that are any function of the past, the output has the law that the relation gives it from a fresh window.
Main results
* NLAlib.Ops.drawRel, NLAlib.Ops.Interp.IsFn.satisfies_drawRel: the vector draw; the vector draw of the model satisfies its contract. * NLAlib.Ops.wp_loop_fill: the loop that fills a block cell by cell.