Given a square matrix A (of varying dimension), I am looking for an efficient algorithm or formula to recompute the determinant of that matrix if a row i is replaced with different values.
For example, given the matrix A:
$$A = \begin{bmatrix} 1 & 2 & 3 \\\\ 4 & 5 & 6 \\\\ 7 & 8 & 9 \end{bmatrix}$$
And replacing the second row (i = 2), as a new matrix B:
$$B = \begin{bmatrix} 1 & 2 & 3 \\\\ 10 & 11 & 12 \\\\ 7 & 8 & 9 \end{bmatrix}$$
I would like to efficiently recalculate the determinant, without performing another full determinant computation for B. The algorithm I am currently using is based on the Wikipedia pseudocode for Gaussian elimination with pivoting. After reducing the matrix to row echelon form, the determinant is obtained by multiplying the diagonals. While essential for numerical stability, the pivoting poses an issue since I cannot "jump back into" the algorithm at row i.
If someone is familiar with a property of matrices that could help saving on computation here or knows of a better way to achieve this without recalculating everything from scratch for B it would be greatly appreciated.
$$ \det\pmatrix{1&2&3\cr a&b&c\cr7&8&9\cr}=-a\det\pmatrix{2&3\cr8&9\cr}+b\det\pmatrix{1&3\cr7&9\cr}-c\det\pmatrix{1&2\cr7&8\cr}=6a-12b+6c $$ so all you have to do is precompute a few smaller determinants and then you're set to swiftly handle any change in a row.