void setAt(int i, int j, double v) { assert(i >= 0 && i < rows && j >= 0 && j < cols, 'Index out of bounds'); data[i * cols + j] = v; }