dotByP method Null safety
calculate this = this dot P. This is not to be confused with P dot this!
Implementation
void dotByP() {
// This is equivalent to doing the inverse of swapping the columns according
// to _rowSwaps
final swaps = cloneRowSwaps();
for (int c = 0; c < columns;) {
final sc = swaps[c];
if (sc == c) {
c++;
} else {
for (int r = 0; r < rows; r++) {
final t = get(r, c);
set(r, c, get(r, sc));
set(r, sc, t);
}
swaps[c] = swaps[sc];
swaps[sc] = sc;
}
}
assert(() {
for (int c = 0; c < columns; c++) {
assert(c == swaps[c]);
}
return true;
}());
}