In this article
A pivot vector records row interchanges in sequence; gathering rows directly by those values can produce a different and duplicated row arrangement.
Begin with a swap that touches an earlier row
A factorization wrapper exports pivot values and a consumer treats them as the final source row for each output row. This fails when successive swaps interact: the meaning of a later swap depends on the arrangement produced by earlier ones. Use distinguishable row labels to inspect that transformation before applying it to floating-point data. Repeated pivot values can be valid instructions for exchanges rather than evidence of duplicated final rows.
Follow the sequential interchange contract
The rocSOLVER auxiliary-function reference defines LASWP as a sequence of row interchanges and documents its pivot indexing convention. Preserve that operation sequence when constructing an explicit permutation representation. Do not silently reinterpret the pivot buffer as an ordinary gather map, even if a special case with no exchanges happens to make both interpretations produce identical output.
Separate buffer stride from row identity
The same reference distinguishes the increment between accessed pivot entries from the row values those entries contain. An increment selects locations within pivot storage; it does not rescale the matrix row identities. The official solver declarations make the arguments visible at the interface boundary. Preserve index conversion at a named boundary when integrating with application arrays using a different indexing convention.
Retain the direction when reconstructing an inverse
The LAPACK reference implementation demonstrates the ordered traversal and reversal associated with the pivot increment. Reversing an interchange sequence is different from merely reversing the list of final row labels. Establish whether a downstream reconstruction needs the forward transformation or its inverse, and keep that choice with the factorization identity used to compare the reconstructed matrix with its original input.
Validate the permutation without arithmetic noise
Apply the recorded swaps to a small labelled identity arrangement and compare with the application’s proposed mapping. Test interacting exchanges and reverse traversal separately before numerical reconstruction. The existing entity identity and split guide and software reproducibility guide give related context. A useful exported pivot contract records the routine, indexing, storage increment and traversal direction, so consumers can reproduce the intended permutation instead of guessing from the shape of an integer array.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.