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.
- src : ℕ
Residue matrix base.
- dst : ℕ
Output matrix base.
- n : ℕ
Number of vertices in each outer part.
- D : ℕ
Padded middle dimension.
- p : ℕ
Positive modulus.
- first : ℕ
First vertex of the selected piece.
- length : ℕ
Number of vertices in the piece.
- rho : ℕ
A–B query residue.
Instances For
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.
Instances For
Residue input pointer.
Instances For
Output matrix pointer.
Instances For
Outer dimension.
Instances For
Middle dimension.
Instances For
Modulus.
Instances For
First vertex of the piece.
Instances For
Piece length.
Instances For
Query residue.
Instances For
Flat output cursor.
Instances For
Number of output cells.
Instances For
Selected source row.
Instances For
Selected vertex within the piece.
Instances For
Middle label.
Instances For
Address temporary.
Instances For
Residue and output value temporary.
Instances For
Constant zero.
Instances For
Constant one.
Instances For
The eight runtime arguments occupy registers 0–7.
Source pointer.
Destination pointer.
Outer dimension.
Middle dimension.
Modulus.
First vertex.
Piece length.
Query residue.
Instances For
Compute the source row and decode the middle label using actual arithmetic instructions.
Instances For
Read the selected residue and form its required label.
Instances For
Write one zero/one cell and increment the flat cursor.
Instances For
The complete builder initializes constants and visits all output positions once.
Instances For
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.