Native zero/one matrices for an Exact Triangle instance #
The input contains ordinary unsigned residues. Each output cell computes its row, middle vertex
and label through charged division/remainder instructions. Cells outside the selected piece are
zero; all other cells test the required modular adjacency. The same seventeen registers serve
the left n×D and right D×n matrices, with no supplied indexing table.
The X/Y output entries are raw unsigned words 0 and 1. A consumer using canonical
Signed.encode matrix entries must double each entry while copying it into that input and
charge the conversion instruction. Scalar headers, pointers and query coordinates remain raw
unsigned words.
This directly adapts the adjacency formulas in the pinned Theorem 17 instance builder. The native implementation visits each output cell once; the source clears and then marks cells.
Main definitions #
WriteMatrices.Args: matrix dimensions, residue/piece parameters and memory blocks.WriteMatrices.entry: the zero/one value at a flat output position.WriteMatrices.program: fixed native left/right matrix builders.
Main results #
WriteMatrices.exec: complete charged execution and the output/input frame.
Runtime arguments of one matrix-building call.
Raw unsigned zero/one row-major adjacency. A true side chooses the right D×n matrix;
false chooses the left n×D matrix. The source residue matrix has shape n×n. A signed-matrix
consumer encodes these entries by doubling them.
Residue input pointer.
Output matrix pointer.
Outer dimension.
Middle dimension.
Modulus.
First vertex of the piece.
Piece length.
Query residue.
Flat output cursor.
Number of output cells.
Selected source row.
Selected vertex within the piece.
Middle label.
Address temporary.
Residue and output value temporary.
Constant zero.
Constant one.
The eight runtime arguments occupy registers 0–7.
Source pointer.
Destination pointer.
Outer dimension.
Middle dimension.
Modulus.
First vertex.
Piece length.
Query residue.
Compute the source row and decode the middle label using actual arithmetic instructions.
Read the selected residue and form its required label.
Write one zero/one cell and increment the flat cursor.
The complete builder initializes constants and visits all output positions once.
The instruction graph has fixed size and never reads the physical word width.
Construct every entry of a left or right instance matrix in 20nD+6 native instructions,
excluding the halt. The source is an actual residue array below the output. All cells outside
the output block and all eight arguments are preserved. No adjacency table is supplied.